Search in sources :

Example 16 with Plot2D

use of cbit.plot.Plot2D in project vcell by virtualcell.

the class PlotPane method setplot2D1.

/**
 * Set the plot2D1 to a new value.
 * @param newValue cbit.plot.Plot2D
 */
private void setplot2D1(Plot2D newValue) {
    if (ivjplot2D1 != newValue) {
        try {
            Plot2D oldValue = getplot2D1();
            /* Stop listening for events from the current object */
            if (ivjplot2D1 != null) {
                ivjplot2D1.removeChangeListener(ivjEventHandler);
            }
            ivjplot2D1 = newValue;
            /* Listen for events from the new object */
            if (ivjplot2D1 != null) {
                ivjplot2D1.addChangeListener(ivjEventHandler);
            }
            connPtoP4SetSource();
            firePropertyChange("plot2D", oldValue, newValue);
        } catch (java.lang.Throwable ivjExc) {
            handleException(ivjExc);
        }
    }
    ;
}
Also used : SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D)

Example 17 with Plot2D

use of cbit.plot.Plot2D in project vcell by virtualcell.

the class PlotPane method setPlot2D.

/**
 * Sets the plot2D property (cbit.plot.Plot2D) value.
 * @param plot2D The new value for the property.
 * @see #getPlot2D
 */
public void setPlot2D(Plot2D plot2D) {
    Plot2D oldValue = fieldPlot2D;
    fieldPlot2D = plot2D;
    firePropertyChange("plot2D", oldValue, plot2D);
}
Also used : SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D)

Example 18 with Plot2D

use of cbit.plot.Plot2D in project vcell by virtualcell.

the class PlotPane method updateLegend.

/**
 * Comment
 */
private void updateLegend() {
    Plot2D plot = getPlot2DPanel1().getPlot2D();
    SymbolTableEntry[] steList = plot.getSymbolTableEntries();
    DataSymbolMetadataResolver metadataResolver = plot.getDataSymbolMetadataResolver();
    String[] plotLabels = plot.getVisiblePlotColumnTitles();
    int[] plotIndices = plot.getVisiblePlotIndices();
    Component[] legends = getJPanelPlotLegends().getComponents();
    // add legends if necessarry
    if (ml == null) {
        ml = new java.awt.event.MouseAdapter() {

            public void mouseClicked(java.awt.event.MouseEvent evt) {
                String name = ((JLabel) evt.getSource()).getText();
                getPlot2DPanel1().setCurrentPlot(name);
            }
        };
    }
    for (int i = 0; i < plotIndices.length - legends.length / 2; i++) {
        JLabel line = new JLabel();
        JLabel text = new JLabel();
        line.setBorder(new EmptyBorder(6, 0, 0, 0));
        text.setBorder(new EmptyBorder(0, 8, 6, 0));
        getJPanelPlotLegends().add(line);
        getJPanelPlotLegends().add(text);
        text.addMouseListener(ml);
    }
    legends = getJPanelPlotLegends().getComponents();
    // update labels and show them,use reverse loop to generate non-repeatable colors
    for (int i = (plotIndices.length - 1); i >= 0; i--) {
        LineIcon icon = new LineIcon(getPlot2DPanel1().getVisiblePlotPaint(i));
        String plotLabel = null;
        if (plot instanceof SingleXPlot2D) {
            plotLabel = plotLabels[i + 1];
        } else {
            plotLabel = plotLabels[2 * i + 1];
        }
        ((JLabel) legends[2 * i]).setIcon(icon);
        final int head = 20;
        final int tail = 0;
        String tooltipString = "";
        String unitSymbol = "";
        if (metadataResolver != null) {
            DataSymbolMetadata metaData = metadataResolver.getDataSymbolMetadata(plotLabel);
            if (metaData != null && metaData.unit != null) {
                VCUnitDefinition ud = metaData.unit;
                if (ud != null) {
                    unitSymbol += ud.getSymbolUnicode();
                }
            }
            if (metaData != null && metaData.tooltipString != null) {
                tooltipString = metaData.tooltipString;
            }
        }
        String shortLabel = plotLabel;
        if (shortLabel.length() > head + 3 + tail) {
            shortLabel = shortLabel.substring(0, head) + "..." + shortLabel.substring(shortLabel.length() - tail, shortLabel.length());
        }
        // shortLabel = "<html>" + shortLabel + "<font color=\"red\">" + " [" + unitSymbol + "] " + "</font></html>";
        shortLabel = "<html>" + shortLabel + "<font color=\"#8B0000\">" + " [" + unitSymbol + "] " + "</font></html>";
        tooltipString = "<html>" + plotLabel + "<font color=\"#0000FF\">" + " " + tooltipString + " " + "</font></html>";
        ((JLabel) legends[2 * i + 1]).setText(shortLabel);
        ((JLabel) legends[2 * i + 1]).setToolTipText(tooltipString);
        legends[2 * i].setVisible(true);
        legends[2 * i + 1].setVisible(true);
    }
    // if extra ones, hide them
    for (int i = 2 * plotIndices.length; i < legends.length; i++) {
        legends[i].setVisible(false);
    }
}
Also used : DataSymbolMetadataResolver(cbit.vcell.solver.SimulationModelInfo.DataSymbolMetadataResolver) JLabel(javax.swing.JLabel) EnhancedJLabel(org.vcell.util.gui.EnhancedJLabel) Paint(java.awt.Paint) SingleXPlot2D(cbit.plot.SingleXPlot2D) DataSymbolMetadata(cbit.vcell.solver.DataSymbolMetadata) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) VCUnitDefinition(cbit.vcell.units.VCUnitDefinition) SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D) Component(java.awt.Component) EmptyBorder(javax.swing.border.EmptyBorder)

Example 19 with Plot2D

use of cbit.plot.Plot2D in project vcell by virtualcell.

the class Plot2DDataPanel method setPlot2D.

/**
 * Sets the plot2D property (cbit.plot.Plot2D) value.
 * @param plot2D The new value for the property.
 * @see #getPlot2D
 */
public void setPlot2D(Plot2D plot2D) {
    Plot2D oldValue = fieldPlot2D;
    fieldPlot2D = plot2D;
    firePropertyChange("plot2D", oldValue, plot2D);
}
Also used : Plot2D(cbit.plot.Plot2D)

Example 20 with Plot2D

use of cbit.plot.Plot2D in project vcell by virtualcell.

the class Plot2DDataPanel method setplot2D1.

/**
 * Set the plot2D1 to a new value.
 * @param newValue cbit.plot.Plot2D
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void setplot2D1(Plot2D newValue) {
    if (ivjplot2D1 != newValue) {
        try {
            cbit.plot.Plot2D oldValue = getplot2D1();
            /* Stop listening for events from the current object */
            if (ivjplot2D1 != null) {
                ivjplot2D1.removeChangeListener(ivjEventHandler);
            }
            ivjplot2D1 = newValue;
            /* Listen for events from the new object */
            if (ivjplot2D1 != null) {
                ivjplot2D1.addChangeListener(ivjEventHandler);
            }
            connPtoP2SetSource();
            connEtoM1(ivjplot2D1);
            firePropertyChange("plot2D", oldValue, newValue);
        // user code begin {1}
        // user code end
        } catch (java.lang.Throwable ivjExc) {
            // user code begin {2}
            // user code end
            handleException(ivjExc);
        }
    }
    ;
// user code begin {3}
// user code end
}
Also used : Plot2D(cbit.plot.Plot2D)

Aggregations

Plot2D (cbit.plot.Plot2D)24 PlotData (cbit.plot.PlotData)12 SingleXPlot2D (cbit.plot.SingleXPlot2D)12 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)7 PlotPane (cbit.plot.gui.PlotPane)5 SpatialSelectionVolume (cbit.vcell.simdata.SpatialSelectionVolume)4 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)3 VariableType (cbit.vcell.math.VariableType)3 Point (java.awt.Point)3 Hashtable (java.util.Hashtable)3 ChildWindow (cbit.vcell.client.ChildWindowManager.ChildWindow)2 VolVariable (cbit.vcell.math.VolVariable)2 Parameter (cbit.vcell.opt.Parameter)2 SimpleSymbolTable (cbit.vcell.parser.SimpleSymbolTable)2 DataIdentifier (cbit.vcell.simdata.DataIdentifier)2 SpatialSelectionMembrane (cbit.vcell.simdata.SpatialSelectionMembrane)2 DataSymbolMetadataResolver (cbit.vcell.solver.SimulationModelInfo.DataSymbolMetadataResolver)2 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Paint (java.awt.Paint)2