Search in sources :

Example 11 with ScrollTable

use of org.vcell.util.gui.ScrollTable in project vcell by virtualcell.

the class ElectricalMembraneMappingPanel method getScrollPaneTable1.

/**
 * Return the ScrollPaneTable1 property value.
 * @return cbit.gui.JTableFixed
 */
private ScrollTable getScrollPaneTable1() {
    if (ivjScrollPaneTable1 == null) {
        try {
            ivjScrollPaneTable1 = new ScrollTable();
            ivjScrollPaneTable1.setName("ScrollPaneTable1");
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return ivjScrollPaneTable1;
}
Also used : ScrollTable(org.vcell.util.gui.ScrollTable)

Example 12 with ScrollTable

use of org.vcell.util.gui.ScrollTable in project vcell by virtualcell.

the class KineticsTypeTemplatePanel method getScrollPaneTable.

private ScrollTable getScrollPaneTable() {
    if (ivjScrollPaneTable == null) {
        try {
            ivjScrollPaneTable = new ScrollTable();
            ivjScrollPaneTable.setModel(getParameterTableModel());
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return ivjScrollPaneTable;
}
Also used : ScrollTable(org.vcell.util.gui.ScrollTable)

Example 13 with ScrollTable

use of org.vcell.util.gui.ScrollTable in project vcell by virtualcell.

the class TransformMassActionPanel method getTable.

private ScrollTable getTable() {
    if (transMATable == null) {
        transMATable = new ScrollTable() {

            // Implement table cell tool tips.
            public String getToolTipText(MouseEvent e) {
                String tip = null;
                java.awt.Point p = e.getPoint();
                int rowIndex = rowAtPoint(p);
                int colIndex = columnAtPoint(p);
                int realColumnIndex = convertColumnIndexToModel(colIndex);
                if (realColumnIndex == TransformMassActionTableModel.COLUMN_REMARK) {
                    // Remark column
                    tip = getValueAt(rowIndex, colIndex) + "";
                } else {
                    // You can omit this part if you know you don't
                    // have any renderers that supply their own tool
                    // tips.
                    tip = super.getToolTipText(e);
                }
                return tip;
            }
        };
        transMATable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
        transMATable.setName("ScrollPaneTable1");
        transMATable.setBounds(0, 0, 450, 400);
        // add table model
        transMATable.setModel(getTableModel());
        transMATable.createDefaultColumnsFromModel();
        // set cell renderer
        for (int i = 0; i < transMATable.getModel().getColumnCount(); i++) {
            TableColumn column = transMATable.getColumnModel().getColumn(i);
            column.setCellRenderer(new TransformMassActionTableRenderer(transMATable.getDefaultRenderer(Boolean.class)));
        }
    }
    return transMATable;
}
Also used : ScrollTable(org.vcell.util.gui.ScrollTable) MouseEvent(java.awt.event.MouseEvent) TableColumn(javax.swing.table.TableColumn)

Example 14 with ScrollTable

use of org.vcell.util.gui.ScrollTable in project vcell by virtualcell.

the class MathOverridesPanel method getJTableFixed.

/**
 * Return the JTableFixed property value.
 * @return cbit.gui.JTableFixed
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private ScrollTable getJTableFixed() {
    if (ivjJTableFixed == null) {
        try {
            ivjJTableFixed = new ScrollTable();
            ivjJTableFixed.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
            ivjJTableFixed.setName("JTableFixed");
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    return ivjJTableFixed;
}
Also used : ScrollTable(org.vcell.util.gui.ScrollTable)

Example 15 with ScrollTable

use of org.vcell.util.gui.ScrollTable in project vcell by virtualcell.

the class BioPaxObjectPropertiesPanel method initialize.

private void initialize() {
    try {
        table = new ScrollTable();
        tableModel = new BioPaxObjectPropertiesTableModel(table);
        table.setModel(tableModel);
        details = new JTextPane();
        details.setContentType("text/html");
        details.setEditable(false);
        JScrollPane scrl = new JScrollPane(details);
        table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    BioPaxObjectProperty property = tableModel.getValueAt(table.getSelectedRow());
                    if (property != null) {
                        final String htmlStart = "<html><font face = \"Arial\"><font size =\"-2\">";
                        final String htmlEnd = "</font></font></html>";
                        if (!property.getDetails().isEmpty()) {
                            details.setText(htmlStart + property.getDetails() + htmlEnd);
                        } else if ((property.value != null) && !property.value.isEmpty()) {
                            String text = FormatDetails(property);
                            details.setText(htmlStart + text + htmlEnd);
                        } else {
                            details.setText(htmlStart + "row: " + table.getSelectedRow() + ", col: " + table.getSelectedColumn() + htmlEnd);
                        }
                    }
                }
            }
        });
        splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, table.getEnclosingScrollPane(), scrl);
        splitPane.setOneTouchExpandable(true);
        splitPane.setDividerLocation(150);
        // provide minimum sizes for the two components in the split pane
        Dimension minimumSize = new Dimension(100, 50);
        table.getEnclosingScrollPane().setMinimumSize(minimumSize);
        scrl.setMinimumSize(minimumSize);
        setLayout(new BorderLayout());
        // add(table.getEnclosingScrollPane(), BorderLayout.CENTER);
        // add(details, BorderLayout.CENTER);
        add(splitPane, BorderLayout.CENTER);
        setBackground(Color.white);
        table.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    // launch the browser when double click on hyperlinks
                    Point pt = e.getPoint();
                    int crow = table.rowAtPoint(pt);
                    int ccol = table.columnAtPoint(pt);
                    if (table.convertColumnIndexToModel(ccol) == BioPaxObjectPropertiesTableModel.Column_Value) {
                        BioPaxObjectProperty property = tableModel.getValueAt(crow);
                        BioPaxObject bioPaxObject = property.bioPaxObject;
                        if (bioPaxObject == null) {
                            BioModelEntityObject bioModelEntityObject = property.bioModelEntityObject;
                            if (bioModelEntityObject != null) {
                                if (bioModelEntityObject instanceof SpeciesContext) {
                                    selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE, ActiveViewID.reaction_diagram), new Object[] { bioModelEntityObject });
                                } else if (bioModelEntityObject instanceof MolecularType) {
                                    selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE, ActiveViewID.species_definitions), new Object[] { bioModelEntityObject });
                                }
                            } else if (((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getFormalNames() == null || ((Entity) BioPaxObjectPropertiesPanel.this.bioPaxObject).getFormalNames().size() == 0) {
                                lookupFormalName(crow);
                            }
                        } else if (bioPaxObject instanceof Xref) {
                            // if xRef, get url
                            String url = ((Xref) bioPaxObject).getURL();
                            DialogUtils.browserLauncher(BioPaxObjectPropertiesPanel.this, url, "Wrong URL.");
                        } else if (bioPaxObject instanceof SBEntity) {
                            // TODO: kineticLaw
                            SBEntity sbE = (SBEntity) bioPaxObject;
                            if (sbE.getID().contains("kineticLaw")) {
                                // String url = "http://sabio.h-its.org/sabioRestWebServices/kineticLaws/" + sbE.getID().substring(sbE.getID().indexOf("kineticLaw") + 10);
                                String url = "http://sabiork.h-its.org/kindatadirectiframe.jsp?kinlawid=" + sbE.getID().substring(sbE.getID().indexOf("kineticLaw") + 10);
                                DialogUtils.browserLauncher(BioPaxObjectPropertiesPanel.this, url, "Wrong URL.");
                            }
                        }
                    }
                }
            }
        });
        // --- end of addMouseListener()
        table.getColumnModel().getColumn(BioPaxObjectPropertiesTableModel.Column_Value).setCellRenderer(new DefaultScrollTableCellRenderer() {

            @Override
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if (column == BioPaxObjectPropertiesTableModel.Column_Value) {
                    BioPaxObjectProperty property = tableModel.getValueAt(row);
                    BioPaxObject bpObject = property.bioPaxObject;
                    String text = property.value;
                    // colorize BLUE and add surround text with <html></html> tags
                    if (bpObject == null) {
                        BioModelEntityObject bioModelEntityObject = property.bioModelEntityObject;
                        if (bioModelEntityObject != null) {
                            if (!isSelected) {
                                setForeground(Color.blue);
                            }
                            setText("<html><u>" + text + "</u></html>");
                        }
                    } else {
                        if (bpObject instanceof Xref) {
                            String url = ((Xref) bpObject).getURL();
                            if (url != null) {
                                setToolTipText(url);
                                if (!isSelected) {
                                    setForeground(Color.blue);
                                }
                                setText("<html><u>" + text + "</u></html>");
                            }
                        } else if (bpObject instanceof SBEntity) {
                            String url = ((SBEntity) bpObject).getID();
                            if (url.contains("kineticLaw")) {
                                setToolTipText(url);
                                if (!isSelected) {
                                    setForeground(Color.blue);
                                }
                                if (url.contains("http")) {
                                    setText("<html><u>" + text + "</u></html>");
                                }
                            }
                        }
                    }
                }
                BioPaxObjectProperty property = tableModel.getValueAt(row);
                if (!property.tooltip.isEmpty()) {
                    setToolTipText(property.tooltip);
                }
                return this;
            }
        });
    // --- end of setCellRenderer()
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : SBEntity(org.vcell.pathway.sbpax.SBEntity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) Entity(org.vcell.pathway.Entity) ScrollTable(org.vcell.util.gui.ScrollTable) BioPaxObject(org.vcell.pathway.BioPaxObject) ListSelectionEvent(javax.swing.event.ListSelectionEvent) SpeciesContext(cbit.vcell.model.SpeciesContext) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) SBEntity(org.vcell.pathway.sbpax.SBEntity) JTextPane(javax.swing.JTextPane) Xref(org.vcell.pathway.Xref) UnificationXref(org.vcell.pathway.UnificationXref) RelationshipXref(org.vcell.pathway.RelationshipXref) PublicationXref(org.vcell.pathway.PublicationXref) BorderLayout(java.awt.BorderLayout) Component(java.awt.Component) JScrollPane(javax.swing.JScrollPane) MouseEvent(java.awt.event.MouseEvent) MouseAdapter(java.awt.event.MouseAdapter) Dimension(java.awt.Dimension) Point(java.awt.Point) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) Point(java.awt.Point) ListSelectionListener(javax.swing.event.ListSelectionListener) MolecularType(org.vcell.model.rbm.MolecularType) JTable(javax.swing.JTable) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) DefaultScrollTableCellRenderer(org.vcell.util.gui.DefaultScrollTableCellRenderer) JSplitPane(javax.swing.JSplitPane)

Aggregations

ScrollTable (org.vcell.util.gui.ScrollTable)18 JPanel (javax.swing.JPanel)4 BorderLayout (java.awt.BorderLayout)3 Dimension (java.awt.Dimension)3 JScrollPane (javax.swing.JScrollPane)3 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Insets (java.awt.Insets)2 Point (java.awt.Point)2 MouseEvent (java.awt.event.MouseEvent)2 TitledBorder (javax.swing.border.TitledBorder)2 ImageException (cbit.image.ImageException)1 LocalVCSimulationDataIdentifier (cbit.vcell.client.ClientSimManager.LocalVCSimulationDataIdentifier)1 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)1 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1 UserDataEntry (cbit.vcell.export.gloworm.atoms.UserDataEntry)1 Curve (cbit.vcell.geometry.Curve)1 SampledCurve (cbit.vcell.geometry.SampledCurve)1 SinglePoint (cbit.vcell.geometry.SinglePoint)1 VariableType (cbit.vcell.math.VariableType)1