public JComboBox<?> getPermissaoCombo() {
   if (permissaoCombo == null) {
     permissaoCombo = new JComboBox<Object>(getList());
     permissaoCombo.setToolTipText("Selecione a permissão");
   }
   return permissaoCombo;
 }
Ejemplo n.º 2
0
  private void createComponents(JPanel p) {
    String tt = "Any of these:  45.5 -120.2   or   45 30 0 n 120 12 0 w   or   Seattle";

    JComboBox field = new JComboBox();
    field.setOpaque(false);
    field.setEditable(true);
    field.setLightWeightPopupEnabled(false);
    field.setPreferredSize(new Dimension(200, field.getPreferredSize().height));
    field.setToolTipText(tt);

    JLabel label = new JLabel(ImageLibrary.getIcon("gov/nasa/worldwindow/images/safari-24x24.png"));
    //            new
    // ImageIcon(getClass().getResource("gov/nasa/worldwindow/images/safari-24x24.png")));
    label.setOpaque(false);
    label.setToolTipText(tt);

    p.add(label, BorderLayout.WEST);
    p.add(field, BorderLayout.CENTER);

    field.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            performGazeteerAction(actionEvent);
          }
        });
  }
Ejemplo n.º 3
0
 @Override
 void showErrMsgAsToolTip(SvmValidationException e) {
   if (comboBoxAnrede != null && e.getAffectedFields().contains(Field.ANREDE)) {
     comboBoxAnrede.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.VORNAME)) {
     txtVorname.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.NACHNAME)) {
     txtNachname.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.STRASSE_HAUSNUMMER)) {
     txtStrasseHausnummer.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.PLZ)) {
     txtPlz.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.ORT)) {
     txtOrt.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.FESTNETZ)) {
     txtFestnetz.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.NATEL)) {
     txtNatel.setToolTipText(e.getMessage());
   }
   if (e.getAffectedFields().contains(Field.EMAIL)) {
     txtEmail.setToolTipText(e.getMessage());
   }
   if (errLblGeburtsdatum != null && e.getAffectedFields().contains(Field.GEBURTSDATUM)) {
     txtGeburtsdatum.setToolTipText(e.getMessage());
   }
 }
  private JComboBox getLinksComboBox() {
    if (linksComboBox == null) {

      linksComboBox = new JComboBox();
      linksComboBox.setRenderer(new LinkListCellRenderer());
      linksComboBox.setModel(
          new SearchableComboBoxModel<ILink>(
              new LinkComparator(),
              new ObjectToStringConverter<ILink>() {

                public String convert(ILink object) {
                  return LinkUtilities.formatAsString(object);
                }
              }));

      linksComboBox.setToolTipText("Links in Knowledgebase");
      linksComboBox.addItemListener(
          new ItemListener() {

            public void itemStateChanged(final ItemEvent e) {
              if (e.getStateChange() == ItemEvent.SELECTED) {
                setLink((ILink) e.getItem());
              }
            }
          });
    }

    return linksComboBox;
  }
  public JPanel buildStrategySelectionPanel(Window aParentContainer, Atdl4jOptions atdl4jOptions) {
    setAtdl4jOptions(atdl4jOptions);

    JPanel panel = new JPanel(new BorderLayout());
    // label
    JLabel strategiesDropDownLabel = new JLabel("Strategy");
    panel.add(strategiesDropDownLabel, BorderLayout.WEST);

    // dropDownList
    strategiesDropDown = new JComboBox();
    strategiesDropDown.setEditable(false);

    panel.add(strategiesDropDown, BorderLayout.CENTER);

    if (Atdl4jConfig.getConfig().getStrategyDropDownItemDepth() != null) {
      strategiesDropDown.setMaximumRowCount(
          Atdl4jConfig.getConfig().getStrategyDropDownItemDepth().intValue());
    }
    // tooltip
    strategiesDropDown.setToolTipText("Select a Strategy");
    // action listener
    strategiesDropDown.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              int index = strategiesDropDown.getSelectedIndex();
              selectDropDownStrategy(index);
            }
          }
        });

    return panel;
  }
Ejemplo n.º 6
0
 /**
  * The constructor
  *
  * @param project the context project
  */
 public GitVcsPanel(@NotNull Project project) {
   myVcs = GitVcs.getInstance(project);
   myAppSettings = GitVcsApplicationSettings.getInstance();
   myProjectSettings = GitVcsSettings.getInstance(project);
   myProject = project;
   mySSHExecutableComboBox.addItem(IDEA_SSH);
   mySSHExecutableComboBox.addItem(NATIVE_SSH);
   mySSHExecutableComboBox.setSelectedItem(
       GitVcsSettings.isDefaultIdeaSsh() ? IDEA_SSH : NATIVE_SSH);
   mySSHExecutableComboBox.setToolTipText(
       GitBundle.message(
           "git.vcs.config.ssh.mode.tooltip",
           ApplicationNamesInfo.getInstance().getFullProductName()));
   myTestButton.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           testConnection();
         }
       });
   myConvertTextFilesComboBox.addItem(CRLF_DO_NOT_CONVERT);
   myConvertTextFilesComboBox.addItem(CRLF_CONVERT_TO_PROJECT);
   myConvertTextFilesComboBox.addItem(CRLF_ASK);
   myConvertTextFilesComboBox.setSelectedItem(CRLF_ASK);
   myGitField.addBrowseFolderListener(
       GitBundle.getString("find.git.title"),
       GitBundle.getString("find.git.description"),
       project,
       new FileChooserDescriptor(true, false, false, false, false, false));
 }
Ejemplo n.º 7
0
    public HttpClientFrame() {
      client = new HttpClient(new MultiThreadedHttpConnectionManager());
      client.getHttpConnectionManager().getParams().setConnectionTimeout(30000);

      JPanel panInput = new JPanel(new FlowLayout());

      String[] aURLs = {
        "http://www.apache.org/",
        "http://www.google.com/",
        "http://www.opensource.org/",
        "http://www.anybrowser.org/",
        "http://jakarta.apache.org/",
        "http://www.w3.org/"
      };

      final JButton btnGET = new JButton("GET");
      btnGET.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              String url = (String) cmbURL.getSelectedItem();
              if (url != null && url.length() > 0) {
                loadPage(url);
              }
            }
          });

      cmbURL = new JComboBox(aURLs);
      cmbURL.setToolTipText("Enter a URL");
      cmbURL.setEditable(true);
      cmbURL.setSelectedIndex(0);

      JLabel lblURL = new JLabel("URL:");

      panInput.add(lblURL);
      panInput.add(cmbURL);
      panInput.add(btnGET);

      taTextResponse = new JTextArea();
      taTextResponse.setEditable(false);
      taTextResponse.setCaretPosition(0);

      htmlPane = new JEditorPane();
      htmlPane.setContentType("text/html");
      htmlPane.setEditable(false);

      JSplitPane splitResponsePane =
          new JSplitPane(
              JSplitPane.HORIZONTAL_SPLIT,
              new JScrollPane(taTextResponse),
              new JScrollPane(htmlPane));
      splitResponsePane.setOneTouchExpandable(false);
      splitResponsePane.setDividerLocation(350);
      // it would be better to set resizeWeight, but this method does
      // not exist in JRE 1.2.2
      //            splitResponsePane.setResizeWeight(0.5);

      this.getContentPane().setLayout(new BorderLayout());
      this.getContentPane().add(panInput, BorderLayout.NORTH);
      this.getContentPane().add(splitResponsePane, BorderLayout.CENTER);
    }
Ejemplo n.º 8
0
  /**
   * Creates new form NewFlurstueckPanel.
   *
   * @param schluessel DOCUMENT ME!
   */
  public CreateFlurstueckPanel(final FlurstueckSchluesselCustomBean schluessel) {
    this.schluessel = schluessel;
    initComponents();
    cboFlur.setToolTipText("Flur");
    txtFlurstueck.setToolTipText("Flurstueck");
    txtFlurstueck.setEnabled(false);
    cboGemarkung.setEditable(false);
    cboFlur.setEditable(false);
    cboGemarkung.setToolTipText("Gemarkung");
    btnCreateNewFlurstueck.setEnabled(false);
    txtFlurstueck.getDocument().addDocumentListener(this);
    txtFlurstueck.addActionListener(this);
    try {
      final Thread keyRetrieverThread =
          new Thread() {

            @Override
            public void run() {
              if (log.isDebugEnabled()) {
                log.debug("Abrufen der Gemarkungen vom Server");
              }
              final Collection gemKeys = CidsBroker.getInstance().getGemarkungsKeys();
              if (gemKeys != null) {
                final Vector gemKeyList = new Vector(gemKeys);
                Collections.sort(gemKeyList);
                cboGemarkung.setModel(new KeyComboboxModel(gemKeyList));
                cboGemarkung.setEnabled(true);
              } else {
                cboGemarkung.setModel(new KeyComboboxModel());
              }
              if (schluessel != null) {
                if (log.isDebugEnabled()) {
                  log.debug("Current Gemarkung: " + schluessel.getGemarkung());
                }
                cboGemarkung.setSelectedItem(schluessel.getGemarkung());
                cboGemarkung.getEditor().setItem(schluessel.getGemarkung());
              }
            }
          };
      keyRetrieverThread.setPriority(Thread.NORM_PRIORITY);
      keyRetrieverThread.start();
    } catch (Exception ex) {
      log.error("Fehler beim Abrufen der Gemarkungen");
    }
  }
Ejemplo n.º 9
0
  private void initPanelVisualizacion() {
    panelVisualizacion = new JPanel();
    panelVisualizacion.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Visualizacion",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 0)));
    GridBagConstraints gbc_panelVisualizacion = new GridBagConstraints();
    gbc_panelVisualizacion.fill = GridBagConstraints.BOTH;
    gbc_panelVisualizacion.insets = new Insets(5, 5, 0, 5);
    gbc_panelVisualizacion.gridx = 0;
    gbc_panelVisualizacion.gridy = 3;
    panelOpciones.add(panelVisualizacion, gbc_panelVisualizacion);
    GridBagLayout gbl_panelVisualizacion = new GridBagLayout();
    gbl_panelVisualizacion.columnWidths = new int[] {48, 0};
    gbl_panelVisualizacion.rowHeights = new int[] {29, 0, 0};
    gbl_panelVisualizacion.columnWeights = new double[] {1.0, Double.MIN_VALUE};
    gbl_panelVisualizacion.rowWeights = new double[] {0.0, 0.0, Double.MIN_VALUE};
    panelVisualizacion.setLayout(gbl_panelVisualizacion);

    comboVista = new JComboBox();
    GridBagConstraints gbc_comboVista = new GridBagConstraints();
    gbc_comboVista.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboVista.insets = new Insets(5, 5, 5, 5);
    gbc_comboVista.gridx = 0;
    gbc_comboVista.gridy = 0;
    panelVisualizacion.add(comboVista, gbc_comboVista);
    comboVista.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            if (item.getStateChange() == ItemEvent.SELECTED) {
              actualizarVista();
            }
          }
        });
    comboVista.setModel(
        new DefaultComboBoxModel(new String[] {"Puntos", "Triangulacion", "Solido"}));
    comboVista.setSelectedIndex(2);
    comboVista.setToolTipText("Modo de Visualizacion");

    chckbxBackfaceCulling = new JCheckBox("Backface Culling");
    chckbxBackfaceCulling.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent item) {
            panelImagen.setBackfaceCulling(item.getStateChange() == ItemEvent.SELECTED);
          }
        });
    GridBagConstraints gbc_chckbxBackfaceCulling = new GridBagConstraints();
    gbc_chckbxBackfaceCulling.anchor = GridBagConstraints.WEST;
    gbc_chckbxBackfaceCulling.insets = new Insets(0, 10, 0, 0);
    gbc_chckbxBackfaceCulling.gridx = 0;
    gbc_chckbxBackfaceCulling.gridy = 1;
    panelVisualizacion.add(chckbxBackfaceCulling, gbc_chckbxBackfaceCulling);
  }
  /**
   * Returns the data-specific widget for controlling the data-specific aspects of the display.
   *
   * @return The data-specific control-component.
   * @throws RemoteException _more_
   * @throws VisADException _more_
   */
  Component getSpecificWidget() throws VisADException, RemoteException {

    stationMenue = new JComboBox(stationIds);

    // TODO: Check this
    if ((selectedStationIndex >= 0) && (selectedStationIndex < stationIds.length)) {
      stationMenue.setSelectedIndex(selectedStationIndex);
      setStation(selectedStationIndex);
    } else {
      setStation(0);
    }
    stationMenue.setToolTipText("Soundings");

    stationMenue.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            try {
              //                    System.err.println("station menu changed");
              //                    setStation(stationMenue.getSelectedIndex());
              updateHeaderLabel();
            } catch (Exception ex) {
              logException(ex);
            }
          }
        });

    stationMenue.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (ignoreStationMenuEvent) {
              return;
            }
            Misc.run(
                new Runnable() {
                  public void run() {
                    try {
                      setStation(stationMenue.getSelectedIndex());
                      Misc.runInABit(
                          250,
                          new Runnable() {
                            public void run() {
                              stationMenue.requestFocus();
                            }
                          });
                      updateHeaderLabel();
                    } catch (Exception ex) {
                      logException(ex);
                    }
                  }
                });
          }
        });

    return GuiUtils.top(GuiUtils.inset(GuiUtils.label("Soundings: ", stationMenue), 8));
  }
Ejemplo n.º 11
0
 /** @param pPerm */
 public void setRecord(Record pPerm) {
   Perm = pPerm;
   Attribute Attr;
   if (ModeGrp) Attr = Perm.getAttr(PDACL.fGROUPNAME);
   else Attr = Perm.getAttr(PDACL.fUSERNAME);
   UserNameLabel.setText(MainWin.DrvTT(Attr.getUserName()));
   if (Attr.getValue() != null) UserComboBox.setSelectedItem((String) Attr.getValue());
   else UserComboBox.setSelectedItem("");
   UserComboBox.setToolTipText(MainWin.DrvTT(Attr.getDescription()));
   Attr = Perm.getAttr(PDACL.fPERMISION);
   PermisionLabel.setText(MainWin.DrvTT(Attr.getUserName()));
   if (Attr.getValue() != null) {
     int Level = (Integer) Attr.getValue();
     if (Level == PDACL.pCATALOG) PermisionComboBox.setSelectedItem("CATALOG");
     else if (Level == PDACL.pVERSION) PermisionComboBox.setSelectedItem("VERSION");
     else if (Level == PDACL.pUPDATE) PermisionComboBox.setSelectedItem("UPDATE");
     else if (Level == PDACL.pDELETE) PermisionComboBox.setSelectedItem("DELETE");
     else PermisionComboBox.setSelectedItem("READ");
   } else PermisionComboBox.setSelectedItem("READ");
   PermisionComboBox.setToolTipText(MainWin.DrvTT(Attr.getDescription()));
 }
    /**
     * If some PostProcessor setting would affect the displayed preferences, then this should be
     * called in its setter
     */
    public void refreshPreferences() {
      panel.removeAll();

      if (multiHead && !dualstruding) {
        Vector<String> extruders = new Vector<String>();
        extruders.add(ToolheadAlias.RIGHT.guiName);
        extruders.add(ToolheadAlias.LEFT.guiName);

        String value =
            Base.preferences.get(
                "replicatorg.slic3r.toolheadOrientation", extruders.firstElement());

        final DefaultComboBoxModel model = new DefaultComboBoxModel(extruders);

        JComboBox input = new JComboBox(model);
        final JCheckBox toolSwap = new JCheckBox("Use");
        panel.add(toolSwap, "split");
        panel.add(input, "split");
        panel.add(new JLabel("extruder"), "wrap");

        ActionListener toolSelected =
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent arg0) {

                Base.preferences.putBoolean(
                    "replicatorg.slic3r.setToolheadOrientation", toolSwap.isSelected());
                if (toolSwap.isSelected()) {
                  if (model.getSelectedItem().equals(ToolheadAlias.LEFT.guiName)) {
                    processor.toolheadTarget = ToolheadAlias.LEFT;
                    Base.preferences.put(
                        "replicatorg.slic3r.toolheadOrientation", ToolheadAlias.LEFT.guiName);
                  } else if (model.getSelectedItem().equals(ToolheadAlias.RIGHT.guiName)) {
                    processor.toolheadTarget = ToolheadAlias.RIGHT;
                    Base.preferences.put(
                        "replicatorg.slic3r.toolheadOrientation", ToolheadAlias.RIGHT.guiName);
                  }
                } else {
                  processor.toolheadTarget = null;
                  Base.preferences.put("replicatorg.slic3r.toolheadOrientation", "-");
                }
              }
            };
        input.addActionListener(toolSelected);
        toolSwap.addActionListener(toolSelected);

        toolSwap.setSelected(
            Base.preferences.getBoolean("replicatorg.slic3r.setToolheadOrientation", true));
        model.setSelectedItem(value);

        input.setToolTipText("select which extruder this gcode prints on");
      }
    }
 @NotNull
 JComponent createComponent() {
   myRemoteCombobox = new JComboBox();
   myRemoteCombobox.setRenderer(new RemoteCellRenderer(myRemoteCombobox.getRenderer()));
   for (GitRemote remote : myRemotes) {
     myRemoteCombobox.addItem(remote);
   }
   myRemoteCombobox.setToolTipText("Select remote");
   if (myRemotes.size() == 1) {
     myRemoteCombobox.setEnabled(false);
   }
   return myRemoteCombobox;
 }
 private void initCompilerTypeCmb() {
   myIncrementalTypeCmb.setModel(new ListComboBoxModel<String>(mySettings.INCREMENTAL_TYPES));
   myIncrementalTypeCmb.setSelectedItem(mySettings.INCREMENTAL_TYPE);
   myIncrementalTypeCmb.setRenderer(
       new ListCellRendererWrapper<String>() {
         @Override
         public void customize(
             JList list, String value, int index, boolean selected, boolean hasFocus) {
           if (value.equals("SBT")) setText("SBT incremental compiler");
           if (value.equals("IDEA")) setText("IntelliJ IDEA");
         }
       });
   myIncrementalTypeCmb.setToolTipText("Rebuild is required after change");
 }
  public static void comboCargar(JComboBox combo, Collection l) {
    String msg = "Cargue un item";
    String nullItem = "<Vacio>";

    if (combo.getSelectedItem() != null && combo.getSelectedItem().equals(nullItem)) {
      combo.removeAllItems();
      combo.setEnabled(true);
      combo.setToolTipText(null);
    }

    l = (l == null) ? new ArrayList() : l;
    Object o = combo.getSelectedItem();
    DefaultComboBoxModel model = new DefaultComboBoxModel(l.toArray());
    model.setSelectedItem((l.contains(o)) ? o : null);
    combo.setModel(model);

    if (l.isEmpty()) {
      combo.addItem(nullItem);
      combo.setSelectedIndex(0);
      combo.setEnabled(false);
      combo.setToolTipText(msg);
    }
  }
Ejemplo n.º 16
0
 /**
  * Sets the text of the tooltip for both renderers, this (the JLabel) and the combobox renderer.
  */
 protected void renderToolTipText(MultiValueResolutionDecision decision) {
   switch (decision.getDecisionType()) {
     case UNDECIDED:
       {
         String toolTipText = tr("Please decide which values to keep");
         setToolTipText(toolTipText);
         cbDecisionRenderer.setToolTipText(toolTipText);
         break;
       }
     case KEEP_ONE:
       {
         String toolTipText =
             tr(
                 "Value ''{0}'' is going to be applied for key ''{1}''",
                 decision.getChosenValue(), decision.getKey());
         setToolTipText(toolTipText);
         cbDecisionRenderer.setToolTipText(toolTipText);
         break;
       }
     case KEEP_NONE:
       {
         String toolTipText =
             tr("The key ''{0}'' and all its values are going to be removed", decision.getKey());
         setToolTipText(toolTipText);
         cbDecisionRenderer.setToolTipText(toolTipText);
         break;
       }
     case KEEP_ALL:
       String toolTipText =
           tr(
               "All values joined as ''{0}'' are going to be applied for key ''{1}''",
               decision.getChosenValue(), decision.getKey());
       setToolTipText(toolTipText);
       cbDecisionRenderer.setToolTipText(toolTipText);
       break;
   }
 }
Ejemplo n.º 17
0
  /**
   * Contruct a new AnimationWidget.
   *
   * @param parentf the parent JFrame
   * @param anim a ucar.visad.display.Animation object to manage
   * @param info Default values for the AnimationInfo
   */
  public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info) {

    // Initialize sharing to true
    super("AnimationWidget", true);
    timesCbx =
        new JComboBox() {
          public String getToolTipText(MouseEvent event) {
            if (boxPanel != null) {
              return boxPanel.getToolTipText();
            }
            return " ";
          }
        };
    timesCbx.setToolTipText("");
    timesCbxMutex = timesCbx.getTreeLock();
    timesCbx.setFont(new Font("Dialog", Font.PLAIN, 9));
    timesCbx.setLightWeightPopupEnabled(false);
    // set to non-visible until items are added
    timesCbx.setVisible(false);
    timesCbx.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!ignoreTimesCbxEvents && (anime != null)) {
              debug("got timesCbx event");
              setTimeFromUser((Real) timesCbx.getSelectedItem());
              if (boxPanel != null) {
                boxPanel.setOnIndex(timesCbx.getSelectedIndex());
              }
            }
          }
        });

    animationInfo = new AnimationInfo();
    if (anim != null) {
      setAnimation(anim);
    }
    if (anime != null) {
      animationInfo.set(anime.getAnimationInfo());
    }
    if (info != null) {
      setProperties(info);
      animationInfo.setRunning(info.getRunning());
    }

    boxPanel = new AnimationBoxPanel(this);
    if (timesArray != null) {
      updateBoxPanel(timesArray);
    }
  }
Ejemplo n.º 18
0
 private void setModelAnrede() throws SvmRequiredException {
   makeErrorLabelInvisible(Field.ANREDE);
   try {
     personModel.setAnrede((Anrede) comboBoxAnrede.getSelectedItem());
   } catch (SvmRequiredException e) {
     LOGGER.trace("PersonController setModelAnrede RequiredException=" + e.getMessage());
     if (isModelValidationMode()) {
       comboBoxAnrede.setToolTipText(e.getMessage());
       // Keine weitere Aktion. Die Required-Prüfung erfolgt erneut nachdem alle Field-Prüfungen
       // bestanden sind.
     } else {
       showErrMsg(e);
     }
     throw e;
   }
 }
Ejemplo n.º 19
0
  private void updateParams(EDPCellData data) {
    paramComboBox.removeAllItems();
    paramKeys = data.getPlugin().getPrintfDescrs(!m_isCrawlRuleEditor);
    if (!m_isCrawlRuleEditor) {
      paramComboBox.addItem(STRING_LITERAL);
    }

    for (Iterator it = paramKeys.values().iterator(); it.hasNext(); ) {
      ConfigParamDescr descr = (ConfigParamDescr) it.next();
      int type = descr.getType();
      if (!m_isCrawlRuleEditor
          && (type == ConfigParamDescr.TYPE_SET || type == ConfigParamDescr.TYPE_RANGE)) continue;
      paramComboBox.addItem(descr);
    }
    paramComboBox.setEnabled(true);
    paramComboBox.setSelectedIndex(0);
    paramComboBox.setToolTipText("Select a parameter to insert into the format string");
    insertButton.setEnabled(true);
  }
Ejemplo n.º 20
0
  public Animation() {
    String[] keys = {"no Animator found"};
    if (tryDir(".")) // || tryDir("BLM305") || tryDir("CSE470"))
    keys = map.keySet().toArray(keys);
    System.out.println(map.size() + " classes loaded");
    menu = new JComboBox(keys);

    pan.setLayout(new BorderLayout(GAP, GAP - 4));
    pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP));
    pan.setBackground(COLOR);

    last = new JPanel();
    last.setPreferredSize(DIM);
    pan.add(last, "Center");

    ref.setFont(NORM);
    ref.setEditable(false);
    ref.setColumns(35);
    ref.setDragEnabled(true);
    pan.add(ref, "North");

    pan.add(bottomPanel(), "South");

    pan.setToolTipText("A collective project for BLM320");
    menu.setToolTipText("Animator classes");
    who.setToolTipText("author()");
    ref.setToolTipText("description()");

    Closer ear = new Closer();
    menu.addActionListener(ear);
    stop.addActionListener(ear);
    frm.addWindowListener(ear);

    if (map.size() > 0) setItem(0);
    frm.setContentPane(pan);
    frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frm.setLocation(scaled(120), scaled(90));
    frm.pack(); // setSize() is called here
    frm.setVisible(true);
    start();
  }
Ejemplo n.º 21
0
  public GUI() {
    String[] keys = {"no Quotation found"};
    if (tryDir(".") || tryDir("BLM305") || tryDir("CSE470")) keys = Q.keySet().toArray(keys);
    menu = new JComboBox<String>(keys);
    if (Q.size() > 0) setMessage(0);

    JPanel pan = new JPanel();
    pan.setLayout(new BorderLayout(GAP, GAP - 4));
    pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP));
    pan.setBackground(COLOR);

    pan.add(topPanel(), "North");

    txt.setFont(LARGE);
    txt.setEditable(false);
    txt.setRows(5);
    txt.setColumns(30);
    txt.setWrapStyleWord(true);
    txt.setLineWrap(true);
    txt.setDragEnabled(true);
    pan.add(new JScrollPane(txt), "Center");

    ref.setFont(SMALL);
    ref.setEditable(false);
    ref.setColumns(35);
    ref.setDragEnabled(true);
    pan.add(ref, "South");

    pan.setToolTipText("A project realized collectively by the class");
    menu.setToolTipText("Quotation classes");
    who.setToolTipText("author()+year()");
    txt.setToolTipText("text()");
    ref.setToolTipText("reference()");

    frm.setContentPane(pan);
    frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frm.setLocation(scaled(120), scaled(90));
    frm.pack();
    frm.setVisible(true);
  }
Ejemplo n.º 22
0
  public static JComboBox addComboBox(
      Function method,
      int index,
      String[] arguments,
      String tooltip,
      boolean enabled,
      boolean visible,
      final IClientPluginAccess pluginAccess) {
    JComboBox box = new JComboBox(arguments);
    box.setPrototypeDisplayValue("XXXXXXXX"); // Set a desired width //$NON-NLS-1$
    box.setMaximumSize(box.getMinimumSize());
    box.setSelectedIndex(index);
    box.setEnabled(enabled);
    box.setVisible(visible);
    box.setToolTipText(tooltip);

    final FunctionDefinition functionDef = new FunctionDefinition(method);
    box.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JComboBox source = (JComboBox) e.getSource();

            Object args[] = new Object[4];

            args[0] = ((Toolbar) source.getParent()).getName();
            args[1] = ((Toolbar) source.getParent()).getDisplayName();
            args[2] = new Boolean(false);
            args[3] = source.getSelectedItem();

            try {
              functionDef.executeAsync(pluginAccess, args);
            } catch (Exception e1) {
              Debug.error(e1);
            }
          }
        });

    return box;
  }
Ejemplo n.º 23
0
  public void SpelersCombo(int ronde) {
    String[] spelers = null;
    if (ronde == 0) {
      spelers = new String[1];
      spelers[0] = "Geen Spelers";
    } else {
      spelers = oc.GeefSpelers(ronde);
    }

    ComboBoxModel cbSpelerModel = new DefaultComboBoxModel(spelers);
    cbSpeler = new JComboBox();
    pInzet.add(cbSpeler);
    cbSpeler.setModel(cbSpelerModel);
    cbSpeler.setBounds(91, 63, 156, 21);
    cbSpeler.setToolTipText("Maak een keuze uit een van de (meespelende) spelers.");
    cbSpeler.addItemListener(
        new ItemListener() {

          public void itemStateChanged(ItemEvent evt) {
            cbSpelerItemStateChanged(evt);
          }
        });
  } // public void SpelersCombo(int ronde)
Ejemplo n.º 24
0
  /** Initialize the contents of the frame. */
  private void initialize(String integer) {
    frame = new JDialog(mainFrame, true);
    frame.setTitle(integer);
    frame.setBounds(100, 100, 450, 300);
    frame.setBounds( // 让新窗口与Swing7窗口示例错开50像素。
        new Rectangle(
            (int) frame.getBounds().getX() + 50,
            (int) frame.getBounds().getY() + 50,
            (int) frame.getBounds().getWidth(),
            (int) frame.getBounds().getHeight()));

    JPanel panel = new JPanel();
    frame.getContentPane().add(panel, BorderLayout.NORTH);
    //		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel v1 = new JPanel();
    panel.add(v1);

    v1.setLayout((LayoutManager) new FlowLayout(FlowLayout.CENTER, 5, 5));

    final JComboBox comboBox_target = new JComboBox(); // 故障类型选择
    comboBox_target.setBorder(
        new TitledBorder(null, "故障目标:", TitledBorder.LEADING, TitledBorder.BELOW_TOP, null, null));
    comboBox_target.setModel(new DefaultComboBoxModel(new String[] {"内存注入", "CPU", "I/O", "bus"}));
    comboBox_target.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            System.out.println(comboBox_target.getSelectedItem()); // 将参数传递给“故障开始时间参数”

            target = comboBox_target.getSelectedIndex();
            // comboBox_1.
            switch (target) {
              case 0:
                object = new MemWave();
                System.out.println("mem ready");
                break;

              case 1:
                object = new CpuWave();
                System.out.println("cpu ready");
                break;
              case 2:
                object = new IOWave();
                System.out.println("Io ready");
                break;
              case 3:
                object = new BusWave();
                System.out.println("bus ready");
                break;

              default:
                break;
            }
          }
        });

    v1.add(comboBox_target);

    final JComboBox comboBox_type = new JComboBox();
    comboBox_type.setBorder(
        new TitledBorder(null, "故障类型:", TitledBorder.LEADING, TitledBorder.BELOW_TOP, null, null));
    comboBox_type.setModel(new DefaultComboBoxModel(new String[] {"线性增加", "指数增加", "恒定值", "正弦变化"}));
    comboBox_type.setToolTipText("\u7EBF\u6027b\r\n");

    comboBox_type.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            // TODO Auto-generated method stub
            System.out.println(comboBox_type.getSelectedItem());
            type = comboBox_type.getSelectedIndex();
          }
        });
    v1.add(comboBox_type);

    JButton button = new JButton("\u786E\u5B9A");
    v1.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // CpuWave cpuWave= new CpuWave();

            try {
              //					CpuWave cpuWave = new CpuWave();
              //
              //					String string="第"+i+"个阶段";
              //					i=i++;
              //
              //					mainFrame.map.put(string, cpuWave);
              //					frame.dispatchEvent(new WindowEvent(frame,WindowEvent.WINDOW_CLOSING) );
              //					System.out.println(mainFrame.map);
              //					for (String key : mainFrame.map.keySet()) {
              //
              //					    Object value = mainFrame.map.get(key);
              //
              //					    System.out.println("Key = " + key +"ddd"+value.toString());
              //
              //					}
              //					mainFrame.fillPList();
              //
            } catch (Exception e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
          }
        });

    JButton button_1 = new JButton("\u53D6\u6D88");
    v1.add(button_1);

    JLabel lblNewLabel = new JLabel();
    frame.getContentPane().add(lblNewLabel, BorderLayout.SOUTH);

    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            Console console = new Console();
            //				CpuWave cpuWave = new CpuWave();
            mainFrame.bObjects.add(object);
            frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
            mainFrame.fillPList();
            Iterator<Object> iter = mainFrame.bObjects.iterator();

            while (iter.hasNext()) {
              System.out.println(iter.next().toString());
            }
          }
        });
  }
Ejemplo n.º 25
0
  /**
   * Create a choicebox for link line style options and return the panel it is in.
   *
   * @return JPanel the panel holding the new choicebox for the link style options.
   */
  private JPanel createLinkDashedChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbLinkDashed = new JComboBox();
    cbLinkDashed.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectDashed")); // $NON-NLS-1$
    cbLinkDashed.setOpaque(true);
    cbLinkDashed.setEditable(false);
    cbLinkDashed.setEnabled(false);
    cbLinkDashed.setMaximumRowCount(10);
    cbLinkDashed.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.plainLine"))); //$NON-NLS-1$
    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.largeDashes"))); //$NON-NLS-1$
    cbLinkDashed.addItem(
        new String(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE,
                "UIToolBarFormatLink.smallDashes"))); //$NON-NLS-1$

    cbLinkDashed.validate();

    cbLinkDashed.setSelectedIndex(0);

    DefaultListCellRenderer drawRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (list != null) {
              if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
              } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
              }
            }

            setText((String) value);
            return this;
          }
        };

    cbLinkDashed.setRenderer(drawRenderer);

    ActionListener drawActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onUpdateLinkDashed(cbLinkDashed.getSelectedIndex());
          }
        };
    cbLinkDashed.addActionListener(drawActionListener);

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbLinkDashed, BorderLayout.CENTER);
    return drawPanel;
  }
Ejemplo n.º 26
0
  /**
   * Create a choicbox for link line thickness options and return the panel it is in.
   *
   * @return JPanel the panel holding the new choicebox for the line thickness options.
   */
  private JPanel createWeightChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbLineWeight = new JComboBox();
    cbLineWeight.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectWeight")); // $NON-NLS-1$
    cbLineWeight.setOpaque(true);
    cbLineWeight.setEditable(false);
    cbLineWeight.setEnabled(false);
    cbLineWeight.setMaximumRowCount(10);
    cbLineWeight.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    cbLineWeight.addItem(new String("1 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("2 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("3 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("4 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("5 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("6 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("7 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("8 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("9 px")); // $NON-NLS-1$
    cbLineWeight.addItem(new String("10 px")); // $NON-NLS-1$

    cbLineWeight.validate();

    cbLineWeight.setSelectedIndex(0);

    DefaultListCellRenderer drawRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (list != null) {
              if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
              } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
              }
            }

            setText((String) value);
            return this;
          }
        };

    cbLineWeight.setRenderer(drawRenderer);

    ActionListener drawActionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            int ind = cbLineWeight.getSelectedIndex();

            if (ind == 0) onUpdateLinkWeight(1);
            else if (ind == 1) onUpdateLinkWeight(2);
            else if (ind == 2) onUpdateLinkWeight(3);
            else if (ind == 3) onUpdateLinkWeight(4);
            else if (ind == 4) onUpdateLinkWeight(5);
            else if (ind == 5) onUpdateLinkWeight(6);
            else if (ind == 6) onUpdateLinkWeight(7);
            else if (ind == 7) onUpdateLinkWeight(8);
            else if (ind == 8) onUpdateLinkWeight(9);
            else if (ind == 9) onUpdateLinkWeight(10);
          }
        };
    cbLineWeight.addActionListener(drawActionListener);

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbLineWeight, BorderLayout.CENTER);
    return drawPanel;
  }
Ejemplo n.º 27
0
  /** Create the arrow head choicebox. */
  private JPanel createArrowChoiceBox() {

    JPanel drawPanel = new JPanel(new BorderLayout());
    CSH.setHelpIDString(drawPanel, "toolbars.formatlink"); // $NON-NLS-1$

    cbArrows = new JComboBox();
    cbArrows.setToolTipText(
        LanguageProperties.getString(
            LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarFormatLink.selectArrow")); // $NON-NLS-1$
    cbArrows.setOpaque(true);
    cbArrows.setEditable(false);
    cbArrows.setEnabled(false);
    cbArrows.setMaximumRowCount(4);
    cbArrows.setFont(new Font("Dialog", Font.PLAIN, 10)); // $NON-NLS-1$

    Vector arrows = new Vector(5);
    arrows.insertElementAt(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.noArrows"),
        0); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.fromTo"),
        1); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.toFfrom"),
        2); //$NON-NLS-1$
    arrows.insertElementAt(
        LanguageProperties.getString(
            LanguageProperties.DIALOGS_BUNDLE, "UILinkEditDialog.bothWays"),
        3); //$NON-NLS-1$
    DefaultComboBoxModel comboModel = new DefaultComboBoxModel(arrows);
    cbArrows.setModel(comboModel);
    cbArrows.setSelectedIndex(0);

    DefaultListCellRenderer comboRenderer =
        new DefaultListCellRenderer() {
          public Component getListCellRendererComponent(
              JList list, Object value, int modelIndex, boolean isSelected, boolean cellHasFocus) {
            if (isSelected) {
              setBackground(list.getSelectionBackground());
              setForeground(list.getSelectionForeground());
            } else {
              setBackground(list.getBackground());
              setForeground(list.getForeground());
            }

            setText((String) value);

            return this;
          }
        };
    cbArrows.setRenderer(comboRenderer);

    cbArrows.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            onUpdateArrowType(cbArrows.getSelectedIndex());
          }
        });

    drawPanel.add(new JLabel(" "), BorderLayout.WEST); // $NON-NLS-1$
    drawPanel.add(cbArrows, BorderLayout.CENTER);
    return drawPanel;
  }
Ejemplo n.º 28
0
  /** Initializes and binds the components related to modeling codon positions. */
  private void initCodonPartitionComponents() {

    PanelUtils.setupComponent(substUnlinkCheck);

    substUnlinkCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setUnlinkedSubstitutionModel(substUnlinkCheck.isSelected());
          }
        });
    substUnlinkCheck.setEnabled(false);
    substUnlinkCheck.setToolTipText(
        ""
            + "<html>Gives each codon position partition different<br>"
            + "substitution model parameters.</html>");

    PanelUtils.setupComponent(heteroUnlinkCheck);
    heteroUnlinkCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setUnlinkedHeterogeneityModel(heteroUnlinkCheck.isSelected());
          }
        });
    heteroUnlinkCheck.setEnabled(heteroCombo.getSelectedIndex() != 0);
    heteroUnlinkCheck.setToolTipText(
        "<html>Gives each codon position partition different<br>rate heterogeneity model parameters.</html>");

    PanelUtils.setupComponent(freqsUnlinkCheck);
    freqsUnlinkCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setUnlinkedFrequencyModel(freqsUnlinkCheck.isSelected());
          }
        });
    freqsUnlinkCheck.setEnabled(false);
    freqsUnlinkCheck.setToolTipText(
        "<html>Gives each codon position partition different<br>nucleotide frequency parameters.</html>");

    PanelUtils.setupComponent(codingCombo);
    codingCombo.setToolTipText("<html>Select how to partition the codon positions.</html>");
    codingCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {

            switch (codingCombo.getSelectedIndex()) {
              case 0:
                model.setCodonHeteroPattern(null);
                break;
              case 1:
                model.setCodonHeteroPattern("112");
                break;
              default:
                model.setCodonHeteroPattern("123");
                break;
            }

            if (codingCombo.getSelectedIndex() != 0) {
              // codon position partitioning
              substUnlinkCheck.setEnabled(true);
              heteroUnlinkCheck.setEnabled(heteroCombo.getSelectedIndex() != 3);
              freqsUnlinkCheck.setEnabled(true);
              substUnlinkCheck.setSelected(true);
              heteroUnlinkCheck.setSelected(heteroCombo.getSelectedIndex() != 0);
              freqsUnlinkCheck.setSelected(true);

            } else {
              substUnlinkCheck.setEnabled(false);
              substUnlinkCheck.setSelected(false);
              heteroUnlinkCheck.setEnabled(false);
              heteroUnlinkCheck.setSelected(false);
              freqsUnlinkCheck.setEnabled(false);
              freqsUnlinkCheck.setSelected(false);
            }
          }
        });
  }
Ejemplo n.º 29
0
  public PartitionModelPanel(final PartitionSubstitutionModel partitionModel) {

    super(12, (OSType.isMac() ? 6 : 24));

    this.model = partitionModel;

    initCodonPartitionComponents();

    PanelUtils.setupComponent(nucSubstCombo);
    nucSubstCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setNucSubstitutionModel((NucModelType) nucSubstCombo.getSelectedItem());
          }
        });
    nucSubstCombo.setToolTipText("<html>Select the type of nucleotide substitution model.</html>");

    PanelUtils.setupComponent(aaSubstCombo);
    aaSubstCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            AminoAcidModelType type = (AminoAcidModelType) aaSubstCombo.getSelectedItem();
            model.setAaSubstitutionModel(type);
            citationText.setText(type.getCitation().toString());
          }
        });
    aaSubstCombo.setToolTipText("<html>Select the type of amino acid substitution model.</html>");

    PanelUtils.setupComponent(binarySubstCombo);
    binarySubstCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setBinarySubstitutionModel((BinaryModelType) binarySubstCombo.getSelectedItem());
            useAmbiguitiesTreeLikelihoodCheck.setSelected(
                binarySubstCombo.getSelectedItem() == BinaryModelType.BIN_COVARION);
            useAmbiguitiesTreeLikelihoodCheck.setEnabled(
                binarySubstCombo.getSelectedItem() != BinaryModelType.BIN_COVARION);
          }
        });
    binarySubstCombo.setToolTipText("<html>Select the type of binary substitution model.</html>");

    PanelUtils.setupComponent(useAmbiguitiesTreeLikelihoodCheck);
    useAmbiguitiesTreeLikelihoodCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setUseAmbiguitiesTreeLikelihood(useAmbiguitiesTreeLikelihoodCheck.isSelected());
          }
        });
    useAmbiguitiesTreeLikelihoodCheck.setToolTipText(
        "<html>Detemine useAmbiguities in &lt treeLikelihood &gt .</html>");

    PanelUtils.setupComponent(frequencyCombo);
    frequencyCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setFrequencyPolicy((FrequencyPolicyType) frequencyCombo.getSelectedItem());
          }
        });
    frequencyCombo.setToolTipText(
        "<html>Select the policy for determining the base frequencies.</html>");

    PanelUtils.setupComponent(heteroCombo);
    heteroCombo.setToolTipText(
        "<html>Select the type of site-specific rate<br>heterogeneity model.</html>");
    heteroCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {

            boolean gammaHetero =
                heteroCombo.getSelectedIndex() == 1 || heteroCombo.getSelectedIndex() == 3;

            model.setGammaHetero(gammaHetero);
            model.setInvarHetero(
                heteroCombo.getSelectedIndex() == 2 || heteroCombo.getSelectedIndex() == 3);

            if (gammaHetero) {
              gammaCatLabel.setEnabled(true);
              gammaCatCombo.setEnabled(true);
            } else {
              gammaCatLabel.setEnabled(false);
              gammaCatCombo.setEnabled(false);
            }

            if (codingCombo.getSelectedIndex() != 0) {
              heteroUnlinkCheck.setEnabled(heteroCombo.getSelectedIndex() != 0);
              heteroUnlinkCheck.setSelected(heteroCombo.getSelectedIndex() != 0);
            }
          }
        });

    PanelUtils.setupComponent(gammaCatCombo);
    gammaCatCombo.setToolTipText(
        "<html>Select the number of categories to use for<br>the discrete gamma rate heterogeneity model.</html>");
    gammaCatCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {

            model.setGammaCategories(gammaCatCombo.getSelectedIndex() + 4);
          }
        });

    setYang96Button = new JButton("Use Yang96 model");
    setYang96Button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            setYang96Model();
          }
        });
    PanelUtils.setupComponent(setYang96Button);
    setYang96Button.setToolTipText(
        "<html>Sets a 3 codon-position model with independent GTR and Gamma as described in<br>"
            + "Yang (1996) <i>J Mol Evol</i> <b>42</b>: 587–596. This model is named 3' in this paper.</html>");

    setSRD06Button = new JButton("Use SRD06 model");
    setSRD06Button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            setSRD06Model();
          }
        });
    PanelUtils.setupComponent(setSRD06Button);
    setSRD06Button.setToolTipText(
        "<html>Sets the SRD06 model as described in<br>"
            + "Shapiro, Rambaut & Drummond (2006) <i>MBE</i> <b>23</b>: 7-9.</html>");

    citationText = new JTextArea(1, 40);
    citationText.setLineWrap(true);
    citationText.setWrapStyleWord(true);
    citationText.setEditable(false);
    citationText.setFont(this.getFont());
    citationText.setOpaque(false);
    AminoAcidModelType type = (AminoAcidModelType) aaSubstCombo.getSelectedItem();
    citationText.setText(type.getCitation().toString());

    dolloCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            if (dolloCheck.isSelected()) {
              binarySubstCombo.setSelectedIndex(0);
              binarySubstCombo.setEnabled(false);
              useAmbiguitiesTreeLikelihoodCheck.setSelected(true);
              useAmbiguitiesTreeLikelihoodCheck.setEnabled(false);
              frequencyCombo.setEnabled(false);
              frequencyCombo.setSelectedItem(FrequencyPolicyType.EMPIRICAL);
              heteroCombo.setSelectedIndex(0);
              heteroCombo.setEnabled(false);
              model.setBinarySubstitutionModel(BinaryModelType.BIN_DOLLO);
              model.setDolloModel(true);
              DolloComponentOptions comp =
                  (DolloComponentOptions)
                      model.getOptions().getComponentOptions(DolloComponentOptions.class);
              comp.createParameters(model.getOptions());
              comp.setActive(true);

            } else {
              binarySubstCombo.setEnabled(true);
              useAmbiguitiesTreeLikelihoodCheck.setEnabled(true);
              frequencyCombo.setEnabled(true);
              heteroCombo.setEnabled(true);
              model.setBinarySubstitutionModel(
                  (BinaryModelType) binarySubstCombo.getSelectedItem());
              model.setDolloModel(false);
            }
          }
        });

    PanelUtils.setupComponent(dolloCheck);
    //        dolloCheck.addChangeListener(new ChangeListener() {
    //            public void stateChanged(ChangeEvent e) {
    //                model.setDolloModel(true);
    //            }
    //        });
    dolloCheck.setEnabled(true);
    dolloCheck.setToolTipText(
        "<html>Activates a Stochastic Dollo model as described in<br>"
            + "Alekseyenko, Lee & Suchard (2008) <i>Syst Biol</i> <b>57</b>: 772-784.</html>");

    PanelUtils.setupComponent(discreteTraitSiteModelCombo);
    discreteTraitSiteModelCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setDiscreteSubstType(
                (DiscreteSubstModelType) discreteTraitSiteModelCombo.getSelectedItem());
          }
        });

    PanelUtils.setupComponent(continuousTraitSiteModelCombo);
    continuousTraitSiteModelCombo.setToolTipText(
        "<html>Select the model of continuous random walk, either homogenous<br>"
            + "or relaxed random walk (RRW) with a choice of distributions.</html>");
    continuousTraitSiteModelCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setContinuousSubstModelType(
                (ContinuousSubstModelType) continuousTraitSiteModelCombo.getSelectedItem());
          }
        });

    PanelUtils.setupComponent(latLongCheck);
    latLongCheck.setToolTipText(
        "<html>Specify whether this is a geographical trait representing <br>"
            + "latitude and longitude. Provides appropriate statistics to log file.</html>");

    latLongCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setIsLatitudeLongitude(latLongCheck.isSelected());
          }
        });
    latLongCheck.setEnabled(false);

    PanelUtils.setupComponent(useLambdaCheck);
    useLambdaCheck.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            ContinuousComponentOptions component =
                (ContinuousComponentOptions)
                    model.getOptions().getComponentOptions(ContinuousComponentOptions.class);
            component.setUseLambda(model, useLambdaCheck.isSelected());
          }
        });
    useLambdaCheck.setToolTipText(
        "<html>Estimate degree of phylogenetic correlation in continuous traits using <br>"
            + "a tree transform. Inspired by Pagel (1999), described in Lemey et al (2013) <i>in prep</i></html>");

    PanelUtils.setupComponent(activateBSSVS);
    activateBSSVS.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setActivateBSSVS(activateBSSVS.isSelected());
          }
        });
    activateBSSVS.setToolTipText(
        "<html>Activates Bayesian stochastic search variable selection on the rates as described in<br>"
            + "Lemey, Rambaut, Drummond & Suchard (2009) <i>PLoS Computational Biology</i> <b>5</b>: e1000520</html>");

    // ============ micro-sat ================
    microsatName.setColumns(30);
    microsatName.addKeyListener(
        new java.awt.event.KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            model.getMicrosatellite().setName(microsatName.getText());
          }
        });
    microsatMax.setColumns(10);
    microsatMax.addKeyListener(
        new java.awt.event.KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            model.getMicrosatellite().setMax(Integer.parseInt(microsatMax.getText()));
          }
        });
    microsatMin.setColumns(10);
    microsatMin.addKeyListener(
        new java.awt.event.KeyListener() {
          public void keyTyped(KeyEvent e) {}

          public void keyPressed(KeyEvent e) {}

          public void keyReleased(KeyEvent e) {
            model.getMicrosatellite().setMin(Integer.parseInt(microsatMin.getText()));
          }
        });

    PanelUtils.setupComponent(shareMicroSatCheck);
    shareMicroSatCheck.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            model.getOptions().shareMicroSat = shareMicroSatCheck.isSelected();
            if (shareMicroSatCheck.isSelected()) {
              model.getOptions().shareMicroSat();
            } else {
              model.getOptions().unshareMicroSat();
            }
            setOptions();
          }
        });

    PanelUtils.setupComponent(rateProportionCombo);
    rateProportionCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setRatePorportion(
                (MicroSatModelType.RateProportionality) rateProportionCombo.getSelectedItem());
          }
        });
    // rateProportionCombo.setToolTipText("<html>Select the type of microsatellite substitution
    // model.</html>");
    PanelUtils.setupComponent(mutationBiasCombo);
    mutationBiasCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setMutationBias(
                (MicroSatModelType.MutationalBias) mutationBiasCombo.getSelectedItem());
          }
        });
    PanelUtils.setupComponent(phaseCombo);
    phaseCombo.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent ev) {
            model.setPhase((MicroSatModelType.Phase) phaseCombo.getSelectedItem());
          }
        });

    setupPanel();
    setOpaque(false);
  }
Ejemplo n.º 30
0
 @Override
 public void makeErrorLabelsInvisible(Set<Field> fields) {
   if ((fields.contains(Field.ALLE) || fields.contains(Field.ANREDE))
       && errLblAnrede != null
       && comboBoxAnrede != null) {
     errLblAnrede.setVisible(false);
     comboBoxAnrede.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.VORNAME))
       && errLblAnrede != null
       && txtVorname != null) {
     errLblVorname.setVisible(false);
     txtVorname.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.NACHNAME))
       && errLblNachname != null
       && txtNachname != null) {
     errLblNachname.setVisible(false);
     txtNachname.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.STRASSE_HAUSNUMMER))
       && errLblStrasseHausnummer != null
       && txtStrasseHausnummer != null) {
     errLblStrasseHausnummer.setVisible(false);
     txtStrasseHausnummer.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.PLZ))
       && errLblPlz != null
       && txtPlz != null) {
     errLblPlz.setVisible(false);
     txtPlz.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.ORT))
       && errLblOrt != null
       && txtOrt != null) {
     errLblOrt.setVisible(false);
     txtOrt.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.FESTNETZ))
       && errLblFestnetz != null
       && txtFestnetz != null) {
     errLblFestnetz.setVisible(false);
     txtFestnetz.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.NATEL))
       && errLblNatel != null
       && txtNatel != null) {
     errLblNatel.setVisible(false);
     txtNatel.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.EMAIL))
       && errLblEmail != null
       && txtEmail != null) {
     errLblEmail.setVisible(false);
     txtEmail.setToolTipText(null);
   }
   if ((fields.contains(Field.ALLE) || fields.contains(Field.GEBURTSDATUM))
       && errLblGeburtsdatum != null
       && txtGeburtsdatum != null) {
     errLblGeburtsdatum.setVisible(false);
     txtGeburtsdatum.setToolTipText(null);
   }
 }