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));
}
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));
}
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));
}
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));
}
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);
}
Aggregations