Package jsynoptic.base

Examples of jsynoptic.base.Plugin


        if (isEditable){
            shapeToolBar = new ShapesToolBar();

            int addedShapeButtons = 0;
            for (int i = 0; i < Run.plugins.size(); ++i) {
                Plugin p = (Plugin) Run.plugins.get(i);
                if (p != null) {
                    List scs = p.getShapeCreators();

                    if (scs!= null){
                        for(int j=0;j<scs.size(); j++){
                            ShapeCreator sc = (ShapeCreator)scs.get(j);
                            if (sc.shapeIcon != null){  // Create a button if the shape icon is not null
                                shapeToolBar.addShapeCreatorButton(sc);
                                addedShapeButtons++;
                            }
                        }
                    }
                }
            }
            if (addedShapeButtons > 0){
                toolbar.add(shapeToolBar);
                toolbar.addSeparator();
            }
           
        } else {
            shapeToolBar = null;
        }
       
       
        toolbar.add(bUndo = resources.getBox("undo", this));
        toolbar.add(bRedo = resources.getBox("redo", this));
        updateUndoEnabled();
        toolbar.add(desktopCardPanel.createPreviousButton());
        toolbar.add(desktopCardPanel.createNextButton());
        toolbar.addSeparator();
        if (USE_SELECTION_TOOL_BOXES) {
            addDepthButtons(toolbar);
            toolbar.addSeparator();
            addAlignButtons(toolbar);
            toolbar.addSeparator();
        }
        toolbar.add(bAdjust = resources.getBox("adjust", this));
        toolbar.add(bAlign = resources.getBox("align", this));
        toolbar.addSeparator();
        tbGridDisplay = new JToggleButton(resources.getIcon("gridImage"));
        tbGridDisplay.setPreferredSize(new Dimension(22, 22));
        tbGridDisplay.addActionListener(this);
        tbGridDisplay.setToolTipText(resources.getStringValue("gridButtonTip"));
        toolbar.add(tbGridDisplay);
        cbxGrid = new JComboBox();
        cbxGrid.addItem("0");
        cbxGrid.addItem("5");
        cbxGrid.addItem("10");
        cbxGrid.addItem("20");
        cbxGrid.addItem("40");
        cbxGrid.setSelectedItem("0");
        cbxGrid.setEditable(true);
        cbxGrid.addActionListener(this);
        toolbar.add(cbxGrid);

        toolbar.addSeparator();
        for (Iterator it = Run.plugins.iterator(); it.hasNext();) {
            Plugin p = (Plugin) it.next();
            p.setToolBarItem(toolbar);
        }
    }
View Full Code Here


            exportFileChooser = fileChooser;
        }

        javax.swing.filechooser.FileFilter firstFilter = null;
        for (int i = 0; i < Run.plugins.size(); ++i) {
            Plugin p = (Plugin) Run.plugins.get(i);
            javax.swing.filechooser.FileFilter[] fft = p.getFileFilters(action);
            if (fft == null) {
                continue;
            }
            for (int j = 0; j < fft.length; ++j) {
                fileChooser.addChoosableFileFilter(fft[j]);
View Full Code Here

    protected Plugin getPluginForFilter(int action, FileFilter activeFilter) {
        if (activeFilter == null) {
            return null;
        }
        for (int i = 0; i < Run.plugins.size(); ++i) {
            Plugin p = (Plugin) Run.plugins.get(i);
            FileFilter[] fft = p.getFileFilters(action);
            if (fft == null) {
                continue;
            }
            for (int j = 0; j < fft.length; j++) {
                if (activeFilter.equals(fft[j])) {
View Full Code Here


        // if the active filter accepts the file, use its plugin in priority
        // otherwise, take the first plugin (excuding the builtin) that can
        // accept the file
        Plugin acceptedPlugin = null;
        for (int i = 0; i < Run.plugins.size(); ++i) {
            Plugin p = (Plugin) Run.plugins.get(i);
            FileFilter[] fft = p.getFileFilters(action);
            if (fft == null) {
                continue;
            }
            for (int j = 0; j < fft.length; ++j) {
                if (accepted && fft[j].equals(activeFilter)) {
View Full Code Here

    public boolean open(File f) {
        setIsOpenProcessCancelled(false);
        if ((f == null) || (!f.exists())) {
            return false; // cancel
        }
        Plugin p = getPluginToProcessFile(f, Plugin.OPEN, currentOpenFileFilter);
        if (p == null) {
            return false; // error displayed already
        }
        container.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        CurrentPathProvider.currentPathProvider.setCurrentPath(f);
        boolean loadIsOk = p.processFile(f, Plugin.OPEN);
        container.setCursor(Cursor.getDefaultCursor());
        if (loadIsOk) {
            setStatus(messageWriter.print1args("fileLoadSuccessful", f.getName()));
        } else {
            setStatus(messageWriter.print1args("fileLoadFailed", f.getName()));
View Full Code Here

            return false; // In fact, should not happen at this point
        }
        if (f.getName().indexOf(".") == -1) {
            f = new File(f.getAbsolutePath() + resources.getStringValue("defaultSaveExtension"));
        }
        Plugin p = getPluginToProcessFile(f, Plugin.SAVE, currentSaveFileFilter);
        if (p == null) {
            return false;
        }
        CurrentPathProvider.currentPathProvider.setCurrentPath(f);
        return p.processFile(f, Plugin.SAVE);
    }
View Full Code Here

    protected boolean exportFile(File f) {
        if (f == null) {
            return false; // In fact, should not happen at this point
        }
        Plugin p = getPluginToProcessFile(f, Plugin.EXPORT, currentExportFileFilter);
        if (p == null) {
            return false;
        }
        CurrentPathProvider.currentPathProvider.setCurrentPath(f);
        return p.processFile(f, Plugin.EXPORT);
    }
View Full Code Here

            if (aboutFrame == null) {
                aboutFrame = new JFrame(messageWriter.print1args("aboutTitle", Run.productName));
                String content = messageWriter.print0args("aboutContent");
                boolean pluginLineWritten = false;
                for (Iterator it = Run.plugins.iterator(); it.hasNext();) {
                    Plugin p = (Plugin) it.next();
                    String text = p.about();
                    if (text == null) {
                        continue;
                    }
                    if (!pluginLineWritten) {
                        content += "<p>" + messageWriter.print0args("Plugins:") + "<ul>";
                        pluginLineWritten = true;
                    }
                    content += "<li>" + p.about() + "</li>";
                }
                if (pluginLineWritten) {
                    content += "</ul></p>";
                }
                JEditorPane jdp = new JEditorPane("text/html", content);
View Full Code Here

            return;
        }
        // Get builtin plugin
        if ((builtInPlugin == null) && (Run.plugins != null)) {
            for (int i = 0; i < Run.plugins.size(); ++i) {
                Plugin p = (Plugin) Run.plugins.get(i);
                if (p instanceof Builtin) {
                    builtInPlugin = (Builtin) p;
                }
            }
        }
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) {
                    System.err.println(messageWriter.print1args("fileLoadFailed", f.getAbsolutePath()));
                    return;
                }
                p.processFile(f, Plugin.OPEN);
            } else {
                System.err.println(messageWriter.print1args("fileLoadFailed", f.getAbsolutePath()));
            }
            return;
        }
        if (command.startsWith("paper ")) {
            String paperName = command.substring(6);
            boolean res = setPaper(paperName);
            if (res) {
                return;
            }
            System.err.println(messageWriter.print1args("unknownPaper", paperName));
            System.err.print(messageWriter.print0args("knownPapers"));
            String[] knownPapers = getKnownPapers();
            if (knownPapers != null) {
                for (int i = 0; i < knownPapers.length; ++i) {
                    System.err.print(knownPapers[i] + (i == (knownPapers.length - 1) ? "" : ", "));
                }
            }
            System.err.println();
            return;
        }
        if (command.startsWith("orientation ")) {
            String orientation = command.substring(12);
            if (!setOrientation(orientation)) {
                System.err.println(messageWriter.print1args("unknownOrientation", orientation));
                System.err.print(messageWriter.print0args("knownOrientations"));
                System.err.println("portrait landscape reverseLandscape");
                return;
            }
            return;
        }
        if (command.startsWith("transform ")) {
            String actionType = command.substring(10);
            if (!actionType.equals("")) {
               
                // synoptic transformation
                boolean canTransformSynoptics = false;
                for (int i = 0; i < getNumberOfPages(); i++) {
                    ShapesContainer sc = ((ShapesContainer) containers.get(i));
                    for (int j = 0; j < Run.plugins.size(); ++j) {
                        Plugin p = (Plugin) Run.plugins.get(j);
                        canTransformSynoptics |= p.processSynoptic(sc, actionType, false);
                    }
                }

                // data transformation
                boolean canTransformData = false;
                Set dataSourceCollections = DataSourcePool.global.dataSourceCollections();
                for(Iterator it=dataSourceCollections.iterator(); it.hasNext();){
                    DataSourceCollection dsc = (DataSourceCollection)it.next();
                    for (int j = 0; j < Run.plugins.size(); ++j) {
                        Plugin p = (Plugin) Run.plugins.get(j);
                        canTransformData |= p.processDataSourceCollection(dsc, actionType);
                    }
                }

                // Display result message
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.