*/
public void resetGUI() {
removeAll();
JPanel palette = new JPanel();
palette.setLayout(new BoxLayout(palette, BoxLayout.Y_AXIS));
palette.setAlignmentX(Component.CENTER_ALIGNMENT); // LEFT
palette.setAlignmentY(Component.CENTER_ALIGNMENT); // BOTTOM
String[] requestorNames = new String[drawingToolRequestors.size()];
if (Debug.debugging("omdtl")) {
Debug.output("Have " + requestorNames.length + " REQUESTORS");
}
for (int i = 0; i < requestorNames.length; i++) {
requestorNames[i] = ((DrawingToolRequestor) drawingToolRequestors.elementAt(i)).getName();
if (requestorNames[i] == null) {
Debug.output("OMDrawingToolLauncher has a requestor that is unnamed. Please assign a name to the requestor");
requestorNames[i] = "-- Unnamed --";
}
if (Debug.debugging("omdtl")) {
Debug.output("Adding REQUESTOR " + requestorNames[i]
+ " to menu");
}
}
Object oldChoice = null;
if (requestors != null) {
oldChoice = requestors.getSelectedItem();
}
requestors = new JComboBox(requestorNames);
requestors.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox jcb = (JComboBox) e.getSource();
String currentChoice = (String) jcb.getSelectedItem();
setCurrentRequestor(currentChoice);
}
});
if (requestorNames.length > 0) {
if (oldChoice == null) {
requestors.setSelectedIndex(0);
} else {
requestors.setSelectedItem(oldChoice);
}
}
JPanel panel = PaletteHelper.createPaletteJPanel(i18n.get(OMDrawingToolLauncher.class,
"panelSendTo",
"Send To:"));
panel.add(requestors);
palette.add(panel);
if (Debug.debugging("omdtl")) {
Debug.output("Figuring out tools, using names");
}
panel = PaletteHelper.createPaletteJPanel(i18n.get(OMDrawingToolLauncher.class,
"panelGraphicType",
"Graphic Type:"));
panel.add(getToolWidgets(useTextEditToolTitles));
palette.add(panel);
String[] renderTypes = new String[3];
renderTypes[OMGraphic.RENDERTYPE_LATLON - 1] = rtc[0];
renderTypes[OMGraphic.RENDERTYPE_XY - 1] = rtc[1];
renderTypes[OMGraphic.RENDERTYPE_OFFSET - 1] = rtc[2];
JComboBox renderTypeList = new JComboBox(renderTypes);
renderTypeList.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComboBox jcb = (JComboBox) e.getSource();
String currentChoice = (String) jcb.getSelectedItem();
if (currentChoice == rtc[2]) {
defaultGraphicAttributes.setRenderType(OMGraphic.RENDERTYPE_OFFSET);
} else if (currentChoice == rtc[1]) {
defaultGraphicAttributes.setRenderType(OMGraphic.RENDERTYPE_XY);
} else {
defaultGraphicAttributes.setRenderType(OMGraphic.RENDERTYPE_LATLON);
}
}
});
renderTypeList.setSelectedIndex(defaultGraphicAttributes.getRenderType() - 1);
panel = PaletteHelper.createHorizontalPanel(i18n.get(OMDrawingToolLauncher.class,
"panelGraphicAttributes",
"Graphic Attributes:"));
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.CENTER;
panel.setLayout(gridbag);
String interString = i18n.get(OMDrawingToolLauncher.class,
"panelRenderingType",
"Rendering Type:");
JPanel panel2 = new JPanel();
JLabel renderTypeLabel = new JLabel(interString);
panel2.add(renderTypeLabel);
panel2.add(renderTypeList);
panel3 = new JPanel();
updateDrawingAttributesGUI();
gridbag.setConstraints(panel2, c);
panel.add(panel2);
gridbag.setConstraints(panel3, c);
panel.add(panel3);
palette.add(panel);
JButton createButton = new JButton(i18n.get(OMDrawingToolLauncher.class,
"createButton",
"Create Graphic"));
createButton.setActionCommand(CreateCmd);
createButton.addActionListener(this);
JPanel dismissBox = new JPanel();
JButton dismiss = new JButton(i18n.get(OMDrawingToolLauncher.class,
"dismiss",
"Close"));
dismissBox.setLayout(new BoxLayout(dismissBox, BoxLayout.X_AXIS));
dismissBox.setAlignmentX(Component.CENTER_ALIGNMENT);
dismissBox.setAlignmentY(Component.BOTTOM_ALIGNMENT);
dismissBox.add(createButton);
dismissBox.add(dismiss);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setAlignmentX(Component.CENTER_ALIGNMENT);
setAlignmentY(Component.BOTTOM_ALIGNMENT);
add(palette);
add(dismissBox);