コード例 #1
0
  private void createUI() {
    memLabel = new JLabel("####", JLabel.RIGHT);

    JTabbedPane tabbedPane = new JTabbedPane();
    setComponentName(tabbedPane, "TabbedPane");

    spatialSubsetPane = createSpatialSubsetPane();
    setComponentName(spatialSubsetPane, "SpatialSubsetPane");
    if (spatialSubsetPane != null) {
      tabbedPane.addTab("Spatial Subset", spatialSubsetPane); /*I18N*/
    }

    bandSubsetPane = createBandSubsetPane();
    setComponentName(bandSubsetPane, "BandSubsetPane");
    if (bandSubsetPane != null) {
      tabbedPane.addTab("Band Subset", bandSubsetPane);
    }

    tiePointGridSubsetPane = createTiePointGridSubsetPane();
    setComponentName(tiePointGridSubsetPane, "TiePointGridSubsetPane");
    if (tiePointGridSubsetPane != null) {
      tabbedPane.addTab("Tie-Point Grid Subset", tiePointGridSubsetPane);
    }

    metadataSubsetPane = createAnnotationSubsetPane();
    setComponentName(metadataSubsetPane, "TiePointGridSubsetPane");
    if (metadataSubsetPane != null) {
      tabbedPane.addTab("Metadata Subset", metadataSubsetPane);
    }

    tabbedPane.setPreferredSize(new Dimension(512, 380));
    tabbedPane.setSelectedIndex(0);

    JPanel contentPane = new JPanel(new BorderLayout(4, 4));
    setComponentName(contentPane, "ContentPane");

    contentPane.add(tabbedPane, BorderLayout.CENTER);
    contentPane.add(memLabel, BorderLayout.SOUTH);
    setContent(contentPane);

    updateSubsetDefNodeNameList();
  }
コード例 #2
0
    private void createUI() {

      ActionListener productNodeCheckListener =
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              updateUIState();
            }
          };

      checkers = new ArrayList<JCheckBox>(10);
      JPanel checkersPane = GridBagUtils.createPanel();
      setComponentName(checkersPane, "CheckersPane");

      GridBagConstraints gbc =
          GridBagUtils.createConstraints("insets.left=4,anchor=WEST,fill=HORIZONTAL");
      for (int i = 0; i < productNodes.length; i++) {
        ProductNode productNode = (ProductNode) productNodes[i];

        String name = productNode.getName();
        JCheckBox productNodeCheck = new JCheckBox(name);
        productNodeCheck.setSelected(selected);
        productNodeCheck.setFont(SMALL_PLAIN_FONT);
        productNodeCheck.addActionListener(productNodeCheckListener);

        if (includeAlways != null && StringUtils.containsIgnoreCase(includeAlways, name)) {
          productNodeCheck.setSelected(true);
          productNodeCheck.setEnabled(false);
        } else if (givenProductSubsetDef != null) {
          productNodeCheck.setSelected(givenProductSubsetDef.containsNodeName(name));
        }
        checkers.add(productNodeCheck);

        String description = productNode.getDescription();
        JLabel productNodeLabel = new JLabel(description != null ? description : " ");
        productNodeLabel.setFont(SMALL_ITALIC_FONT);

        GridBagUtils.addToPanel(
            checkersPane, productNodeCheck, gbc, "weightx=0,gridx=0,gridy=" + i);
        GridBagUtils.addToPanel(
            checkersPane, productNodeLabel, gbc, "weightx=1,gridx=1,gridy=" + i);
      }
      // Add a last 'filler' row
      GridBagUtils.addToPanel(
          checkersPane,
          new JLabel(" "),
          gbc,
          "gridwidth=2,weightx=1,weighty=1,gridx=0,gridy=" + productNodes.length);

      ActionListener allCheckListener =
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
              if (e.getSource() == allCheck) {
                checkAllProductNodes(true);
              } else if (e.getSource() == noneCheck) {
                checkAllProductNodes(false);
              }
              updateUIState();
            }
          };

      allCheck = new JCheckBox("Select all");
      allCheck.setName("selectAll");
      allCheck.setMnemonic('a');
      allCheck.addActionListener(allCheckListener);

      noneCheck = new JCheckBox("Select none");
      noneCheck.setName("SelectNone");
      noneCheck.setMnemonic('n');
      noneCheck.addActionListener(allCheckListener);

      JScrollPane scrollPane = new JScrollPane(checkersPane);
      scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

      JPanel buttonRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 4));
      buttonRow.add(allCheck);
      buttonRow.add(noneCheck);

      setLayout(new BorderLayout());
      add(scrollPane, BorderLayout.CENTER);
      add(buttonRow, BorderLayout.SOUTH);
      setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));

      updateUIState();
    }