예제 #1
0
  /**
   * Get the {@link JComponent} that displays the given message.
   *
   * @param msg Message to display.
   * @param breakLines Whether or not {@literal "long"} lines should be broken up.
   * @return {@code JComponent} that displays {@code msg}.
   */
  private static JComponent getMessageComponent(String msg, boolean breakLines) {
    if (msg.startsWith("<html>")) {
      Component[] comps = GuiUtils.getHtmlComponent(msg, null, 500, 400);
      return (JScrollPane) comps[1];
    }

    int msgLength = msg.length();
    if (msgLength < 50) {
      return new JLabel(msg);
    }

    StringBuilder sb = new StringBuilder(msgLength * 2);
    if (breakLines) {
      for (String line : StringUtil.split(msg, "\n")) {
        line = StringUtil.breakText(line, "\n", 50);
        sb.append(line).append('\n');
      }
    } else {
      sb.append(msg).append('\n');
    }

    JTextArea textArea = new JTextArea(sb.toString());
    textArea.setFont(textArea.getFont().deriveFont(Font.BOLD));
    textArea.setBackground(new JPanel().getBackground());
    textArea.setEditable(false);
    JScrollPane textSp = GuiUtils.makeScrollPane(textArea, 400, 200);
    textSp.setPreferredSize(new Dimension(400, 200));
    return textSp;
  }
예제 #2
0
  /**
   * Load in the {@link ucar.unidata.idv.ui.ParamInfo}-s defined in the xml from the given root
   * Element. Create a new JTable and add it into the GUI.
   *
   * @param root The xml root
   * @param i Which resource is this
   */
  private void addList(Element root, int i) {
    List infos;
    boolean isWritable = resources.isWritableResource(i);
    if (root != null) {
      infos = createParamInfoList(root);
    } else {
      if (!isWritable) {
        return;
      }
      infos = new ArrayList();
    }

    if (infos.size() == 0) {
      //            infos.add(new ParamInfo("", null, null, null, null));
    }
    ParamDefaultsTable table = new ParamDefaultsTable(infos, isWritable);
    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    String editableStr = "";
    if (!isWritable) {
      editableStr = " (" + Msg.msg("non-editable") + ") ";
    }
    JLabel label =
        new JLabel(
            "<html>" + Msg.msg("Path: ${param1}", resources.get(i) + editableStr) + "</html>");
    JPanel tablePanel = GuiUtils.topCenter(GuiUtils.inset(label, 4), new JScrollPane(table));

    table.label = resources.getShortName(i);
    tableTabbedPane.add(resources.getShortName(i), tablePanel);
    myTables.add(table);
  }
예제 #3
0
파일: VMManager.java 프로젝트: nbearson/IDV
  /** Capture an image for all ViewManagers */
  public void captureAll() {
    List vms = getViewManagers();

    String filename = FileManager.getWriteFile(FileManager.FILTER_IMAGE, FileManager.SUFFIX_JPG);
    if (filename == null) {
      return;
    }
    String root = IOUtil.stripExtension(filename);
    String ext = IOUtil.getFileExtension(filename);

    StringBuffer sb = new StringBuffer("<html>");
    sb.append("Since there were multiple images they were written out as:<ul>");
    for (int i = 0; i < vms.size(); i++) {
      ViewManager vm = (ViewManager) vms.get(i);
      String name = vm.getName();
      if ((name == null) || (name.trim().length() == 0)) {
        name = "" + (i + 1);
      }
      if (vms.size() != 1) {
        filename = root + name + ext;
      }

      sb.append("<li> " + filename);
      vm.writeImage(filename);
    }
    sb.append("</ul></html>");
    if (vms.size() > 1) {
      GuiUtils.showDialog("Captured Images", GuiUtils.inset(new JLabel(sb.toString()), 5));
    }
  }
예제 #4
0
  public void getPropertyComponents(List comps, final ObjectListener listener) {
    visibleCbx = new JCheckBox(getName(), visible);
    float[] rgb = color.get().getRGBComponents(null);
    slider = new JSlider(0, 100, (int) (rgb[0] * 100));

    float[] xyz = new float[3];
    direction.get(xyz);
    directionXFld = makeField("" + xyz[0], listener, "X Direction");
    directionYFld = makeField("" + xyz[1], listener, "Y Direction");
    directionZFld = makeField("" + xyz[2], listener, "Z Direction");

    double[] pxyz = new double[3];
    location.get(pxyz);
    locationXFld = makeField("" + pxyz[0], listener, "");
    locationYFld = makeField("" + pxyz[1], listener, "");
    locationZFld = makeField("" + pxyz[2], listener, "");

    List fldComps =
        Misc.newList(GuiUtils.rLabel("Direction:"), directionXFld, directionYFld, directionZFld);
    //
    // fldComps.addAll(Misc.newList(GuiUtils.rLabel("Location:"),locationXFld,locationYFld,locationZFld));

    comps.add(visibleCbx);
    GuiUtils.tmpInsets = new Insets(0, 2, 0, 0);
    comps.add(
        GuiUtils.vbox(
            slider, GuiUtils.left(GuiUtils.doLayout(fldComps, 4, GuiUtils.WT_N, GuiUtils.WT_N))));

    if (listener != null) {
      visibleCbx.addActionListener(listener);
      slider.addChangeListener(listener);
    }
  }
예제 #5
0
 /**
  * _more_
  *
  * @return _more_
  */
 private JComponent doMakeContents() {
   chartTop = new JPanel(new BorderLayout());
   chartLeft = new JPanel(new BorderLayout());
   JComponent chartComp =
       GuiUtils.leftCenter(chartLeft, GuiUtils.topCenter(chartTop, getChart().getContents()));
   return chartComp;
 }
예제 #6
0
 /**
  * Make the edit menu
  *
  * @param editMenu edit menu
  * @return edit menu
  */
 public JMenu makeEditMenu(JMenu editMenu) {
   editMenu.add(GuiUtils.makeDynamicMenu("Symbols", this, "initSymbolsMenu"));
   editMenu.add(
       GuiUtils.makeMenuItem("Set properties on selected", this, "setPropertiesOnSelected"));
   editMenu.addSeparator();
   return super.makeEditMenu(editMenu);
 }
예제 #7
0
 /**
  * Make a combo box to select vertical separation of wind barbs, in m
  *
  * @return component for vertical interval selection
  */
 protected JComponent doMakeVerticalIntervalComponent() {
   JComboBox intervalBox =
       GuiUtils.createValueBox(
           this,
           CMD_INTERVAL,
           (int) verticalIntervalValue,
           Misc.createIntervalList(250, 1000, 250),
           true);
   return GuiUtils.label("  Vertical interval (m): ", GuiUtils.wrap(intervalBox));
 }
예제 #8
0
 /**
  * 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));
 }
  /**
   * Returns the data-specific widget for controlling the data-specific aspects of the display.
   *
   * @return The data-specific control-component.
   * @throws RemoteException _more_
   * @throws VisADException _more_
   */
  Component getSpecificWidget() throws VisADException, RemoteException {

    stationMenue = new JComboBox(stationIds);

    // TODO: Check this
    if ((selectedStationIndex >= 0) && (selectedStationIndex < stationIds.length)) {
      stationMenue.setSelectedIndex(selectedStationIndex);
      setStation(selectedStationIndex);
    } else {
      setStation(0);
    }
    stationMenue.setToolTipText("Soundings");

    stationMenue.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            try {
              //                    System.err.println("station menu changed");
              //                    setStation(stationMenue.getSelectedIndex());
              updateHeaderLabel();
            } catch (Exception ex) {
              logException(ex);
            }
          }
        });

    stationMenue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ignoreStationMenuEvent) {
              return;
            }
            Misc.run(
                new Runnable() {
                  public void run() {
                    try {
                      setStation(stationMenue.getSelectedIndex());
                      Misc.runInABit(
                          250,
                          new Runnable() {
                            public void run() {
                              stationMenue.requestFocus();
                            }
                          });
                      updateHeaderLabel();
                    } catch (Exception ex) {
                      logException(ex);
                    }
                  }
                });
          }
        });

    return GuiUtils.top(GuiUtils.inset(GuiUtils.label("Soundings: ", stationMenue), 8));
  }
예제 #10
0
 /**
  * SHow the popup menu
  *
  * @param where component to show near to
  * @param x x
  * @param y y
  */
 public void showPopup(JComponent where, int x, int y) {
   List items = new ArrayList();
   getPopupMenuItems(items);
   items.add(GuiUtils.MENU_SEPARATOR);
   items.add(GuiUtils.makeMenuItem("Properties...", this, "showProperties"));
   //        addGroupMenuItems(items);
   if (items.size() == 0) {
     return;
   }
   GuiUtils.makePopupMenu(items).show(where, x, y);
 }
예제 #11
0
 /**
  * Show a dialog containing a message.
  *
  * @param msg Message to display.
  * @param breakLines If {@code true}, long lines are split.
  */
 public static void userMessage(String msg, boolean breakLines) {
   msg = Msg.msg(msg);
   if (LogUtil.showGui()) {
     LogUtil.consoleMessage(msg);
     JComponent msgComponent = getMessageComponent(msg, breakLines);
     GuiUtils.addModalDialogComponent(msgComponent);
     JOptionPane.showMessageDialog(LogUtil.getCurrentWindow(), msgComponent);
     GuiUtils.removeModalDialogComponent(msgComponent);
   } else {
     System.err.println(msg);
   }
 }
예제 #12
0
    /**
     * Make the gui for the data subset panel
     *
     * @return gui for data subset panel
     */
    protected JComponent doMakeContents() {
      GuiUtils.tmpInsets = GuiUtils.INSETS_5;
      String prop = (String) pointDataSource.getProperty(PROP_STATIONMODELNAME);
      if (dataSelection != null) {
        prop = (String) dataSelection.getProperty(PROP_STATIONMODELNAME);
      }
      if (prop != null) {
        pmc.setPlotModelByName((String) prop);
      }

      return GuiUtils.top(GuiUtils.hflow(Misc.newList(new JLabel("Layout Model: "), pmc), 5, 5));
    }
예제 #13
0
  /**
   * Make the IdvWindow. Add event handlers for adding new data sources and closing the window.
   *
   * @return The window to put the gui in
   */
  public IdvWindow doMakeFrame() {
    if (frame == null) {
      JButton newBtn = new JButton("Add New Data Source");
      newBtn.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              idv.showChooser();
            }
          });
      JButton closeBtn = new JButton("Close");
      closeBtn.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              doClose();
            }
          });

      JComponent extra = getButtons();
      JComponent buttons;
      if (extra != null) {
        buttons =
            GuiUtils.wrap(
                GuiUtils.hflow(
                    Misc.newList(
                        /*newBtn,*/
                        extra, closeBtn),
                    4,
                    4));
      } else {
        buttons =
            GuiUtils.wrap(
                GuiUtils.hflow(
                    Misc.newList(
                        /*newBtn,*/
                        closeBtn),
                    4,
                    4));
      }

      JPanel contents = GuiUtils.centerBottom(getContents(), buttons);
      frame = new IdvWindow(getName(), idv, false);
      frame.getContentPane().add(contents);
      frame.addWindowListener(
          new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              doClose();
            }
          });
      frame.pack();
      frame.show();
    }
    return frame;
  }
예제 #14
0
  /**
   * 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)));
  }
예제 #15
0
 /**
  * Add the Grid Fields component to the properties tab
  *
  * @param tabbedPane properties tab
  */
 public void addPropertiesTabs(JTabbedPane tabbedPane) {
   super.addPropertiesTabs(tabbedPane);
   List comps = new ArrayList();
   gridProperties = new GridParameters(this);
   makeGridFieldsCbx = new JCheckBox("Make Grid Fields", makeGridFields);
   comps.add(GuiUtils.filler());
   comps.add(GuiUtils.left(makeGridFieldsCbx));
   comps.addAll(gridProperties.comps);
   GuiUtils.tmpInsets = GuiUtils.INSETS_5;
   tabbedPane.addTab(
       "Objective Analysis",
       GuiUtils.topLeft(GuiUtils.doLayout(comps, 2, GuiUtils.WT_NN, GuiUtils.WT_N)));
 }
예제 #16
0
    /**
     * Sets the set of times of all the profiles. The set will contain one or more times as double
     * values, in order, from earliest to latest.
     *
     * @param times The times of all the profiles.
     * @param source
     * @throws VisADException if a VisAD failure occurs.
     * @throws RemoteException if a Java RMI failure occurs.
     */
    public void setTimes(SampledSet times, SoundingDataNode source)
        throws VisADException, RemoteException {

      RealType timeType = (RealType) ((SetType) times.getType()).getDomain().getComponent(0);

      // use a LineDrawing because it's the simplest DisplayableData
      if (timesHolder == null) {
        timesHolder = new LineDrawing("times ref");
      }

      /*
       * Add a data object to the display that has the right
       * time-centers.
       */
      Field dummy =
          new FieldImpl(new FunctionType(timeType, AirTemperatureProfile.instance()), times);

      for (int i = 0, n = times.getLength(); i < n; i++) {
        dummy.setSample(i, AirTemperatureProfile.instance().missingData());
      }

      timesHolder.setData(dummy);
      if (widget == null) {
        if (times.getLength() == 1) {
          DateTime time =
              new DateTime(
                  new Real(
                      timeType, times.indexToDouble(new int[] {0})[0][0], times.getSetUnits()[0]));

          widget = GuiUtils.wrap(new JLabel(time.toString()));
          dataNode.setTime(time);
          setSounding(0);
        } else {
          //
          // Set the animation.
          //
          Animation animation = getInternalAnimation(timeType);
          getSoundingView().setExternalAnimation(animation, getAnimationWidget());
          aeroDisplay.addDisplayable(animation);
          aeroDisplay.addDisplayable(timesHolder);

          Container container = Box.createHorizontalBox();
          // Wrap these components so they don't get stretched in the Y direction
          container.add(GuiUtils.wrap(getAnimationWidget().getContents(false)));
          // container.add(GuiUtils.wrap (animationWidget.getIndicatorComponent()));

          widget = container;
        }
      }
    }
예제 #17
0
 /**
  * Override the base class method to catch any events.
  *
  * @param e The action event.
  */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   try {
     if (cmd.equals(CMD_BARBSIZE)) {
       setFlowScale(GuiUtils.getBoxValue((JComboBox) e.getSource()));
     } else if (cmd.equals(CMD_INTERVAL)) {
       setVerticalInterval(GuiUtils.getBoxValue((JComboBox) e.getSource()));
     } else {
       super.actionPerformed(e);
     }
   } catch (NumberFormatException nfe) {
     userErrorMessage("Incorrect number format");
   }
 }
예제 #18
0
 /**
  * Add to the given comps list all the status line and server components.
  *
  * @param comps List of comps to add to
  * @param extra The components after the server box if non-null.
  */
 protected void addTopComponents(List comps, Component extra) {
   if (extra == null) {
     extra = GuiUtils.filler();
   }
   comps.add(GuiUtils.rLabel(LABEL_SERVER));
   GuiUtils.tmpInsets = GRID_INSETS;
   JPanel right =
       GuiUtils.doLayout(
           new Component[] {serverSelector, extra, getConnectButton()},
           3,
           GuiUtils.WT_YN,
           GuiUtils.WT_N);
   comps.add(GuiUtils.left(right));
 }
예제 #19
0
  /** Set the group list */
  protected void setGroups() {
    AddeServer server = getAddeServer();
    if (server != null) {
      Object selected = groupSelector.getSelectedItem();
      List groups = server.getGroupsWithType(getGroupType());
      GuiUtils.setListData(groupSelector, groups);
      if ((selected != null) && groups.contains(selected)) {
        groupSelector.setSelectedItem(selected);
      }

    } else {
      GuiUtils.setListData(groupSelector, new Vector());
    }
  }
예제 #20
0
  /**
   * Add components to properties dialog
   *
   * @param comps List of components
   * @param tabIdx Which tab in properties dialog
   */
  protected void getPropertiesComponents(List comps, int tabIdx) {
    super.getPropertiesComponents(comps, tabIdx);
    if (tabIdx != 0) {
      return;
    }
    comps.add(GuiUtils.rLabel("Histogram: "));

    comps.add(
        GuiUtils.left(
            GuiUtils.hbox(
                Misc.newList(new JLabel("Number of Bins: "), binFld = new JTextField("" + bins, 6)),
                4)));
    //                                             new JLabel("      Stacked: "),
    // stackedCbx = new JCheckBox("",stacked)),4)));
  }
예제 #21
0
  /**
   * Called by doMakeWindow in DisplayControlImpl, which then calls its doMakeMainButtonPanel(),
   * which makes more buttons.
   *
   * @return container of contents
   */
  public Container doMakeContents() {
    try {
      JTabbedPane tab = new MyTabbedPane();
      tab.add("Settings", GuiUtils.inset(GuiUtils.top(doMakeWidgetComponent()), 5));

      // MH: just add a dummy component to this tab for now..
      //            don't init histogram until the tab is clicked.
      tab.add("Histogram", new JLabel("Histogram not yet initialized"));

      return tab;
    } catch (Exception exc) {
      logException("doMakeContents", exc);
    }
    return null;
  }
예제 #22
0
    /**
     * Set the fields from the ProjectionClass
     *
     * @param projClass projection class to use
     */
    private void setFieldsWithClassParams(ProjectionClass projClass) {

      // set the projection in the JComboBox
      String want = projClass.toString();
      for (int i = 0; i < projClassCB.getItemCount(); i++) {
        ProjectionClass pc = (ProjectionClass) projClassCB.getItemAt(i);
        if (pc.toString().equals(want)) {
          projClassCB.setSelectedItem((Object) pc);
          break;
        }
      }

      // set the parameter fields
      paramPanel.removeAll();
      paramPanel.setVisible(0 < projClass.paramList.size());

      List widgets = new ArrayList();
      for (int i = 0; i < projClass.paramList.size(); i++) {
        ProjectionParam pp = (ProjectionParam) projClass.paramList.get(i);
        // construct the label
        String name = pp.name;
        String text = "";
        // Create a decent looking label
        for (int cIdx = 0; cIdx < name.length(); cIdx++) {
          char c = name.charAt(cIdx);
          if (cIdx == 0) {
            c = Character.toUpperCase(c);
          } else {
            if (Character.isUpperCase(c)) {
              text += " ";
              c = Character.toLowerCase(c);
            }
          }
          text += c;
        }
        widgets.add(GuiUtils.rLabel(text + ": "));
        // text input field
        JTextField tf = new JTextField();
        pp.setTextField(tf);
        tf.setColumns(12);
        widgets.add(tf);
      }
      GuiUtils.tmpInsets = new Insets(4, 4, 4, 4);
      JPanel widgetPanel = GuiUtils.doLayout(widgets, 2, GuiUtils.WT_N, GuiUtils.WT_N);

      paramPanel.add("North", widgetPanel);
      paramPanel.add("Center", GuiUtils.filler());
    }
예제 #23
0
  public void setMenuBar(JMenuBar menuBar) {
    this.menuBar = menuBar;

    if (frame != null) {
      GuiUtils.decorateFrame(frame, menuBar);
    }
  }
예제 #24
0
 /**
  * _more_
  *
  * @param comp _more_
  * @param width _more_
  * @param height _more_
  * @return _more_
  */
 JScrollPane makeScroller(JComponent comp, int width, int height) {
   JScrollPane scroller = GuiUtils.makeScrollPane(comp, width, height);
   scroller.setBorder(BorderFactory.createLoweredBevelBorder());
   scroller.setPreferredSize(new Dimension(width, height));
   scroller.setMinimumSize(new Dimension(width, height));
   return scroller;
 }
예제 #25
0
  /**
   * Creates the Viewpoint Toolbar in the specified orientation.
   *
   * @param orientation orientation of the toolbar (JToolBar.VERTICAL or JToolBar.HORIZONTAL)
   * @return the toolbar component
   */
  public Component doMakeViewPointToolBar(int orientation) {
    JToolBar toolbar = getViewpointControl().getToolBar(getToolbarsFloatable());

    toolbar.setOrientation(orientation);

    return GuiUtils.top(toolbar);
  }
예제 #26
0
  /**
   * return the String id of the chosen server name
   *
   * @return the server name
   */
  public String getServer() {
    Object selected = serverSelector.getSelectedItem();
    if (selected == null) {
      return null;
    }
    AddeServer server;
    if (selected instanceof AddeServer) {
      server = (AddeServer) selected;
      return server.getName();
    }
    String serverName = selected.toString();
    server = getIdv().getIdvChooserManager().addAddeServer(serverName);
    addeServers = getIdv().getIdvChooserManager().getAddeServers(getGroupType());

    Object selectedGroup = groupSelector.getSelectedItem();
    AddeServer.Group group = null;
    if (selectedGroup != null) {
      group =
          getIdv()
              .getIdvChooserManager()
              .addAddeServerGroup(server, selectedGroup.toString(), getGroupType());
    }

    boolean old = ignoreStateChangedEvents;
    ignoreStateChangedEvents = true;
    GuiUtils.setListData(serverSelector, addeServers);
    serverSelector.setSelectedItem(server);
    setGroups();
    if (group != null) {
      groupSelector.setSelectedItem(group);
    }
    ignoreStateChangedEvents = old;
    return server.getName();
  }
예제 #27
0
  /**
   * initialize the symbols menu
   *
   * @param m menu
   */
  public void initSymbolsMenu(JMenu m) {
    m.removeAll();
    for (int i = 0; i < glyphs.size(); i++) {
      final MetSymbol metSymbol = (MetSymbol) glyphs.get(i);
      JMenuItem mi = GuiUtils.makeMenuItem(metSymbol.getLabel(), this, "showProperties", metSymbol);
      mi.addMouseListener(
          new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
              highlightedMetSymbol = null;
              StationModelCanvas.this.repaint();
            }

            public void mouseReleased(MouseEvent e) {
              highlightedMetSymbol = null;
              StationModelCanvas.this.repaint();
            }

            public void mouseEntered(MouseEvent e) {
              highlightedMetSymbol = metSymbol;
              StationModelCanvas.this.repaint();
            }

            public void mouseExited(MouseEvent e) {
              highlightedMetSymbol = null;
              StationModelCanvas.this.repaint();
            }
          });
      m.add(mi);
    }
  }
예제 #28
0
  /**
   * Make the gui. Align it left
   *
   * @return The gui
   * @throws RemoteException on badness
   * @throws VisADException on badness
   */
  protected Container doMakeContents() throws VisADException, RemoteException {
    if (usePoints) {
      setAttributeFlags(FLAG_SKIPFACTOR);
    }

    return GuiUtils.left(doMakeWidgetComponent());
  }
예제 #29
0
  /**
   * Construct the widget. with interval, min, max entry boxes and ok and cancel buttons.
   *
   * @param displayControl The display
   * @param title title for frame
   * @param info the color scale info
   * @param showDialog true to show the dialog
   */
  public ColorScaleDialog(
      DisplayControlImpl displayControl, String title, ColorScaleInfo info, boolean showDialog) {
    ok = false;
    this.displayControl = displayControl;

    myInfo = new ColorScaleInfo(info);

    if (showDialog) {
      dialog =
          GuiUtils.createDialog(
              ((displayControl != null) ? displayControl.getWindow() : null), title, true);
    }

    doMakeContents(showDialog);
    String place = myInfo.getPlacement();
    // account for old bundles
    if (place != null) {
      placementBox.setSelectedItem(place);
    }
    // orientationBox.setSelectedItem(myInfo.getOrientation());
    visibilityCbx.setSelected(myInfo.getIsVisible());
    unitCbx.setSelected(myInfo.isUnitVisible());
    labelVisibilityCbx.setSelected(myInfo.getLabelVisible());
    alphaCbx.setSelected(myInfo.getUseAlpha());

    if (showDialog) {
      dialog.setVisible(true);
    }
  }
예제 #30
0
  /**
   * add to properties
   *
   * @param comps comps
   */
  public void getPropertiesComponents(List comps) {
    super.getPropertiesComponents(comps);
    binWidthField = new TimeLengthField("Bin Width", true);
    binRoundToField = new TimeLengthField("Bin Round To", true);
    binWidthField.setTime(binWidth);
    binRoundToField.setTime(binRoundTo);
    List roundToItems =
        Misc.toList(
            new Object[] {
              new TwoFacedObject("Change", new Double(0)),
              new TwoFacedObject("On the hour", new Double(60)),
              new TwoFacedObject("5 after", new Double(5)),
              new TwoFacedObject("10 after", new Double(10)),
              new TwoFacedObject("15 after", new Double(15)),
              new TwoFacedObject("20 after", new Double(20)),
              new TwoFacedObject("30 after", new Double(30)),
              new TwoFacedObject("45 after", new Double(45)),
              new TwoFacedObject("10 to", new Double(50)),
              new TwoFacedObject("5 to", new Double(55))
            });

    roundToCbx =
        GuiUtils.makeComboBox(
            roundToItems, roundToItems.get(0), false, this, "setRoundToFromComboBox");

    List widthItems =
        Misc.toList(
            new Object[] {
              new TwoFacedObject("Change", new Double(0)),
              new TwoFacedObject("5 minutes", new Double(5)),
              new TwoFacedObject("10 minutes", new Double(10)),
              new TwoFacedObject("15 minutes", new Double(15)),
              new TwoFacedObject("20 minutes", new Double(20)),
              new TwoFacedObject("30 minutes", new Double(30)),
              new TwoFacedObject("45 minutes", new Double(45)),
              new TwoFacedObject("1 hour", new Double(60)),
              new TwoFacedObject("6 hours", new Double(60 * 6)),
              new TwoFacedObject("12 hours", new Double(60 * 12)),
              new TwoFacedObject("1 day", new Double(60 * 24))
            });

    widthCbx =
        GuiUtils.makeComboBox(widthItems, widthItems.get(0), false, this, "setWidthFromComboBox");

    comps.add(GuiUtils.filler());
    comps.add(getPropertiesHeader("Time Binning"));

    comps.add(GuiUtils.rLabel("Bin Size:"));
    comps.add(GuiUtils.left(GuiUtils.hbox(binWidthField.getContents(), widthCbx, 5)));
    comps.add(GuiUtils.rLabel("Round To:"));
    comps.add(GuiUtils.left(GuiUtils.hbox(binRoundToField.getContents(), roundToCbx, 5)));
  }