示例#1
0
  public Component getControls() {
    if (panel == null) {

      panel = new JPanel();
      panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

      Box filler = Box.createHorizontalBox();
      filler.setPreferredSize(new Dimension(50, 10));
      panel.add(filler);

      visBox = Box.createHorizontalBox();
      visBox.setAlignmentX(Box.CENTER_ALIGNMENT);
      visualizer = new Visualizer(defn);
      visBox.add(new ScrollPane(visualizer));
      panel.add(visBox);

      filler = Box.createHorizontalBox();
      filler.setPreferredSize(new Dimension(50, 10));
      panel.add(filler);

      symbolPanel = new SymbolPanel();
      panel.add(symbolPanel);
    }

    return panel;
  }
  /** Create buttons for choosing the spatial criteria and a panel for them */
  private JComponent createSpatialButtons() {
    // JLabel label = new JLabel( GUIMessages.SPATIAL_CRITERIA );
    // label.setBounds(LEFT_MARGIN + 2, 370,200,18);
    // add(label);

    noCritButton = new JRadioButton(I18N.getString("AttributeResearchPanel.none"));
    noCritButton.setActionCommand(WFSPanel.NONE);
    noCritButton.doClick();
    bboxCritButton = new JRadioButton(I18N.getString("AttributeResearchPanel.bbox"));
    bboxCritButton.setActionCommand(WFSPanel.BBOX);
    bboxCritButton.setBounds(10, 30, 200, STD_HEIGHT);
    selecGeoButton = new JRadioButton(I18N.getString("AttributeResearchPanel.selectedGeometry"));
    selecGeoButton.setActionCommand(WFSPanel.SELECTED_GEOM);

    ActionListener bal =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JRadioButton rb = (JRadioButton) e.getSource();
            spatialSearchCriteria = rb.getActionCommand();
          }
        };
    noCritButton.addActionListener(bal);
    bboxCritButton.addActionListener(bal);
    selecGeoButton.addActionListener(bal);

    ButtonGroup bg = new ButtonGroup();
    bg.add(noCritButton);
    bg.add(bboxCritButton);
    bg.add(selecGeoButton);

    Box b = Box.createVerticalBox();
    b.setAlignmentX(0.95f);
    b.setBorder(
        BorderFactory.createTitledBorder(I18N.getString("AttributeResearchPanel.spatialCriteria")));

    b.add(noCritButton);
    b.add(bboxCritButton);
    b.add(selecGeoButton);
    b.setPreferredSize(new Dimension(150, 100));

    return b;
  }
    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());
              }
            }
          });
    }
示例#4
0
    @SuppressWarnings("unchecked") // we must be compatible with 1.6
    public VersionManagementPanel(final VisualCanvas canvas) {

      super(canvas);

      setLayout(new GridLayout());

      // TODO @Christian Poliwoda what does manual testing mean?
      // numbers tested manually
      Dimension prefScrollPaneDim = new Dimension(100, 30);
      Dimension visibleRectDim = canvas.getVisibleRect().getSize();

      final VersionController controller =
          canvas.getProjectController().getProject().getProjectFile();

      final int numVersions = controller.getNumberOfVersions() - 1;

      versionData = new Object[numVersions];

      ArrayList<RevCommit> versions = new ArrayList<RevCommit>();

      try {
        versions = controller.getVersions();
      } catch (IOException ex) {
        Logger.getLogger(VersionManagementPanel.class.getName()).log(Level.SEVERE, null, ex);
      }

      int maxTextwidth = 0;
      String longestText = null;

      // the history with timestamp and a short commit message
      for (int i = 1; i < versions.size(); i++) {
        String text =
            // + Message.generateHTMLSpace(3)
            new Date(versions.get(i).getCommitTime() * 1000L)
                + ": "
                + versions.get(i).getShortMessage();

        // truncate texts that are too long
        int maxTextLength = 100;
        String dots = "...";

        int textLength = text.length() - dots.length();

        if (textLength > maxTextLength) {
          text = text.substring(0, maxTextLength) + dots;
        }

        versionData[versions.size() - i - 1] = new Version(text, i);

        if (text.length() > maxTextwidth) {
          maxTextwidth = text.length();
          longestText = text;
        }
      }

      resultModel = new DefaultListModel();

      // first init to show all if search not started yet
      for (int i = 0; i < versionData.length; i++) {
        resultModel.addElement(versionData[i]);
      }

      versionList = new JList(resultModel);

      // set the width of version managment window
      // dependent on largest git short message length
      double maxFontWidth =
          versionList
              .getFontMetrics(versionList.getFont())
              .getStringBounds(longestText, versionList.getGraphics())
              .getWidth();

      if (maxFontWidth <= visibleRectDim.width) {

        prefScrollPaneDim.width = (int) maxFontWidth;
      } else {

        if (visibleRectDim.width < 400) {
          prefScrollPaneDim.width = visibleRectDim.width;
        } else {
          prefScrollPaneDim.width = 400;
        }
      }

      versionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

      versionList.setOpaque(false);

      versionList.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      versionList.setBorder(new EmptyBorder(3, 3, 3, 3));

      Box upperTopBox = Box.createVerticalBox();

      // press the commits to top with VerticalGlue
      // contains search area at top and
      // search results at the botton
      Box upperOuterBox = Box.createVerticalBox();

      JButton searchButton = new JButton("search");
      searchButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
              searchAndAddToResultList();
            }
          });

      searchField = new JTextArea();

      // search area box
      Box upperBox1 = Box.createHorizontalBox();

      upperBox1.add(searchField);
      upperBox1.add(searchButton);

      Dimension fieldDim = new Dimension(Short.MAX_VALUE, searchField.getPreferredSize().height);
      searchField.setMaximumSize(fieldDim);

      searchField.addKeyListener(
          new KeyAdapter() {
            String tmp = "";

            @Override
            public void keyReleased(KeyEvent ke) {

              searchAndAddToResultList();
            }
          });

      //            upperOuterBox.add(upperBox1);
      upperTopBox.add(upperBox1);
      upperTopBox.add(upperOuterBox);

      // result area box
      Box upperBox2 = Box.createHorizontalBox();

      upperBox2.add(Box.createHorizontalGlue());
      upperBox2.add(versionList);
      upperBox2.add(Box.createHorizontalGlue());

      upperOuterBox.add(upperBox2);
      upperOuterBox.add(Box.createVerticalGlue());

      // added for optical reasons to force correct scrollbar position
      Box upperInnerBorderPane = Box.createHorizontalBox();
      upperInnerBorderPane.add(upperOuterBox);
      upperInnerBorderPane.setBorder(new EmptyBorder(5, 15, 5, 15));
      upperInnerBorderPane.setBackground(VSwingUtil.TRANSPARENT_COLOR);

      VScrollPane upperScrollPane = new VScrollPane(upperInnerBorderPane);
      upperScrollPane.setHorizontalScrollBarPolicy(VScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      upperScrollPane.setVerticalScrollBarPolicy(VScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      upperScrollPane.setMinimumSize(prefScrollPaneDim);

      JSplitPane splitPane = new VSplitPane(JSplitPane.VERTICAL_SPLIT);
      splitPane.setEnabled(true); // true = transparent
      splitPane.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      splitPane.setBorder(new EmptyBorder(5, 5, 5, 5));
      splitPane.setDividerLocation(0.5);

      upperTopBox.add(upperScrollPane);
      splitPane.add(upperTopBox); // add in the upper part

      htmlCommit.setBackground(VSwingUtil.TRANSPARENT_COLOR);
      htmlCommit.setContentType("text/html");
      htmlCommit.setOpaque(false);
      htmlCommit.setEditable(false);
      htmlCommit.setBorder(new EmptyBorder(0, 15, 0, 15));

      Box lowerBox = Box.createVerticalBox();
      lowerBox.setAlignmentX(Component.LEFT_ALIGNMENT);
      lowerBox.add(htmlCommit);
      lowerBox.add(Box.createVerticalGlue());

      VScrollPane lowerScrollPane = new VScrollPane(lowerBox);

      lowerScrollPane.setHorizontalScrollBarPolicy(VScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      lowerScrollPane.setVerticalScrollBarPolicy(VScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
      lowerScrollPane.setMinimumSize(new Dimension(0, 0));

      // add in the lower part
      splitPane.setBottomComponent(lowerScrollPane);

      add(splitPane);

      versionList.addMouseListener(
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

              // show commit message in lower part if clicked on a row
              // in upper part
              if (e.getClickCount() == 1) {

                final VersionController controller =
                    canvas.getProjectController().getProject().getProjectFile();

                final int numVersions = controller.getNumberOfVersions() - 1;

                ArrayList<RevCommit> versions = new ArrayList<RevCommit>();

                try {
                  versions = controller.getVersions();
                } catch (IOException ex) {
                  Logger.getLogger(VersionManagementPanel.class.getName())
                      .log(Level.SEVERE, null, ex);
                }

                int versionIndex = ((Version) versionList.getSelectedValue()).getVersion();

                htmlCommit.setText(
                    "<html>"
                        + "<pre> <font color=white><br>"
                        + "<b>SHA-1:</b> "
                        + versions.get(versionIndex).getName()
                        + "<br><br>"
                        + "<b>Message:</b><br><br>"
                        + versions.get(versionIndex).getFullMessage()
                        + "</pre></p>"
                        + "</html>");
                htmlCommit.setCaretPosition(0);
              }

              if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {

                if (((Version) versionList.getSelectedValue()).getVersion() < 2) {
                  VDialog.showMessageDialog(
                      canvas,
                      "Cannot Load Version",
                      "The first version in a project contains no"
                          + " sessions and cannot be loaded!");
                  return;
                }

                //                        if (VDialog.showConfirmDialog(canvas,
                //                                "Checkout Version:",
                //                                "<html><div align=Center>"
                //                                + "<p>Do you want to checkout the selected"
                //                                + " version?<p>"
                //                                + "<p><b>Unsaved changes will be lost!</b></p>"
                //                                + "</div></html>",
                //                                VDialog.DialogType.YES_NO) != VDialog.YES) {
                //                            return;
                //                        }

                int answer =
                    VDialog.showConfirmDialog(
                        canvas,
                        "Checkout Version:",
                        "<html><div align=Center>"
                            + "<p>Checking out selected version.<p><br>"
                            + "<p>Do you want to save the current session?</p><br>"
                            + "<p><b>Unsaved changes will be lost!</b></p>"
                            + "</div></html>",
                        new String[] {"Save", "Discard", "Cancel"});

                if (answer == 0) {
                  try {
                    canvas.getProjectController().saveProject(false);
                  } catch (IOException ex) {
                    Logger.getLogger(VersionManagement.class.getName()).log(Level.SEVERE, null, ex);

                    VDialog.showMessageDialog(
                        canvas,
                        "Cannot save Project:",
                        "<html><div align=Center>" + "Project cannot be saved!" + "</div></html>");
                  }
                } else if (answer == 1) {
                  // nothing to do
                } else if (answer == 2) {
                  return;
                }

                try {

                  int versionIndex = ((Version) versionList.getSelectedValue()).getVersion();

                  canvas.setActive(false);

                  String currentSessionName = canvas.getProjectController().getCurrentSession();

                  canvas.getProjectController().close(currentSessionName);

                  controller.checkoutVersion(versionIndex);

                  if (dialog != null) {
                    dialog.close();
                    dialog = null;
                  }

                  if (canvas
                      .getProjectController()
                      .getProject()
                      .getSessionFileByEntryName(currentSessionName)
                      .exists()) {
                    canvas.getProjectController().open(currentSessionName, false, true);
                  } else {
                    //                                VDialog.showMessageDialog(canvas,
                    //                                        "Cannot load \""
                    //                                        + currentSessionName
                    //                                        +"\":", "<html><div align=Center>"
                    //                                        + "<p>The Session "
                    //                                        + Message.EMPHASIZE_BEGIN
                    //                                        + currentSessionName
                    //                                         +  Message.EMPHASIZE_END
                    //                                        + " does not exist in the current"
                    //                                        + " version."
                    //                                        + "<p>The <b>Main</b>-Session will"
                    //                                        + "be loaded instead</div></html>");
                    canvas.getProjectController().open("Main", false, true);
                  }

                } catch (IOException ex) {
                  Logger.getLogger(VersionManagementPanel.class.getName())
                      .log(Level.SEVERE, null, ex);
                }
              }
            }
          });

      //            setMinimumSize(visibleRectDim);
      setMaximumSize(visibleRectDim);

      int width = getPreferredSize().width;
      setPreferredSize(new Dimension(width, (int) (visibleRectDim.height * 0.5)));
    } // end constructure
  public void doInit() {

    final InviteResponseMessageBox _this = this;

    if (!this.message.isDealtWith()) {

      // Show the response.
      this.responseBox = new Box(BoxLayout.Y_AXIS);

      this.add(this.responseBox);

      JComponent l =
          UIUtils.createBoldSubHeader(
              String.format(
                  "%s the invitation", (this.message.isAccepted() ? "Accepted" : "Rejected")),
              (this.message.isAccepted()
                  ? Constants.ACCEPTED_ICON_NAME
                  : Constants.REJECTED_ICON_NAME));

      this.responseBox.add(l);
      this.responseBox.setBorder(UIUtils.createPadding(5, 5, 0, 5));

      if (this.message.isAccepted()) {

        if ((this.message.getEditorName() != null) || (this.message.getEditorAvatar() != null)) {

          JTextPane desc =
              UIUtils.createHelpTextPane(
                  "Additionally they provided the following name/avatar.", this.projectViewer);

          this.responseBox.add(Box.createVerticalStrut(5));

          this.responseBox.add(desc);
          desc.setBorder(null);
          desc.setSize(new Dimension(UIUtils.getPopupWidth() - 20, desc.getPreferredSize().height));

          Box editorInfo = new Box(BoxLayout.X_AXIS);
          editorInfo.setAlignmentX(Component.LEFT_ALIGNMENT);
          editorInfo.setBorder(UIUtils.createPadding(5, 5, 5, 5));

          this.responseBox.add(editorInfo);

          if (this.message.getEditorAvatar() != null) {

            JLabel avatar = new JLabel();

            avatar.setAlignmentY(Component.TOP_ALIGNMENT);
            avatar.setVerticalAlignment(SwingConstants.TOP);

            editorInfo.add(avatar);
            avatar.setOpaque(false);

            avatar.setIcon(
                new ImageIcon(UIUtils.getScaledImage(_this.message.getEditorAvatar(), 50)));

            avatar.setBorder(
                new CompoundBorder(UIUtils.createPadding(0, 0, 0, 5), UIUtils.createLineBorder()));
          }

          if (this.message.getEditorName() != null) {

            JLabel name = new JLabel(this.message.getEditorName());
            editorInfo.add(name);

            name.setBorder(null);
            name.setAlignmentY(Component.TOP_ALIGNMENT);
            name.setVerticalAlignment(JLabel.TOP);
            name.setAlignmentX(Component.LEFT_ALIGNMENT);
            name.setFont(
                name.getFont()
                    .deriveFont((float) UIUtils.getScaledFontSize(14))
                    .deriveFont(java.awt.Font.PLAIN));
          }
        }
      }

      final EditorEditor ed = this.message.getEditor();

      JButton ok = new JButton("Ok, got it");

      ok.addActionListener(
          new ActionAdapter() {

            public void actionPerformed(ActionEvent ev) {

              try {

                if (_this.message.isAccepted()) {

                  ed.setEditorStatus(EditorEditor.EditorStatus.current);

                  if (_this.message.getEditorName() != null) {

                    ed.setName(_this.message.getEditorName());
                  }

                  if (_this.message.getEditorAvatar() != null) {

                    ed.setAvatar(_this.message.getEditorAvatar());
                  }

                  EditorsEnvironment.updateEditor(ed);

                  // Is this response for an invite message or just out of the blue from a web
                  // service invite?
                  if (!EditorsEnvironment.hasSentMessageOfTypeToEditor(
                      ed, InviteMessage.MESSAGE_TYPE)) {

                    EditorsEnvironment.sendUserInformationToEditor(ed, null, null, null);
                  }

                } else {

                  ed.setEditorStatus(EditorEditor.EditorStatus.rejected);

                  EditorsEnvironment.updateEditor(ed);
                }

                _this.message.setDealtWith(true);

                EditorsEnvironment.updateMessage(_this.message);

                _this.responseBox.setVisible(false);

              } catch (Exception e) {

                Environment.logError("Unable to update editor: " + ed, e);

                UIUtils.showErrorMessage(
                    _this.projectViewer,
                    "Unable to update {editor}, please contact Quoll Writer support for assitance.");

                return;
              }
            }
          });

      JButton[] buts = new JButton[] {ok};

      JPanel bb = UIUtils.createButtonBar2(buts, Component.LEFT_ALIGNMENT);
      bb.setOpaque(false);
      bb.setAlignmentX(Component.LEFT_ALIGNMENT);
      bb.setBorder(UIUtils.createPadding(5, 0, 0, 0));

      this.responseBox.add(bb);

      return;
    }

    boolean accepted = this.message.isAccepted();
    String iconName = (accepted ? Constants.ACCEPTED_ICON_NAME : Constants.REJECTED_ICON_NAME);

    String message = "Accepted invitation to be {an editor}";

    if (!accepted) {

      message = "Rejected invitation to be {an editor}";
    }

    JComponent h = UIUtils.createBoldSubHeader(message, iconName);

    this.add(h);
  }
示例#6
0
  private void initComponents() {
    final TitledBorder border = BorderFactory.createTitledBorder(label);
    final Font titleFont = border.getTitleFont();
    if (titleFont != null) {
      border.setTitleFont(titleFont.deriveFont(Font.BOLD));
    }
    setBorder(border);

    jtext = new JTextField();
    // jtext.setText(defalt.getFile().getPath());
    jRelativneKProgramu = new JCheckBox("Relativně k umístění programu");
    jRelativneKProgramu.setEnabled(FConst.JAR_DIR_EXISTUJE);
    jActive = new JCheckBox("Aktivní");
    jActive.setEnabled(lzeDeaktivovat);
    jCurrVal = new JTextField();
    jCurrVal.setForeground(Color.BLUE);
    jCurrVal.setEditable(false);
    jCurrVal.setBorder(null);
    final JButton jbut = new JButton("...");
    // jtext.setText(defalt.getFile().getPath());
    jtext.setColumns(50);
    if (editovatelne) {
      final Box box2 = Box.createHorizontalBox();
      box2.setAlignmentX(LEFT_ALIGNMENT);
      box2.add(jtext);
      box2.add(jbut);
      final Box panel3 = Box.createHorizontalBox();
      if (FConst.JAR_DIR_EXISTUJE) {
        panel3.add(jRelativneKProgramu);
      }
      if (jActive.isEnabled()) {
        panel3.add(jActive);
      }
      if (panel3.getComponentCount() > 0) {
        add(panel3);
      }
      panel3.setAlignmentX(LEFT_ALIGNMENT);
      add(box2);
    }
    // panel.add(Box.createVerticalStrut(20));
    jCurrVal.setAlignmentX(LEFT_ALIGNMENT);
    add(jCurrVal);
    // add(panel);
    // add(Box.createVerticalStrut(20));
    jbut.addActionListener(
        new ActionListener() {
          private JFileChooser fc;

          @Override
          public void actionPerformed(final ActionEvent ae) {
            if (fc == null) { // dlouho to trvá, tak vytvoříme vždy nový
              fc = new JFileChooser();
            }
            fc.setCurrentDirectory(new File(jtext.getText()));
            if (jenAdresare) {
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            }
            final int result = fc.showDialog(JJedenSouborPanel.this, "Vybrat");
            if (result == JFileChooser.APPROVE_OPTION) {
              jtext.setText(fc.getSelectedFile().getPath());
            }
          }
        });

    prepocitej();
    jtext.getDocument().addDocumentListener(this);

    jRelativneKProgramu.addActionListener(e -> prepocitej());
    jActive.addActionListener(e -> prepocitej());
  }
示例#7
0
  private void createComponents() {

    Box box0 = Box.createVerticalBox();
    Box box1 = Box.createVerticalBox();
    Box box2 = Box.createVerticalBox();
    Box box3 = Box.createHorizontalBox();
    Box box4 = Box.createVerticalBox();
    Box box5 = Box.createHorizontalBox();

    lMonitor = new JLabel(rb.getString("lbl_folder"));
    // lMonitor.setAlignmentX(Component.CENTER_ALIGNMENT);
    // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    lClearFolder = new JLabel(rb.getString("lbl_clear_folder"));
    lTimer = new JLabel(rb.getString("lbl_timer"));

    jTxtFolderMonitorName = new JTextField(props.getProperty(Property.MONITORFOLDER), 20);
    jTxtFolderMonitorName.addActionListener(new MyActionListener(ComponentID.TXTF_FOLDER));
    jTxtFolderMonitorName.addKeyListener(new MyKeyListener());
    jTxtFolderMonitorName.addFocusListener(new MyFocusListener(ComponentID.TXTF_FOLDER));

    jTxtTimer = new JTextField(props.getProperty(Property.TIMER), 20);
    jTxtTimer.addActionListener(new MyActionListener(ComponentID.TXTF_TIMER));
    jTxtTimer.addKeyListener(new MyKeyListener());
    jTxtTimer.addFocusListener(new MyFocusListener(ComponentID.TXTF_TIMER));

    JCheckBox jCBClearFolder = new JCheckBox();
    jCBClearFolder.addActionListener(new MyActionListener(ComponentID.CHK_CLEAR_FOLDER));
    jCBClearFolder.addKeyListener(new MyKeyListener());

    buttonPanel = new JPanel();
    buttonPanel.setBorder(new TitledBorder(new EtchedBorder(), rb.getString("brd_monitor_button")));

    jbnStop = new JButton(rb.getString("b_stop"));
    jbnStop.setMnemonic(KeyEvent.VK_P);
    jbnStart = new JButton(rb.getString("b_start"));
    jbnStart.setMnemonic(KeyEvent.VK_S);

    buttonPanel.add(jbnStart);
    buttonPanel.add(jbnStop);

    jbnStop.addActionListener(new MyActionListener(ComponentID.B_STOP));
    jbnStop.addKeyListener(new MyKeyListener());
    jbnStart.addActionListener(new MyActionListener(ComponentID.B_START));
    jbnStart.addKeyListener(new MyKeyListener());

    box0.add(lMonitor);
    box0.add(Box.createVerticalStrut(10));
    box0.add(lClearFolder);
    box0.add(Box.createVerticalStrut(10));
    box0.add(lTimer);

    box1.add(jTxtFolderMonitorName);
    box1.setAlignmentX(LEFT_ALIGNMENT);
    box1.add(jCBClearFolder);
    box1.add(jTxtTimer);
    //		box1.setBorder(new BevelBorder(BevelBorder.LOWERED));

    box3.add(box0);
    box3.add(Box.createHorizontalStrut(10));
    box3.add(box1);
    //		box3.add(box2);

    //		box4.add(box3);
    //		box4.setBorder(new BevelBorder(BevelBorder.LOWERED));
    //		box4.add(box1);
    box5.add(box3);
    box5.add(Box.createHorizontalStrut(10));
    //		box5.setBorder(new BevelBorder(BevelBorder.LOWERED));
    box5.add(buttonPanel);
    container.add(box5);

    ControlWindowMenuBar cwm = new ControlWindowMenuBar();
    Property.getInstance().addPropertyChangeListener(Property.RESOURCEBUNDLE, cwm);
    Property.getInstance().addPropertyChangeListener(Property.RESOURCEBUNDLE, new MyKeyListener());

    setJMenuBar(cwm);
  }
  public DisplayDetailsPanel(int dn) {

    setBackground(varsOrange);
    JLabel stimJL = new JLabel("Stimulus" + dn + ":", JLabel.RIGHT);
    stimJL.setFont(f12b);
    String[] stims = {"word", "picture", "sound", "video", "blank"};
    stimtypeJCB = new JComboBox(stims);
    stimtypeJCB.setSelectedIndex(0);

    stimJTF = new JTextField("", 10);
    stimJTF.setMaximumSize(new Dimension(stimJTF.getPreferredSize()));

    String[] locs = {"center", "random", "position"};
    stimlocJCB = new JComboBox(locs);
    stimlocJCB.setSelectedIndex(0);

    JLabel xJL = new JLabel("x:  ", JLabel.RIGHT);
    xJL.setFont(f12b);
    xJTF = new JTextField("", 3);
    xJTF.setMaximumSize(new Dimension(xJTF.getPreferredSize()));
    xJTF.setEditable(false);
    JLabel yJL = new JLabel("y:  ", JLabel.RIGHT);
    yJL.setFont(f12b);
    yJTF = new JTextField("", 3);
    yJTF.setMaximumSize(new Dimension(yJTF.getPreferredSize()));
    yJTF.setEditable(false);
    AbstractAction stimlocJCBaction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent ae) {
            if (stimlocJCB.getSelectedIndex() == 2) {
              xJTF.setEditable(true);
              yJTF.setEditable(true);
            } else {
              xJTF.setText("");
              yJTF.setText("");
              xJTF.setEditable(false);
              yJTF.setEditable(false);
            }
          }
        };
    stimlocJCB.addActionListener(stimlocJCBaction);

    JLabel durJL = new JLabel("Duration(sec):", JLabel.RIGHT);
    durJTF = new JTextField("", 3);
    durJTF.setMaximumSize(new Dimension(durJTF.getPreferredSize()));
    AbstractAction stimtypeJCBaction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent ae) {
            if (stimtypeJCB.getSelectedIndex() == 3) {
              stimJTF.setText("");
              stimJTF.setEditable(false);
              stimlocJCB.setEnabled(false);
              xJTF.setText("");
              xJTF.setEditable(false);
              yJTF.setText("");
              yJTF.setEditable(false);
              durJTF.setEditable(true);
            } else {
              if (stimtypeJCB.getSelectedIndex() == 2) {
                stimJTF.setEditable(true);
                stimlocJCB.setEnabled(false);
                xJTF.setText("");
                xJTF.setEditable(false);
                yJTF.setText("");
                yJTF.setEditable(false);
                durJTF.setText("");
                durJTF.setEditable(false);
              } else {
                stimJTF.setEditable(true);
                stimlocJCB.setEnabled(true);
                durJTF.setEditable(true);
              }
            }
          }
        };
    stimtypeJCB.addActionListener(stimtypeJCBaction);

    ddhbox = Box.createHorizontalBox();
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(stimtypeJCB);
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(stimJTF);
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(stimlocJCB);
    ddhbox.add(Box.createHorizontalStrut(5));
    ddhbox.add(xJL);
    ddhbox.add(xJTF);
    ddhbox.add(Box.createHorizontalStrut(5));
    ddhbox.add(yJL);
    ddhbox.add(yJTF);
    ddhbox.add(Box.createHorizontalStrut(10));
    ddhbox.add(durJL);
    ddhbox.add(durJTF);

    ddvbox = Box.createVerticalBox();
    ddvbox.add(stimJL);
    stimJL.setAlignmentX(Component.LEFT_ALIGNMENT);
    ddvbox.add(Box.createVerticalStrut(5));
    ddvbox.add(ddhbox);
    ddhbox.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(ddvbox);
  }
 /**
  * Construct a dialog for setting the eye 3D view options.
  *
  * @param view A view whose display will be the parent of the dialog. This view is redrawn (if it
  *     is showing a stereo view) to show the new eye separation, and anaglyph is turned on or off
  *     if the setting of apply anaglyph is never or always.
  */
 private Set3DViewOptionsDialog(View3D view) {
   super(view.getDisplay(), I18n.tr("vmm.core3D.commands.SetEyeSep"));
   this.view = view;
   originalVal = Prefs.getDouble("eyeSeparationMultiplier", 1);
   multiplier = new RealParam(I18n.tr("vmm.core3D.SetEyeSepDialog.EyeSep"), originalVal);
   multiplier.setDefaultValue(1);
   multiplier.setMinimumValueForInput(0.1);
   multiplier.setMaximumValueForInput(10);
   input = new ParameterInput(multiplier);
   input.setColumns(5);
   Box inputPanel = Box.createVerticalBox();
   inputPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
   Box eyeSepInput = Box.createVerticalBox();
   Box viewModeInput = Box.createVerticalBox();
   Box anaglyphPositioningInput = Box.createVerticalBox();
   eyeSepInput.setAlignmentX(0);
   viewModeInput.setAlignmentX(0);
   inputPanel.add(eyeSepInput);
   inputPanel.add(Box.createVerticalStrut(12));
   inputPanel.add(viewModeInput);
   inputPanel.add(Box.createVerticalStrut(12));
   inputPanel.add(anaglyphPositioningInput);
   eyeSepInput.setBorder(
       BorderFactory.createCompoundBorder(
           BorderFactory.createTitledBorder(
               I18n.tr("vmm.core3D.Set3DViewOptionsDialog.SetEyeSepMul")),
           BorderFactory.createEmptyBorder(8, 8, 8, 8)));
   viewModeInput.setBorder(
       BorderFactory.createCompoundBorder(
           BorderFactory.createTitledBorder(
               I18n.tr("vmm.core3D.Set3DViewOptionsDialog.SetViewModePref")),
           BorderFactory.createEmptyBorder(8, 8, 8, 8)));
   anaglyphPositioningInput.setBorder(
       BorderFactory.createCompoundBorder(
           BorderFactory.createTitledBorder(
               I18n.tr("vmm.core3D.Set3DViewOptionsDialog.SetAnaglyphObjectPosition")),
           BorderFactory.createEmptyBorder(8, 8, 8, 8)));
   JLabel labl = new JLabel(I18n.tr("vmm.core3D.Set3DViewOptionsDialog.EyeSep.info"));
   labl.setAlignmentX(0);
   eyeSepInput.add(labl);
   viewModeInput.add(Box.createVerticalStrut(18));
   JPanel temp = new JPanel();
   labl = new JLabel(I18n.tr("vmm.core3D.Set3DViewOptionsDialog.EyeSepMul") + " = ");
   labl.setAlignmentX(0);
   temp.add(labl);
   eyeSepInput.add(temp);
   temp.add(input);
   temp.setAlignmentX(0);
   originalAnaglyph = Prefs.get("view3d.initialAnaglyphMode", "default");
   alwaysAnaglyphButton = new JRadioButton(I18n.tr("vmm.core3D.SetAnaglyphDefaultMode.always"));
   neverAnaglyphButton = new JRadioButton(I18n.tr("vmm.core3D.SetAnaglyphDefaultMode.never"));
   defaultAnaglyphButton = new JRadioButton(I18n.tr("vmm.core3D.SetAnaglyphDefaultMode.default"));
   ButtonGroup group = new ButtonGroup();
   group.add(alwaysAnaglyphButton);
   group.add(neverAnaglyphButton);
   group.add(defaultAnaglyphButton);
   if (originalAnaglyph.equalsIgnoreCase("always")) alwaysAnaglyphButton.setSelected(true);
   else if (originalAnaglyph.equalsIgnoreCase("never")) neverAnaglyphButton.setSelected(true);
   else defaultAnaglyphButton.setSelected(true);
   labl = new JLabel(I18n.tr("vmm.core3D.Set3DViewOptionsDialog.AnaglyphPref.info"));
   viewModeInput.add(labl);
   viewModeInput.add(Box.createVerticalStrut(12));
   viewModeInput.add(defaultAnaglyphButton);
   viewModeInput.add(alwaysAnaglyphButton);
   viewModeInput.add(neverAnaglyphButton);
   moveObjectsForwardInAnaglyphToggle =
       new JCheckBox(I18n.tr("vmm.core3D.Set3DViewOptionsDialog.AnaglyphPositionOption"));
   originalMoveObjectsForwardInAnaglyph =
       "yes".equals(Prefs.get("view3d.moveObjectsForwardInAnaglyph"));
   moveObjectsForwardInAnaglyphToggle.setSelected(originalMoveObjectsForwardInAnaglyph);
   anaglyphPositioningInput.add(Box.createVerticalStrut(2));
   anaglyphPositioningInput.add(moveObjectsForwardInAnaglyphToggle);
   addInfoLabel(I18n.tr("vmm.core3D.Set3DViewOptionsDialog.info"));
   addInputPanel(inputPanel);
 }
示例#10
0
  /**
   * The main method that runs when the program is launched.
   *
   * @param args command line arguments. Unused.
   */
  public static void main(String[] args) {
    // Sets up the Font used for title
    try {
      titleFont = Font.createFont(Font.TRUETYPE_FONT, new File("EXPLETUSSANS-BOLD.ttf"));
    } catch (FontFormatException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
    titleFont = titleFont.deriveFont(Font.BOLD, 28f);

    // Creates main window and icon
    frame = new JFrame("quickCheck");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setResizable(false);
    ImageIcon frameIcon = new ImageIcon(QuickCheck.class.getResource("/logo.png"));
    frame.setIconImage(frameIcon.getImage());

    /*Required to instantiate an inner class*/
    QuickCheck thisProgram = new QuickCheck();

    // Sets up upper panel
    JPanel upperPanel = new JPanel();
    upperPanel.setBackground(TOP_COLOR);
    upperPanel.setPreferredSize(new Dimension(WINDOW_WIDTH, 44));
    upperPanel.add(upperLabel);
    QuickCheck.ContentFrame lowerPanel = thisProgram.new ContentFrame();

    // Sets up title bar (upperPanel) and actual content pane (lowerPanel)
    frame.getContentPane().add(upperPanel, "North");
    frame.getContentPane().add(lowerPanel, "South");

    // Sets up font of title bar
    upperLabel.setFont(titleFont);

    // Creates the scroll bar for the text on the left
    JScrollPane textScrollHolder = new JScrollPane(text);
    textScrollHolder.setBorder(BorderFactory.createEmptyBorder());

    // Creates the text field on the left side
    text.setCaretPosition(0);
    lowerPanel.getLeft().add(textScrollHolder);
    text.setLineWrap(true);
    text.setWrapStyleWord(true);

    // Adds text field errorsListener
    QuickCheck.TypeListener lstn = thisProgram.new TypeListener();
    text.getDocument().addDocumentListener(lstn);

    // Creates upper-right panel
    JPanel rightNestedUpper = new JPanel();
    rightNestedUpper.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 20));
    rightNestedUpper.setBackground(RIGHT_COLOR);

    // Creates lower-right panel
    JPanel rightNestedLower = new JPanel();
    rightNestedLower.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 20));
    rightNestedLower.setBackground(RIGHT_COLOR);

    BorderLayout rightLayout = new BorderLayout();
    lowerPanel.getRight().setLayout(rightLayout);
    lowerPanel.getRight().add(rightNestedUpper);

    // Creates middle-right panel
    JPanel rightNestedInner = new JPanel();
    BoxLayout rightNestedInnerLayout = new BoxLayout(rightNestedInner, BoxLayout.Y_AXIS);
    rightNestedInner.setLayout(rightNestedInnerLayout);

    // Adds middle-right panel to right side, then error text to it.
    lowerPanel.getRight().add(rightNestedInner, BorderLayout.CENTER);

    /*Error Word List Label Setup */

    // Creates Error JLabel and sets up its font
    Font errorFont = titleFont.deriveFont(Font.BOLD, 22f);
    JLabel errorLabel = new JLabel("Errors");
    errorLabel.setFont(errorFont);

    // Creates wrapper to center JLabel
    JPanel errorLabelPanel = new JPanel();
    errorLabelPanel.add(errorLabel);
    Box box = new Box(BoxLayout.Y_AXIS);
    box.setAlignmentX(Component.CENTER_ALIGNMENT);
    box.add(Box.createVerticalGlue());
    box.add(errorLabelPanel);
    box.add(Box.createVerticalGlue());

    // Adds first the JLabel wrapper, then the JLabel
    lowerPanel.getRight().add(box, BorderLayout.NORTH);
    box.add(errorLabelPanel);

    /*Error Word List Setup*/

    // Error words List creation
    errorsList = new JList<String>(errListModel);
    errorsList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    errorsList.setLayoutOrientation(JList.VERTICAL);
    errorsList.setVisibleRowCount(10);
    errorsList.setFixedCellHeight(15);
    errorsList.setFixedCellWidth(100);

    // Error words List scroll bar
    JScrollPane errorsListScroller = new JScrollPane(errorsList);
    errorsListScroller.setPreferredSize(new Dimension(250, 80));
    errorsListScroller.setBorder(BorderFactory.createEmptyBorder());

    // Adding both the List and the Scroll bar to the right inner panel
    rightNestedInner.add(errorsListScroller);

    /*Correction Word List Label Setup */

    // Creates Correction JLabel and sets up its font
    Font correctionFont = titleFont.deriveFont(Font.BOLD, 22f);
    JLabel correctionLabel = new JLabel("Corrections");
    correctionLabel.setFont(correctionFont);

    // Creates wrapper to center JLabel
    JPanel correctionLabelPanel = new JPanel();
    correctionLabelPanel.add(correctionLabel);
    Box box2 = new Box(BoxLayout.Y_AXIS);
    box2.setAlignmentX(Component.CENTER_ALIGNMENT);
    box2.add(Box.createVerticalGlue());
    box2.add(correctionLabelPanel);
    box2.add(Box.createVerticalGlue());

    // Adds first the JLabel wrapper, then the JLabel
    rightNestedLower.add(box2);
    box2.add(correctionLabelPanel);

    /*Correction Word List Setup*/

    // Correction words List creation
    correctionsList = new JList<String>(correctionsListModel);
    correctionsList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    correctionsList.setLayoutOrientation(JList.VERTICAL);
    correctionsList.setVisibleRowCount(10);
    correctionsList.setFixedCellHeight(15);
    correctionsList.setFixedCellWidth(100);

    // Error words List scroll bar
    JScrollPane correctionsListScroller = new JScrollPane(correctionsList);
    correctionsListScroller.setPreferredSize(new Dimension(250, 80));
    correctionsListScroller.setBorder(BorderFactory.createEmptyBorder());

    // Creates wrapper JPanel for both corrections title and contents
    JPanel correctionsWrapper = new JPanel();
    BoxLayout correctionsWrapperLayout = new BoxLayout(correctionsWrapper, BoxLayout.Y_AXIS);
    correctionsWrapper.setLayout(correctionsWrapperLayout);
    correctionsWrapper.add(correctionLabelPanel);
    correctionsWrapper.add(correctionsListScroller);

    JPanel buttonHolder = new JPanel();
    BoxLayout buttonHolderLayout = new BoxLayout(buttonHolder, BoxLayout.Y_AXIS);
    buttonHolder.setLayout(buttonHolderLayout);
    correctionsWrapper.add(buttonHolder);

    // Creates wrapper to center JLabel
    JPanel btnHold1 = new JPanel();
    btnHold1.setBackground(RIGHT_COLOR);
    JPanel btnHold2 = new JPanel();
    btnHold2.setBackground(RIGHT_COLOR);
    JPanel btnHold3 = new JPanel();
    btnHold3.setBackground(RIGHT_COLOR);
    Box box3 = new Box(BoxLayout.Y_AXIS);
    box3.setAlignmentX(Component.CENTER_ALIGNMENT);
    box3.add(btnHold1);
    box3.add(Box.createVerticalGlue());
    box3.add(btnHold2);
    box3.add(Box.createVerticalGlue());
    box3.add(btnHold3);
    box3.add(Box.createVerticalGlue());

    // Adding both the List and the Scroll bar to the right inner panel
    rightNestedLower.add(correctionsWrapper);

    // Sets colors for panels
    rightNestedInner.setBackground(RIGHT_COLOR);
    errorLabelPanel.setBackground(RIGHT_COLOR);
    correctionLabelPanel.setBackground(RIGHT_COLOR);

    // Adds lower-right panel
    lowerPanel.getRight().add(rightNestedLower, BorderLayout.SOUTH);
    rightNestedLower.setPreferredSize(new Dimension(300, 350));
    rightNestedInner.setMaximumSize(new Dimension(300, 0));
    rightNestedUpper.setPreferredSize(new Dimension(300, 0));
    lowerPanel.getLeft().setMaximumSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));

    // errorsList listeners and setup
    errorsList.addListSelectionListener(selectClickListener);
    errorsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ImageIcon corBtnIcon = new ImageIcon(QuickCheck.class.getResource("/bt1def.png"));
    ImageIcon corAllBtnIcon = new ImageIcon(QuickCheck.class.getResource("/bt2def.png"));
    ImageIcon ignoreBtnIcon = new ImageIcon(QuickCheck.class.getResource("/bt3def.png"));

    b1 = new JButton("", corBtnIcon);
    b2 = new JButton("", corAllBtnIcon);
    b3 = new JButton("", ignoreBtnIcon);
    b1.setActionCommand("disable");
    b1.setBorderPainted(false);
    b1.setFocusPainted(false);
    b1.setContentAreaFilled(false);
    b2.setActionCommand("disable");
    b2.setBorderPainted(false);
    b2.setFocusPainted(false);
    b2.setContentAreaFilled(false);
    b3.setActionCommand("disable");
    b3.setBorderPainted(false);
    b3.setFocusPainted(false);
    b3.setContentAreaFilled(false);

    // QuickCheck.btnListener listen = thisProgram.new btnListener(b1);
    // b1.addActionListener(listen);
    // b1.setPreferredSize(new Dimension(100,50));
    // b2.setPreferredSize(new Dimension(100,50));
    // b3.setPreferredSize(new Dimension(100,50));

    buttonHolder.add(box3);
    btnHold1.add(b1);
    btnHold2.add(b2);
    btnHold3.add(b3);

    CorrBtnListener mouseListen = thisProgram.new CorrBtnListener();
    b1.addMouseListener(mouseListen);

    CorrAllBtnListener corAllListen = thisProgram.new CorrAllBtnListener();
    b2.addMouseListener(corAllListen);

    IgnoreBtnListener ignoreListen = thisProgram.new IgnoreBtnListener();
    b3.addMouseListener(ignoreListen);

    frame.pack();
    frame.setVisible(true);
  }
 @Override
 protected JPanel createContent() {
   JPanel mainPanel = new JPanel();
   Box b1 = Box.createVerticalBox();
   InputStream connectionResource =
       getClass().getClassLoader().getResourceAsStream("connection_local.xml");
   try {
     Box horizontalTopBox = Box.createHorizontalBox();
     horizontalTopBox.setAlignmentX(CENTER_ALIGNMENT);
     AFSwinxForm chooseCountry =
         AFSwinx.getInstance()
             .getFormBuilder()
             .initBuilder(COUNTRY_FORM, connectionResource, COUNTRY_CONNECTION)
             .setLocalization(ApplicationContext.getInstance().getLocalization())
             .setSkin(new MySkin())
             .buildComponent();
     chooseCountryButton = new JButton(Localization.getLocalizationText("button.choose"));
     horizontalTopBox.add(chooseCountry);
     horizontalTopBox.add(Box.createHorizontalStrut(10));
     horizontalTopBox.add(chooseCountryButton);
     horizontalTopBox.add(Box.createHorizontalStrut(130));
     b1.add(horizontalTopBox);
   } catch (AFSwinxBuildException e) {
     getDialogs()
         .failed("afswinx.build.title.failed", "afswinx.build.text.failed", e.getMessage());
   }
   if (isDisplayAdditionalsField()) {
     try {
       connectionResource =
           getClass().getClassLoader().getResourceAsStream("connection_local.xml");
       HashMap<String, String> parameters = new HashMap<String, String>();
       parameters.put("id", String.valueOf(selectedCountry));
       AFSwinxTable table =
           AFSwinx.getInstance()
               .getTableBuilder()
               .initBuilder(
                   ABSENCE_TYPE_TABLE,
                   connectionResource,
                   ABSENCY_TYPE_TABLE_CONNECTION,
                   parameters)
               .setLocalization(ApplicationContext.getInstance().getLocalization())
               .buildComponent();
       Box centerPanel = Box.createVerticalBox();
       centerPanel.setAlignmentX(CENTER_ALIGNMENT);
       HashMap<String, String> securityConstrains =
           ApplicationContext.getInstance().getSecurityContext().getUserNameAndPasswodr();
       securityConstrains.put("id", String.valueOf(selectedCountry));
       connectionResource = getClass().getClassLoader().getResourceAsStream("connection.xml");
       AFSwinxForm form =
           AFSwinx.getInstance()
               .getFormBuilder()
               .initBuilder(
                   ABSENCY_TYPE_FORM,
                   connectionResource,
                   ABSENCY_TYPE_FORM_CONNECTION,
                   securityConstrains)
               .setLocalization(ApplicationContext.getInstance().getLocalization())
               .setSkin(new MySkin())
               .buildComponent();
       centerPanel.add(form);
       performButton =
           new JButton(Localization.getLocalizationText("avaiableCountryView.buttton.add"));
       performButton.setAlignmentX(CENTER_ALIGNMENT);
       formResetButton = new JButton(Localization.getLocalizationText("button.reset"));
       formResetButton.setAlignmentX(CENTER_ALIGNMENT);
       Box buttonBox = Box.createHorizontalBox();
       buttonBox.add(performButton);
       buttonBox.add(Box.createHorizontalStrut(60));
       buttonBox.add(formResetButton);
       centerPanel.add(Box.createVerticalStrut(20));
       centerPanel.add(buttonBox);
       chooseButton =
           new JButton(Localization.getLocalizationText("avaiableCountryView.buttton.choose"));
       chooseButton.setAlignmentX(RIGHT_ALIGNMENT);
       Box centerBox = Box.createHorizontalBox();
       centerBox.add(Box.createHorizontalStrut(100));
       centerBox.add(centerPanel);
       centerBox.add(Box.createHorizontalStrut(100));
       b1.add(table);
       b1.add(chooseButton);
       b1.add(Box.createVerticalStrut(40));
       b1.add(centerBox);
       b1.add(Box.createVerticalStrut(40));
     } catch (AFSwinxBuildException e) {
       getDialogs()
           .failed("afswinx.build.title.failed", "afswinx.build.text.failed", e.getMessage());
       b1.add(Box.createVerticalStrut(400));
     }
   } else {
     b1.add(Box.createVerticalStrut(400));
   }
   mainPanel.add(b1);
   mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
   return mainPanel;
 }
示例#12
0
  ConfPassFrame(OpenProjFrame f, final int index) {
    setTitle("Enter project password...");
    cpf = this;
    opf = f;
    Toolkit kit = Toolkit.getDefaultToolkit();
    Dimension screen = kit.getScreenSize();
    scr_w = screen.width;
    scr_h = screen.height;
    this.setLocation(scr_w / 2 - 150, scr_h / 2 - 100);
    setTitle("Login...");
    setSize(300, 100);

    pass = new JLabel("Password");
    passTextField = new JTextField(13);
    passTextField.setMaximumSize(passTextField.getPreferredSize());
    passTextField.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_ENTER) Ok(index, passTextField.getText());
          }

          public void keyReleased(KeyEvent arg0) {}

          public void keyTyped(KeyEvent arg0) {}
        });
    hbox1 = Box.createHorizontalBox();
    hbox1.add(Box.createHorizontalStrut(20));
    hbox1.add(pass);
    hbox1.add(Box.createHorizontalStrut(29));
    hbox1.add(passTextField);
    hbox1.setAlignmentX(Component.LEFT_ALIGNMENT);

    buttonOk = new JButton("Ok");
    buttonOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Ok(index, passTextField.getText());
          }
        });
    buttonOk.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_ENTER) Ok(index, passTextField.getText());
          }

          public void keyReleased(KeyEvent arg0) {}

          public void keyTyped(KeyEvent arg0) {}
        });
    buttonCancel = new JButton("Cancel");
    buttonCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            cpf.dispose();
          }
        });
    buttonCancel.addKeyListener(
        new KeyListener() {
          public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_ENTER) cpf.dispose();
          }

          public void keyReleased(KeyEvent arg0) {}

          public void keyTyped(KeyEvent arg0) {}
        });
    hbox2 = Box.createHorizontalBox();
    hbox2.add(Box.createHorizontalStrut(30));
    hbox2.add(buttonOk);
    hbox2.add(Box.createHorizontalStrut(10));
    hbox2.add(buttonCancel);
    hbox2.setAlignmentX(Component.LEFT_ALIGNMENT);

    vbox = Box.createVerticalBox();
    vbox.add(hbox1);
    vbox.add(hbox2);

    contentPane = getContentPane();
    contentPane.add(vbox, BorderLayout.CENTER);
    this.setResizable(false);
  }
  public ReactionColumnNameInterface(final Connection con, ArrayList<String> columnNamesFromFile)
      throws SQLException {

    final ArrayList<Image> icons = new ArrayList<Image>();
    icons.add(new ImageIcon("etc/most16.jpg").getImage());
    icons.add(new ImageIcon("etc/most32.jpg").getImage());

    LocalConfig.getInstance().setProgress(0);
    progressBar.pack();
    progressBar.setIconImages(icons);
    progressBar.setSize(200, 70);
    progressBar.setTitle("Loading...");
    progressBar.setVisible(false);

    setColumnNamesFromFile(columnNamesFromFile);

    setTitle(ColumnInterfaceConstants.REACTIONS_COLUMN_NAME_INTERFACE_TITLE);
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

    cbKnockout.setEditable(true);
    cbFluxValue.setEditable(true);
    cbReactionAbbreviation.setEditable(true);
    cbReactionName.setEditable(true);
    cbReactionEquation.setEditable(true);
    cbReversible.setEditable(true);
    cbLowerBound.setEditable(true);
    cbUpperBound.setEditable(true);
    cbObjective.setEditable(true);

    cbKnockout.setPreferredSize(new Dimension(250, 30));
    cbKnockout.setMaximumSize(new Dimension(250, 30));
    cbKnockout.setMinimumSize(new Dimension(250, 30));

    cbFluxValue.setPreferredSize(new Dimension(250, 30));
    cbFluxValue.setMaximumSize(new Dimension(250, 30));
    cbFluxValue.setMinimumSize(new Dimension(250, 30));

    cbReactionAbbreviation.setPreferredSize(new Dimension(250, 30));
    cbReactionAbbreviation.setMaximumSize(new Dimension(250, 30));
    cbReactionAbbreviation.setMinimumSize(new Dimension(250, 30));

    cbReactionName.setPreferredSize(new Dimension(250, 30));
    cbReactionName.setMaximumSize(new Dimension(250, 30));
    cbReactionName.setMinimumSize(new Dimension(250, 30));

    cbReactionEquation.setPreferredSize(new Dimension(250, 30));
    cbReactionEquation.setMaximumSize(new Dimension(250, 30));
    cbReactionEquation.setMinimumSize(new Dimension(250, 30));

    cbReversible.setPreferredSize(new Dimension(250, 30));
    cbReversible.setMaximumSize(new Dimension(250, 30));
    cbReversible.setMinimumSize(new Dimension(250, 30));

    cbLowerBound.setPreferredSize(new Dimension(250, 30));
    cbLowerBound.setMaximumSize(new Dimension(250, 30));
    cbLowerBound.setMinimumSize(new Dimension(250, 30));

    cbUpperBound.setPreferredSize(new Dimension(250, 30));
    cbUpperBound.setMaximumSize(new Dimension(250, 30));
    cbUpperBound.setMinimumSize(new Dimension(250, 30));

    cbObjective.setPreferredSize(new Dimension(250, 30));
    cbObjective.setMaximumSize(new Dimension(250, 30));
    cbObjective.setMinimumSize(new Dimension(250, 30));

    JTextField fieldKnockout = (JTextField) cbKnockout.getEditor().getEditorComponent();
    fieldKnockout.addKeyListener(new ComboKeyHandler(cbKnockout));

    JTextField fieldFluxValue = (JTextField) cbFluxValue.getEditor().getEditorComponent();
    fieldFluxValue.addKeyListener(new ComboKeyHandler(cbFluxValue));

    JTextField fieldReactionAbbreviation =
        (JTextField) cbReactionAbbreviation.getEditor().getEditorComponent();
    fieldReactionAbbreviation.addKeyListener(new ComboKeyHandler(cbReactionAbbreviation));

    JTextField fieldReactionName = (JTextField) cbReactionName.getEditor().getEditorComponent();
    fieldReactionName.addKeyListener(new ComboKeyHandler(cbReactionName));

    JTextField fieldReactionEquation =
        (JTextField) cbReactionEquation.getEditor().getEditorComponent();
    fieldReactionEquation.addKeyListener(new ComboKeyHandler(cbReactionEquation));

    JTextField fieldReversible = (JTextField) cbReversible.getEditor().getEditorComponent();
    fieldReversible.addKeyListener(new ComboKeyHandler(cbReversible));

    JTextField fieldLowerBound = (JTextField) cbLowerBound.getEditor().getEditorComponent();
    fieldLowerBound.addKeyListener(new ComboKeyHandler(cbLowerBound));

    JTextField fieldUpperBound = (JTextField) cbUpperBound.getEditor().getEditorComponent();
    fieldUpperBound.addKeyListener(new ComboKeyHandler(cbUpperBound));

    JTextField fieldObjective = (JTextField) cbObjective.getEditor().getEditorComponent();
    fieldObjective.addKeyListener(new ComboKeyHandler(cbObjective));

    populateNamesFromFileBoxes(columnNamesFromFile);

    // box layout
    Box vb = Box.createVerticalBox();

    Box hbLabels = Box.createHorizontalBox();
    Box hb1 = Box.createHorizontalBox();
    Box hb2 = Box.createHorizontalBox();
    Box hb3 = Box.createHorizontalBox();
    Box hb4 = Box.createHorizontalBox();
    Box hb5 = Box.createHorizontalBox();
    Box hb6 = Box.createHorizontalBox();
    Box hb7 = Box.createHorizontalBox();
    Box hb8 = Box.createHorizontalBox();
    Box hb9 = Box.createHorizontalBox();
    Box hbTop = Box.createHorizontalBox();
    Box hbKnockoutLabel = Box.createHorizontalBox();
    Box hbKnockout = Box.createHorizontalBox();
    Box hbFluxValueLabel = Box.createHorizontalBox();
    Box hbFluxValue = Box.createHorizontalBox();
    Box hbReactionAbbreviationLabel = Box.createHorizontalBox();
    Box hbReactionAbbreviation = Box.createHorizontalBox();
    Box hbReactionNameLabel = Box.createHorizontalBox();
    Box hbReactionName = Box.createHorizontalBox();
    Box hbReactionEquationLabel = Box.createHorizontalBox();
    Box hbReactionEquation = Box.createHorizontalBox();
    Box hbReversibleLabel = Box.createHorizontalBox();
    Box hbReversible = Box.createHorizontalBox();
    Box hbLowerBoundLabel = Box.createHorizontalBox();
    Box hbLowerBound = Box.createHorizontalBox();
    Box hbUpperBoundLabel = Box.createHorizontalBox();
    Box hbUpperBound = Box.createHorizontalBox();
    Box hbObjectiveLabel = Box.createHorizontalBox();
    Box hbObjective = Box.createHorizontalBox();

    Box hbButton = Box.createHorizontalBox();

    // top label
    JLabel topLabel = new JLabel();
    topLabel.setText(ColumnInterfaceConstants.REACTIONS_TOP_LABEL);
    topLabel.setSize(new Dimension(300, 30));
    // top, left, bottom. right
    topLabel.setBorder(BorderFactory.createEmptyBorder(20, 30, 20, 200));
    topLabel.setAlignmentX(LEFT_ALIGNMENT);

    hbTop.add(topLabel);
    hbTop.setAlignmentX(LEFT_ALIGNMENT);

    hbLabels.add(hbTop);

    // knockout Label and combo
    JLabel knockoutLabel = new JLabel();
    knockoutLabel.setText(ColumnInterfaceConstants.KO_LABEL);
    knockoutLabel.setSize(new Dimension(300, 20));
    knockoutLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 80));
    knockoutLabel.setAlignmentX(LEFT_ALIGNMENT);
    // knockoutLabel.setAlignmentY(TOP_ALIGNMENT);

    JPanel panelKnockoutLabel = new JPanel();
    panelKnockoutLabel.setLayout(new BoxLayout(panelKnockoutLabel, BoxLayout.X_AXIS));
    panelKnockoutLabel.add(knockoutLabel);
    panelKnockoutLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbKnockoutLabel.add(panelKnockoutLabel);
    hbKnockoutLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelKnockout = new JPanel();
    panelKnockout.setLayout(new BoxLayout(panelKnockout, BoxLayout.X_AXIS));
    panelKnockout.add(cbKnockout);
    panelKnockout.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelKnockout.setAlignmentX(RIGHT_ALIGNMENT);

    hbKnockout.add(panelKnockout);
    hbKnockout.setAlignmentX(RIGHT_ALIGNMENT);

    hb1.add(hbKnockoutLabel);
    hb1.add(hbKnockout);

    // flux value label and combo
    JLabel fluxValueLabel = new JLabel();
    fluxValueLabel.setText(ColumnInterfaceConstants.FLUX_VALUE_LABEL);
    fluxValueLabel.setSize(new Dimension(300, 20));
    fluxValueLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    fluxValueLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelFluxValueLabel = new JPanel();
    panelFluxValueLabel.setLayout(new BoxLayout(panelFluxValueLabel, BoxLayout.X_AXIS));
    panelFluxValueLabel.add(fluxValueLabel);
    panelFluxValueLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbFluxValueLabel.add(panelFluxValueLabel);
    hbFluxValueLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelFluxValue = new JPanel();
    panelFluxValue.setLayout(new BoxLayout(panelFluxValue, BoxLayout.X_AXIS));
    panelFluxValue.add(cbFluxValue);
    panelFluxValue.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelFluxValue.setAlignmentX(RIGHT_ALIGNMENT);

    hbFluxValue.add(panelFluxValue);
    hbFluxValue.setAlignmentX(RIGHT_ALIGNMENT);

    hb2.add(hbFluxValueLabel);
    hb2.add(hbFluxValue);

    // reaction abbreviation label and combo
    JLabel reactionAbbreviationLabel = new JLabel();
    reactionAbbreviationLabel.setText(ColumnInterfaceConstants.REACTION_ABBREVIATION_LABEL);
    reactionAbbreviationLabel.setSize(new Dimension(300, 20));
    reactionAbbreviationLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    reactionAbbreviationLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReactionAbbreviationLabel = new JPanel();
    panelReactionAbbreviationLabel.setLayout(
        new BoxLayout(panelReactionAbbreviationLabel, BoxLayout.X_AXIS));
    panelReactionAbbreviationLabel.add(reactionAbbreviationLabel);
    panelReactionAbbreviationLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbReactionAbbreviationLabel.add(panelReactionAbbreviationLabel);
    hbReactionAbbreviationLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReactionAbbreviation = new JPanel();
    panelReactionAbbreviation.setLayout(new BoxLayout(panelReactionAbbreviation, BoxLayout.X_AXIS));
    panelReactionAbbreviation.add(cbReactionAbbreviation);
    panelReactionAbbreviation.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelReactionAbbreviation.setAlignmentX(RIGHT_ALIGNMENT);

    hbReactionAbbreviation.add(panelReactionAbbreviation);
    hbReactionAbbreviation.setAlignmentX(RIGHT_ALIGNMENT);

    hb3.add(hbReactionAbbreviationLabel);
    hb3.add(hbReactionAbbreviation);

    // reaction name label and combo
    JLabel reactionNameLabel = new JLabel();
    reactionNameLabel.setText(ColumnInterfaceConstants.REACTION_NAME_LABEL);
    reactionNameLabel.setSize(new Dimension(300, 20));
    reactionNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    reactionNameLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReactionNameLabel = new JPanel();
    panelReactionNameLabel.setLayout(new BoxLayout(panelReactionNameLabel, BoxLayout.X_AXIS));
    panelReactionNameLabel.add(reactionNameLabel);
    panelReactionNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbReactionNameLabel.add(panelReactionNameLabel);
    hbReactionNameLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReactionName = new JPanel();
    panelReactionName.setLayout(new BoxLayout(panelReactionName, BoxLayout.X_AXIS));
    panelReactionName.add(cbReactionName);
    panelReactionName.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelReactionName.setAlignmentX(RIGHT_ALIGNMENT);

    hbReactionName.add(panelReactionName);
    hbReactionName.setAlignmentX(RIGHT_ALIGNMENT);

    hb4.add(hbReactionNameLabel);
    hb4.add(hbReactionName);

    // reaction equation label and combo
    JLabel reactionEquationLabel = new JLabel();
    reactionEquationLabel.setText(ColumnInterfaceConstants.REACTION_EQUATION_LABEL);
    reactionEquationLabel.setSize(new Dimension(300, 20));
    reactionEquationLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    reactionEquationLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReactionEquationLabel = new JPanel();
    panelReactionEquationLabel.setLayout(
        new BoxLayout(panelReactionEquationLabel, BoxLayout.X_AXIS));
    panelReactionEquationLabel.add(reactionEquationLabel);
    panelReactionEquationLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbReactionEquationLabel.add(panelReactionEquationLabel);
    hbReactionEquationLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReactionEquation = new JPanel();
    panelReactionEquation.setLayout(new BoxLayout(panelReactionEquation, BoxLayout.X_AXIS));
    panelReactionEquation.add(cbReactionEquation);
    panelReactionEquation.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelReactionEquation.setAlignmentX(RIGHT_ALIGNMENT);

    hbReactionEquation.add(panelReactionEquation);
    hbReactionEquation.setAlignmentX(RIGHT_ALIGNMENT);

    hb5.add(hbReactionEquationLabel);
    hb5.add(hbReactionEquation);

    // reversible label and combo
    JLabel reversibleLabel = new JLabel();
    reversibleLabel.setText(ColumnInterfaceConstants.REVERSIBLE_LABEL);
    reversibleLabel.setSize(new Dimension(300, 20));
    reversibleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    reversibleLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReversibleLabel = new JPanel();
    panelReversibleLabel.setLayout(new BoxLayout(panelReversibleLabel, BoxLayout.X_AXIS));
    panelReversibleLabel.add(reversibleLabel);
    panelReversibleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbReversibleLabel.add(panelReversibleLabel);
    hbReversibleLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelReversible = new JPanel();
    panelReversible.setLayout(new BoxLayout(panelReversible, BoxLayout.X_AXIS));
    panelReversible.add(cbReversible);
    panelReversible.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelReversible.setAlignmentX(RIGHT_ALIGNMENT);

    hbReversible.add(panelReversible);
    hbReversible.setAlignmentX(RIGHT_ALIGNMENT);

    hb6.add(hbReversibleLabel);
    hb6.add(hbReversible);

    // lower bound label and combo
    JLabel lowerBoundLabel = new JLabel();
    lowerBoundLabel.setText(ColumnInterfaceConstants.LOWER_BOUND_LABEL);
    lowerBoundLabel.setSize(new Dimension(300, 20));
    lowerBoundLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    lowerBoundLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelLowerBoundLabel = new JPanel();
    panelLowerBoundLabel.setLayout(new BoxLayout(panelLowerBoundLabel, BoxLayout.X_AXIS));
    panelLowerBoundLabel.add(lowerBoundLabel);
    panelLowerBoundLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbLowerBoundLabel.add(panelLowerBoundLabel);
    hbLowerBoundLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelLowerBound = new JPanel();
    panelLowerBound.setLayout(new BoxLayout(panelLowerBound, BoxLayout.X_AXIS));
    panelLowerBound.add(cbLowerBound);
    panelLowerBound.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelLowerBound.setAlignmentX(RIGHT_ALIGNMENT);

    hbLowerBound.add(panelLowerBound);
    hbLowerBound.setAlignmentX(RIGHT_ALIGNMENT);

    hb7.add(hbLowerBoundLabel);
    hb7.add(hbLowerBound);

    // upper bound label and combo
    JLabel upperBoundLabel = new JLabel();
    upperBoundLabel.setText(ColumnInterfaceConstants.UPPER_BOUND_LABEL);
    upperBoundLabel.setSize(new Dimension(300, 20));
    upperBoundLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    upperBoundLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelUpperBoundLabel = new JPanel();
    panelUpperBoundLabel.setLayout(new BoxLayout(panelUpperBoundLabel, BoxLayout.X_AXIS));
    panelUpperBoundLabel.add(upperBoundLabel);
    panelUpperBoundLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbUpperBoundLabel.add(panelUpperBoundLabel);
    hbUpperBoundLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelUpperBound = new JPanel();
    panelUpperBound.setLayout(new BoxLayout(panelUpperBound, BoxLayout.X_AXIS));
    panelUpperBound.add(cbUpperBound);
    panelUpperBound.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelUpperBound.setAlignmentX(RIGHT_ALIGNMENT);

    hbUpperBound.add(panelUpperBound);
    hbUpperBound.setAlignmentX(RIGHT_ALIGNMENT);

    hb8.add(hbUpperBoundLabel);
    hb8.add(hbUpperBound);

    // objective label and combo
    JLabel objectiveLabel = new JLabel();
    objectiveLabel.setText(ColumnInterfaceConstants.BIOLOGICAL_OBJECTIVE_LABEL);
    objectiveLabel.setSize(new Dimension(300, 20));
    objectiveLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 80));
    objectiveLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelObjectiveLabel = new JPanel();
    panelObjectiveLabel.setLayout(new BoxLayout(panelObjectiveLabel, BoxLayout.X_AXIS));
    panelObjectiveLabel.add(objectiveLabel);
    panelObjectiveLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));

    hbObjectiveLabel.add(panelObjectiveLabel);
    hbObjectiveLabel.setAlignmentX(LEFT_ALIGNMENT);

    JPanel panelObjective = new JPanel();
    panelObjective.setLayout(new BoxLayout(panelObjective, BoxLayout.X_AXIS));
    panelObjective.add(cbObjective);
    panelObjective.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
    panelObjective.setAlignmentX(RIGHT_ALIGNMENT);

    hbObjective.add(panelObjective);
    hbObjective.setAlignmentX(RIGHT_ALIGNMENT);

    hb9.add(hbObjectiveLabel);
    hb9.add(hbObjective);

    okButton.setMnemonic(KeyEvent.VK_O);
    JLabel blank = new JLabel("    ");
    cancelButton.setMnemonic(KeyEvent.VK_C);
    JLabel blank2 = new JLabel("    ");
    nextRowButton.setMnemonic(KeyEvent.VK_N);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(okButton);
    buttonPanel.add(blank);
    buttonPanel.add(cancelButton);
    buttonPanel.add(blank2);
    buttonPanel.add(nextRowButton);
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 20, 20));

    hbButton.add(buttonPanel);

    vb.add(hbLabels);
    vb.add(hb1);
    vb.add(hb2);
    vb.add(hb3);
    vb.add(hb4);
    vb.add(hb5);
    vb.add(hb6);
    vb.add(hb7);
    vb.add(hb8);
    vb.add(hb9);
    vb.add(hbButton);

    add(vb);

    ActionListener okButtonActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent prodActionEvent) {
            // add metacolumn names to db
            ReactionsMetaColumnManager reactionsMetaColumnManager =
                new ReactionsMetaColumnManager();
            ArrayList<String> metaColumnNames = new ArrayList();
            ArrayList<Integer> usedIndices = new ArrayList();
            ArrayList<Integer> metaColumnIndexList = new ArrayList();

            if (getColumnNamesFromFile().contains(cbKnockout.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setKnockoutColumnIndex(
                      getColumnNamesFromFile().indexOf(cbKnockout.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbKnockout.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbFluxValue.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setFluxValueColumnIndex(
                      getColumnNamesFromFile().indexOf(cbFluxValue.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbFluxValue.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbReactionAbbreviation.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setReactionAbbreviationColumnIndex(
                      getColumnNamesFromFile().indexOf(cbReactionAbbreviation.getSelectedItem()));
              usedIndices.add(
                  getColumnNamesFromFile().indexOf(cbReactionAbbreviation.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbReactionName.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setReactionNameColumnIndex(
                      getColumnNamesFromFile().indexOf(cbReactionName.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbReactionName.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbReactionEquation.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setReactionEquationColumnIndex(
                      getColumnNamesFromFile().indexOf(cbReactionEquation.getSelectedItem()));
              usedIndices.add(
                  getColumnNamesFromFile().indexOf(cbReactionEquation.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbReversible.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setReversibleColumnIndex(
                      getColumnNamesFromFile().indexOf(cbReversible.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbReversible.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbLowerBound.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setLowerBoundColumnIndex(
                      getColumnNamesFromFile().indexOf(cbLowerBound.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbLowerBound.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbUpperBound.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setUpperBoundColumnIndex(
                      getColumnNamesFromFile().indexOf(cbUpperBound.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbUpperBound.getSelectedItem()));
            }
            if (getColumnNamesFromFile().contains(cbObjective.getSelectedItem())) {
              LocalConfig.getInstance()
                  .setBiologicalObjectiveColumnIndex(
                      getColumnNamesFromFile().indexOf(cbObjective.getSelectedItem()));
              usedIndices.add(getColumnNamesFromFile().indexOf(cbObjective.getSelectedItem()));
            }
            for (int i = 0; i < getColumnNamesFromFile().size(); i++) {
              if (!usedIndices.contains(i)) {
                metaColumnNames.add(getColumnNamesFromFile().get(i));
                metaColumnIndexList.add(
                    getColumnNamesFromFile().indexOf(getColumnNamesFromFile().get(i)));
              }
            }

            reactionsMetaColumnManager.addColumnNames(
                LocalConfig.getInstance().getDatabaseName(), metaColumnNames);
            LocalConfig.getInstance().setReactionsMetaColumnIndexList(metaColumnIndexList);

            setVisible(false);
            dispose();

            progressBar.setVisible(true);

            t.start();

            task = new Task();
            task.execute();
          }
        };

    okButton.addActionListener(okButtonActionListener);

    ActionListener cancelButtonActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent prodActionEvent) {
            setVisible(false);
            dispose();
            // this is a hack, same as clear method in gui
            try {
              Class.forName("org.sqlite.JDBC");
              DatabaseCreator databaseCreator = new DatabaseCreator();
              LocalConfig.getInstance().setDatabaseName(ConfigConstants.DEFAULT_DATABASE_NAME);
              Connection con =
                  DriverManager.getConnection(
                      "jdbc:sqlite:" + ConfigConstants.DEFAULT_DATABASE_NAME + ".db");
              databaseCreator.createDatabase(LocalConfig.getInstance().getDatabaseName());
              databaseCreator.addRows(
                  LocalConfig.getInstance().getDatabaseName(),
                  GraphicalInterfaceConstants.BLANK_DB_NUMBER_OF_ROWS,
                  GraphicalInterfaceConstants.BLANK_DB_NUMBER_OF_ROWS);
            } catch (ClassNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            } catch (SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        };

    cancelButton.addActionListener(cancelButtonActionListener);

    ActionListener nextRowButtonActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent prodActionEvent) {
            TextReactionsModelReader reader = new TextReactionsModelReader();
            int correction = LocalConfig.getInstance().getReactionsNextRowCorrection();
            if ((correction + 1) < reader.numberOfLines(GraphicalInterface.getReactionsCSVFile())) {
              LocalConfig.getInstance().setReactionsNextRowCorrection(correction + 1);
              System.out.println(
                  "corr " + LocalConfig.getInstance().getReactionsNextRowCorrection());
              ArrayList<String> newColumnNamesFromFile =
                  reader.columnNamesFromFile(
                      GraphicalInterface.getReactionsCSVFile(),
                      LocalConfig.getInstance().getReactionsNextRowCorrection());
              setColumnNamesFromFile(newColumnNamesFromFile);
              populateNamesFromFileBoxes(newColumnNamesFromFile);
            }
          }
        };

    nextRowButton.addActionListener(nextRowButtonActionListener);
  }