/**
   * Initialize the common user interface components.
   *
   * <p>
   */
  protected JButton[] initUI(
      String title, JComponent extraComps, String confirm, String[][] extra, String cancel) {
    JButton[] extraBtns = null;

    /* create dialog body components */
    {
      JPanel body = new JPanel();
      body.setName("MainDialogPanel");

      body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));

      body.add(UIFactory.createPanelLabel("Existing Layouts:"));

      body.add(Box.createRigidArea(new Dimension(0, 4)));

      {
        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new TreeData(), true);
        DefaultTreeModel model = new DefaultTreeModel(root, true);

        JTree tree = new JFancyTree(model);
        pTree = tree;
        tree.setName("DarkTree");

        tree.setCellRenderer(new JLayoutTreeCellRenderer());
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

        {
          JScrollPane scroll =
              UIFactory.createScrollPane(
                  pTree,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(230, 120),
                  new Dimension(230, 150),
                  null);

          body.add(scroll);
        }
      }

      if (extraComps != null) body.add(extraComps);

      extraBtns = super.initUI(title, body, confirm, null, extra, cancel);
    }

    return extraBtns;
  }
Example #2
0
  /** Construct a new dialog. */
  public JArchiveDialog() {
    super("Archive Tool");

    pPrivilegeDetails = new PrivilegeDetails();

    /* create dialog body components */
    {
      JPanel cpanel = new JPanel();
      {
        cpanel.setName("ButtonDialogPanel");
        cpanel.setLayout(new BoxLayout(cpanel, BoxLayout.Y_AXIS));

        cpanel.add(UIFactory.createPanelLabel("Candidate Versions:"));

        cpanel.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          ArchiveCandidateTableModel model = new ArchiveCandidateTableModel();
          pCandidateTableModel = model;

          JTablePanel tpanel = new JTablePanel(model);
          pCandidateTablePanel = tpanel;

          cpanel.add(tpanel);
        }

        cpanel.add(Box.createRigidArea(new Dimension(0, 5)));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createHorizontalGlue());
          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Search...",
                    "candidate-search",
                    this,
                    "Search for new candidate checked-in versions to archive.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(20, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Clear",
                    "clear-candidate",
                    this,
                    "Clear the displayed candidate checked-in versions.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));
          hbox.add(Box.createHorizontalGlue());

          cpanel.add(hbox);
        }
      }

      JPanel apanel = new JPanel();
      {
        apanel.setName("ButtonDialogPanel");
        apanel.setLayout(new BoxLayout(apanel, BoxLayout.Y_AXIS));

        {
          Box box = new Box(BoxLayout.X_AXIS);

          box.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("Versions to Archive:");
            label.setName("PanelLabel");
            box.add(label);
          }

          box.add(Box.createHorizontalGlue());

          {
            JLabel label = new JLabel("Total Size: ???");
            pArchiveSizeLabel = label;
            label.setName("PanelLabel");
            box.add(label);
          }

          box.add(Box.createRigidArea(new Dimension(23, 0)));

          apanel.add(box);
        }

        apanel.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          NodeVersionSizeTableModel model = new NodeVersionSizeTableModel(880);
          pArchiveTableModel = model;

          JTablePanel tpanel = new JTablePanel(model);
          pArchiveTablePanel = tpanel;

          apanel.add(tpanel);
        }

        apanel.add(Box.createRigidArea(new Dimension(0, 5)));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createHorizontalGlue());
          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Add",
                    "add-archive",
                    this,
                    "Add the selected candidate versions to the list of versions to be "
                        + "archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Add All",
                    "add-all-archive",
                    this,
                    "Add all candidate versions to the list of versions to be archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(20, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Remove",
                    "remove-archive",
                    this,
                    "Remove the selected versions from the list of versions to be archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Clear",
                    "remove-all-archive",
                    this,
                    "Clear the list of versions to be archived.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(20, 0)));

          {
            JButton btn =
                UIFactory.createDialogButton(
                    "Calc Sizes",
                    "calc-archive",
                    this,
                    "Calculate the amount of disk space needed to archive the files "
                        + "associated with the checked-in versions.");

            hbox.add(btn);
          }

          hbox.add(Box.createRigidArea(new Dimension(10, 0)));
          hbox.add(Box.createHorizontalGlue());

          apanel.add(hbox);
        }
      }

      JSplitPane body = new JVertSplitPanel(cpanel, apanel);
      body.setAlignmentX(0.5f);

      String extra[][] = {{"Archive...", "archive"}};

      JButton btns[] = super.initUI("Archive Tool:", body, null, null, extra, "Close", null);

      pArchiveButton = btns[0];
      pArchiveButton.setEnabled(false);

      updatePanel();
      pack();
    }

    pQueryDialog = new JArchiveQueryDialog(this);
    pArchiveParamsDialog = new JArchiveParamsDialog(this);
  }
  /** Construct a new dialog. */
  public JExecDetailsDialog() {
    super("Execution Details");

    /* create dialog body components */
    {
      JPanel body = new JPanel();
      body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));

      {
        JPanel panel = new JPanel();
        panel.setName("MainDialogPanel");
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

        /* working directory */
        {
          panel.add(UIFactory.createPanelLabel("Working Directory:"));

          panel.add(Box.createRigidArea(new Dimension(0, 4)));

          JTextField field = UIFactory.createTextField(null, 100, JLabel.LEFT);
          pWorkingDirField = field;

          panel.add(field);
        }

        body.add(panel);
      }

      {
        JPanel panel = new JPanel();
        panel.setName("HorizontalBar");

        Dimension size = new Dimension(100, 7);
        panel.setPreferredSize(size);
        panel.setMinimumSize(size);
        panel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 7));

        body.add(panel);
      }

      /* command line */
      JPanel above = new JPanel();
      {
        above.setName("MainDialogPanel");
        above.setLayout(new BoxLayout(above, BoxLayout.Y_AXIS));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("X");
            pCommandLineLabel = label;

            label.setName("PanelLabel");

            hbox.add(label);
          }

          hbox.add(Box.createHorizontalGlue());

          above.add(hbox);
        }

        above.add(Box.createRigidArea(new Dimension(0, 4)));

        {
          JTextArea area = new JTextArea(null, 5, 70);
          pCommandLineArea = area;

          area.setName("CodeTextArea");
          area.setLineWrap(true);
          area.setWrapStyleWord(true);
          area.setEditable(false);
        }

        {
          JScrollPane scroll =
              UIFactory.createScrollPane(
                  pCommandLineArea,
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(100, 27),
                  null,
                  null);

          above.add(scroll);
        }
      }

      /* environment */
      JPanel below = new JPanel();
      {
        below.setName("MainDialogPanel");
        below.setLayout(new BoxLayout(below, BoxLayout.Y_AXIS));

        {
          Box hbox = new Box(BoxLayout.X_AXIS);

          hbox.add(Box.createRigidArea(new Dimension(4, 0)));

          {
            JLabel label = new JLabel("X");
            pEnvLabel = label;

            label.setName("PanelLabel");

            hbox.add(label);
          }

          hbox.add(Box.createHorizontalGlue());

          below.add(hbox);
        }

        below.add(Box.createRigidArea(new Dimension(0, 4)));

        Component comps[] = UIFactory.createTitledPanels();
        {
          JPanel tpanel = (JPanel) comps[0];
          JPanel vpanel = (JPanel) comps[1];

          tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0)));
          vpanel.add(Box.createHorizontalGlue());
        }

        {
          pEnvScroll =
              UIFactory.createScrollPane(
                  comps[2],
                  ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER,
                  ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                  new Dimension(100, 50),
                  new Dimension(100, 300),
                  null);

          below.add(pEnvScroll);
        }
      }

      {
        JVertSplitPanel split = new JVertSplitPanel(above, below);
        split.setResizeWeight(0.0);
        split.setAlignmentX(0.5f);

        body.add(split);
      }

      super.initUI("X", body, null, null, null, "Close", null);
    }
  }