Search in sources :

Example 1 with TextFieldAutoCompletion

use of cbit.gui.TextFieldAutoCompletion in project vcell by virtualcell.

the class EventPanel method getEventAssignExpressionTextField.

private TextFieldAutoCompletion getEventAssignExpressionTextField() {
    if (eventAssgnExpressionTextField == null) {
        try {
            eventAssgnExpressionTextField = new TextFieldAutoCompletion();
            eventAssgnExpressionTextField.setName("EventAssignExpressionTextField");
        // eventAssgnExpressionTextField.setPreferredSize(new java.awt.Dimension(200, 30));
        // eventAssgnExpressionTextField.setMaximumSize(new java.awt.Dimension(200, 30));
        // eventAssgnExpressionTextField.setMinimumSize(new java.awt.Dimension(200, 30));
        } catch (java.lang.Throwable e) {
            e.printStackTrace(System.out);
        }
    }
    return eventAssgnExpressionTextField;
}
Also used : TextFieldAutoCompletion(cbit.gui.TextFieldAutoCompletion)

Example 2 with TextFieldAutoCompletion

use of cbit.gui.TextFieldAutoCompletion in project vcell by virtualcell.

the class ParameterPropertiesPanel method initialize.

/**
 * Initialize the class.
 */
private void initialize() {
    try {
        nameTextField = new JTextField();
        nameTextField.setEditable(false);
        unitTextField = new JTextField();
        unitTextField.setEditable(false);
        expressionTextField = new TextFieldAutoCompletion();
        expressionTextField.setEditable(false);
        descriptionTextField = new JTextField();
        descriptionTextField.setEditable(false);
        annotationTextArea = new javax.swing.JTextArea("", 1, 30);
        annotationTextArea.setLineWrap(true);
        annotationTextArea.setWrapStyleWord(true);
        annotationTextArea.setEditable(false);
        annotationTextArea.setBackground(UIManager.getColor("TextField.inactiveBackground"));
        nameTextField.addActionListener(eventHandler);
        unitTextField.addActionListener(eventHandler);
        expressionTextField.addActionListener(eventHandler);
        annotationTextArea.addFocusListener(eventHandler);
        nameTextField.addFocusListener(eventHandler);
        expressionTextField.addFocusListener(eventHandler);
        unitTextField.addFocusListener(eventHandler);
        setBackground(Color.white);
        setLayout(new GridBagLayout());
        int gridy = 0;
        GridBagConstraints gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.gridwidth = 2;
        gbc.insets = new java.awt.Insets(0, 4, 0, 4);
        gbc.fill = GridBagConstraints.HORIZONTAL;
        pathLabel = new JLabel("");
        pathLabel.setHorizontalAlignment(SwingConstants.CENTER);
        pathLabel.setFont(pathLabel.getFont().deriveFont(Font.BOLD));
        add(pathLabel, gbc);
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_END;
        JLabel label = new JLabel("Parameter Name");
        add(label, gbc);
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.weightx = 1.0;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_START;
        add(nameTextField, gbc);
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_END;
        label = new JLabel("Description");
        add(label, gbc);
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.weightx = 1.0;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_START;
        add(descriptionTextField, gbc);
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_END;
        label = new JLabel("Unit");
        add(label, gbc);
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.weightx = 1.0;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_START;
        add(unitTextField, gbc);
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_END;
        label = new JLabel("Expression");
        add(label, gbc);
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.weightx = 1.0;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.insets = new Insets(0, 4, 4, 4);
        gbc.anchor = GridBagConstraints.LINE_START;
        add(expressionTextField, gbc);
        gridy++;
        gbc = new java.awt.GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = gridy;
        gbc.insets = new Insets(4, 4, 4, 4);
        gbc.anchor = GridBagConstraints.FIRST_LINE_END;
        add(new JLabel("Annotation"), gbc);
        javax.swing.JScrollPane jsp = new javax.swing.JScrollPane(annotationTextArea);
        gbc = new java.awt.GridBagConstraints();
        gbc.weightx = 1.0;
        gbc.weighty = 1;
        gbc.gridx = 1;
        gbc.gridy = gridy;
        gbc.anchor = GridBagConstraints.LINE_START;
        gbc.fill = java.awt.GridBagConstraints.BOTH;
        gbc.insets = new Insets(4, 4, 4, 4);
        add(jsp, gbc);
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) GridBagConstraints(java.awt.GridBagConstraints) TextFieldAutoCompletion(cbit.gui.TextFieldAutoCompletion) JTextArea(javax.swing.JTextArea)

Example 3 with TextFieldAutoCompletion

use of cbit.gui.TextFieldAutoCompletion in project vcell by virtualcell.

the class OutputFunctionsPanel method getFunctionExpressionTextField.

private TextFieldAutoCompletion getFunctionExpressionTextField() {
    if (functionExpressionTextField == null) {
        try {
            functionExpressionTextField = new TextFieldAutoCompletion();
            functionExpressionTextField.setName("FunctionExpressionTextField");
        } catch (java.lang.Throwable e) {
            e.printStackTrace(System.out);
        }
    }
    return functionExpressionTextField;
}
Also used : TextFieldAutoCompletion(cbit.gui.TextFieldAutoCompletion)

Example 4 with TextFieldAutoCompletion

use of cbit.gui.TextFieldAutoCompletion in project vcell by virtualcell.

the class DatabaseSearchPanel method initialize.

private void initialize() {
    // JLabel nameLabel = new JLabel("Search ");
    nameSearchTextField = new TextFieldAutoCompletion();
    nameSearchTextField.putClientProperty("JTextField.variant", "search");
    textFieldAutoComSet.add(nameSearchTextField);
    advancedButton = new JLabel("<html><u>Advanced &gt;&gt;</u></html>");
    advancedButton.setFont(advancedButton.getFont().deriveFont(advancedButton.getFont().getSize2D() - 1));
    advancedButton.setForeground(Color.blue);
    advancedButton.setVerticalAlignment(SwingConstants.BOTTOM);
    JLabel dateLabel1 = new JLabel("Modified between");
    JLabel dateLabel2 = new JLabel("and");
    advancedOptions.add(dateLabel1);
    advancedOptions.add(dateLabel2);
    startDatePanel = new DatePanel();
    Calendar cal = new GregorianCalendar();
    cal.add(Calendar.DATE, -7);
    startDatePanel.setCalendar(cal);
    advancedOptions.add(startDatePanel);
    endDatePanel = new DatePanel();
    advancedOptions.add(endDatePanel);
    searchButton = new JButton("Search");
    searchButton.setActionCommand(SEARCH_Command);
    cancelButton = new JButton("Show All");
    cancelButton.setActionCommand(SEARCH_SHOW_ALL_COMMAND);
    JPanel mainPanel = new JPanel();
    GridBagLayout gbl_mainPanel = new GridBagLayout();
    gbl_mainPanel.columnWeights = new double[] { 0.0, 1.0 };
    mainPanel.setLayout(gbl_mainPanel);
    // 0
    int gridy = 0;
    GridBagConstraints gbc = new GridBagConstraints();
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.gridwidth = 2;
    gbc.insets = new Insets(2, 5, 5, 0);
    gbc.anchor = GridBagConstraints.LINE_START;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(nameSearchTextField, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.gridwidth = 2;
    gbc.insets = new Insets(0, 5, 5, 0);
    gbc.anchor = GridBagConstraints.LINE_START;
    mainPanel.add(advancedButton, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(2, 5, 5, 5);
    gbc.anchor = GridBagConstraints.LINE_END;
    mainPanel.add(dateLabel1, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.anchor = GridBagConstraints.LINE_START;
    gbc.insets = new Insets(2, 0, 5, 0);
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(startDatePanel, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.insets = new Insets(2, 5, 5, 5);
    gbc.anchor = GridBagConstraints.LINE_END;
    mainPanel.add(dateLabel2, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.anchor = GridBagConstraints.LINE_START;
    gbc.insets = new Insets(2, 0, 5, 0);
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(endDatePanel, gbc);
    gridy++;
    lblSpeciesName = new JLabel("Species Names:");
    GridBagConstraints gbc_lblSpeciesName = new GridBagConstraints();
    gbc_lblSpeciesName.anchor = GridBagConstraints.EAST;
    gbc_lblSpeciesName.insets = new Insets(0, 0, 5, 5);
    gbc_lblSpeciesName.gridx = 0;
    gbc_lblSpeciesName.gridy = 4;
    mainPanel.add(lblSpeciesName, gbc_lblSpeciesName);
    advancedOptions.add(lblSpeciesName);
    lblSpeciesName.setVisible(bEnableSpeciesSearch);
    textFieldSpeciesName = new JTextField();
    GridBagConstraints gbc_textFieldSpeciesName = new GridBagConstraints();
    gbc_textFieldSpeciesName.insets = new Insets(0, 0, 5, 0);
    gbc_textFieldSpeciesName.fill = GridBagConstraints.HORIZONTAL;
    gbc_textFieldSpeciesName.gridx = 1;
    gbc_textFieldSpeciesName.gridy = 4;
    mainPanel.add(textFieldSpeciesName, gbc_textFieldSpeciesName);
    textFieldSpeciesName.setColumns(10);
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.insets = new Insets(10, 5, 0, 5);
    mainPanel.add(searchButton, gbc);
    advancedOptions.add(textFieldSpeciesName);
    textFieldSpeciesName.setVisible(bEnableSpeciesSearch);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 5;
    gbc.insets = new Insets(10, 5, 0, 0);
    gbc.anchor = GridBagConstraints.LINE_START;
    mainPanel.add(cancelButton, gbc);
    JScrollPane scroll = new JScrollPane(mainPanel);
    getContentPanel().setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(0, 0, 0, 0);
    gbc.fill = GridBagConstraints.BOTH;
    getContentPanel().add(scroll, gbc);
    initConnections();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) TextFieldAutoCompletion(cbit.gui.TextFieldAutoCompletion) DatePanel(org.vcell.util.gui.generic.DatePanel)

Example 5 with TextFieldAutoCompletion

use of cbit.gui.TextFieldAutoCompletion in project vcell by virtualcell.

the class BioModelEditorPathwayCommonsPanel method initialize.

private void initialize() {
    searchTextField = new TextFieldAutoCompletion();
    searchTextField.addActionListener(eventHandler);
    searchTextField.putClientProperty("JTextField.variant", "search");
    filterTextField = new TextFieldAutoCompletion();
    filterTextField.addActionListener(eventHandler);
    filterTextField.addKeyListener(eventHandler);
    filterTextField.putClientProperty("JTextField.variant", "filter");
    searchButton = new JButton("Search");
    searchButton.addActionListener(eventHandler);
    sortButton = new JButton("Sort");
    sortButton.addActionListener(eventHandler);
    showPathwayButton = new JButton("Preview");
    showPathwayButton.addActionListener(eventHandler);
    showPathwayButton.setEnabled(false);
    gotoPathwayButton = new JButton("Open Web Link");
    gotoPathwayButton.addActionListener(eventHandler);
    gotoPathwayButton.setEnabled(false);
    responseTree = new JTree();
    responseTreeModel = new ResponseTreeModel();
    responseTree.setModel(responseTreeModel);
    ToolTipManager.sharedInstance().registerComponent(responseTree);
    CollapsiblePanel searchPanel = new CollapsiblePanel("Search", true);
    searchPanel.getContentPanel().setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    searchPanel.getContentPanel().add(searchTextField, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.insets = new Insets(0, 4, 0, 0);
    searchPanel.getContentPanel().add(searchButton, gbc);
    setPreferredSize(new Dimension(475, 300));
    setLayout(new GridBagLayout());
    int gridy = 0;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 4);
    add(searchPanel, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(4, 4, 4, 4);
    gbc.fill = GridBagConstraints.BOTH;
    add(new JScrollPane(responseTree), gbc);
    gridy++;
    CollapsiblePanel filterPanel = new CollapsiblePanel("Filter", true);
    filterPanel.getContentPanel().setLayout(new GridBagLayout());
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 1.0;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.LINE_START;
    filterPanel.getContentPanel().add(filterTextField, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.insets = new Insets(0, 4, 0, 0);
    filterPanel.getContentPanel().add(sortButton, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 4);
    filterPanel.expand(true);
    add(filterPanel, gbc);
    // JPanel optionsField = new JPanel(new GridLayout());
    // ButtonGroup buttonGroup = new ButtonGroup();
    // JRadioButton o1, o2, o3;
    // o1 = new JRadioButton(" Entity ");
    // buttonGroup.add(o1);
    // optionsField.add(o1);
    // o2 = new JRadioButton(" Database ");
    // buttonGroup.add(o2);
    // optionsField.add(o2);
    // o3 = new JRadioButton(" Organism ");
    // buttonGroup.add(o3);
    // optionsField.add(o3);
    // o3.setSelected(true);
    // 
    // gridy ++;
    // CollapsiblePanel optionsPanel = new CollapsiblePanel("Group by... ", true);
    // optionsPanel.getContentPanel().setLayout(new GridBagLayout());
    // gbc = new GridBagConstraints();
    // gbc.gridx = 0;
    // gbc.gridy = gridy;
    // gbc.weightx = 1.0;
    // gbc.fill = GridBagConstraints.HORIZONTAL;
    // gbc.anchor = GridBagConstraints.LINE_START;
    // optionsPanel.getContentPanel().add(optionsField, gbc);
    // 
    // gbc = new GridBagConstraints();
    // gbc.gridx = 0;
    // gbc.gridy = gridy;
    // gbc.weightx = 1.0;
    // gbc.gridwidth = GridBagConstraints.REMAINDER;
    // gbc.fill = GridBagConstraints.HORIZONTAL;
    // gbc.insets = new Insets(4,4,4,4);
    // optionsPanel.expand(false);
    // add(optionsPanel, gbc);
    gridy++;
    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 4, 4, 1);
    add(showPathwayButton, gbc);
    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = gridy;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(4, 1, 4, 4);
    add(gotoPathwayButton, gbc);
    sortButton.setIcon(bAscending ? VCellIcons.sortDownIcon : VCellIcons.sortUpIcon);
    ResponseTreeCellRenderer renderer = new ResponseTreeCellRenderer();
    // renderer.setLeafIcon(null);
    // renderer.setClosedIcon(null);
    // renderer.setOpenIcon(null);
    renderer.setLeafIcon(VCellIcons.pathwayLeafIcon);
    responseTree.setCellRenderer(renderer);
    responseTree.setRootVisible(false);
    responseTree.getSelectionModel().addTreeSelectionListener(eventHandler);
    responseTree.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() <= 1) {
                return;
            }
            showPathway();
        }
    });
    responseTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {

        public void valueChanged(TreeSelectionEvent e) {
            Object obj = responseTree.getLastSelectedPathComponent();
            if (obj == null || !(obj instanceof BioModelNode)) {
                return;
            }
            BioModelNode selectedNode = (BioModelNode) obj;
            Object userObject = selectedNode.getUserObject();
            setSelectedObjects(new Object[] { userObject });
        }
    });
}
Also used : JScrollPane(javax.swing.JScrollPane) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) MouseEvent(java.awt.event.MouseEvent) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) MouseAdapter(java.awt.event.MouseAdapter) TreeSelectionListener(javax.swing.event.TreeSelectionListener) BioModelNode(cbit.vcell.desktop.BioModelNode) Dimension(java.awt.Dimension) CollapsiblePanel(org.vcell.util.gui.CollapsiblePanel) JTree(javax.swing.JTree) TextFieldAutoCompletion(cbit.gui.TextFieldAutoCompletion) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent)

Aggregations

TextFieldAutoCompletion (cbit.gui.TextFieldAutoCompletion)6 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3 Insets (java.awt.Insets)3 JButton (javax.swing.JButton)2 JLabel (javax.swing.JLabel)2 JScrollPane (javax.swing.JScrollPane)2 JTextField (javax.swing.JTextField)2 BioModelNode (cbit.vcell.desktop.BioModelNode)1 ExpressionBindingException (cbit.vcell.parser.ExpressionBindingException)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 Dimension (java.awt.Dimension)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 PropertyVetoException (java.beans.PropertyVetoException)1 Calendar (java.util.Calendar)1