Package simtools.diagram

Examples of simtools.diagram.DiagramComponent


        if (command.startsWith("transform ")) {
            String actionType = command.substring(10);
            if (!actionType.equals("")) {
                boolean canTransform = false;
                for (Iterator it = desktopCardPanel.getComponentIterator(); it.hasNext();) {
                    DiagramComponent d = (DiagramComponent) it.next();
                    desktopCardPanel.selectComponent(d);
                    for (int j = 0; j < Run.plugins.size(); ++j) {
                        Plugin p = (Plugin) Run.plugins.get(j);
                        canTransform |= p.processSynoptic(getActiveContainer(), actionType, true);
                    }
View Full Code Here


    }

    protected void createActions() {
        aCut = new AbstractAction(resources.getStringValue("cutAction"), resources.getIcon("cutImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectionCut();
                }
            }
        };
        aCopy = new AbstractAction(resources.getStringValue("copyAction"), resources.getIcon("copyImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectionCopy();
                }
            }
        };
        aPaste = new AbstractAction(resources.getStringValue("pasteAction"), resources.getIcon("pasteImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeClipboardPaste();
                }
            }
        };
        aGroup = new AbstractAction(resources.getStringValue("groupAction"), resources.getIcon("groupImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if ((d != null) && (d instanceof ShapesComponent)) {
                    ((ShapesComponent) d).group();
                }
            }
        };
        aUngroup = new AbstractAction(resources.getStringValue("ungroupAction"), resources.getIcon("ungroupImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if ((d != null) && (d instanceof ShapesComponent)) {
                    ((ShapesComponent) d).unGroup();
                }
            }
        };
        aRegroup = new AbstractAction(resources.getStringValue("regroupAction"), resources.getIcon("regroupImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if ((d != null) && (d instanceof ShapesComponent)) {
                    ((ShapesComponent) d).reGroup();
                }
            }
        };
        aRemove = new AbstractAction(resources.getStringValue("removeAction")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectionDelete();
                }
            }
        };
        aSelectAll = new AbstractAction(resources.getStringValue("selectAllAction"), null) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.executeSelectAll();
                }
            }
        };
        aSelectAll.setEnabled(isEditable);

        aFullScreen = new AbstractAction(resources.getStringValue("fullScreen")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                // Toggle full screen on / off
                if (d.isFullScreen()) {
                    d.setFullScreen(false);
                } else {
                    d.setFullScreen(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
                }
            }
        };
        aFullScreen.putValue(Action.ACCELERATOR_KEY, resources.getKeyStroke("fullScreenShortcut"));
        aFront = new AbstractAction(resources.getStringValue("frontAction"), resources.getIcon("frontImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().bringSelectionToFront();
                }
            }
        };
        aForward = new AbstractAction(resources.getStringValue("forwardAction"), resources.getIcon("forwardImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().bringSelectionForward();
                }
            }
        };
        aBackward = new AbstractAction(resources.getStringValue("backwardAction"), resources.getIcon("backwardImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().sendSelectionBackward();
                }
            }
        };
        aBack = new AbstractAction(resources.getStringValue("backAction"), resources.getIcon("backImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().sendSelectionToBack();
                }
            }
        };
        aLeft = new AbstractAction(resources.getStringValue("leftAction"), resources.getIcon("leftImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToLeft();
                }
            }
        };
        aRight = new AbstractAction(resources.getStringValue("rightAction"), resources.getIcon("rightImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToRight();
                }
            }
        };
        aTop = new AbstractAction(resources.getStringValue("topAction"), resources.getIcon("topImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToTop();
                }
            }
        };
        aBottom = new AbstractAction(resources.getStringValue("bottomAction"), resources.getIcon("bottomImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionToBottom();
                }
            }
        };
        aVCenter = new AbstractAction(resources.getStringValue("vCenterAction"), resources.getIcon("vCenterImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionVCenter();
                }
            }
        };
        aHCenter = new AbstractAction(resources.getStringValue("hCenterAction"), resources.getIcon("hCenterImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().alignSelectionHCenter();
                }
            }
        };
        dHorizontally = new AbstractAction(resources.getStringValue("dHorizontallyAction"), resources
                .getIcon("dHorizontallyImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().distributeSelectionHorizontally();
                }
            }
        };
        dVertically = new AbstractAction(resources.getStringValue("dVerticallyAction"), resources
                .getIcon("dVerticallyImage")) {
            public void actionPerformed(ActionEvent e) {
                DiagramComponent d = getActiveDiagram();
                if (d != null) {
                    d.getDiagramSelection().distributeSelectionVertically();
                }
            }
        };

        aZoomIn = new AbstractAction(resources.getStringValue("zoomInAction"),
View Full Code Here

            return;
        }
        if (command.startsWith("export ")) {
            File directory = new File(command.substring(7));
            for (int i = 0; i < getNumberOfPages(); i++) {
                DiagramComponent d = ((ShapesContainer) containers.get(i)).getComponent();
                try {
                    String fileName;
                    if (directory.exists()) {
                        fileName = new File(directory, d.toString() + ".PNG").getCanonicalPath();
                    } else {
                        fileName = new File(d.toString() + ".PNG").getCanonicalPath();
                    }
                    print(d, IMAGE_FILE_MODE, fileName);
                    System.out.println(messageWriter.print1args("exported", fileName));
                } catch (Exception ex) {
                    System.err.println(messageWriter.print2args("cannotExport", d.getName(), ex.getMessage()));
                    ex.printStackTrace();
                    return;
                }
            }
            return;
View Full Code Here

TOP

Related Classes of simtools.diagram.DiagramComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.