Пример #1
0
  /**
   * Method that makes the necessary JComponents for the SettingsPanel. The used JComponents are: a
   * textfield for the cluster name, a TextOrGraphPanel for choosing between text and graph input,
   * two comboboxes for the distributions and the corrections, a textfield for the alpha, two
   * comboboxes for the option against what cluster should be tested and one for the option how many
   * categories must be displayed int the graph, two SettingsOpenPanels for choosing the annotation
   * and ontology file, a SettingsSavePanel for the data-file and a button to start the
   * calculations.
   */
  public void makeJComponents() {

    helpButton = new JButton("Help");
    helpButton.setMnemonic(KeyEvent.VK_H);
    helpButton.addActionListener(new HelpButtonActionListener(this, openBrowserService));

    saveSettingsButton = new JButton("Save settings as default");
    saveSettingsButton.setMnemonic(KeyEvent.VK_S);
    saveSettingsButton.addActionListener(new SaveSettingsButtonActionListener(this));

    // JComboboxes.
    testBox = new JComboBox(testsArray);
    testBox.setSelectedItem(bingo_props.getProperty("tests_def"));
    correctionBox = new JComboBox(correctionArray);
    correctionBox.setSelectedItem(bingo_props.getProperty("correction_def"));
    categoriesBox = new JComboBox(categoriesArray);
    categoriesBox.setSelectedItem(bingo_props.getProperty("categories_def"));
    clusterVsPanel =
        new ChooseRefSetPanel(
            this, bingoDir, clusterVsArray, bingo_props.getProperty("refset_def"));

    // JTextField.
    alphaField = new JTextField(bingo_props.getProperty("signif_def"));
    nameField = new JTextField("");

    // OverUnderPanel
    overUnderPanel = new OverUnderPanel();

    // OverUnderPanel
    vizPanel = new VizPanel();

    // TextOrGraphPanel
    textOrGraphPanel = new TextOrGraphPanel();

    // JLabels.
    overUnderLabel = new JLabel(overunder_label);
    nameLabel = new JLabel(clustername_label);
    testLabel = new JLabel(test_label);
    correctionLabel = new JLabel(correction_label);
    alphaLabel = new JLabel(sig_label);
    categoriesLabel = new JLabel(category_label);
    clusterVsLabel = new JLabel(ref_label);
    testLabel.setForeground(Color.black);
    correctionLabel.setForeground(Color.black);
    alphaLabel.setForeground(Color.black);
    categoriesLabel.setForeground(Color.black);
    clusterVsLabel.setForeground(Color.black);
    ecLabel = new JLabel(ec_label);

    // annotationPanel.
    annotationLabel = new JLabel(annotation_label);
    annotationPanel =
        new ChooseAnnotationPanel(
            this, bingoDir, params.getSpeciesLabels(), bingo_props.getProperty("species_def"));

    // evidence code Field
    ecField = new JTextField();

    // ontologyPanel.
    namespaceLabel = new JLabel(namespace_label);
    namespacePanel =
        new ChooseNamespacePanel(
            this, bingoDir, params.getNamespaceLabels(), bingo_props.getProperty("namespace_def"));

    ontologyLabel = new JLabel(ontology_label);
    ontologyPanel =
        new ChooseOntologyPanel(
            this,
            bingoDir,
            params.getOntologyLabels(),
            bingo_props.getProperty("ontology_file_def"));

    // Creating SettingsSavePanels.
    dataPanel = new SaveResultsPanel("Data", this, bingoDir);

    // the bingo-button to start the calculations.
    bingoButton = new JButton("Start bingo");
    bingoButton.setMnemonic(KeyEvent.VK_B);
    bingoButton.addActionListener(new SettingsPanelActionListener(params, this, adapter));
  }
Пример #2
0
  /** This constructor creates the panel with its swing-components. */
  public SettingsPanel(
      final String bingoDir, final CySwingAppAdapter adapter, OpenBrowser openBrowserService) {
    super();
    this.bingoDir = bingoDir;
    this.adapter = adapter;
    this.openBrowserService = openBrowserService;

    // Create a new bingo parameter set
    try {
      params = new BingoParameters(bingoDir);
    } catch (IOException e) {
      JOptionPane.showMessageDialog(
          this,
          "Error opening the properties file."
              + "\n"
              + "Please make sure that there is bingo_gui.properties file"
              + "\n"
              + "in the bingo.jar or in your cytoscape plugins directory.");
    }
    bingo_props = params.getbingo_props();

    // create the JComponents.
    makeJComponents();

    setPreferredSize(new Dimension(DIM_WIDTH, DIM_HEIGHT));
    setOpaque(false);
    // create border.
    setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.black),
            "bingo settings",
            0,
            0,
            new Font("bingo settings", Font.BOLD, 16),
            Color.black));

    // Layout with GridBagLayout.
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    setLayout(gridbag);

    c.weighty = 1;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;

    JPanel dummyPanel = new JPanel();
    dummyPanel.setOpaque(false);
    dummyPanel.setPreferredSize(new Dimension(50, 20));
    c.gridx = 0;
    gridbag.setConstraints(dummyPanel, c);
    add(dummyPanel);

    c.gridx = 1;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    gridbag.setConstraints(saveSettingsButton, c);
    add(saveSettingsButton);
    c.gridx = 2;
    c.anchor = GridBagConstraints.EAST;
    gridbag.setConstraints(helpButton, c);
    add(helpButton);

    JPanel dummyPanel2 = new JPanel();
    dummyPanel2.setOpaque(false);
    dummyPanel2.setPreferredSize(new Dimension(50, 20));
    c.gridx = 3;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.CENTER;
    c.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(dummyPanel2, c);
    add(dummyPanel2);

    c.weighty = 1;
    c.weightx = 100;
    c.gridx = 1;
    c.gridwidth = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.HORIZONTAL;

    gridbag.setConstraints(nameLabel, c);
    add(nameLabel);

    gridbag.setConstraints(nameField, c);
    add(nameField);

    c.fill = GridBagConstraints.BOTH;
    c.gridheight = 1;
    c.weighty = 100;
    gridbag.setConstraints(textOrGraphPanel, c);
    add(textOrGraphPanel);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridheight = 1;
    c.weighty = 1;

    gridbag.setConstraints(overUnderLabel, c);
    add(overUnderLabel);

    gridbag.setConstraints(overUnderPanel, c);
    add(overUnderPanel);

    gridbag.setConstraints(vizPanel, c);
    add(vizPanel);

    gridbag.setConstraints(testLabel, c);
    add(testLabel);

    gridbag.setConstraints(testBox, c);
    add(testBox);

    gridbag.setConstraints(correctionLabel, c);
    add(correctionLabel);

    gridbag.setConstraints(correctionBox, c);
    add(correctionBox);

    gridbag.setConstraints(alphaLabel, c);
    add(alphaLabel);

    gridbag.setConstraints(alphaField, c);
    add(alphaField);

    gridbag.setConstraints(categoriesLabel, c);
    add(categoriesLabel);

    gridbag.setConstraints(categoriesBox, c);
    add(categoriesBox);

    gridbag.setConstraints(clusterVsLabel, c);
    add(clusterVsLabel);

    // include custom ref set option
    gridbag.setConstraints(clusterVsPanel, c);
    add(clusterVsPanel);

    gridbag.setConstraints(ontologyLabel, c);
    add(ontologyLabel);

    gridbag.setConstraints(ontologyPanel, c);
    add(ontologyPanel);

    gridbag.setConstraints(namespaceLabel, c);
    add(namespaceLabel);

    gridbag.setConstraints(namespacePanel, c);
    add(namespacePanel);

    gridbag.setConstraints(annotationLabel, c);
    add(annotationLabel);

    gridbag.setConstraints(annotationPanel, c);
    add(annotationPanel);

    gridbag.setConstraints(ecLabel, c);
    add(ecLabel);

    gridbag.setConstraints(ecField, c);
    add(ecField);

    gridbag.setConstraints(dataPanel, c);
    add(dataPanel);

    gridbag.setConstraints(bingoButton, c);
    add(bingoButton);

    validate();
  }