/** * Create the properties contents * * @param comps List of components * @param tabIdx Which tab */ protected void getPropertiesComponents(List comps, int tabIdx) { super.getPropertiesComponents(comps, tabIdx); if (tabIdx != 0) { return; } propertiesNameFld = new JTextField(getName()); labelShownCbx = new JCheckBox("Label Shown", getLabelShown()); comps.add(GuiUtils.rLabel("Name: ")); comps.add(GuiUtils.centerRight(propertiesNameFld, labelShownCbx)); }
/** * Make the gui widget for setting the station model * * @return the widget */ private JComponent makeStationModelWidget() { JButton editButton = GuiUtils.getImageButton("/ucar/unidata/idv/images/edit.gif", getClass()); editButton.setToolTipText("Show the plot model editor"); editButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) {} }); label = new JLabel(" "); changeButton = GuiUtils.getImageButton("/auxdata/ui/icons/DownDown.gif", getClass()); changeButton.setToolTipText("Click to change plot model"); changeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { StationModelManager smm = idv.getStationModelManager(); ObjectListener listener = new ObjectListener(null) { public void actionPerformed(ActionEvent ae) { Misc.run( new Runnable() { public void run() { idv.showWaitCursor(); try { plotModel = (StationModel) theObject; if (plotModel != null) { label.setText(plotModel.getDisplayName()); } method.invoke(plotModelListener, new Object[] {plotModel}); } catch (Exception exc) { idv.logException("Changing plot model", exc); } idv.showNormalCursor(); } }); } }; List items = StationModelCanvas.makeStationModelMenuItems(smm.getStationModels(), listener, smm); items.add(0, GuiUtils.MENU_SEPARATOR); if (addNone) { items.add(0, GuiUtils.makeMenuItem("None", PlotModelComponent.this, "setNone")); } items.add(0, GuiUtils.makeMenuItem("Edit", PlotModelComponent.this, "editPlotModel")); JPopupMenu popup = GuiUtils.makePopupMenu(items); popup.show( changeButton, changeButton.getSize().width / 2, changeButton.getSize().height); } }); return GuiUtils.centerRight(label, GuiUtils.inset(changeButton, new Insets(0, 4, 0, 0))); }