private JPanel buildCheckboxPanel() {
    JPanel tp = new JPanel();

    tp.setBorder(BorderFactory.createTitledBorder("Webserver Options"));
    tp.setLayout(new GridLayout(1, 2));
    String doLocalServer = JConfig.queryConfiguration("server.enabled", "false");
    String doAllowSyndication = JConfig.queryConfiguration("allow.syndication", "true");

    localServerBrowseBox = new JCheckBox("Use internal web server");
    localServerBrowseBox.setToolTipText(
        "<html><body>Turning this on enables JBidwatchers internal web server; 'Show in Browser' will go through JBidwatcher<br>first, in order to allow it to show old/deleted auctions,and to avoid the need to log in regularly.<br>The internal web server is password protected with your auction server username/password.</body></html>");
    // localServerBrowseBox.setToolTipText("Turning this on enables JBidwatchers internal web
    // server; 'Show in Browser' will go through JBidwatcher first, in order to allow it to show
    // old/deleted auctions, and to avoid the need to log in regularly.  The internal web server is
    // password protected with your auction server username/password.");
    localServerBrowseBox.setSelected(doLocalServer.equals("true"));
    tp.add(localServerBrowseBox);

    openSyndication = new JCheckBox("Allow syndication to bypass authentication");
    openSyndication.setToolTipText(
        "Allows syndication requests and thumbnail requests to be resolved without requiring a username/password.");
    openSyndication.setSelected(doAllowSyndication.equals("true"));
    tp.add(openSyndication);

    return tp;
  }
示例#2
0
  private void refreshLanguage() {
    uploadPrioLabel.setText(language.getString("Options.news.1.messageUploadPriority") + " (2)");
    downloadPrioLabel.setText(
        language.getString("Options.news.1.messageDownloadPriority") + " (2)");
    useOneConnectionForMessagesCheckBox.setText(
        language.getString("Options.news.1.useOneConnectionForMessages"));
    displayDaysLabel.setText(language.getString("Options.news.1.numberOfDaysToDisplay") + " (15)");
    downloadDaysLabel.setText(
        language.getString("Options.news.1.numberOfDaysToDownloadBackwards") + " (5)");
    messageBaseLabel.setText(language.getString("Options.news.1.messageBase") + " (news)");
    alwaysDownloadBackloadCheckBox.setText(
        language.getString("Options.news.1.alwaysDownloadBackload"));
    alwaysDownloadBackloadCheckBox.setToolTipText(
        language.getString("Options.news.1.alwaysDownloadBackload.tooltip"));

    final String minutes = language.getString("Options.common.minutes");

    minimumIntervalLabel.setText(
        language.getString("Options.news.3.minimumUpdateInterval") + " (" + minutes + ") (45)");
    concurrentUpdatesLabel.setText(
        language.getString("Options.news.3.numberOfConcurrentlyUpdatingBoards") + " (6)");

    automaticBoardUpdateCheckBox.setText(language.getString("Options.news.3.automaticBoardUpdate"));

    storeSentMessagesCheckBox.setText(language.getString("Options.news.1.storeSentMessages"));
    silentlyRetryCheckBox.setText(language.getString("Options.news.3.silentlyRetryFailedMessages"));

    final String off = language.getString("Options.common.off");
    altEditCheckBox.setText(
        language.getString("Options.miscellaneous.useEditorForWritingMessages") + " (" + off + ")");
  }
示例#3
0
  private JPanel buildExtraSettings() {
    JPanel tp = new JPanel();
    tp.setBorder(BorderFactory.createTitledBorder("Snipe Settings"));
    tp.setLayout(new BorderLayout());

    autoSubtractShippingBox =
        new JCheckBox("Subtract shipping/insurance from bid amounts by default");
    autoSubtractShippingBox.setToolTipText(
        "Determines the default behaviour of deducting shipping/insurance from bid amounts. This behaviour can be overridden on a per-bid basis.");

    tp.add(autoSubtractShippingBox);
    return tp;
  }
  public DvcsCommitAdditionalComponent(
      @NotNull final Project project, @NotNull CheckinProjectPanel panel) {
    myCheckinPanel = panel;
    myPanel = new JPanel(new GridBagLayout());
    final Insets insets = new Insets(2, 2, 2, 2);
    // add amend checkbox
    GridBagConstraints c = new GridBagConstraints();
    // todo change to MigLayout
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 2;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = insets;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;

    myAmend = new NonFocusableCheckBox(DvcsBundle.message("commit.amend"));
    myAmend.setMnemonic('m');
    myAmend.setToolTipText(DvcsBundle.message("commit.amend.tooltip"));
    myPreviousMessage = myCheckinPanel.getCommitMessage();

    myAmend.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (myAmend.isSelected()) {
              if (myPreviousMessage.equals(
                  myCheckinPanel
                      .getCommitMessage())) { // if user has already typed something, don't revert
                                              // it
                if (myMessagesForRoots == null) {
                  loadMessagesInModalTask(project); // load all commit messages for all repositories
                }
                String message = constructAmendedMessage();
                if (!StringUtil.isEmptyOrSpaces(message)) {
                  myAmendedMessage = message;
                  substituteCommitMessage(myAmendedMessage);
                }
              }
            } else {
              // there was the amended message, but user has changed it => not reverting
              if (myCheckinPanel.getCommitMessage().equals(myAmendedMessage)) {
                myCheckinPanel.setCommitMessage(myPreviousMessage);
              }
            }
          }
        });
    myPanel.add(myAmend, c);
  }
  public AmendComponent(
      @NotNull Project project,
      @NotNull RepositoryManager<? extends Repository> repoManager,
      @NotNull CheckinProjectPanel panel,
      @NotNull String title) {
    myRepoManager = repoManager;
    myCheckinPanel = panel;
    myAmend = new NonFocusableCheckBox(title);
    myAmend.setMnemonic('m');
    myAmend.setToolTipText(DvcsBundle.message("commit.amend.tooltip"));
    myPreviousMessage = myCheckinPanel.getCommitMessage();

    myAmend.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (myAmend.isSelected()) {
              if (myPreviousMessage.equals(
                  myCheckinPanel
                      .getCommitMessage())) { // if user has already typed something, don't revert
                                              // it
                if (myMessagesForRoots == null) {
                  loadMessagesInModalTask(project); // load all commit messages for all repositories
                }
                String message = constructAmendedMessage();
                if (!StringUtil.isEmptyOrSpaces(message)) {
                  myAmendedMessage = message;
                  substituteCommitMessage(myAmendedMessage);
                }
              }
            } else {
              // there was the amended message, but user has changed it => not reverting
              if (myCheckinPanel.getCommitMessage().equals(myAmendedMessage)) {
                myCheckinPanel.setCommitMessage(myPreviousMessage);
              }
            }
          }
        });
  }
示例#6
0
  private void setupCheckboxes(List<SearchEngine> searchEngines, JPanel parent) {

    final Map<JCheckBox, BooleanSetting> cBoxes = new HashMap<JCheckBox, BooleanSetting>();

    ItemListener listener =
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            if (areAll(false)) {
              ((JCheckBox) e.getItemSelectable()).setSelected(true);
            }

            if (resultPanel != null) {
              resultPanel.filterChanged(new SearchEngineFilter(engineCheckboxes), 0);
            }
          }
        };

    for (SearchEngine se : searchEngines) {
      JCheckBox cBox = new JCheckBox(se.getName());
      cBox.setSelected(se.isEnabled());
      cBox.setEnabled(se.isEnabled());

      if (!cBox.isEnabled()) {
        cBox.setToolTipText(
            se.getName()
                + " "
                + I18n.tr(
                    "has been disabled on your FrostWire Search Options. (Go to Tools > Options > Search to enable)"));
      }

      parent.add(cBox);

      cBoxes.put(cBox, se.getEnabledSetting());
      cBox.addItemListener(listener);

      engineCheckboxes.put(se, cBox);
    }
  }
  @Override
  protected void init() {
    super.init();

    JavaRefactoringSettings settings = JavaRefactoringSettings.getInstance();

    initReplaceFieldsWithGetters(settings);

    myDeclareFinalCheckBox.setSelected(hasFinalModifier());
    myDelegateViaOverloadingMethodCheckBox.setVisible(myInfo.getToSearchFor() != null);

    setTitle(RefactoringBundle.message("introduce.parameter.title"));

    myTable.init(myInfo);

    final GrParameter[] parameters = myInfo.getToReplaceIn().getParameters();
    toRemoveCBs.forEachEntry(
        new TObjectIntProcedure<JCheckBox>() {
          @Override
          public boolean execute(JCheckBox checkbox, int index) {
            checkbox.setSelected(true);

            final GrParameter param = parameters[index];
            final ParameterInfo pinfo = findParamByOldName(param.getName());
            if (pinfo != null) {
              pinfo.setPassAsParameter(false);
            }
            return true;
          }
        });

    updateSignature();

    if (myCanIntroduceSimpleParameter) {
      mySignaturePanel.setVisible(false);

      // action to hide signature panel if we have variants to introduce simple parameter
      myTypeComboBox.addItemListener(
          new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
              mySignaturePanel.setVisible(myTypeComboBox.isClosureSelected());
              pack();
            }
          });
    }

    final PsiType closureReturnType = inferClosureReturnType();
    if (PsiType.VOID.equals(closureReturnType)) {
      myForceReturnCheckBox.setEnabled(false);
      myForceReturnCheckBox.setSelected(false);
    } else {
      myForceReturnCheckBox.setSelected(isForceReturn());
    }

    if (myInfo.getToReplaceIn() instanceof GrClosableBlock) {
      myDelegateViaOverloadingMethodCheckBox.setEnabled(false);
      myDelegateViaOverloadingMethodCheckBox.setToolTipText(
          "Delegating is not allowed in closure context");
    }

    pack();
  }
    protected void initComponents(
        AirspaceBuilderModel model, final AirspaceBuilderController controller) {
      final JCheckBox resizeNewShapesCheckBox;
      final JCheckBox enableEditCheckBox;

      JPanel newShapePanel = new JPanel();
      {
        JButton newShapeButton = new JButton("New shape");
        newShapeButton.setActionCommand(NEW_AIRSPACE);
        newShapeButton.addActionListener(controller);
        newShapeButton.setToolTipText("Create a new shape centered in the viewport");

        this.factoryComboBox = new JComboBox(defaultAirspaceFactories);
        this.factoryComboBox.setEditable(false);
        this.factoryComboBox.setToolTipText("Choose shape type to create");

        resizeNewShapesCheckBox = new JCheckBox("Fit new shapes to viewport");
        resizeNewShapesCheckBox.setActionCommand(SIZE_NEW_SHAPES_TO_VIEWPORT);
        resizeNewShapesCheckBox.addActionListener(controller);
        resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
        resizeNewShapesCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        resizeNewShapesCheckBox.setToolTipText(
            "New shapes are sized to fit the geographic viewport");

        enableEditCheckBox = new JCheckBox("Enable shape editing");
        enableEditCheckBox.setActionCommand(ENABLE_EDIT);
        enableEditCheckBox.addActionListener(controller);
        enableEditCheckBox.setSelected(controller.isEnableEdit());
        enableEditCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);
        enableEditCheckBox.setToolTipText("Allow modifications to shapes");

        Box newShapeBox = Box.createHorizontalBox();
        newShapeBox.add(newShapeButton);
        newShapeBox.add(Box.createHorizontalStrut(5));
        newShapeBox.add(this.factoryComboBox);
        newShapeBox.setAlignmentX(Component.LEFT_ALIGNMENT);

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(newShapeBox);
        gridPanel.add(resizeNewShapesCheckBox);
        gridPanel.add(enableEditCheckBox);

        newShapePanel.setLayout(new BorderLayout());
        newShapePanel.add(gridPanel, BorderLayout.NORTH);
      }

      JPanel entryPanel = new JPanel();
      {
        this.entryTable = new JTable(model);
        this.entryTable.setColumnSelectionAllowed(false);
        this.entryTable.setRowSelectionAllowed(true);
        this.entryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        this.entryTable
            .getSelectionModel()
            .addListSelectionListener(
                new ListSelectionListener() {
                  public void valueChanged(ListSelectionEvent e) {
                    if (!ignoreSelectEvents) {
                      controller.actionPerformed(
                          new ActionEvent(e.getSource(), -1, SELECTION_CHANGED));
                    }
                  }
                });
        this.entryTable.setToolTipText("<html>Click to select<br>Double-Click to rename</html>");

        JScrollPane tablePane = new JScrollPane(this.entryTable);
        tablePane.setPreferredSize(new Dimension(200, 100));

        entryPanel.setLayout(new BorderLayout(0, 0)); // hgap, vgap
        entryPanel.add(tablePane, BorderLayout.CENTER);
      }

      JPanel selectionPanel = new JPanel();
      {
        JButton delselectButton = new JButton("Deselect");
        delselectButton.setActionCommand(CLEAR_SELECTION);
        delselectButton.addActionListener(controller);
        delselectButton.setToolTipText("Clear the selection");

        JButton deleteButton = new JButton("Delete Selected");
        deleteButton.setActionCommand(REMOVE_SELECTED);
        deleteButton.addActionListener(controller);
        deleteButton.setToolTipText("Delete selected shapes");

        JPanel gridPanel = new JPanel(new GridLayout(0, 1, 0, 5)); // rows, cols, hgap, vgap
        gridPanel.add(delselectButton);
        gridPanel.add(deleteButton);

        selectionPanel.setLayout(new BorderLayout());
        selectionPanel.add(gridPanel, BorderLayout.NORTH);
      }

      this.setLayout(new BorderLayout(30, 0)); // hgap, vgap
      this.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); // top, left, bottom, right
      this.add(newShapePanel, BorderLayout.WEST);
      this.add(entryPanel, BorderLayout.CENTER);
      this.add(selectionPanel, BorderLayout.EAST);

      controller.addPropertyChangeListener(
          new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent e) {
              if (SIZE_NEW_SHAPES_TO_VIEWPORT.equals(e.getPropertyName())) {
                resizeNewShapesCheckBox.setSelected(controller.isResizeNewShapesToViewport());
              } else if (ENABLE_EDIT.equals(e.getPropertyName())) {
                enableEditCheckBox.setSelected(controller.isEnableEdit());
              }
            }
          });
    }
 private void addToolTips() {
   _translationFactorSpinner.setToolTipText(
       "Für Punkte, die auf einer Straße liegen, wird die Darstellung orthogonal um diese Länge verschoben.");
   _joinByLineCheckBox.setToolTipText(
       "Hier wird festgelegt, ob die verschobene Darstellung mit dem Lagepunkt durch eine Linie verbunden wird.");
 }
示例#10
0
  public DataPanel(
      BeautiFrame parent,
      Action importDataAction,
      Action removeDataAction /*, Action importTraitsAction*/) {

    this.frame = parent;

    dataTableModel = new DataTableModel();
    dataTable = new JTable(dataTableModel);

    dataTable.getTableHeader().setReorderingAllowed(false);
    dataTable
        .getTableHeader()
        .setDefaultRenderer(new HeaderRenderer(SwingConstants.LEFT, new Insets(0, 4, 0, 4)));

    TableColumn col = dataTable.getColumnModel().getColumn(5);
    ComboBoxRenderer comboBoxRenderer = new ComboBoxRenderer();
    comboBoxRenderer.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    col.setCellRenderer(comboBoxRenderer);

    //        col = dataTable.getColumnModel().getColumn(5);
    //        comboBoxRenderer = new ComboBoxRenderer();
    //        comboBoxRenderer.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    //        col.setCellRenderer(comboBoxRenderer);

    col = dataTable.getColumnModel().getColumn(6);
    comboBoxRenderer = new ComboBoxRenderer();
    comboBoxRenderer.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    col.setCellRenderer(comboBoxRenderer);

    col = dataTable.getColumnModel().getColumn(7);
    comboBoxRenderer = new ComboBoxRenderer();
    comboBoxRenderer.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    col.setCellRenderer(comboBoxRenderer);

    TableEditorStopper.ensureEditingStopWhenTableLosesFocus(dataTable);

    dataTable
        .getSelectionModel()
        .addListSelectionListener(
            new ListSelectionListener() {
              public void valueChanged(ListSelectionEvent evt) {
                selectionChanged();
              }
            });

    dataTable.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
              showAlignment();
            }
          }
        });

    scrollPane =
        new JScrollPane(
            dataTable,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    scrollPane.setOpaque(false);

    JToolBar toolBar1 = new JToolBar();
    toolBar1.setFloatable(false);
    toolBar1.setOpaque(false);
    toolBar1.setLayout(new BoxLayout(toolBar1, BoxLayout.X_AXIS));

    JButton button = new JButton(unlinkModelsAction);
    unlinkModelsAction.setEnabled(false);
    PanelUtils.setupComponent(button);
    toolBar1.add(button);

    button = new JButton(linkModelsAction);
    linkModelsAction.setEnabled(false);
    PanelUtils.setupComponent(button);
    toolBar1.add(button);

    toolBar1.addSeparator();

    button = new JButton(unlinkClocksAction);
    unlinkClocksAction.setEnabled(false);
    PanelUtils.setupComponent(button);
    toolBar1.add(button);

    button = new JButton(linkClocksAction);
    linkClocksAction.setEnabled(false);
    PanelUtils.setupComponent(button);
    toolBar1.add(button);

    toolBar1.addSeparator();

    button = new JButton(unlinkTreesAction);
    unlinkTreesAction.setEnabled(false);
    PanelUtils.setupComponent(button);
    toolBar1.add(button);

    button = new JButton(linkTreesAction);
    linkTreesAction.setEnabled(false);
    PanelUtils.setupComponent(button);
    toolBar1.add(button);

    // too crowded on the toolbar  - just double click to show
    //            button = new JButton(showAction);
    //            showAction.setEnabled(false);
    //            PanelUtils.setupComponent(button);
    //            toolBar1.add(button);

    ActionPanel actionPanel1 = new ActionPanel(false);
    actionPanel1.setAddAction(importDataAction);
    actionPanel1.setRemoveAction(removeDataAction);
    removeDataAction.setEnabled(false);

    JPanel controlPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    controlPanel1.setOpaque(false);
    controlPanel1.add(actionPanel1);

    controlPanel1.add(new JLabel("   "));
    PanelUtils.setupComponent(createImportTraitButton);
    controlPanel1.add(createImportTraitButton);

    //        controlPanel1.add(new JLabel(" or "));
    //
    //        button = new JButton(importTraitsAction);
    //        PanelUtils.setupComponent(button);
    //        controlPanel1.add(button);

    JPanel panel1 = new JPanel(new BorderLayout());
    panel1.setOpaque(false);
    panel1.add(useStarBEASTCheck, BorderLayout.NORTH);
    panel1.add(toolBar1, BorderLayout.SOUTH);

    setOpaque(false);
    setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));
    setLayout(new BorderLayout(0, 0));
    add(panel1, BorderLayout.NORTH);
    add(scrollPane, BorderLayout.CENTER);
    add(controlPanel1, BorderLayout.SOUTH);

    useStarBEASTCheck.setEnabled(false);
    useStarBEASTCheck.setToolTipText(STARBEASTOptions.CITATION);
    useStarBEASTCheck.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(
              ActionEvent e) { // wrong listener Issue 397: *BEAST in BEAUti is broken
            frame.setupStarBEAST(useStarBEASTCheck.isSelected());
            dataTableModel.fireTableDataChanged();
          }
        });
  }
示例#11
0
  /**
   * Конструктор
   *
   * @param mediator Посредник родитьельского окна
   */
  public ButtonToolBar(final IGuiMediator mediator) {
    this.mediator = mediator;

    try {
      locale = ((WBDrawing) mediator).getLocalizer();
    } catch (Exception e) {
      logger.debug(e.getMessage(), e);
    }

    mouseMenu = new JPopupMenu();
    imagePanel = new JPanel();
    imagePanel.setLayout(new GridLayout(4, 2));
    mouseMenu.add(imagePanel);
    imagePanel.addFocusListener(
        new FocusListener() {
          public void focusGained(FocusEvent e) {
            System.out.println("Focus Gained");
          }

          public void focusLost(FocusEvent e) {
            mouseMenu.setVisible(false);
            System.out.println("Focus Lost");
          }
        });

    URL url = ClassLoader.getSystemResource("img/open.gif");
    Icon iconOpen = new ImageIcon(url);
    JButton btnOpen = new JButton(iconOpen);
    btnOpen.setToolTipText(locale.getString("btntoolbar.open"));
    url = ClassLoader.getSystemResource("img/save.gif");
    Icon iconSave = new ImageIcon(url);
    JButton btnSave = new JButton(iconSave);
    btnSave.setToolTipText(locale.getString("btntoolbar.save"));
    url = ClassLoader.getSystemResource("img/undo.gif");
    Icon iconUndo = new ImageIcon(url);
    btnUndo = new JButton(iconUndo);
    btnUndo.setToolTipText(locale.getString("btntoolbar.undo"));
    url = ClassLoader.getSystemResource("img/redo.gif");
    Icon iconRedo = new ImageIcon(url);
    btnRedo = new JButton(iconRedo);
    btnRedo.setToolTipText(locale.getString("btntoolbar.redo"));
    url = ClassLoader.getSystemResource("img/draw.gif");
    Icon iconDraw = new ImageIcon(url);
    btnDraw = new JToggleButton(iconDraw, true);
    btnDraw.setToolTipText(locale.getString("btntoolbar.draw"));
    url = ClassLoader.getSystemResource("img/pen.gif");
    Icon iconPen = new ImageIcon(url);
    btnPen = new JToggleButton(iconPen);
    btnPen.setToolTipText(locale.getString("btntoolbar.pen"));
    url = ClassLoader.getSystemResource("img/calibrate.gif");
    Icon iconCalibrate = new ImageIcon(url);
    btnCalibrate = new JToggleButton(iconCalibrate);
    btnCalibrate.setToolTipText(locale.getString("btntoolbar.calibration"));
    url = ClassLoader.getSystemResource("img/gridMove.gif");
    Icon iconGridMove = new ImageIcon(url);

    JToggleButton btnGrigMove = new JToggleButton(iconGridMove);
    url = ClassLoader.getSystemResource("img/hand.gif");
    Icon iconHand = new ImageIcon(url);

    JToggleButton btnHand = new JToggleButton(iconHand);
    btnHand.setToolTipText(locale.getString("btntoolbar.hand"));

    url = ClassLoader.getSystemResource("img/selTool.gif");
    Icon iconSelTool = new ImageIcon(url);
    JToggleButton btnSelTool = new JToggleButton(iconSelTool);

    url = ClassLoader.getSystemResource("img/spline.gif");
    Icon iconQuadTool = new ImageIcon(url);
    btnSpline = new JToggleButton(iconQuadTool);
    btnSpline.setToolTipText(locale.getString("btntoolbar.spline"));

    btnTools = new JToggleButton("T");

    btnTextTool = new JToggleButton("A");

    url = ClassLoader.getSystemResource("img/ruler.gif");
    Icon iconRulerTool = new ImageIcon(url);
    btnRulerTool = new JToggleButton(iconRulerTool);

    url = ClassLoader.getSystemResource("img/sendFile.gif");
    Icon iconSendFile = new ImageIcon(url);
    JToggleButton btnFileTransmit = new JToggleButton(iconSendFile);
    btnFileTransmit.setToolTipText(locale.getString("btntoolbar.fileTransmit"));
    url = ClassLoader.getSystemResource("img/nodesEdit.gif");
    Icon iconNodesEdit = new ImageIcon(url);

    JToggleButton btnNodesEdit = new JToggleButton(iconNodesEdit);
    btnNodesEdit.setToolTipText(locale.getString("btntoolbar.nodeEdit"));

    JButton btnTest = new JButton(locale.getString("btntoolbar.button.Test"));
    btnTest.setEnabled(false);
    url = ClassLoader.getSystemResource("img/send.gif");
    Icon iconSend = new ImageIcon(url);
    JButton btnSendArq = new JButton(iconSend);
    btnSendArq.setToolTipText(locale.getString("btntoolbar.send"));
    url = ClassLoader.getSystemResource("img/clear.gif");
    Icon iconClear = new ImageIcon(url);
    JButton btnClearTab = new JButton(iconClear);
    btnClearTab.setToolTipText(locale.getString("btntoolbar.clear"));

    JButton btnRequestModel = new JButton(locale.getString("btntoolbar.button.RequestModel"));
    btnRequestModel.setEnabled(false);

    JComboBox cmbTools = new JComboBox();
    cmbTools.addItem("Thick Line");

    cmbTools.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent e) {
            boolean selected = btnTools.getModel().isSelected();
            if (selected) {
              mode = getToolsMode();
              guiChanged();
            }
          }
        });

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(btnDraw);
    buttonGroup.add(btnPen);
    buttonGroup.add(btnCalibrate);
    buttonGroup.add(btnGrigMove);
    buttonGroup.add(btnHand);
    buttonGroup.add(btnSelTool);
    buttonGroup.add(btnSpline);
    buttonGroup.add(btnTextTool);
    buttonGroup.add(btnRulerTool);
    buttonGroup.add(btnNodesEdit);
    // buttonGroup.add( btnTools );

    btnDraw.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_DRAWING;
            }
            guiChanged();
          }
        });

    btnPen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_PEN;
            }
            guiChanged();
          }
        });

    btnCalibrate.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_CALIBRATING;
            }
            guiChanged();
          }
        });

    btnGrigMove.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_GRID_MOVING;
            }
            guiChanged();
          }
        });

    btnHand.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_HAND_MAP;
            }
            guiChanged();
          }
        });

    btnSelTool.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_SELECT_TOOL;
            }
            guiChanged();
          }
        });

    btnSpline.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_QUAD_TOOL;
            }
            guiChanged();
          }
        });

    btnTextTool.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_TEXT_TOOL;
            }
            guiChanged();
          }
        });

    btnRulerTool.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_RULER_TOOL;
            }
            guiChanged();
          }
        });

    btnNodesEdit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            AbstractButton abstractButton = (AbstractButton) actionEvent.getSource();
            boolean selected = abstractButton.getModel().isSelected();
            if (selected) {
              mode = Mode.MODE_NODES_EDIT;
            }
            guiChanged();
          }
        });

    btnTools.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mode = getToolsMode();
            guiChanged();
          }
        });

    btnOpen.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnOpenPressed();
          }
        });

    btnSave.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnSavePressed();
          }
        });

    btnUndo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnUndoPressed();
          }
        });

    btnRedo.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnRedoPressed();
          }
        });

    btnTest.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnTestPressed();
          }
        });

    btnSendArq.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnSendModelPressed();
          }
        });

    btnSendArq.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnSendArqModelPressed();
          }
        });

    btnClearTab.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnClearTabPressed();
          }
        });

    btnRequestModel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnFileTransmitPressed();
          }
        });

    btnFileTransmit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            mediator.btnFileTransmitPressed();
          }
        });

    add(btnOpen);
    add(btnSave);
    //        add( btnUndo );
    //        add( btnRedo );
    addSeparator();
    // add(lblMode);

    actionButton = new JToggleButton(btnDraw.getIcon());
    actionButton.setToolTipText(btnDraw.getToolTipText());
    actionButton.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            mouseMenu.show(e.getComponent(), e.getX(), e.getY());
          }
        });
    addButton(btnDraw);
    addButton(btnPen);
    addButton(btnCalibrate);
    // add( btnGrigMove );
    addButton(btnHand);
    // add(btnSelTool);
    addButton(btnSpline);
    addButton(btnNodesEdit);
    // add( btnTextTool );
    addButton(btnRulerTool);
    // addSeparator();
    // add(cmbTools);
    add(actionButton);

    cmbScale = new JComboBox();
    cmbScale.setEditable(true);
    cmbScale.addItem("1:1000");
    cmbScale.addItem("1:2000");
    cmbScale.addItem("1:5000");
    cmbScale.addItem("1:10000");
    cmbScale.addItem("1:25000");
    cmbScale.addItem("1:50000");
    cmbScale.addItem("1:100000");
    cmbScale.setSelectedIndex(3);
    cmbScale.setToolTipText(locale.getString("btntoolbar.scale"));
    cmbScale.setPreferredSize(cmbScale.getMinimumSize());
    cmbScale.setMaximumSize(cmbScale.getMinimumSize());

    cmbScale.addItemListener(new ZoomListener());
    addSeparator();

    chbVisibleGrid = new JCheckBox();
    chbVisibleGrid.setSelected(true);
    chbVisibleGrid.setToolTipText(locale.getString("btntoolbar.grid"));
    // addSeparator();
    chbVisibleGrid.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent e) {
            guiChanged();
          }
        });
    add(btnFileTransmit);
    add(btnSendArq);
    add(btnClearTab);
    add(chbVisibleGrid);
    add(cmbScale);
    // addSeparator();
    // add( lblControl );
    // add( btnSend );
    // add( btnRequestModel );
    // add( btnTest );
  }
示例#12
0
    private void createUI() {

      setThumbnailSubsampling();
      final Dimension imageSize = getScaledImageSize();
      thumbnailLoader =
          new ProgressMonitorSwingWorker<BufferedImage, Object>(
              this, "Loading thumbnail image...") {

            @Override
            protected BufferedImage doInBackground(ProgressMonitor pm) throws Exception {
              return createThumbNailImage(imageSize, pm);
            }

            @Override
            protected void done() {
              BufferedImage thumbnail = null;
              try {
                thumbnail = get();
              } catch (Exception e) {
                if (e instanceof IOException) {
                  showErrorDialog("Failed to load thumbnail image:\n" + e.getMessage());
                }
              }

              if (thumbnail != null) {
                imageCanvas.setImage(thumbnail);
              }
            }
          };
      thumbnailLoader.execute();
      imageCanvas = new SliderBoxImageDisplay(imageSize.width, imageSize.height, this);
      imageCanvas.setSize(imageSize.width, imageSize.height);
      setComponentName(imageCanvas, "ImageCanvas");

      imageScrollPane = new JScrollPane(imageCanvas);
      imageScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      imageScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      imageScrollPane
          .getViewport()
          .setExtentSize(new Dimension(MAX_THUMBNAIL_WIDTH, 2 * MAX_THUMBNAIL_WIDTH));
      setComponentName(imageScrollPane, "ImageScrollPane");

      subsetWidthLabel = new JLabel("####", JLabel.RIGHT);
      subsetHeightLabel = new JLabel("####", JLabel.RIGHT);

      setToVisibleButton = new JButton("Use Preview"); /*I18N*/
      setToVisibleButton.setMnemonic('v');
      setToVisibleButton.setToolTipText("Use coordinates of visible thumbnail area"); /*I18N*/
      setToVisibleButton.addActionListener(this);
      setComponentName(setToVisibleButton, "UsePreviewButton");

      fixSceneWidthCheck = new JCheckBox("Fix full width");
      fixSceneWidthCheck.setMnemonic('w');
      fixSceneWidthCheck.setToolTipText("Checks whether or not to fix the full scene width");
      fixSceneWidthCheck.addActionListener(this);
      setComponentName(fixSceneWidthCheck, "FixWidthCheck");

      fixSceneHeightCheck = new JCheckBox("Fix full height");
      fixSceneHeightCheck.setMnemonic('h');
      fixSceneHeightCheck.setToolTipText("Checks whether or not to fix the full scene height");
      fixSceneHeightCheck.addActionListener(this);
      setComponentName(fixSceneHeightCheck, "FixHeightCheck");

      JPanel textInputPane = GridBagUtils.createPanel();
      setComponentName(textInputPane, "TextInputPane");
      final JTabbedPane tabbedPane = new JTabbedPane();
      setComponentName(tabbedPane, "coordinatePane");
      tabbedPane.addTab("Pixel Coordinates", createPixelCoordinatesPane());
      tabbedPane.addTab("Geo Coordinates", createGeoCoordinatesPane());
      tabbedPane.setEnabledAt(1, canUseGeoCoordinates(product));

      GridBagConstraints gbc =
          GridBagUtils.createConstraints("insets.left=7,anchor=WEST,fill=HORIZONTAL, weightx=1.0");
      GridBagUtils.setAttributes(gbc, "gridwidth=2");
      GridBagUtils.addToPanel(textInputPane, tabbedPane, gbc, "gridx=0,gridy=0");

      GridBagUtils.setAttributes(gbc, "insets.top=7,gridwidth=1");
      GridBagUtils.addToPanel(textInputPane, new JLabel("Scene step X:"), gbc, "gridx=0,gridy=1");
      GridBagUtils.addToPanel(
          textInputPane, UIUtils.createSpinner(paramSX, 1, "#0"), gbc, "gridx=1,gridy=1");
      GridBagUtils.setAttributes(gbc, "insets.top=1");
      GridBagUtils.addToPanel(textInputPane, new JLabel("Scene step Y:"), gbc, "gridx=0,gridy=2");
      GridBagUtils.addToPanel(
          textInputPane, UIUtils.createSpinner(paramSY, 1, "#0"), gbc, "gridx=1,gridy=2");

      GridBagUtils.setAttributes(gbc, "insets.top=4");
      GridBagUtils.addToPanel(
          textInputPane, new JLabel("Subset scene width:"), gbc, "gridx=0,gridy=3");
      GridBagUtils.addToPanel(textInputPane, subsetWidthLabel, gbc, "gridx=1,gridy=3");

      GridBagUtils.setAttributes(gbc, "insets.top=1");
      GridBagUtils.addToPanel(
          textInputPane, new JLabel("Subset scene height:"), gbc, "gridx=0,gridy=4");
      GridBagUtils.addToPanel(textInputPane, subsetHeightLabel, gbc, "gridx=1,gridy=4");

      GridBagUtils.setAttributes(gbc, "insets.top=4,gridwidth=1");
      GridBagUtils.addToPanel(
          textInputPane, new JLabel("Source scene width:"), gbc, "gridx=0,gridy=5");
      GridBagUtils.addToPanel(
          textInputPane,
          new JLabel(String.valueOf(product.getSceneRasterWidth()), JLabel.RIGHT),
          gbc,
          "gridx=1,gridy=5");

      GridBagUtils.setAttributes(gbc, "insets.top=1");
      GridBagUtils.addToPanel(
          textInputPane, new JLabel("Source scene height:"), gbc, "gridx=0,gridy=6");
      GridBagUtils.addToPanel(
          textInputPane,
          new JLabel(String.valueOf(product.getSceneRasterHeight()), JLabel.RIGHT),
          gbc,
          "gridx=1,gridy=6");

      GridBagUtils.setAttributes(gbc, "insets.top=7,gridwidth=1, gridheight=2");
      GridBagUtils.addToPanel(textInputPane, setToVisibleButton, gbc, "gridx=0,gridy=7");

      GridBagUtils.setAttributes(gbc, "insets.top=7,gridwidth=1, gridheight=1");
      GridBagUtils.addToPanel(textInputPane, fixSceneWidthCheck, gbc, "gridx=1,gridy=7");

      GridBagUtils.setAttributes(gbc, "insets.top=1,gridwidth=1");
      GridBagUtils.addToPanel(textInputPane, fixSceneHeightCheck, gbc, "gridx=1,gridy=8");

      setLayout(new BorderLayout(4, 4));
      add(imageScrollPane, BorderLayout.WEST);
      add(textInputPane, BorderLayout.CENTER);
      setBorder(BorderFactory.createEmptyBorder(7, 7, 7, 7));

      updateUIState(null);
      imageCanvas.scrollRectToVisible(imageCanvas.getSliderBoxBounds());
    }
示例#13
0
  public Component getCustomOptionComponent() {

    /* DEPTH */
    final JSpinner jspnMaxDepth = new JSpinner(new SpinnerNumberModel(s_maxDepth + 1, 1, 100, 1));
    jspnMaxDepth.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent e) {
            Integer value = (Integer) ((JSpinner) e.getSource()).getValue();
            s_maxDepth = value - 1;

            logger.debug("maxDepth " + (s_maxDepth + 1));
          }
        });
    final JRadioButton jrbMaxDepth = new JRadioButton("Depth");
    final JLabel lblMaxDepth = new JLabel("Depth: ");

    final JPanel jpMaxDepthSub =
        new JPanel() {
          @Override
          public void setEnabled(boolean b) {
            super.setEnabled(b);
            jspnMaxDepth.setEnabled(b);
            lblMaxDepth.setEnabled(b);
          }
        };
    jpMaxDepthSub.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
    jpMaxDepthSub.add(lblMaxDepth);
    jpMaxDepthSub.add(jspnMaxDepth);

    ///
    final JPanel jpMaxDepth =
        new JPanel() {
          @Override
          public void setEnabled(boolean b) {
            super.setEnabled(b);
            jrbMaxDepth.setEnabled(b);
            jpMaxDepthSub.setEnabled(b);
          }
        };

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

    jpMaxDepth.add(GuiUtil.addComponentAsFlow(jrbMaxDepth, FlowLayout.LEFT));
    jpMaxDepth.add(GuiUtil.addComponentAsFlow(jpMaxDepthSub, FlowLayout.RIGHT));

    /* REPETITION */
    final JSpinner jspnMaxRept = new JSpinner(new SpinnerNumberModel(s_maxRept, 1, 100, 1));
    jspnMaxRept.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent e) {
            s_maxRept = (Integer) ((JSpinner) e.getSource()).getValue();

            logger.debug("maxRept " + s_maxRept);
          }
        });

    final JRadioButton jrbMaxRept = new JRadioButton("Repetition");

    final JLabel lblMaxRept = new JLabel("Count: ");

    final JPanel jpMaxReptSub =
        new JPanel() {
          @Override
          public void setEnabled(boolean b) {
            super.setEnabled(b);
            jspnMaxRept.setEnabled(b);
            lblMaxRept.setEnabled(b);
          }
        };
    jpMaxReptSub.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
    jpMaxReptSub.add(lblMaxRept);
    jpMaxReptSub.add(jspnMaxRept);

    final JPanel jpMaxRept =
        new JPanel() {
          @Override
          public void setEnabled(boolean b) {
            super.setEnabled(b);
            jrbMaxRept.setEnabled(b);
            jpMaxReptSub.setEnabled(b);
          }
        };
    jpMaxRept.setLayout(new BoxLayout(jpMaxRept, BoxLayout.Y_AXIS));

    jpMaxRept.add(GuiUtil.addComponentAsFlow(jrbMaxRept, FlowLayout.LEFT));
    jpMaxRept.add(GuiUtil.addComponentAsFlow(jpMaxReptSub, FlowLayout.RIGHT));

    ///////////////////////////////////////
    final JLabel lbl = new JLabel("Limit search by:", SwingConstants.LEFT);

    final JPanel panel =
        new JPanel() {
          @Override
          public void setEnabled(boolean b) {
            super.setEnabled(b);
            lbl.setEnabled(b);
            jpMaxDepth.setEnabled(b);
            jpMaxRept.setEnabled(b);
          }

          @Override
          public void setVisible(boolean b) {
            super.setVisible(b);
            final JPanel p = this;
            //                SwingUtilities.invokeLater( new Runnable() {
            //                    public void run() {
            Window win = SwingUtilities.getWindowAncestor(p);
            System.err.println(win);
            if (win != null) {
              System.err.println("packing");
              win.pack();
            }
            //                    }
            //                } );
          }
        };
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createEmptyBorder(0, 15, 0, 0));
    panel.add(GuiUtil.addComponentAsFlow(lbl, FlowLayout.LEFT));
    panel.add(jpMaxDepth);
    panel.add(jpMaxRept);

    ButtonGroup bg = new ButtonGroup();
    bg.add(jrbMaxDepth);
    bg.add(jrbMaxRept);

    /* CHECKBOX */
    final JCheckBox chboxRepeat =
        new JCheckBox("Allow subtask recursive repetition", s_isSubtaskRepetitionAllowed);

    chboxRepeat.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent e) {
            if (s_isSubtaskRepetitionAllowed == chboxRepeat.isSelected()) return;

            s_isSubtaskRepetitionAllowed = chboxRepeat.isSelected();
            panel.setVisible(s_isSubtaskRepetitionAllowed);

            logger.debug("m_isSubtaskRepetitionAllowed " + s_isSubtaskRepetitionAllowed);
          }
        });

    panel.setVisible(s_isSubtaskRepetitionAllowed);

    final JCheckBox chboxIncremental = new JCheckBox("Incremental", s_isIncremental);
    chboxIncremental.setToolTipText("Incremental depth-first search");

    chboxIncremental.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent e) {

            if (s_isIncremental == chboxIncremental.isSelected()) return;

            s_isIncremental = chboxIncremental.isSelected();

            logger.debug("isIncremental " + s_isIncremental);
          }
        });

    final JCheckBox chboxOptimize =
        new JCheckBox("Disable optimization in subtasks", s_disableOptimizationInSubtasks);
    chboxOptimize.setToolTipText("Use for debugging purposes");

    chboxOptimize.addChangeListener(
        new ChangeListener() {

          public void stateChanged(ChangeEvent e) {

            if (s_disableOptimizationInSubtasks == chboxOptimize.isSelected()) return;

            s_disableOptimizationInSubtasks = chboxOptimize.isSelected();

            logger.debug("disableOptimizationInSubtasks " + s_disableOptimizationInSubtasks);
          }
        });

    JPanel container1 = new JPanel();
    container1.setLayout(new BoxLayout(container1, BoxLayout.Y_AXIS));
    container1.setBorder(BorderFactory.createTitledBorder("Planning settings"));
    container1.add(GuiUtil.addComponentAsFlow(chboxOptimize, FlowLayout.LEFT));
    container1.add(GuiUtil.addComponentAsFlow(chboxIncremental, FlowLayout.LEFT));
    container1.add(GuiUtil.addComponentAsFlow(chboxRepeat, FlowLayout.LEFT));
    container1.add(GuiUtil.addComponentAsFlow(panel, FlowLayout.LEFT));

    JPanel container2 = new JPanel(new GridLayout(2, 0));
    container2.setBorder(BorderFactory.createTitledBorder("Logging options"));

    final JCheckBox linear = new JCheckBox("Detailed linear planning", isLinearLoggingOn());
    linear.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            setLinearLoggingOn(linear.isSelected());
          }
        });
    container2.add(linear);
    final JCheckBox subtask = new JCheckBox("Detailed subtask planning", isSubtaskLoggingOn());
    subtask.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            setSubtaskLoggingOn(subtask.isSelected());
          }
        });
    container2.add(subtask);

    JPanel main = new JPanel();
    main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));
    main.add(container1);
    main.add(container2);

    return main;
  }
示例#14
0
  /** Creating the configuration form */
  private void init() {
    ResourceManagementService resources = LoggingUtilsActivator.getResourceService();

    enableCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.loggingutils.ENABLE_DISABLE"));
    enableCheckBox.addActionListener(this);

    sipProtocolCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.sipaccregwizz.PROTOCOL_NAME"));
    sipProtocolCheckBox.addActionListener(this);

    jabberProtocolCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.jabberaccregwizz.PROTOCOL_NAME"));
    jabberProtocolCheckBox.addActionListener(this);

    String rtpDescription =
        resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_RTP_DESCRIPTION");
    rtpProtocolCheckBox =
        new SIPCommCheckBox(
            resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_RTP")
                + " "
                + rtpDescription);
    rtpProtocolCheckBox.addActionListener(this);
    rtpProtocolCheckBox.setToolTipText(rtpDescription);

    ice4jProtocolCheckBox =
        new SIPCommCheckBox(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_ICE4J"));
    ice4jProtocolCheckBox.addActionListener(this);

    JPanel mainPanel = new TransparentPanel();

    add(mainPanel, BorderLayout.NORTH);

    mainPanel.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();

    enableCheckBox.setAlignmentX(Component.LEFT_ALIGNMENT);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.gridx = 0;
    c.gridy = 0;
    mainPanel.add(enableCheckBox, c);

    String label = resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_DESCRIPTION");
    JLabel descriptionLabel = new JLabel(label);
    descriptionLabel.setToolTipText(label);
    enableCheckBox.setToolTipText(label);
    descriptionLabel.setForeground(Color.GRAY);
    descriptionLabel.setFont(descriptionLabel.getFont().deriveFont(8));
    c.gridy = 1;
    c.insets = new Insets(0, 25, 10, 0);
    mainPanel.add(descriptionLabel, c);

    final JPanel loggersButtonPanel = new TransparentPanel(new GridLayout(0, 1));

    loggersButtonPanel.setBorder(
        BorderFactory.createTitledBorder(resources.getI18NString("service.gui.PROTOCOL")));

    loggersButtonPanel.add(sipProtocolCheckBox);
    loggersButtonPanel.add(jabberProtocolCheckBox);
    loggersButtonPanel.add(rtpProtocolCheckBox);
    loggersButtonPanel.add(ice4jProtocolCheckBox);

    c.insets = new Insets(0, 20, 10, 0);
    c.gridy = 2;
    mainPanel.add(loggersButtonPanel, c);

    final JPanel advancedPanel = new TransparentPanel(new GridLayout(0, 2));

    advancedPanel.setBorder(
        BorderFactory.createTitledBorder(resources.getI18NString("service.gui.ADVANCED")));

    fileCountField.getDocument().addDocumentListener(this);
    fileSizeField.getDocument().addDocumentListener(this);

    fileCountLabel =
        new JLabel(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_FILE_COUNT"));
    advancedPanel.add(fileCountLabel);
    advancedPanel.add(fileCountField);
    fileSizeLabel =
        new JLabel(resources.getI18NString("plugin.loggingutils.PACKET_LOGGING_FILE_SIZE"));
    advancedPanel.add(fileSizeLabel);
    advancedPanel.add(fileSizeField);

    c.gridy = 3;
    mainPanel.add(advancedPanel, c);

    archiveButton = new JButton(resources.getI18NString("plugin.loggingutils.ARCHIVE_BUTTON"));
    archiveButton.addActionListener(this);

    c = new GridBagConstraints();
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 4;
    mainPanel.add(archiveButton, c);

    if (!StringUtils.isNullOrEmpty(getUploadLocation())) {
      uploadLogsButton =
          new JButton(resources.getI18NString("plugin.loggingutils.UPLOAD_LOGS_BUTTON"));
      uploadLogsButton.addActionListener(this);

      c.insets = new Insets(10, 0, 0, 0);
      c.gridy = 5;
      mainPanel.add(uploadLogsButton, c);
    }
  }
示例#15
0
  /** the JbInit method */
  public void jbInit() throws Exception {
    // Layout definition for this panel
    dataPanel.setLayout(panelLayout);
    dataPanel.setMinimumSize(new Dimension(100, 100));
    this.setLayout(borderLayout);
    this.setSize(new Dimension(862, 514));
    this.setPreferredSize(new Dimension(479, 306));
    this.setMinimumSize(new Dimension(479, 306));
    this.setMaximumSize(new Dimension(479, 306));
    mIdtraslo.setDocument((Document) panelBinding.bindUIControl("Idtraslo", mIdtraslo));
    mIdtraslo.setEditable(false);
    mDescrip.setFocusable(false);
    mDescrip.setEditable(false);
    mEstadotraslotxt.setFocusable(false);
    mEstadopasillotxt.setFocusable(false);
    mEstadoprocesotraslotxt.setFocusable(false);
    mDescripvisualEntrada.setFocusable(false);
    mDescripvisualSalida.setFocusable(false);
    mPasilloactual.setFocusable(false);
    mPasillodestino.setFocusable(true);
    mPosplc.setFocusable(false);
    jCheckBoxTrasbordoEntrada.setText("Trasbord Entradas");
    jCheckBoxTrasbordoEntrada.setToolTipText(
        "Realitzar trasbord per ubicar containers en entrada de passadis");
    dataPanel.add(
        labelIdtraslo,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mIdtraslo,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelIdtraslo.setLabelFor(mIdtraslo);
    mIdtraslo.setColumns(5);
    labelIdtraslo.setText(panelBinding.findCtrlValueBinding("Idtraslo").getLabel());
    mIdtraslo.setToolTipText(panelBinding.findCtrlValueBinding("Idtraslo").getTooltip());
    mDescrip.setDocument((Document) panelBinding.bindUIControl("Descrip", mDescrip));
    dataPanel.add(
        labelDescrip,
        new GridBagConstraints(
            0,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescrip,
        new GridBagConstraints(
            1,
            1,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescrip.setLabelFor(mDescrip);
    mDescrip.setColumns(15);
    labelDescrip.setText(panelBinding.findCtrlValueBinding("Descrip").getLabel());
    mDescrip.setToolTipText(panelBinding.findCtrlValueBinding("Descrip").getTooltip());
    mEstadotraslotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadotraslotxt", mEstadotraslotxt));
    dataPanel.add(
        labelEstadotraslotxt,
        new GridBagConstraints(
            0,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadotraslotxt,
        new GridBagConstraints(
            1,
            2,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadotraslotxt.setLabelFor(mEstadotraslotxt);
    mEstadotraslotxt.setColumns(20);
    labelEstadotraslotxt.setText(panelBinding.findCtrlValueBinding("Estadotraslotxt").getLabel());
    mEstadotraslotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadotraslotxt").getTooltip());
    mEstadopasillotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadopasillotxt", mEstadopasillotxt));
    dataPanel.add(
        labelEstadopasillotxt,
        new GridBagConstraints(
            0,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadopasillotxt,
        new GridBagConstraints(
            1,
            3,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadopasillotxt.setLabelFor(mEstadopasillotxt);
    mEstadopasillotxt.setColumns(20);
    labelEstadopasillotxt.setText(panelBinding.findCtrlValueBinding("Estadopasillotxt").getLabel());
    mEstadopasillotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadopasillotxt").getTooltip());
    mEstadoprocesotraslotxt.setDocument(
        (Document) panelBinding.bindUIControl("Estadoprocesotraslotxt", mEstadoprocesotraslotxt));
    dataPanel.add(
        labelEstadoprocesotraslotxt,
        new GridBagConstraints(
            0,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mEstadoprocesotraslotxt,
        new GridBagConstraints(
            1,
            4,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelEstadoprocesotraslotxt.setLabelFor(mEstadoprocesotraslotxt);
    mEstadoprocesotraslotxt.setColumns(20);
    labelEstadoprocesotraslotxt.setText(
        panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getLabel());
    mEstadoprocesotraslotxt.setToolTipText(
        panelBinding.findCtrlValueBinding("Estadoprocesotraslotxt").getTooltip());
    mDescripvisualEntrada.setDocument(
        (Document) panelBinding.bindUIControl("DescripvisualEntrada", mDescripvisualEntrada));
    dataPanel.add(
        labelDescripvisualEntrada,
        new GridBagConstraints(
            0,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescripvisualEntrada,
        new GridBagConstraints(
            1,
            5,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescripvisualEntrada.setLabelFor(mDescripvisualEntrada);
    mDescripvisualEntrada.setColumns(20);
    labelDescripvisualEntrada.setText(
        panelBinding.findCtrlValueBinding("DescripvisualEntrada").getLabel());
    mDescripvisualEntrada.setToolTipText(
        panelBinding.findCtrlValueBinding("DescripvisualEntrada").getTooltip());
    mDescripvisualSalida.setDocument(
        (Document) panelBinding.bindUIControl("DescripvisualSalida", mDescripvisualSalida));
    dataPanel.add(
        labelDescripvisualSalida,
        new GridBagConstraints(
            0,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mDescripvisualSalida,
        new GridBagConstraints(
            1,
            6,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelDescripvisualSalida.setLabelFor(mDescripvisualSalida);
    mDescripvisualSalida.setColumns(20);
    labelDescripvisualSalida.setText(
        panelBinding.findCtrlValueBinding("DescripvisualSalida").getLabel());
    mDescripvisualSalida.setToolTipText(
        panelBinding.findCtrlValueBinding("DescripvisualSalida").getTooltip());
    mPasilloactual.setDocument(
        (Document) panelBinding.bindUIControl("Pasilloactual", mPasilloactual));
    dataPanel.add(
        labelPasilloactual,
        new GridBagConstraints(
            0,
            7,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPasilloactual,
        new GridBagConstraints(
            1,
            7,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelPasilloactual.setLabelFor(mPasilloactual);
    mPasilloactual.setColumns(3);
    labelPasilloactual.setText(panelBinding.findCtrlValueBinding("Pasilloactual").getLabel());
    mPasilloactual.setToolTipText(panelBinding.findCtrlValueBinding("Pasilloactual").getTooltip());
    mPasillodestino.setDocument(
        (Document) panelBinding.bindUIControl("Pasillodestino", mPasillodestino));
    dataPanel.add(
        labelPasillodestino,
        new GridBagConstraints(
            0,
            8,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPasillodestino,
        new GridBagConstraints(
            1,
            8,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    labelPasillodestino.setLabelFor(mPasillodestino);
    mPasillodestino.setColumns(3);
    labelPasillodestino.setText(panelBinding.findCtrlValueBinding("Pasillodestino").getLabel());
    mPasillodestino.setToolTipText(
        panelBinding.findCtrlValueBinding("Pasillodestino").getTooltip());
    mPosplc.setDocument((Document) panelBinding.bindUIControl("Posplc", mPosplc));
    dataPanel.add(
        labelPosplc,
        new GridBagConstraints(
            0,
            9,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    dataPanel.add(
        mPosplc,
        new GridBagConstraints(
            1,
            9,
            1,
            1,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            1,
            1));
    // dataPanel.add(buttonArrancar, new GridBagConstraints(0, 10, 3, 2, 0.0, 0.0,
    // GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 22, 63), -98, -13));
    dataPanel.add(
        buttonArrancar,
        new GridBagConstraints(
            0,
            10,
            3,
            2,
            0.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 5, 5),
            0,
            0));
    // dataPanel.add(jCheckBoxTrasbordoEntrada, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0,
    // GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    labelPosplc.setLabelFor(mPosplc);
    mPosplc.setColumns(5);
    labelPosplc.setText(panelBinding.findCtrlValueBinding("Posplc").getLabel());

    // Layout the datapanel and the navigation bar
    mPosplc.setToolTipText(panelBinding.findCtrlValueBinding("Posplc").getTooltip());
    add(dataPanel, BorderLayout.CENTER);

    navBar.setModel(
        JUNavigationBar.createViewBinding(
            panelBinding, navBar, "SgavtrasloEntSalView1", null, "SgavtrasloEntSal1Iter"));
    statusBar.setModel(JUStatusBar.createPanelBinding(panelBinding, statusBar));
    add(navBar, BorderLayout.NORTH);
    add(statusBar, BorderLayout.SOUTH);

    // Quitar botones de add / remove
    navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_DELETE));
    navBar.remove(navBar.getButton(JUNavigationBar.BUTTON_INSERT));
    jCheckBoxTrasbordoEntrada.setModel(
        (ButtonModel) panelBinding.bindUIControl("Trasbordoentrada", jCheckBoxTrasbordoEntrada));
    if (getIdTraslo() == 0) jCheckBoxTrasbordoEntrada.setEnabled(false);
  }
示例#16
0
  public BeastDialog(final JFrame frame, final String titleString, final Icon icon) {
    this.frame = frame;

    optionPanel = new OptionsPanel(12, 12);

    // this.frame = frame;

    JPanel panel = new JPanel(new BorderLayout());
    panel.setOpaque(false);

    final OptionsPanel optionPanel3 = new OptionsPanel(0, 3);

    final JLabel titleIcon = new JLabel();
    titleIcon.setIcon(icon);

    final JLabel titleText = new JLabel(titleString);
    optionPanel3.addComponent(titleText);

    //        final JButton aboutButton = new JButton("About BEAST...");
    //        //aboutButton.setAction();
    //        optionPanel3.addComponent(aboutButton);

    optionPanel.addComponents(titleIcon, optionPanel3);

    final JButton inputFileButton = new JButton("Choose File...");
    final JTextField inputFileNameText = new JTextField("not selected", 16);

    inputFileButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            FileDialog dialog = new FileDialog(frame, "Select target file...", FileDialog.LOAD);

            dialog.setVisible(true);
            if (dialog.getFile() == null) {
              // the dialog was cancelled...
              return;
            }

            inputFile = new File(dialog.getDirectory(), dialog.getFile());
            inputFileNameText.setText(inputFile.getName());
          }
        });
    inputFileNameText.setEditable(false);

    JPanel panel1 = new JPanel(new BorderLayout(0, 0));
    panel1.add(inputFileNameText, BorderLayout.CENTER);
    panel1.add(inputFileButton, BorderLayout.EAST);
    inputFileNameText.setToolTipText(
        "<html>Drag a BEAST XML file here or use the button to<br>"
            + "select one from a file dialog box.</html>");
    inputFileButton.setToolTipText(
        "<html>Drag a BEAST XML file here or use the button to<br>"
            + "select one from a file dialog box.</html>");
    optionPanel.addComponentWithLabel("BEAST XML File: ", panel1);

    Color focusColor = UIManager.getColor("Focus.color");
    Border focusBorder = BorderFactory.createMatteBorder(2, 2, 2, 2, focusColor);
    new FileDrop(
        null,
        inputFileNameText,
        focusBorder,
        new FileDrop.Listener() {
          public void filesDropped(java.io.File[] files) {
            inputFile = files[0];
            inputFileNameText.setText(inputFile.getName());
          } // end filesDropped
        }); // end FileDrop.Listener

    overwriteCheckBox.setToolTipText(
        "<html>Specify whether BEAST will overwrite existing log files<br>"
            + "with the same name.</html>");
    optionPanel.addComponent(overwriteCheckBox);

    optionPanel.addSeparator();

    seedText.setColumns(12);
    seedText.setToolTipText(
        "<html>Specify a particular random number seed to replicate<br>"
            + "precisely the sequence of steps in the MCMC chain. By<br>"
            + "default this uses system information to provide a new<br>"
            + "seed each run.</html>");

    optionPanel.addComponentWithLabel("Random number seed: ", seedText);

    threadsCombo.setToolTipText(
        "<html>Specify how large a thread pool to use.<br>"
            + "In most circumstances this should be set to 'automatic'<br>"
            + "but in some circumstances it may be desirable to restict<br>"
            + "the number of cores being used. 0 will turn off threading</html>");

    optionPanel.addComponentWithLabel("Thread pool size: ", threadsCombo);

    optionPanel.addSeparator();

    optionPanel.addSpanningComponent(beagleCheckBox);
    beagleCheckBox.setSelected(true);

    final OptionsPanel optionPanel1 = new OptionsPanel(0, 6);
    //        optionPanel1.setBorder(BorderFactory.createEmptyBorder());
    optionPanel1.setBorder(new TitledBorder(""));

    OptionsPanel optionPanel2 = new OptionsPanel(0, 3);
    optionPanel2.setBorder(BorderFactory.createEmptyBorder());
    final JLabel label1 =
        optionPanel2.addComponentWithLabel("Prefer use of: ", beagleResourceCombo);
    optionPanel2.addComponent(beagleSSECheckBox);
    beagleSSECheckBox.setSelected(true);
    final JLabel label2 =
        optionPanel2.addComponentWithLabel("Prefer precision: ", beaglePrecisionCombo);
    final JLabel label3 =
        optionPanel2.addComponentWithLabel("Rescaling scheme: ", beagleScalingCombo);
    optionPanel2.addComponent(beagleInfoCheckBox);
    optionPanel2.setBorder(BorderFactory.createEmptyBorder());

    optionPanel1.addComponent(optionPanel2);

    final JEditorPane beagleInfo =
        new JEditorPane(
            "text/html",
            "<html><div style=\"font-family:'helvetica neue light',helvetica,sans-serif;font-size:12;\"><p>BEAGLE is a high-performance phylogenetic library that can make use of<br>"
                + "additional computational resources such as graphics boards. It must be<br>"
                + "downloaded and installed independently of BEAST:</p>"
                + "<pre><a href=\"http://beagle-lib.googlecode.com/\">http://beagle-lib.googlecode.com/</a></pre></div>");
    beagleInfo.setOpaque(false);
    beagleInfo.setEditable(false);
    beagleInfo.addHyperlinkListener(new SimpleLinkListener());
    optionPanel1.addComponent(beagleInfo);
    optionPanel1.setBorder(BorderFactory.createEmptyBorder());
    optionPanel.addSpanningComponent(optionPanel1);

    beagleInfoCheckBox.setEnabled(false);
    beagleCheckBox.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            beagleInfo.setEnabled(beagleCheckBox.isSelected());
            beagleInfoCheckBox.setEnabled(beagleCheckBox.isSelected());
            label1.setEnabled(beagleCheckBox.isSelected());
            beagleResourceCombo.setEnabled(beagleCheckBox.isSelected());
            beagleSSECheckBox.setEnabled(beagleCheckBox.isSelected());
            label2.setEnabled(beagleCheckBox.isSelected());
            beaglePrecisionCombo.setEnabled(beagleCheckBox.isSelected());
            label3.setEnabled(beagleCheckBox.isSelected());
            beagleScalingCombo.setEnabled(beagleCheckBox.isSelected());
          }
        });

    beagleCheckBox.setSelected(false);
    beagleResourceCombo.setSelectedItem("CPU");
  }
示例#17
0
  public ThumbMaker() {
    super("ThumbMaker");

    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPrefs = ThumbMakerPreferences.getInstance();

    // content pane
    JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    setContentPane(pane);

    // top panel
    JPanel top = new JPanel();
    top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
    pane.add(top);

    // left-hand panel
    JPanel left = new JPanel();
    left.setLayout(new BoxLayout(left, BoxLayout.Y_AXIS));
    top.add(left);

    // horizontal padding
    top.add(Box.createHorizontalStrut(5));

    // label for file list
    JLabel listLabel = GUIUtil.makeLabel("Files to process:");
    listLabel.setDisplayedMnemonic('f');
    String listTip = "List of files from which to create thumbnails";
    listLabel.setToolTipText(listTip);
    left.add(GUIUtil.pad(listLabel));

    // list of files to convert
    list = new JList();
    listLabel.setLabelFor(list);
    list.setToolTipText(listTip);
    list.setModel(new DefaultListModel());
    list.setDragEnabled(true);
    changeFilesInList = new ThumbTransferHandler();
    list.setTransferHandler(changeFilesInList);
    left.add(new JScrollPane(list));

    // progress bar
    progress = new JProgressBar(0, 1);
    progress.setString("[Drag and drop files onto list to begin]");
    progress.setStringPainted(true);
    progress.setToolTipText("Status of thumbnail processing operation");
    left.add(progress);

    // panel for process and remove buttons
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // add files button
    addFiles = new JButton("Add Files");
    addFiles.setMnemonic('d');
    addFiles.setToolTipText("Add files to be processed.");
    addFiles.addActionListener(this);
    p.add(addFiles);

    p.add(Box.createHorizontalStrut(5));

    // process button
    process = new JButton("Process");
    process.setMnemonic('p');
    process.setToolTipText("Begin creating thumbnails");
    process.addActionListener(this);
    p.add(process);

    p.add(Box.createHorizontalStrut(5));

    // remove button
    remove = new JButton("Remove");
    remove.setMnemonic('v');
    remove.setToolTipText("Remove selected files from the list");
    remove.addActionListener(this);
    p.add(remove);

    left.add(GUIUtil.pad(p));

    // right-hand panel
    JPanel right = new JPanel();
    right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS));
    top.add(right);

    // panel for resolution settings
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // resolution label
    JLabel resLabel = GUIUtil.makeLabel("Resolution: ");
    resLabel.setDisplayedMnemonic('s');
    resLabel.setToolTipText("Resolution of the thumbnails");
    p.add(resLabel);

    // x resolution text box
    xres =
        GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME), 2);
    resLabel.setLabelFor(xres);
    xres.setToolTipText("Thumbnail width");
    p.add(xres);

    // "by" label
    JLabel byLabel = GUIUtil.makeLabel(" by ");
    byLabel.setDisplayedMnemonic('y');
    p.add(byLabel);

    // y resolution text box
    yres =
        GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME), 2);
    byLabel.setLabelFor(yres);
    yres.setToolTipText("Thumbnail height");
    p.add(yres);

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(8));

    // aspect ratio checkbox
    aspect = new JCheckBox("Maintain aspect ratio", true);
    aspect.setMnemonic('m');
    aspect.setToolTipText(
        "When checked, thumbnails are not stretched, "
            + "but rather padded with the background color.");
    aspect.addActionListener(this);
    right.add(GUIUtil.pad(aspect));
    // make sure that the check box is initialized correctly
    aspect.setSelected(
        myPrefs
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // panel for background color
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // load the color values from the preferences
    int redValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // background color label
    colorLabel = GUIUtil.makeLabel("Background color: ");
    String colorTip = "Thumbnail background color";
    colorLabel.setToolTipText(colorTip);
    p.add(colorLabel);

    // background color
    colorBox = new JPanel();
    colorBox.setToolTipText(colorTip);
    colorBox.setBorder(new LineBorder(Color.black, 1));
    Dimension colorBoxSize = new Dimension(45, 15);
    colorBox.setMaximumSize(colorBoxSize);
    colorBox.setMinimumSize(colorBoxSize);
    colorBox.setPreferredSize(colorBoxSize);
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));
    p.add(colorBox);

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(2));

    // red slider
    redLabel = GUIUtil.makeLabel("R");
    red = new JSlider(0, 255, redValueNumber);
    redValue = GUIUtil.makeLabel("" + redValueNumber);
    redValue.setToolTipText("Red color component slider");
    right.add(makeSlider(redLabel, red, redValue, "Red"));

    // green slider
    greenLabel = GUIUtil.makeLabel("G");
    green = new JSlider(0, 255, greenValueNumber);
    greenValue = GUIUtil.makeLabel("" + greenValueNumber);
    greenValue.setToolTipText("Green color component slider");
    right.add(makeSlider(greenLabel, green, greenValue, "Green"));

    // blue slider
    blueLabel = GUIUtil.makeLabel("B");
    blue = new JSlider(0, 255, blueValueNumber);
    blueValue = GUIUtil.makeLabel("" + blueValueNumber);
    right.add(makeSlider(blueLabel, blue, blueValue, "Blue"));

    right.add(Box.createVerticalStrut(8));

    // panel for algorithm
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // algorithm label
    JLabel algorithmLabel = GUIUtil.makeLabel("Algorithm: ");
    algorithmLabel.setDisplayedMnemonic('l');
    String algorithmTip = "Resizing algorithm to use";
    algorithmLabel.setToolTipText(algorithmTip);
    p.add(algorithmLabel);

    // algorithm combo box
    algorithm =
        GUIUtil.makeComboBox(
            new String[] {"Smooth", "Standard", "Fast", "Replicate", "Area averaging"});
    algorithmLabel.setLabelFor(algorithm);
    algorithm.setToolTipText(algorithmTip);
    p.add(algorithm);
    // set the algorithm value from the preferences
    algorithm.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    right.add(GUIUtil.pad(p));

    // panel for output format
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // format label
    JLabel formatLabel = GUIUtil.makeLabel("Format: ");
    formatLabel.setDisplayedMnemonic('f');
    String formatTip = "Thumbnail output format";
    formatLabel.setToolTipText(formatTip);
    p.add(formatLabel);

    // format combo box
    format = GUIUtil.makeComboBox(new String[] {"PNG", "JPG"});
    formatLabel.setLabelFor(format);
    format.setToolTipText(formatTip);
    p.add(format);
    // set the format value from the preferences
    format.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(5));

    // panel for prepend string
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // prepend label
    JLabel prependLabel = GUIUtil.makeLabel("Prepend: ");
    prependLabel.setDisplayedMnemonic('e');
    String prependTip = "Starting string for each thumbnail filename";
    prependLabel.setToolTipText(prependTip);
    p.add(prependLabel);

    // prepend field
    prepend =
        GUIUtil.makeTextField(
            myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME), 4);
    prependLabel.setLabelFor(prepend);
    prepend.setToolTipText(prependTip);
    p.add(prepend);

    p.add(Box.createHorizontalStrut(5));

    // append label
    JLabel appendLabel = GUIUtil.makeLabel("Append: ");
    appendLabel.setDisplayedMnemonic('a');
    String appendTip = "Ending string for each thumbnail filename";
    appendLabel.setToolTipText(appendTip);
    p.add(appendLabel);

    // append field
    append =
        GUIUtil.makeTextField(
            myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME), 4);
    appendLabel.setLabelFor(append);
    append.setToolTipText(appendTip);
    p.add(append);

    right.add(GUIUtil.pad(p));

    // vertical padding
    right.add(Box.createVerticalGlue());

    // bottom panel
    JPanel bottom = new JPanel();
    bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS));
    pane.add(bottom);

    // output folder label
    JLabel outputLabel = GUIUtil.makeLabel("Output folder: ");
    outputLabel.setDisplayedMnemonic('o');
    String outputTip = "Thumbnail output folder";
    outputLabel.setToolTipText(outputTip);
    bottom.add(outputLabel);

    // output folder field
    String filePath =
        new File(myPrefs.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME))
            .getAbsolutePath();
    output = GUIUtil.makeTextField(filePath, 8);
    outputLabel.setLabelFor(output);
    output.setToolTipText(outputTip);
    // start this in default and then lock down so "..." is used
    output.setEditable(false);
    output.setBackground(Color.LIGHT_GRAY);
    bottom.add(output);

    // add a file chooser button "..."
    dotDotDot = new JButton("...");
    dotDotDot.setMnemonic('.');
    dotDotDot.setToolTipText("Select destination directory.");
    dotDotDot.addActionListener(this);
    bottom.add(dotDotDot);

    right.add(GUIUtil.pad(p));

    setFromPreferences();
    addWindowListener(this);
  }