Package jsynoptic.base

Examples of jsynoptic.base.Plugin


     
       
        // SOURCE PANE
        filteredSourceTree = new FilteredSourceTree(new SourceTree(sourcePool), resources.getString("KnownSources"));
        for (Iterator it = Run.plugins.iterator(); it.hasNext();) {
            Plugin p = (Plugin) it.next();
            Object[][] tab = p.getDataSourceIcons();
            if (tab != null) {
                SourceTree.addSourceIcons(tab);
            }
        }
        lAlias = new JLabel(resources.getStringValue("Alias"));
        tfAlias = new JTextField();
       
       
        GridBagPanel sourcePane = new GridBagPanel();
        sourcePane.addOnCurrentRow(filteredSourceTree, 5, true, true, true);
        sourcePane.addOnCurrentRow(lAlias);
        sourcePane.addOnCurrentRow(tfAlias, 4, true, false, true);
        sourcePane.addOnCurrentRow(new ExpressionPanel(filteredSourceTree.getSourceTree()), 5, true, false, true);

    
        tfAlias.getDocument().addDocumentListener(new DocumentListener() {
            public void changedUpdate(DocumentEvent e) {
                updateAlias();
            }

            public void insertUpdate(DocumentEvent e) {
                updateAlias();
            }

            public void removeUpdate(DocumentEvent e) {
                updateAlias();
            }

            private void updateAlias() {
                if (!tfAlias.isEnabled()) {
                    return;
                }
                Object o = filteredSourceTree.getSelectedSourceOrCollection();
                if (o instanceof DataSource) {
                    DataInfo di = ((DataSource) o).getInformation();
                    String alias = tfAlias.getText();
                    if (alias.equals("")) {
                        alias = null;
                    }
                    if (di != null) {
                        String oldAlias = di.alias;
                        if (((oldAlias == null) && (alias != null)) || ((oldAlias != null) && (alias == null))
                                || ((oldAlias != null) && (!oldAlias.equals(alias)))) {
                            di.alias = alias;
                            ((DataSource) o).notifyListenersForInfoChange(di);
                            tfAlias.getDocument().removeDocumentListener(this);
                            TreeNode tn = (TreeNode) ( filteredSourceTree.getSourceTree().getSelectionPath().getLastPathComponent());
                            ((DefaultTreeModel) ( filteredSourceTree.getSourceTree().getModel())).nodeChanged(tn);
                            tfAlias.getDocument().addDocumentListener(this);
                            tfAlias.requestFocus();
                        }
                    }
                }
            }
        });
       
        filteredSourceTree.getSourceTree().addTreeSelectionListener(new TreeSelectionListener() {
            public void valueChanged(TreeSelectionEvent e) {
                Object o =  filteredSourceTree.getSelectedSourceOrCollection();
                filteredSourceTree.getSourceTree().removeTreeSelectionListener(this);
                if ((o instanceof DataSource) && e.isAddedPath()) {
                    tfAlias.setEnabled(true);
                    lAlias.setEnabled(true);
                    tfAlias.setEditable(true);
                    String alias = DataInfo.getAlias(o);
                    tfAlias.setText(alias == null ? "" : alias);
                    tfAlias.requestFocus();
                } else {
                    tfAlias.setEnabled(false);
                    lAlias.setEnabled(false);
                    tfAlias.setEditable(false);
                    tfAlias.setText("");
                }
                filteredSourceTree.getSourceTree().addTreeSelectionListener(this);
            }
        });
       
        // wait for a selection
        tfAlias.setEnabled(false);
        tfAlias.setEditable(false);
        lAlias.setEnabled(false);

        addElement(sourcePane, resources.getStringValue("sources"));
       
       

        // SHAPE PANE
        shapesListModel = new ShapeListModel();

        // Add shape creators
        for (Iterator it = Run.plugins.iterator(); it.hasNext();) {
            Plugin p = (Plugin) it.next();
            List shapeCreators = p.getShapeCreators();
            if (shapeCreators != null){
                for (int i=0;i<shapeCreators.size();i++){
                    shapesListModel.addShapeCreator( (ShapeCreator)shapeCreators.get(i));
                }
            }
View Full Code Here


        initializeFileChooser();
        if (filter!=null){
          fileChooser.setFileFilter(filter);

          // Add an accessory panel
          Plugin plugin=null;
          for (int i = 0; i < Run.plugins.size(); ++i) {
            Plugin p = (Plugin) Run.plugins.get(i);
            FileFilter[] fft = p.getFileFilters(Plugin.OPEN);
            if (fft == null)
              continue;
            for (int j = 0; j < fft.length; j++) {
              if (filter.equals(fft[j]))
                plugin = p;
View Full Code Here

    private void createHelpContents(){ 
        // Get help content from plug-ins
        if (Run.plugins!=null){
            for (int i = 0; i < Run.plugins.size(); ++i) {
                Plugin p = (Plugin) Run.plugins.get(i);
                if (p != null) {
                    HelpNode hn = p.getHelp();
                    rootNode.addHelpNode(hn);
                }
            }
        }
        // Create the AWT help tree
View Full Code Here

        addOnCurrentRow(tabbedPane, 5, true, false, true);
        addOnCurrentRow(addExp = new JButton(resources.getString("addTemplate")),2);

        // get the source templates from the plugins
        for (Iterator it = Run.plugins.iterator(); it.hasNext();) {
            Plugin p = (Plugin)it.next();
            if (p==null) continue;
            String[] templates = p.getSources();
            if (templates==null) continue;
            for (int i=0; i<templates.length; ++i) {
                // Insert at the right place
                int j=0;
                for (; j<cbxPredefined.getItemCount(); ++j) {
View Full Code Here

        for (int i = 0; i < plugins.size(); ++i) {
            if (plugins.get(i).getClass().getName().equals(name)) {
                return; // already loaded
            }
        }
        Plugin p;
        try {
            p = Plugin.load(name);
        } catch (Throwable t) {
            p = null;
            t.printStackTrace();
View Full Code Here

            } else if (action == Plugin.EXPORT) {
                filter =  exportFileChooser.getFileFilter();
            }

            Plugin p = getPluginForFilter(action, filter);
            if (p != null) {
                JComponent j = p.getOptionPanelForFilter(filter);
                if (j != null) {
                    add(j);
                    j.setVisible(true);
                }
            }
View Full Code Here

                }
            }
            panes = new Panes(getOwner(), DataSourcePool.global);
            // Add source panel hooks
            for (int i = 0; i < Run.plugins.size(); ++i) {
                Plugin p = (Plugin) Run.plugins.get(i);
                if (p != null) {
                    try {
                        p.newSourceComponent(panes);
                    } catch (Throwable t) {
                        t.printStackTrace();
                    }
                }
            }
            panes.invalidate();
        } else {
            panes = null;
        }


        progress(65);
        desktopCardPanel = new FiledDesktopCardPanel(true);
        createActions();
        createMenu();
        createToolBar();
        progress(70);
       
       
        // Disable all buttons
        setSelectionEditEnabled(false);
        setPasteEnabled(false);
        setDiagramComponentSpecificsEnabled(false);
        setShapeToolEnabled(false);
       
        desktopCardPanel.addListener(this);

        progress(75);

        // Add desktop panel hooks
        for (int i = 0; i < Run.plugins.size(); ++i) {
            Plugin p = (Plugin) Run.plugins.get(i);
            if (p != null) {
                p.newDesktopComponent(desktopCardPanel);
            }
        }
        desktopCardPanel.invalidate();

        // Add plugins templates
        if (isEditable) {
            for (int i = 0; i < Run.plugins.size(); ++i) {
                Plugin p = (Plugin) Run.plugins.get(i);
                if (p != null) {
                    Template[] t = p.getTemplates();
                    if (t == null){
                        continue;
                    }
                    for (int j = 0; j < t.length; j++) {
                        Template.getTemplates().add(t[j]);
View Full Code Here

    public void processCommand(String command) {
        if (command.startsWith("load ")) {
            File f = FileSerializer.readFromString(command.substring(5), CurrentPathProvider.currentPathProvider
                    .getCurrentPath());
            if (f.exists()) {
                Plugin p = getPluginToProcessFile(f, Plugin.OPEN, null);
                if (p == null) {
                    return;
                }
                p.processFile(f, Plugin.OPEN); // we don't display whether or
                // not file has been
                // successfullly loaded
            }
            return;
        }
        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);
                    }
                }
                if (canTransform) {
                    setStatus(messageWriter.print1args("transformed", actionType));
                } else {
View Full Code Here

     * destroyed
     */
    protected void exitPlugins() {
        // Add source panel hooks
        for (int i = 0; i < Run.plugins.size(); ++i) {
            Plugin p = (Plugin) Run.plugins.get(i);
            if (p != null) {
                p.exit();
            }
        }
    }
View Full Code Here

        menuBar = new JMenuBar();
        addFileMenu(menuBar);
        addEditMenu(menuBar);
        addToolsMenu(menuBar);
        for (Iterator it = Run.plugins.iterator(); it.hasNext();) {
            Plugin p = (Plugin) it.next();
            p.setMenu(menuBar);
        }

        jmWindows = desktopCardPanel.createMenu(null);

        JMenuItem item = jmWindows.add(aZoomIn);
View Full Code Here

TOP

Related Classes of jsynoptic.base.Plugin

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.