~ubuntu-branches/ubuntu/precise/scilab/precise

« back to all changes in this revision

Viewing changes to modules/xcos/src/java/org/scilab/modules/xcos/link/actions/StyleHorizontalAction.java

  • Committer: Bazaar Package Importer
  • Author(s): Sylvestre Ledru
  • Date: 2010-04-16 15:57:24 UTC
  • mfrom: (1.1.9 upstream) (4.4.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100416155724-lx1sdku0oidl0ffn
Tags: 5.2.2-1
* New upstream release
* better-feedback-on-lib-error.diff, full_support.diff, renesas-sh.diff,
  s390javadetection.diff, sparc64.diff, test_run_permission.diff,
  z_cpudetection.diff removed (applied upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 
3
 * Copyright (C) 2010 - DIGITEO - Clément DAVID
 
4
 *
 
5
 * This file must be used under the terms of the CeCILL.
 
6
 * This source file is licensed as described in the file COPYING, which
 
7
 * you should have received as part of this distribution.  The terms
 
8
 * are also available at
 
9
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 
10
 *
 
11
 */
 
12
 
 
13
package org.scilab.modules.xcos.link.actions;
 
14
 
 
15
import java.awt.event.ActionEvent;
 
16
import java.awt.event.KeyEvent;
 
17
 
 
18
import org.scilab.modules.graph.ScilabGraph;
 
19
import org.scilab.modules.gui.menuitem.MenuItem;
 
20
import org.scilab.modules.xcos.link.BasicLink;
 
21
import org.scilab.modules.xcos.utils.XcosMessages;
 
22
 
 
23
import com.mxgraph.util.mxConstants;
 
24
 
 
25
/**
 
26
 * Implement the set link horizontal action
 
27
 */
 
28
public class StyleHorizontalAction extends StyleAction {
 
29
        /** Name of the action */
 
30
        public static final String NAME = XcosMessages.LINK_STYLE_HORIZONTAL;
 
31
        /** Icon name of the action */
 
32
        public static final String SMALL_ICON = "";
 
33
        /** Mnemonic key of the action */
 
34
        public static final int MNEMONIC_KEY = KeyEvent.VK_H;
 
35
 
 
36
        /**
 
37
         * Default constructor the associated graph
 
38
         * 
 
39
         * @param scilabGraph
 
40
         *            the graph to associate
 
41
         */
 
42
        public StyleHorizontalAction(ScilabGraph scilabGraph) {
 
43
                super(scilabGraph);
 
44
        }
 
45
 
 
46
        /**
 
47
         * @param scilabGraph
 
48
         *            graph
 
49
         * @return menu item
 
50
         */
 
51
        public static MenuItem createMenu(ScilabGraph scilabGraph) {
 
52
                return createMenu(scilabGraph, StyleHorizontalAction.class);
 
53
        }
 
54
 
 
55
        /**
 
56
         * Action !!!
 
57
         * 
 
58
         * @param e
 
59
         *            params
 
60
         * @see org.scilab.modules.xcos.link.actions.StyleAction#actionPerformed(java.awt.event.ActionEvent)
 
61
         */
 
62
        @Override
 
63
        public void actionPerformed(ActionEvent e) {
 
64
                BasicLink[] links = getLinks();
 
65
                getGraph(e).setCellStyles(mxConstants.STYLE_EDGE,
 
66
                                mxConstants.EDGESTYLE_ELBOW, links);
 
67
                getGraph(e).setCellStyles(mxConstants.STYLE_ELBOW,
 
68
                                mxConstants.ELBOW_HORIZONTAL, links);
 
69
 
 
70
                removePointsOnLinks(links);
 
71
        }
 
72
}