use of com.sldeditor.tool.ToolManager in project sldeditor by robward-scisys.
the class SLDEditorDefaultLayout method createUI.
/**
* Creates the ui.
*
* @param application the application
* @param uiMgr the ui mgr
* @param extensionList the extension list
*/
/*
* (non-Javadoc)
*
* @see com.sldeditor.UILayoutInterface#createUI(com.sldeditor.SLDEditorInterface, com.sldeditor.SLDEditorUIPanels, java.util.List)
*/
@Override
public void createUI(SLDEditorInterface application, SLDEditorUIPanels uiMgr, List<ExtensionInterface> extensionList) {
if (application == null) {
return;
}
JPanel appPanel = application.getAppPanel();
appPanel.setLayout(new BorderLayout(0, 0));
// Console
JPanel consolePanel = ConsoleManager.getInstance().getPanel();
appPanel.add(consolePanel, BorderLayout.SOUTH);
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout(0, 0));
appPanel.add(panel, BorderLayout.CENTER);
ToolManager toolManagerInstance = ToolManager.getInstance();
toolManagerInstance.setApplication(application);
// Initialise extensions
for (ExtensionInterface extension : extensionList) {
extension.initialise(application.getLoadSLDInterface(), toolManagerInstance);
}
// SLD symbol data panel
JComponent legendPanel = uiMgr.getLegendData();
JComponent dataPanel = uiMgr.getSLDSymbolData();
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.addTab(Localisation.getString(SLDEditorDefaultLayout.class, "panels.symbol"), null, dataPanel, Localisation.getString(SLDEditorDefaultLayout.class, "panels.symbol.tooltip"));
// Legend data panel
tabbedPane.addTab(Localisation.getString(SLDEditorDefaultLayout.class, "panels.legend"), null, legendPanel, Localisation.getString(SLDEditorDefaultLayout.class, "panels.legend.tooltip"));
// SLD raw data panel
JComponent sldPanel = SLDTextArea.getPanel();
tabbedPane.addTab(Localisation.getString(SLDEditorDefaultLayout.class, "panels.sld"), null, sldPanel, Localisation.getString(SLDEditorDefaultLayout.class, "panels.sld.tooltip"));
// Map renderer
MapRender mapTabPanel = RenderPanelFactory.getMapRenderer();
tabbedPane.addTab(Localisation.getString(SLDEditorDefaultLayout.class, "panels.map"), null, mapTabPanel, Localisation.getString(SLDEditorDefaultLayout.class, "panels.map.tooltip"));
// Data source
JComponent dataSourceConfig = uiMgr.getDataSourceConfig();
tabbedPane.addTab(Localisation.getString(SLDEditorDefaultLayout.class, "panels.dataSource"), null, dataSourceConfig, Localisation.getString(SLDEditorDefaultLayout.class, "panels.dataSource.tooltip"));
// Vendor option
JComponent vendorOptionConfig = uiMgr.getVendorOption();
tabbedPane.addTab(Localisation.getString(SLDEditorDefaultLayout.class, "panels.vendorOption"), null, vendorOptionConfig, Localisation.getString(SLDEditorDefaultLayout.class, "panels.vendorOption.tooltip"));
panel.add(tabbedPane);
tabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() instanceof JTabbedPane) {
JTabbedPane pane = (JTabbedPane) e.getSource();
if (pane.getSelectedComponent() == mapTabPanel) {
mapTabPanel.updateStyle();
}
}
}
});
// Extension tab
JTabbedPane extensionTab = new JTabbedPane(JTabbedPane.TOP);
panel.add(extensionTab, BorderLayout.WEST);
for (ExtensionInterface extension : extensionList) {
extensionTab.addTab(extension.getName(), null, extension.getPanel(), extension.getTooltip());
}
if (application != null) {
JFrame applicationFrame = application.getApplicationFrame();
if (applicationFrame != null) {
applicationFrame.getContentPane().add(appPanel);
}
}
}
use of com.sldeditor.tool.ToolManager in project sldeditor by robward-scisys.
the class SLDEditorDockableLayout method createUI.
/*
* (non-Javadoc)
*
* @see com.sldeditor.UILayoutInterface#createUI(com.sldeditor.SLDEditorInterface, com.sldeditor.SLDEditorUIPanels, java.util.List)
*/
@Override
public void createUI(SLDEditorInterface application, SLDEditorUIPanels uiMgr, List<ExtensionInterface> extensionList) {
JFrame frame = application.getApplicationFrame();
control = new CControl(frame);
frame.setLayout(new GridLayout(1, 1));
frame.add(control.getContentArea());
CGrid grid = new CGrid(control);
SingleCDockable legend = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.legend"), (JPanel) uiMgr.getLegendData());
SingleCDockable symbol = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.symbol"), uiMgr.getSLDSymbolData());
SingleCDockable sld = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.sld"), SLDTextArea.getPanel());
SingleCDockable map = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.map"), RenderPanelFactory.getMapRenderer());
SingleCDockable dataSource = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.dataSource"), uiMgr.getDataSourceConfig());
SingleCDockable vendorOption = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.vendorOption"), uiMgr.getVendorOption());
SingleCDockable console = create(Localisation.getString(SLDEditorDockableLayout.class, "panels.console"), ConsoleManager.getInstance().getPanel());
control.addDockable(sld);
control.addDockable(legend);
control.addDockable(symbol);
control.addDockable(map);
control.addDockable(dataSource);
control.addDockable(vendorOption);
control.addDockable(console);
ToolManager toolManagerInstance = ToolManager.getInstance();
toolManagerInstance.setApplication(application);
for (ExtensionInterface extension : extensionList) {
extension.initialise(application.getLoadSLDInterface(), toolManagerInstance);
SingleCDockable dockablePlugin = create(extension.getName(), extension.getPanel());
control.addDockable(dockablePlugin);
grid.add(0, 0, 1, 4, dockablePlugin);
}
grid.add(1, 0, 2, 4, sld);
grid.add(1, 0, 2, 4, legend);
grid.add(1, 0, 2, 4, map);
grid.add(1, 0, 2, 4, dataSource);
grid.add(1, 0, 2, 4, vendorOption);
grid.add(1, 0, 2, 4, symbol);
grid.add(0, 4, 3, 1, console);
CContentArea content = control.getContentArea();
content.deploy(grid);
}
Aggregations