示例#1
0
 /**
  * Remove the currently display gui and insert the given one.
  *
  * @param comp The new gui.
  */
 private void addToContents(JComponent comp) {
   handlerHolder.removeAll();
   comp.setPreferredSize(new Dimension(200, 300));
   handlerHolder.add(comp, BorderLayout.CENTER);
   if (myContents != null) {
     myContents.invalidate();
     myContents.validate();
     myContents.repaint();
   }
 }
 // @pre: param key is key of the bottom-most row in kvp
 public void removeBottomRow(String key) {
   if (keysVisible) {
     kvpPanel.remove(keyKeyComponentMap.remove(key));
   }
   kvpPanel.remove(keyValueComponentMap.remove(key));
   for (JPanel j : keyExtraComponentsMap.remove(key)) {
     kvpPanel.remove(j);
   }
   kvpPanel.remove(keyDetailComponentMap.remove(key));
   for (GridBagConstraints c : columnConstraints) {
     c.gridy--;
   }
   keyDetailConstraints.gridy--;
   kvpPanel.invalidate();
   kvpPanel.updateUI();
 }
  public void dispose() {
    disposing = true;
    // remove utilities
    if (currentPageChanger != null) {
      currentPageChanger.dispose();
    }
    if (keyListenerPageChanger != null) {
      keyListenerPageChanger.uninstall();
    }

    // trigger a re-layout
    pagesPanel.removeAll();
    pagesPanel.invalidate();

    // make sure we call super.
    super.dispose();
  }
 /** Update any UI elements from the model (hint that data has changed). */
 public void updateFromModel() {
   if (ColorAndFontConstants.isInverse()) {
     inactiveBackGroundColor =
         new Color(
             Math.min(255, Themes.currentTheme.detailPanelBackground().getRed() + 2 * COLOR_DELTA),
             Math.min(
                 255, Themes.currentTheme.detailPanelBackground().getBlue() + 2 * COLOR_DELTA),
             Math.min(
                 255, Themes.currentTheme.detailPanelBackground().getGreen() + 2 * COLOR_DELTA));
   } else {
     inactiveBackGroundColor =
         new Color(
             Math.max(0, Themes.currentTheme.detailPanelBackground().getRed() - COLOR_DELTA),
             Math.max(0, Themes.currentTheme.detailPanelBackground().getBlue() - COLOR_DELTA),
             Math.max(0, Themes.currentTheme.detailPanelBackground().getGreen() - COLOR_DELTA));
   }
   panelMain.invalidate();
   panelMain.revalidate();
   panelMain.repaint();
 }
  public void updateResultTableTree(MongoResult mongoResult) {
    resultTableView =
        new JsonTreeTableView(
            JsonTreeModel.buildJsonTree(mongoResult), JsonTreeTableView.COLUMNS_FOR_READING);
    resultTableView.setName("resultTreeTable");

    resultTableView.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent mouseEvent) {
            if (mouseEvent.getClickCount() == 2 && MongoResultPanel.this.isSelectedNodeId()) {
              MongoResultPanel.this.editSelectedMongoDocument();
            }
          }
        });

    buildPopupMenu();

    resultTreePanel.invalidate();
    resultTreePanel.removeAll();
    resultTreePanel.add(new JBScrollPane(resultTableView));
    resultTreePanel.validate();
  }
示例#6
0
 /**
  * This adds the specified component to the setup panel. It is added below the last 'default'
  * item. You can only add 1 component here, so if you need to add multiple things, you'll have to
  * handle adding that to yourself to the one component.
  *
  * @param component the component to add.
  */
 public void setCustomPanel(JComponent component) {
   customPanelPlaceHolder.add(component, BorderLayout.CENTER);
   customPanelPlaceHolder.invalidate();
   mainPanel.validate();
 }
示例#7
0
  /** _more_ */
  protected void createChart() {

    if (madeChart) {
      return;
    }
    madeChart = true;
    final JCheckBox chartDiffCbx = new JCheckBox("Use Difference", chartDifference);
    chartDiffCbx.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            chartDifference = chartDiffCbx.isSelected();
            updateChart();
          }
        });

    chartTimeBox = new JList();
    chartTimeBox.setVisibleRowCount(3);
    chartTimeBox.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    chartTimeBox.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            if (ignoreChartTimeChanges) {
              return;
            }

            updateChart();
          }
        });

    List<StormParam> params = getStormTrackParams();

    Insets inset = new Insets(3, 7, 7, 0);
    List chartComps = new ArrayList();

    List<Way> ways = Misc.sort(stormDisplayState.getTrackCollection().getWayList());
    List wayComps = new ArrayList();
    for (Way way : ways) {
      final Way theWay = way;
      if (way.isObservation() && !chartWays.contains(way)) {
        chartWays.add(way);
      }
      final JCheckBox cbx = new JCheckBox(way.toString(), chartWays.contains(theWay));
      cbx.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              if (cbx.isSelected()) {
                addChartWay(theWay);
              } else {
                removeChartWay(theWay);
              }
            }
          });
      if (!way.isObservation()) {
        wayComps.add(cbx);
      } else {
        wayComps.add(0, cbx);
      }
    }

    chartComps.add(new JLabel(stormDisplayState.getStormTrackControl().getWaysName() + ":"));
    JComponent chartWayComp = GuiUtils.vbox(wayComps);
    if (wayComps.size() > 6) {
      chartWayComp = makeScroller(chartWayComp, 100, 150);
    }
    chartComps.add(GuiUtils.inset(chartWayComp, inset));
    chartComps.add(GuiUtils.lLabel((isHourly() ? "Forecast Hour:" : "Forecast Time:")));
    JScrollPane sp = new JScrollPane(chartTimeBox);
    chartComps.add(GuiUtils.inset(sp, inset));

    List paramComps = new ArrayList();
    for (StormParam param : params) {
      //   if (param.getIsChartParam() == false) {
      //       continue;
      //   }
      final StormParam theParam = param;
      boolean useChartParam = chartParams.contains(theParam);
      final JCheckBox cbx = new JCheckBox(param.toString(), useChartParam);
      cbx.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              if (cbx.isSelected()) {
                addChartParam(theParam);
              } else {
                removeChartParam(theParam);
              }
            }
          });
      paramComps.add(cbx);
    }
    chartComps.add(new JLabel("Parameters:"));
    JComponent paramComp = GuiUtils.vbox(paramComps);
    if (paramComps.size() > 6) {
      paramComp = makeScroller(paramComp, 100, 150);
    }
    chartComps.add(GuiUtils.inset(paramComp, inset));
    chartComps.add(chartDiffCbx);

    JButton removeBtn = GuiUtils.makeButton("Remove Chart", this, "removeChart");
    chartComps.add(GuiUtils.filler(5, 10));
    chartComps.add(removeBtn);

    //        JComponent top = GuiUtils.left(GuiUtils.hbox(
    //                                                     GuiUtils.label("Forecast Time: ",
    // chartTimeBox),
    //                                                     chartDiffCbx));
    //        top = GuiUtils.inset(top,5);
    //        chartTop.add(BorderLayout.NORTH, top);
    JComponent left = GuiUtils.doLayout(chartComps, 1, GuiUtils.WT_N, new double[] {0, 1, 0, 1, 0});
    chartLeft.add(BorderLayout.CENTER, GuiUtils.inset(left, 5));

    chartLeft.invalidate();
    chartLeft.validate();
    chartLeft.repaint();
  }