示例#1
0
文件: GridUI.java 项目: nbald/thredds
 private void setChoosers() {
   fieldPanel.removeAll();
   for (int i = 0; i < choosers.size(); i++) {
     Chooser c = (Chooser) choosers.get(i);
     if (c.isWanted) fieldPanel.add(c.field);
   }
 }
示例#2
0
文件: GridUI.java 项目: nbald/thredds
 void setDrawHorizAndVert(boolean drawHoriz, boolean drawVert) {
   drawingPanel.removeAll();
   if (drawHoriz && drawVert) {
     splitDraw.setTopComponent(panz);
     splitDraw.setBottomComponent(vertPanel);
     drawingPanel.add(splitDraw, BorderLayout.CENTER);
   } else if (drawHoriz) {
     drawingPanel.add(panz, BorderLayout.CENTER);
   } else if (drawVert) {
     drawingPanel.add(splitDraw, BorderLayout.CENTER);
   }
 }
示例#3
0
  public void addActions(JPanel buttPanel) {

    AbstractAction netcdfAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            String location = ds.getLocation();
            if (location == null) location = "test";
            int pos = location.lastIndexOf(".");
            if (pos > 0) location = location.substring(0, pos);

            String filename = fileChooser.chooseFilenameToSave(location + ".nc");
            if (filename == null) return;
            writeNetCDF(filename);
          }
        };
    BAMutil.setActionProperties(netcdfAction, "netcdf", "Write netCDF-3 file", false, 'S', -1);
    BAMutil.addActionToContainer(buttPanel, netcdfAction);

    AbstractAction ncstreamAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            String location = ds.getLocation();
            if (location == null) location = "test";
            int pos = location.lastIndexOf(".");
            if (pos > 0) location = location.substring(0, pos);

            String filename = fileChooser.chooseFilenameToSave(location + ".ncs");
            if (filename == null) return;
            writeNcstream(filename);
          }
        };
    BAMutil.setActionProperties(ncstreamAction, "netcdf", "Write ncstream file", false, 'S', -1);
    BAMutil.addActionToContainer(buttPanel, ncstreamAction);

    AbstractButton compareButton = BAMutil.makeButtcon("Select", "Compare to another file", false);
    compareButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            compareDataset();
          }
        });
    buttPanel.add(compareButton);

    AbstractAction attAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            showAtts();
          }
        };
    BAMutil.setActionProperties(attAction, "FontDecr", "global attributes", false, 'A', -1);
    BAMutil.addActionToContainer(buttPanel, attAction);
  }
示例#4
0
    OpPanel(PreferencesExt prefs, boolean isAccess) {
      this.prefs = prefs;
      this.isAccess = isAccess;
      ta = new TextHistoryPane(true);
      infoWindow =
          new IndependentWindow("Details", BAMutil.getImage("netcdfUI"), new JScrollPane(ta));
      Rectangle bounds = (Rectangle) prefs.getBean(FRAME_SIZE, new Rectangle(200, 50, 500, 700));
      infoWindow.setBounds(bounds);

      topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));

      // which server
      serverCB = new JComboBox();
      serverCB.setModel(manage.getServersCB().getModel());
      serverCB.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              String server = (String) serverCB.getSelectedItem();
              setServer(server);
            }
          });

      // serverCB.setModel(manage.getServers().getModel());
      topPanel.add(new JLabel("server:"));
      topPanel.add(serverCB);

      // the date selectors
      startDateField = new JTextArea("                    ");
      endDateField = new JTextArea("                    ");

      topPanel.add(new JLabel("Start Date:"));
      topPanel.add(startDateField);
      topPanel.add(new JLabel("End Date:"));
      topPanel.add(endDateField);

      AbstractAction showAction =
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              showLogs();
            }
          };
      BAMutil.setActionProperties(showAction, "Import", "get logs", false, 'G', -1);
      BAMutil.addActionToContainer(topPanel, showAction);

      AbstractAction filterAction =
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              Boolean state = (Boolean) getValue(BAMutil.STATE);
              removeTestReq = state.booleanValue();
            }
          };
      BAMutil.setActionProperties(filterAction, "time", "remove test Requests", true, 'F', -1);
      BAMutil.addActionToContainer(topPanel, filterAction);

      AbstractAction filter2Action =
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              Boolean state = (Boolean) getValue(BAMutil.STATE);
              problemsOnly = state.booleanValue();
            }
          };
      BAMutil.setActionProperties(filter2Action, "time", "only show problems", true, 'F', -1);
      BAMutil.addActionToContainer(topPanel, filter2Action);

      AbstractAction infoAction =
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              Formatter f = new Formatter();
              showInfo(f);
              ta.setText(f.toString());
              infoWindow.show();
            }
          };
      BAMutil.setActionProperties(
          infoAction, "Information", "info on selected logs", false, 'I', -1);
      BAMutil.addActionToContainer(topPanel, infoAction);

      setLayout(new BorderLayout());
      add(topPanel, BorderLayout.NORTH);
    }
示例#5
0
文件: GridUI.java 项目: nbald/thredds
 private void addToolbarOption(String toolbarName, JToolBar toolbar, AbstractAction act) {
   boolean wantsToolbar = store.getBoolean(toolbarName, true);
   if (wantsToolbar) toolPanel.add(toolbar);
 }
示例#6
0
文件: GridUI.java 项目: nbald/thredds
  private void makeUI(int defaultHeight) {

    datasetNameLabel = new JLabel();
    /* gridPP = new PrefPanel("GridView", (PreferencesExt) store.node("GridViewPrefs"));
    gridUrlIF = gridPP.addTextComboField("url", "Gridded Data URL", null, 10, false);
    gridPP.addButton( BAMutil.makeButtconFromAction( chooseLocalDatasetAction ));
    gridPP.finish(true, BorderLayout.EAST);
    gridPP.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        InvDatasetImpl ds = new InvDatasetImpl( gridUrlIF.getText(), thredds.catalog.DataType.GRID, ServiceType.NETCDF);
        setDataset( ds);
      }
    }); */

    // top tool panel
    toolPanel = new JPanel();
    toolPanel.setBorder(new EtchedBorder());
    toolPanel.setLayout(new MFlowLayout(FlowLayout.LEFT, 0, 0));

    // menus
    JMenu dataMenu = new JMenu("Dataset");
    dataMenu.setMnemonic('D');
    configMenu = new JMenu("Configure");
    configMenu.setMnemonic('C');
    JMenu toolMenu = new JMenu("Controls");
    toolMenu.setMnemonic('T');
    addActionsToMenus(dataMenu, configMenu, toolMenu);
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(dataMenu);
    menuBar.add(configMenu);
    menuBar.add(toolMenu);
    toolPanel.add(menuBar);

    // field choosers
    fieldPanel = new JPanel();
    fieldPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    toolPanel.add(fieldPanel);

    // stride
    toolPanel.add(controller.strideSpinner);

    // buttcons
    BAMutil.addActionToContainer(toolPanel, controller.drawHorizAction);
    BAMutil.addActionToContainer(toolPanel, controller.drawVertAction);
    mapBeanMenu = MapBean.makeMapSelectButton();
    toolPanel.add(mapBeanMenu.getParentComponent());

    // the Navigated panel and its toolbars
    panz.setLayout(new FlowLayout());
    navToolbar = panz.getNavToolBar();
    moveToolbar = panz.getMoveToolBar();
    if (((Boolean) navToolbarAction.getValue(BAMutil.STATE)).booleanValue())
      toolPanel.add(navToolbar);
    if (((Boolean) moveToolbarAction.getValue(BAMutil.STATE)).booleanValue())
      toolPanel.add(moveToolbar);

    BAMutil.addActionToContainer(toolPanel, panz.setReferenceAction);
    BAMutil.addActionToContainer(toolPanel, controller.dataProjectionAction);
    BAMutil.addActionToContainer(toolPanel, controller.showGridAction);
    BAMutil.addActionToContainer(toolPanel, controller.showContoursAction);
    BAMutil.addActionToContainer(toolPanel, controller.showContourLabelsAction);

    BAMutil.addActionToContainer(toolPanel, redrawAction);

    //  vertical split
    vertPanel = new VertPanel();
    splitDraw = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panz, vertPanel);
    int divLoc = store.getInt("vertSplit", 2 * defaultHeight / 3);
    splitDraw.setDividerLocation(divLoc);
    drawingPanel = new JPanel(new BorderLayout()); // filled later

    // status panel
    JPanel statusPanel = new JPanel(new BorderLayout());
    statusPanel.setBorder(new EtchedBorder());
    positionLabel = new JLabel("position");
    positionLabel.setToolTipText("position at cursor");
    dataValueLabel = new JLabel("data value", SwingConstants.CENTER);
    dataValueLabel.setToolTipText("data value (double click on grid)");
    statusPanel.add(positionLabel, BorderLayout.WEST);
    statusPanel.add(dataValueLabel, BorderLayout.CENTER);
    panz.setPositionLabel(positionLabel);

    // colorscale panel
    colorScalePanel = new ColorScale.Panel(this, controller.getColorScale());
    csDataMinMax = new JComboBox(GridRenderer.MinMaxType.values());
    csDataMinMax.setToolTipText("ColorScale Min/Max setting");
    csDataMinMax.addActionListener(
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            controller.setDataMinMaxType((GridRenderer.MinMaxType) csDataMinMax.getSelectedItem());
          }
        });
    JPanel westPanel = new JPanel(new BorderLayout());
    westPanel.add(colorScalePanel, BorderLayout.CENTER);
    westPanel.add(csDataMinMax, BorderLayout.NORTH);

    // lay it out
    JPanel northPanel = new JPanel();
    // northPanel.setLayout( new BoxLayout(northPanel, BoxLayout.Y_AXIS));
    northPanel.setLayout(new BorderLayout());
    northPanel.add(datasetNameLabel, BorderLayout.NORTH);
    northPanel.add(toolPanel, BorderLayout.SOUTH);

    setLayout(new BorderLayout());
    add(northPanel, BorderLayout.NORTH);
    add(statusPanel, BorderLayout.SOUTH);
    add(westPanel, BorderLayout.WEST);
    add(drawingPanel, BorderLayout.CENTER);

    setDrawHorizAndVert(controller.drawHorizOn, controller.drawVertOn);
  }