コード例 #1
0
  public UpravitKultPodujatieForm(
      javax.swing.JDialog parent, boolean modal, KulturnePodujatie podujatie) {
    super(parent, modal);
    initComponents();
    setLocationRelativeTo(null);

    kulturnePodujatie = podujatie;

    krajinaComboBox.setEditable(true);
    krajinaComboBox.addActionListener(krajinaComboBox);
    AutoCompleteDecorator.decorate(krajinaComboBox);
    List<String> zoznamKrajin = dajVsetkyKrajiny();
    String krajina;
    krajinaComboBox.addItem(" ");
    for (int i = 0; i < zoznamKrajin.size(); i++) {
      krajina = zoznamKrajin.get(i);
      krajinaComboBox.addItem(krajina);
    }

    // KrajinaTextField.setText(kulturnePodujatie.getKrajina());

    krajinaComboBox.setSelectedItem(kulturnePodujatie.getKrajina());
    MestoTextField.setText(kulturnePodujatie.getMesto());
    NazovTextField.setText(kulturnePodujatie.getNazov());
    DatumDatePicker.setDate(kulturnePodujatie.getDatum());
    TypTextField.setText(kulturnePodujatie.getTyp());
    NavstiveneCheckBox.setSelected(kulturnePodujatie.isNavstivene());
  }
コード例 #2
0
ファイル: PatientsEdit.java プロジェクト: saydulk/Open-MRM
  private void butDeleteActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_butDeleteActionPerformed
    try {
      String sql2 = "select * from patients where patientId='" + txtSearchbyID.getText() + "'";
      ResultSet rst = stm.executeQuery(sql2);

      if (rst.next()) {
        String sql = "delete from patients where patientId='" + txtSearchbyID.getText() + "'";
        stm.executeUpdate(sql);
        JOptionPane.showMessageDialog(
            this,
            "Record Deleted!",
            "Open MRM System",
            javax.swing.JOptionPane.INFORMATION_MESSAGE);
        clear();
        AutoCompleteDecorator.decorate(txtSearchbyName, addPatientData(), strictMatching);
      } else {
        JOptionPane.showMessageDialog(
            this, "Nothing to Delete!", "Open MRM System", javax.swing.JOptionPane.ERROR_MESSAGE);
        return;
      }
    } catch (SQLException ex) {
      JOptionPane.showMessageDialog(
          this, "Error Occured!", "Open MRM System", javax.swing.JOptionPane.ERROR_MESSAGE);
      Logger.getLogger(PatientsEdit.class.getName()).log(Level.SEVERE, null, ex);
    }
  } // GEN-LAST:event_butDeleteActionPerformed
コード例 #3
0
  public SearchAlignment() {
    super();

    this.setTitle("Search Alignment");
    this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    this.setPreferredSize(new Dimension(700, 140));

    AML aml = AML.getInstance();

    // The containing panel
    dialogPanel = new JPanel();
    cl = new CardLayout();
    dialogPanel.setLayout(cl);

    // The search panel
    JLabel desc = new JLabel("Enter Search Term: (min 3 characters)");
    Font font = desc.getFont();
    boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize());
    desc.setFont(boldFont);
    JPanel labelPanel = new JPanel();
    labelPanel.add(desc);
    Alignment a = AML.getInstance().getAlignment();
    int total = a.size();
    mappings = new ArrayList<String>(total);
    for (int i = 0; i < total; i++) {
      Mapping m = a.get(i);
      String map = aml.getSource().getName(m.getSourceId());
      map += " = ";
      map += aml.getTarget().getName(m.getTargetId());
      mappings.add(map);
    }
    searchField = new JTextArea(1, 60);
    searchField.setEditable(true);
    AutoCompleteDecorator.decorate(searchField, mappings, false);
    JPanel selectionPanel = new JPanel();
    selectionPanel.add(searchField);
    cancel = new JButton("Cancel");
    cancel.setPreferredSize(new Dimension(70, 28));
    cancel.addActionListener(this);
    find = new JButton("Find");
    find.setPreferredSize(new Dimension(70, 28));
    find.addActionListener(this);
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(cancel);
    buttonPanel.add(find);

    searchPanel = new JPanel();
    searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.PAGE_AXIS));
    searchPanel.add(labelPanel);
    searchPanel.add(selectionPanel);
    searchPanel.add(buttonPanel);

    dialogPanel.add(searchPanel, "Search");
    cl.show(dialogPanel, "Search");

    this.add(dialogPanel);
    this.pack();
    this.setVisible(true);
  }
コード例 #4
0
ファイル: CreatIndex.java プロジェクト: noon87/CrystalCockpit
  /** Creates new form CreateIndex */
  public CreatIndex() {
    initComponents();
    show_addedColumnBox.setVisible(false);
    scriptText.setEnabled(false);
    show_columnName.removeAllItems();
    show_columnName.setEnabled(false);
    EditModeLabel.setVisible(false);
    addColumn.setVisible(false);
    AutoCompleteDecorator.decorate(list_table_name);
    saveScript.setEnabled(false);

    scriptText.setDisabledTextColor(Color.BLACK);
    show_addedColumnBox.setDisabledTextColor(Color.BLACK);
  }
コード例 #5
0
ファイル: PatientsEdit.java プロジェクト: saydulk/Open-MRM
 public PatientsEdit() throws SQLException {
   initComponents();
   setIconImage(
       Toolkit.getDefaultToolkit()
           .getImage(PatientsEdit.class.getResource("/resources/logo.png")));
   setResizable(false);
   Dimension screenSize = new Dimension(Toolkit.getDefaultToolkit().getScreenSize());
   Dimension windowSize = new Dimension(getPreferredSize());
   int wdwLeft = 50 + screenSize.width / 2 - windowSize.width / 2;
   int wdwTop = screenSize.height / 2 - windowSize.height / 2;
   pack();
   setLocation(wdwLeft, wdwTop);
   setTitle("Update/Delete Patients");
   dbConnect = new DBConnect();
   con = dbConnect.connect();
   stm = con.createStatement();
   AutoCompleteDecorator.decorate(txtSearchbyName, addPatientData(), strictMatching);
 }
コード例 #6
0
ファイル: ElementWindow.java プロジェクト: cbrinkrolf/VANESA
  private void updateWindow(GraphElementAbstract element) {
    p.removeAll();
    // this.element = element;
    // this.ab = (GraphElementAbstract) graphInstance
    // .getPathwayElement(element);
    original = element;
    PropertyWindowListener pwl = new PropertyWindowListener(element);

    JTextField label = new JTextField(20);
    JTextField name = new JTextField(20);

    if (ref != null) {
      this.ab = ref;
      label.setText(ref.getLabel());
      name.setText(ref.getName());
    } else {
      this.ab = original;
      label.setText(ab.getLabel());
      name.setText(ab.getName());
    }

    reference = new JCheckBox();
    knockedOut = new JCheckBox();
    colorButton = new JButton("Colour");
    hideNeighbours = new JButton("Hide all Neighbours");
    showNeighbours = new JButton("Show all Neighbours");
    parametersButton = new JButton("Parameters");
    showLabels = new JButton("Show Labels");

    colorButton.setBackground(ab.getColor());
    colorButton.setToolTipText("Colour");
    colorButton.setActionCommand("colour");
    colorButton.addActionListener(this);

    // System.out.println("label: "+ab.getLabel());
    // System.out.println("name: "+ab.getName());
    label.setName("label");
    name.setName("name");

    label.addFocusListener(pwl);
    name.addFocusListener(pwl);

    reference.setSelected(ab.isReference());
    reference.setToolTipText("Set this element to a reference");
    reference.setActionCommand("reference");
    reference.addActionListener(this);

    MigLayout headerlayout = new MigLayout("fillx", "[right]rel[grow,fill]", "");
    JPanel headerPanel = new JPanel(headerlayout);
    // headerPanel.setBackground(new Color(192, 215, 227));
    headerPanel.add(new JLabel(ab.getBiologicalElement()), "");
    headerPanel.add(new JSeparator(), "gap 10");

    MigLayout layout = new MigLayout("fillx", "[grow,fill]", "");
    p.setLayout(layout);
    p.add(new JLabel("Element"), "gap 5 ");
    p.add(new JLabel(ab.getBiologicalElement()), "wrap,span 3");
    p.add(new JLabel("Label"), "gap 5 ");
    p.add(label, "wrap,span 3");
    p.add(new JLabel("Name"), "gap 5 ");
    p.add(name, "wrap ,span 3");

    // JCheckBox transitionfire = new JCheckBox("Should transition fire:",
    // true);
    // JTextField transitionStatement = new JTextField("true");

    if (ab.isVertex()) {
      BiologicalNodeAbstract bna = (BiologicalNodeAbstract) original;
      String lbl = "";
      if (bna.hasRef()) {
        lbl = bna.getID() + "_" + bna.getRef().getLabel();
      }
      p.add(new JLabel("Reference:"), "gap 5 ");
      p.add(new JLabel(lbl), "wrap ,span 3");

      if (bna.hasRef()) {
        this.deleteRef = new JButton("Delete Reference");
        deleteRef.setToolTipText("Delete Reference");
        deleteRef.setActionCommand("deleteRef");
        deleteRef.addActionListener(this);
        p.add(deleteRef);
        this.pickOrigin = new JButton("Highlight Origin");
        pickOrigin.setToolTipText("Highlight Origin");
        pickOrigin.setActionCommand("pickOrigin");
        pickOrigin.addActionListener(this);
        p.add(pickOrigin);

      } else {
        this.chooseRef = new JButton("Choose Reference");
        chooseRef.setToolTipText("Choose Reference");
        chooseRef.setActionCommand("chooseRef");
        chooseRef.addActionListener(this);
        p.add(chooseRef);
        if (bna.getRefs().size() > 0) {
          this.pickRefs = new JButton("Highlight References");
          pickRefs.setToolTipText("Highlight References");
          pickRefs.setActionCommand("pickRefs");
          pickRefs.addActionListener(this);
          p.add(pickRefs);
        }
      }

      showLabels.setToolTipText("Show all Labels");
      showLabels.setActionCommand("showLabels");
      showLabels.addActionListener(this);
      p.add(showLabels, "wrap");

      JComboBox<String> compartment = new JComboBox<String>();
      addCompartmentItems(compartment);
      AutoCompleteDecorator.decorate(compartment);

      compartment.setSelectedItem(bna.getCompartment());
      compartment.addItemListener(this);

      p.add(new JLabel("Compartment"), "gap 5 ");
      p.add(compartment, "wrap ,span 3");

      // ADDing Attributes (for all nodes)

      // Show Database IDs
      JTextArea dbids = new JTextArea();
      String dbidstring = new String();
      dbids.setEditable(false);
      dbids.setFont(dbids.getFont().deriveFont(Font.BOLD));
      dbids.setBackground(Color.WHITE);

      p.add(new JLabel("IDs known:"), "gap 5");
      p.add(dbids, "wrap, span 3");

      // Show Experiment names and values
      JTextArea experiments = new JTextArea();
      String experimentstring = new String();
      experiments.setEditable(false);
      experiments.setBackground(Color.WHITE);

      p.add(new JLabel("Dataset:"), "gap 5");
      p.add(experiments, "wrap, span 3");

      // Show GO annotations
      JTextArea goannoations = new JTextArea();
      String annotationstring = new String();
      goannoations.setEditable(false);
      goannoations.setForeground(Color.BLUE);
      goannoations.setBackground(Color.WHITE);

      p.add(new JLabel("Gene Ontology:"), "gap 5");
      p.add(goannoations, "wrap, span 3");

      // Show graph properties (local property)
      JTextArea graphproperties = new JTextArea();
      String propertiesstring = new String();
      graphproperties.setEditable(false);
      graphproperties.setForeground(new Color(255, 55, 55));
      graphproperties.setBackground(Color.WHITE);

      p.add(new JLabel("Graph properties:"), "gap 5");
      p.add(graphproperties, "wrap, span 3");

      // JTextField aaSequence = new JTextField(20);
      // aaSequence.setText(protein.getAaSequence());
      // aaSequence.setName("protein");
      // aaSequence.addFocusListener(pwl);
      // p.add(new JLabel("AA-Sequence"), "gap 5 ");
      // p.add(aaSequence, "wrap, span 3");

      String atname, atsvalue;
      double atdvalue;

      ArrayList<String> experimententries = new ArrayList<>(),
          databaseidentries = new ArrayList<>(),
          annotationentries = new ArrayList<>(),
          graphpropertiesentries = new ArrayList<>();

      for (NodeAttribute att : bna.getNodeAttributes()) {
        atname = att.getName();
        atsvalue = att.getStringvalue();
        atdvalue = att.getDoublevalue();

        switch (att.getType()) {
          case NodeAttributeTypes.EXPERIMENT:
            experimententries.add(atname + ":\t" + atdvalue + "\n");
            break;

          case NodeAttributeTypes.DATABASE_ID:
            databaseidentries.add(atname + ":\t" + atsvalue + "\n");
            break;

          case NodeAttributeTypes.ANNOTATION:
            annotationentries.add(atname + ":\t" + atsvalue + "\n");
            break;

          case NodeAttributeTypes.GRAPH_PROPERTY:
            graphpropertiesentries.add(atname + ":\t" + atdvalue + "\n");
            break;

          default:
            break;
        }
      }

      // Sort for more convenient display
      Collections.sort(experimententries);
      for (String exp : experimententries) experimentstring += exp;

      Collections.sort(databaseidentries);
      for (String dbid : databaseidentries) dbidstring += dbid;

      Collections.sort(annotationentries);
      for (String ann : annotationentries) annotationstring += ann;

      Collections.sort(graphpropertiesentries);
      for (String gprop : graphpropertiesentries) propertiesstring += gprop;

      experiments.setText(experimentstring);
      dbids.setText(dbidstring);
      goannoations.setText(annotationstring);
      graphproperties.setText(propertiesstring);

      if (ab instanceof PathwayMap) {
        p.add(new JLabel("Linked to Pathway"), "gap 5 ");
        boolean b = ((PathwayMap) ab).getPathwayLink() == null;
        JCheckBox linked = new JCheckBox("", !b);
        linked.setToolTipText(
            "Shows whether there is a connected Pathway in Memory to this Map (uncheck the Box to delete that Pathway)");
        linked.setActionCommand("pathwayLink");
        linked.addActionListener(this);
        linked.setEnabled(!b);
        p.add(linked, "wrap ,span 3");
      } else if (ab instanceof Protein) {
        Protein protein = (Protein) ab;
        JTextField aaSequence = new JTextField(20);
        aaSequence.setText(protein.getAaSequence());
        aaSequence.setName("protein");
        aaSequence.addFocusListener(pwl);
        p.add(new JLabel("AA-Sequence"), "gap 5 ");
        p.add(aaSequence, "wrap, span 3");
      } else if (ab instanceof DNA) {
        DNA dna = (DNA) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(dna.getNtSequence());
        ntSequence.setName("dna");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof Gene) {
        Gene dna = (Gene) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(dna.getNtSequence());
        ntSequence.setName("gene");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof RNA) {
        RNA rna = (RNA) ab;
        JTextField ntSequence = new JTextField(20);
        ntSequence.setText(rna.getNtSequence());
        ntSequence.setName("rna");
        ntSequence.addFocusListener(pwl);
        p.add(new JLabel("NT-Sequence"), "gap 5 ");
        p.add(ntSequence, "wrap, span 3");
      } else if (ab instanceof Place) {
        p.add(new JLabel("ID"), "gap 5 ");
        JTextField id = new JTextField(20);
        id.setText("P" + Integer.toString(ab.getID()));
        id.setEditable(false);
        p.add(id, "wrap ,span 3");
        Place place = (Place) ab;

        JLabel lswitchPlace = new JLabel("Place Type");
        JComboBox<String> placeList =
            new JComboBox<String>(new String[] {"discrete", "continuous"});
        if (place.isDiscrete()) placeList.setSelectedItem("discrete");
        else placeList.setSelectedItem("continuous");
        placeList.setName("placeList");
        placeList.addFocusListener(pwl);
        p.add(lswitchPlace, "gap 5 ");
        p.add(placeList, "wrap");

        MyJFormattedTextField token;
        MyJFormattedTextField tokenStart;

        JLabel lblTokenStart = new JLabel("Token Start");
        if (place.isDiscrete()) {
          token = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenStart = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenMin = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          tokenMax = new MyJFormattedTextField(MyNumberFormat.getIntegerFormat());
          token.setText((int) place.getToken() + "");
          tokenStart.setText((int) place.getTokenStart() + "");
          tokenMin.setText((int) place.getTokenMin() + "");
          tokenMax.setText((int) place.getTokenMax() + "");
        } else {
          token = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenStart = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenMin = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          tokenMax = new MyJFormattedTextField(MyNumberFormat.getDecimalFormat());
          token.setText(place.getToken() + "");
          tokenStart.setText(place.getTokenStart() + "");
          tokenMin.setText(place.getTokenMin() + "");
          tokenMax.setText(place.getTokenMax() + "");
        }
        JLabel lblToken = new JLabel("Token");

        token.setName("token");
        // token.addFocusListener(pwl);
        token.setEditable(false);
        token.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);

        tokenStart.setName("tokenStart");
        tokenStart.setFocusLostBehavior(JFormattedTextField.COMMIT);
        tokenStart.addFocusListener(pwl);

        tokenMin.setName("tokenMin");
        tokenMin.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
        tokenMin.addFocusListener(pwl);
        JLabel lblTokenMin = new JLabel("min Tokens");

        tokenMax.setName("tokenMax");
        tokenMax.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
        tokenMax.addFocusListener(pwl);
        JLabel lblTokenMax = new JLabel("max Tokens");
        p.add(lblToken, "gap 5 ");
        p.add(token, "wrap");

        p.add(lblTokenStart, "gap 5 ");
        p.add(tokenStart, "");

        constCheck = new JCheckBox("constant");
        constCheck.setActionCommand("constCheck");
        constCheck.addActionListener(this);
        constCheck.setSelected(place.isConstant());
        p.add(constCheck, "wrap");

        if (constCheck.isSelected()) {
          tokenMin.setEnabled(false);
          tokenMax.setEnabled(false);
        }
        p.add(lblTokenMin, "gap 5 ");
        p.add(tokenMin, "wrap");
        p.add(lblTokenMax, "gap 5");
        p.add(tokenMax, "wrap");
      } else if (ab instanceof Transition) {
        JLabel lswitchTrans = new JLabel("Transition Type");
        JComboBox<String> transList =
            new JComboBox<String>(
                new String[] {
                  DiscreteTransition.class.getName(),
                  ContinuousTransition.class.getName(),
                  StochasticTransition.class.getName()
                });
        transList.setSelectedItem(ab.getClass().getCanonicalName());
        transList.setName("transList");
        transList.addFocusListener(pwl);
        p.add(lswitchTrans, "gap 5");
        p.add(transList, "wrap");

        JTextField firingCondition = new JTextField(4);
        JLabel lblFiringCondition = new JLabel("Firing Condition");
        firingCondition.setText(((Transition) ab).getFiringCondition());
        firingCondition.setName("firingCondition");
        firingCondition.addFocusListener(pwl);

        p.add(lblFiringCondition, "gap 5");
        p.add(firingCondition, "wrap");

        if (ab instanceof DiscreteTransition) {
          DiscreteTransition trans = (DiscreteTransition) ab;
          JTextField delay = new JTextField(4);
          JLabel lbldelay = new JLabel("Delay");
          delay.setText(trans.getDelay() + "");
          delay.setName("delay");
          delay.addFocusListener(pwl);

          p.add(lbldelay, "gap 5");
          p.add(delay, "wrap");
        } else if (ab instanceof StochasticTransition) {
          StochasticTransition trans = (StochasticTransition) ab;
          String[] disStrings = {"norm", "exp"};
          // Create the combo box, select item at index 4.
          // Indices start at 0, so 4 specifies the pig.
          JComboBox<String> distributionList = new JComboBox<String>(disStrings);
          distributionList.setSelectedItem(trans.getDistribution());
          distributionList.setName("disList");
          distributionList.addFocusListener(pwl);
          p.add(new JLabel("Distribution"), "gap 5");
          p.add(distributionList, "wrap");
        } else if (ab instanceof ContinuousTransition) {
          ContinuousTransition trans = (ContinuousTransition) ab;
          JTextField maxSpeed = new JTextField(4);
          JLabel lblMaxSpeed = new JLabel("Maximum Speed");
          maxSpeed.setText(trans.getMaximumSpeed());
          maxSpeed.setName("maximumSpeed");
          maxSpeed.addFocusListener(pwl);

          p.add(lblMaxSpeed, "gap 5");
          p.add(maxSpeed, "wrap");

          if (trans.isKnockedOut()) {
            maxSpeed.setEnabled(false);
          }
        }
      }

    } else if (ab.isEdge()) {
      // System.out.println("edge");
      if (ab instanceof PNEdge) {

        PNEdge e = (PNEdge) ab;
        JTextField prob = new JTextField(4);
        prob.setText(e.getActivationProbability() + "");
        prob.setName("activationProb");
        prob.addFocusListener(pwl);
        JLabel lblProb = new JLabel("activation Probability");
        JTextField function = new JTextField(5);
        function.setText(e.getFunction());
        function.setName("function");
        function.addFocusListener(pwl);
        JLabel lblpassingTokens = new JLabel("Edge Function");
        JTextField lowBoundary = new JTextField(5);
        lowBoundary.setText(e.getLowerBoundary() + "");
        lowBoundary.setName("lowBoundary");
        lowBoundary.addFocusListener(pwl);
        JLabel lblLow = new JLabel("lower Boundary");
        JTextField upBoundary = new JTextField(5);
        upBoundary.setText(e.getUpperBoundary() + "");
        upBoundary.setName("upBoundary");
        upBoundary.addFocusListener(pwl);
        JLabel lblUp = new JLabel("upper Boundary");

        // String[] types = { "discrete", "continuous", "inhibition" };
        // Create the combo box, select item at index 4.
        // Indices start at 0, so 4 specifies the pig.
        // JLabel typeList = new JComboBox(types);

        p.add(new JLabel("Edge Type"), "gap 5 ");
        p.add(new JLabel(e.getType()), "wrap");

        JButton dirChanger = new JButton("Change Direction");
        dirChanger.setActionCommand("dirChanger");
        dirChanger.addActionListener(this);
        p.add(dirChanger, "wrap");

        p.add(lblProb, "gap 5");
        p.add(prob, "wrap");
        p.add(lblpassingTokens, "gap 5");
        p.add(function, "wrap");
        p.add(lblLow, "gap 5");
        p.add(lowBoundary, "wrap");
        p.add(lblUp, "gap 5");
        p.add(upBoundary, "wrap");
      }
    }

    p.add(new JLabel("Reference"), "gap 5 ");
    p.add(reference, "wrap, span 3");
    if (ab instanceof Transition) {
      knockedOut.setSelected(((Transition) ab).isKnockedOut());
      knockedOut.setToolTipText("Knock out");
      knockedOut.setActionCommand("knockedOut");
      knockedOut.addActionListener(this);
      p.add(new JLabel("Knocked out"), "gap 5 ");
      p.add(knockedOut, "wrap ,span 3");
    }

    if (ab.isVertex()) {
      hideNeighbours.setToolTipText("Sets all Neighbors of the selected Node to Reference");
      hideNeighbours.setActionCommand("hideNeighbours");
      hideNeighbours.addActionListener(this);
      hideNeighbours.setMaximumSize(new Dimension(120, 30));
      showNeighbours.setToolTipText("Delete Reference flag of all Neighbours of the current Node");
      showNeighbours.setActionCommand("showNeighbours");
      showNeighbours.addActionListener(this);
      showNeighbours.setMaximumSize(new Dimension(120, 30));
      p.add(showNeighbours);
      p.add(hideNeighbours);
    }
    parametersButton.setToolTipText("Show all Parameters");
    parametersButton.setActionCommand("showParameters");
    parametersButton.addActionListener(this);
    p.add(parametersButton);

    p.add(colorButton, "gap 5");
  }
コード例 #7
0
 /** Creates new form GestionarCursoPostgrado */
 public GestionarCursoPostgrado(java.awt.Frame parent, boolean modal) {
   super(parent, modal);
   initComponents();
   AutoCompleteDecorator.decorate(jComboBox1);
 }
コード例 #8
0
  /** Initializes the user interface */
  private void initGui() {
    Insets insets1 = new Insets(5, 5, 0, 5);
    Insets insets2 = new Insets(5, 25, 0, 5);
    Insets insets3 = new Insets(5, 5, 0, 0);
    Insets insets4 = new Insets(5, 0, 0, 5);
    Insets insets5 = new Insets(5, 5, 5, 5);
    Insets insets6 = new Insets(5, 25, 5, 5);
    Insets insets10 = new Insets(10, 10, 10, 10);

    JPanel content = new JPanel(new GridBagLayout());
    getContentPane().add(content);

    // ********************************
    // ** Route properties panel
    // ********************************

    JPanel routeProps = new JPanel(new GridBagLayout());
    routeProps.setBorder(new TitledBorder(new LineBorder(Color.black), "Route Properties"));
    content.add(
        routeProps, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets10, 0, 0));

    // Auto-completion
    List<String> strings = new ArrayList<>();
    strings.add("Copenhagen");
    strings.add("Oslo");
    AutoCompleteDecorator.decorate(originTxT, strings, false);
    AutoCompleteDecorator.decorate(destinationTxT, strings, false);

    // Column 1 widgets
    int gridY = 0;
    nameTxT.setEditable(!readOnlyRoute);
    nameTxT.getDocument().addDocumentListener(new TextFieldChangeListener(nameTxT));
    routeProps.add(
        new JLabel("Name:"),
        new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));
    routeProps.add(
        fixSize(nameTxT, 120),
        new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    originTxT.setEditable(!readOnlyRoute);
    originTxT.getDocument().addDocumentListener(new TextFieldChangeListener(originTxT));
    routeProps.add(
        new JLabel("Origin:"),
        new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));
    routeProps.add(
        fixSize(originTxT, 120),
        new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    destinationTxT.setEnabled(!readOnlyRoute);
    destinationTxT.getDocument().addDocumentListener(new TextFieldChangeListener(destinationTxT));
    routeProps.add(
        new JLabel("Destination:"),
        new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));
    routeProps.add(
        fixSize(destinationTxT, 120),
        new GridBagConstraints(1, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    distanceTxT.setEditable(false);
    routeProps.add(
        new JLabel("Total Distance:"),
        new GridBagConstraints(0, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    routeProps.add(
        fixSize(distanceTxT, 120),
        new GridBagConstraints(1, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));

    // Column 2 widgets
    gridY = 0;
    int h = (int) departurePicker.getPreferredSize().getHeight();
    initDatePicker(departurePicker, departureSpinner);
    routeProps.add(
        new JLabel("Estimated Time of Departure:"),
        new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(
        fixSize(departurePicker, 120),
        new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0));
    routeProps.add(
        fixSize(departureSpinner, 60, h),
        new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0));

    initDatePicker(arrivalPicker, arrivalSpinner);
    routeProps.add(
        new JLabel("Estimated Time of Arrival:"),
        new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(
        fixSize(arrivalPicker, 120),
        new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0));
    routeProps.add(
        fixSize(arrivalSpinner, 60, h),
        new GridBagConstraints(4, gridY++, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0));

    inrouteTxT.setEditable(false);
    routeProps.add(
        new JLabel("Estimated Time in-route:"),
        new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(
        fixSize(inrouteTxT, 180),
        new GridBagConstraints(3, gridY++, 2, 1, 0.0, 0.0, WEST, NONE, insets1, 0, 0));

    etaCalculationTime.setEnabled(!readOnlyRoute);
    etaCalculationTime.addActionListener(this);
    routeProps.add(
        new JLabel("Calculate TTG/ETA using:"),
        new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets6, 0, 0));
    routeProps.add(
        fixSize(etaCalculationTime, 180),
        new GridBagConstraints(3, gridY++, 2, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));

    allSpeeds.setEnabled(!readOnlyRoute);
    allSpeedsBtn.setEnabled(!readOnlyRoute);
    routeProps.add(
        new JLabel("Speed all legs: "),
        new GridBagConstraints(2, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets2, 0, 0));
    routeProps.add(
        fixSize(allSpeeds, 60),
        new GridBagConstraints(3, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets3, 0, 0));
    routeProps.add(
        fixSize(allSpeedsBtn, 60, h),
        new GridBagConstraints(4, gridY, 1, 1, 0.0, 0.0, WEST, NONE, insets4, 0, 0));

    routeProps.add(
        new JLabel(""),
        new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets2, 0, 0));

    // ********************************
    // ** Route detail panel
    // ********************************

    routeTableModel = createRouteTableModel();
    routeDetailTable = new DeltaTable(routeTableModel, DELTA_START_COL_INDEX);
    routeDetailTable.setTableFont(routeDetailTable.getTableFont().deriveFont(10.0f));
    routeDetailTable.setNonEditableBgColor(
        UIManager.getColor("Table.background").darker().darker());
    routeDetailTable.addListSelectionListener(this);

    // Set the minimum column widths
    for (int x = 0; x < COL_MIN_WIDTHS.length; x++) {
      routeDetailTable.getColumn(x).setMinWidth(COL_MIN_WIDTHS[x]);
    }

    // Configure lock column
    routeDetailTable.fixColumnWidth(0, COL_MIN_WIDTHS[0]);
    routeDetailTable.getColumn(0).setCellRenderer(new LockTableCell.CustomBooleanCellRenderer());
    routeDetailTable.getColumn(0).setCellEditor(new LockTableCell.CustomBooleanCellEditor());

    // Configure ETA column
    routeDetailTable.getColumn(7).setCellEditor(new EtaEditor());

    // Configure heading column
    JComboBox<Heading> headingCombo = new JComboBox<>(Heading.values());
    headingCombo.setFont(headingCombo.getFont().deriveFont(10.0f));
    routeDetailTable.getColumn(10).setCellEditor(new DefaultCellEditor(headingCombo));

    JPanel routeTablePanel = new JPanel(new BorderLayout());
    routeTablePanel.add(routeDetailTable, BorderLayout.CENTER);
    routeTablePanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Route Details"));
    content.add(
        routeTablePanel,
        new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, NORTHWEST, BOTH, insets10, 0, 0));

    // ********************************
    // ** Button panel
    // ********************************

    JPanel btnPanel = new JPanel(new GridBagLayout());
    content.add(
        btnPanel,
        new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, NORTHWEST, HORIZONTAL, insets10, 0, 0));

    btnZoomToRoute.addActionListener(this);
    btnZoomToWp.addActionListener(this);
    btnDelete.addActionListener(this);
    btnActivate.addActionListener(this);
    btnClose.addActionListener(this);
    cbVisible.addActionListener(this);
    allSpeedsBtn.addActionListener(this);
    getRootPane().setDefaultButton(btnClose);
    btnPanel.add(
        btnZoomToRoute, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(
        btnZoomToWp, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(
        btnDelete, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(
        btnActivate, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(
        cbVisible, new GridBagConstraints(4, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0));
    btnPanel.add(btnClose, new GridBagConstraints(5, 0, 1, 1, 1.0, 0.0, EAST, NONE, insets5, 0, 0));
  }
コード例 #9
0
 /**
  * Construct the {@link JComboBox} and make it autocompletable.
  *
  * @param genes The genes to select
  */
 public FindGenesView(Gene[] genes) {
   super(genes);
   setEditable(true);
   AutoCompleteDecorator.decorate(this);
 }