Search in sources :

Example 6 with ToolButton

use of com.sldeditor.tool.ToolButton in project sldeditor by robward-scisys.

the class SaveSLDTool method createUI.

/**
 * Creates the ui.
 */
private void createUI() {
    groupPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    groupPanel.setBorder(BorderFactory.createTitledBorder(Localisation.getString(SaveSLDTool.class, "SaveSLDTool.save")));
    saveAllSLD = new ToolButton(Localisation.getString(SaveSLDTool.class, "SaveSLDTool.sld"), "tool/savesld.png");
    saveAllSLD.setEnabled(false);
    saveAllSLD.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle(Localisation.getString(SaveSLDTool.class, "SaveSLDTool.destinationFolder"));
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            // 
            // Disable the "All files" option.
            // 
            chooser.setAcceptAllFileFilterUsed(false);
            // Save external images option
            JPanel accessory = new JPanel();
            JCheckBox isOpenBox = new JCheckBox(Localisation.getString(SaveSLDTool.class, "SaveSLDTool.saveExternalImages"));
            accessory.setLayout(new BorderLayout());
            accessory.add(isOpenBox, BorderLayout.CENTER);
            chooser.setAccessory(accessory);
            if (chooser.showSaveDialog(saveAllSLD) == JFileChooser.APPROVE_OPTION) {
                saveAllSLDToFolder(chooser.getSelectedFile(), isOpenBox.isSelected());
            }
        }
    });
    groupPanel.add(saveAllSLD);
    saveAllSLD.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) JFileChooser(javax.swing.JFileChooser) BorderLayout(java.awt.BorderLayout) ToolButton(com.sldeditor.tool.ToolButton) ActionEvent(java.awt.event.ActionEvent) Dimension(java.awt.Dimension) SLDEditorFile(com.sldeditor.datasource.SLDEditorFile) File(java.io.File)

Example 7 with ToolButton

use of com.sldeditor.tool.ToolButton in project sldeditor by robward-scisys.

the class VectorTool method createUI.

/**
 * Creates the ui.
 */
private void createUI() {
    vectorPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) vectorPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    vectorPanel.setBorder(BorderFactory.createTitledBorder(Localisation.getString(VectorTool.class, "VectorTool.title")));
    // 
    // Import vector
    // 
    importVectorButton = new ToolButton(Localisation.getString(VectorTool.class, "VectorTool.import"), "tool/importvector.png");
    vectorPanel.add(importVectorButton);
    importVectorButton.setEnabled(false);
    importVectorButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if ((nodeTypeList != null) && (nodeTypeList.size() == 1)) {
                if (sldEditorInterface != null) {
                    NodeInterface nodeInterface = nodeTypeList.get(0);
                    if (nodeInterface instanceof FileTreeNode) {
                        FileTreeNode fileTreeNode = (FileTreeNode) nodeInterface;
                        if (!importFile(fileTreeNode)) {
                            return;
                        }
                    } else if (nodeInterface instanceof DatabaseFeatureClassNode) {
                        DatabaseFeatureClassNode featureClassNode = (DatabaseFeatureClassNode) nodeInterface;
                        if (!importFeatureClass(featureClassNode)) {
                            return;
                        }
                    }
                }
            }
        }
    });
    // 
    // Set data source
    // 
    dataSourceButton = new ToolButton(Localisation.getString(VectorTool.class, "VectorTool.dataSource"), "tool/setdatasource.png");
    vectorPanel.add(dataSourceButton);
    dataSourceButton.setEnabled(false);
    dataSourceButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if ((nodeTypeList != null) && (nodeTypeList.size() == 1)) {
                if (sldEditorInterface != null) {
                    NodeInterface nodeInterface = nodeTypeList.get(0);
                    if (nodeInterface instanceof FileTreeNode) {
                        FileTreeNode fileTreeNode = (FileTreeNode) nodeInterface;
                        setDataSource(fileTreeNode);
                    } else if (nodeInterface instanceof DatabaseFeatureClassNode) {
                        DatabaseFeatureClassNode featureClassNode = (DatabaseFeatureClassNode) nodeInterface;
                        setDataSource(featureClassNode);
                    }
                }
            }
        }
    });
    vectorPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) DatabaseFeatureClassNode(com.sldeditor.datasource.extension.filesystem.node.database.DatabaseFeatureClassNode) ActionListener(java.awt.event.ActionListener) ToolButton(com.sldeditor.tool.ToolButton) ActionEvent(java.awt.event.ActionEvent) Dimension(java.awt.Dimension) NodeInterface(com.sldeditor.common.NodeInterface) FileTreeNode(com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)

Example 8 with ToolButton

use of com.sldeditor.tool.ToolButton in project sldeditor by robward-scisys.

the class YSLDTool method createUI.

/**
 * Creates the ui.
 */
private void createUI() {
    groupPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    groupPanel.setBorder(BorderFactory.createTitledBorder(Localisation.getString(YSLDTool.class, "YSLDTool.groupTitle")));
    // Export to YSLD
    exportToYSLDButton = new ToolButton(Localisation.getString(YSLDTool.class, "YSLDTool.exportToYSLD"), "tool/exporttoysld.png");
    exportToYSLDButton.setEnabled(false);
    exportToYSLDButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            exportToYSLD();
        }
    });
    groupPanel.add(exportToYSLDButton);
    // Export to SLD
    exportToSLDButton = new ToolButton(Localisation.getString(YSLDTool.class, "YSLDTool.exportToSLD"), "tool/exporttosld.png");
    exportToSLDButton.setEnabled(false);
    exportToSLDButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            exportToSLD();
        }
    });
    groupPanel.add(exportToSLDButton);
    groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) ToolButton(com.sldeditor.tool.ToolButton) ActionEvent(java.awt.event.ActionEvent) Dimension(java.awt.Dimension)

Example 9 with ToolButton

use of com.sldeditor.tool.ToolButton in project sldeditor by robward-scisys.

the class LegendTool method createUI.

/**
 * Creates the ui.
 */
private void createUI() {
    legendPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) legendPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    legendPanel.setBorder(BorderFactory.createTitledBorder(Localisation.getString(LegendTool.class, "LegendTool.legend")));
    saveAllLegend = new ToolButton(Localisation.getString(LegendTool.class, "LegendTool.legend"), "tool/savealllegend.png");
    legendPanel.add(saveAllLegend);
    saveAllLegend.setEnabled(false);
    saveAllLegend.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            File currentDir = new File(".");
            chooser.setCurrentDirectory(currentDir);
            chooser.setDialogTitle(Localisation.getString(LegendTool.class, "LegendTool.destinationFolder"));
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            // Disable the "All files" option.
            chooser.setAcceptAllFileFilterUsed(false);
            if (chooser.showSaveDialog(saveAllLegend) == JFileChooser.APPROVE_OPTION) {
                saveAllLegendToFolder(chooser.getSelectedFile());
            }
        }
    });
    exportAllHTML = new ToolButton(Localisation.getString(LegendTool.class, "LegendTool.html"), "tool/legendhtml.png");
    legendPanel.add(exportAllHTML);
    exportAllHTML.setEnabled(false);
    exportAllHTML.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser();
            chooser.setCurrentDirectory(new java.io.File("."));
            chooser.setDialogTitle(Localisation.getString(LegendTool.class, "LegendTool.htmlDestinationFolder"));
            chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            // 
            // Disable the "All files" option.
            // 
            chooser.setAcceptAllFileFilterUsed(false);
            // 
            if (chooser.showSaveDialog(exportAllHTML) == JFileChooser.APPROVE_OPTION) {
                saveAllHTMLToFolder(chooser.getSelectedFile());
            }
        }
    });
    legendPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) JFileChooser(javax.swing.JFileChooser) ToolButton(com.sldeditor.tool.ToolButton) ActionEvent(java.awt.event.ActionEvent) Dimension(java.awt.Dimension) File(java.io.File)

Example 10 with ToolButton

use of com.sldeditor.tool.ToolButton in project sldeditor by robward-scisys.

the class MapBoxTool method createUI.

/**
 * Creates the ui.
 */
private void createUI() {
    groupPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) groupPanel.getLayout();
    flowLayout.setVgap(0);
    flowLayout.setHgap(0);
    TitledBorder titledBorder = BorderFactory.createTitledBorder(Localisation.getString(MapBoxTool.class, "MapBoxTool.groupTitle"));
    groupPanel.setBorder(titledBorder);
    // Export to SLD
    exportToSLDButton = new ToolButton(Localisation.getString(MapBoxTool.class, "MapBoxTool.exportToSLD"), "tool/exporttosld.png");
    exportToSLDButton.setEnabled(false);
    exportToSLDButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            exportToSLD();
        }
    });
    groupPanel.setPreferredSize(new Dimension(PANEL_WIDTH, ToolPanel.TOOL_PANEL_HEIGHT));
    groupPanel.add(exportToSLDButton);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) ToolButton(com.sldeditor.tool.ToolButton) ActionEvent(java.awt.event.ActionEvent) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

ToolButton (com.sldeditor.tool.ToolButton)15 JPanel (javax.swing.JPanel)15 Dimension (java.awt.Dimension)13 ActionEvent (java.awt.event.ActionEvent)13 ActionListener (java.awt.event.ActionListener)13 FlowLayout (java.awt.FlowLayout)12 File (java.io.File)5 SLDDataInterface (com.sldeditor.common.SLDDataInterface)3 ArrayList (java.util.ArrayList)3 GeoServerConnection (com.sldeditor.common.data.GeoServerConnection)2 SLDData (com.sldeditor.common.data.SLDData)2 SLDEditorFile (com.sldeditor.datasource.SLDEditorFile)2 FileTreeNode (com.sldeditor.datasource.extension.filesystem.node.file.FileTreeNode)2 Component (java.awt.Component)2 IOException (java.io.IOException)2 JFileChooser (javax.swing.JFileChooser)2 Test (org.junit.Test)2 DataSourceConnectorInterface (com.sldeditor.common.DataSourceConnectorInterface)1 DataSourcePropertiesInterface (com.sldeditor.common.DataSourcePropertiesInterface)1 LoadSLDInterface (com.sldeditor.common.LoadSLDInterface)1