use of javax.swing.DefaultListCellRenderer in project vcell by virtualcell.
the class MovingBoundarySolverOptionsPanel method getFrontTrackingPanel.
private JPanel getFrontTrackingPanel() {
JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(BorderFactory.createTitledBorder(GuiConstants.TAB_PANEL_BORDER, "Front Tracking"));
int gridy = 0;
GridBagConstraints gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Front To Volume Nodes Ratio"), gbc);
textFieldFrontToNodeRatio = new JFormattedTextField(DecimalFormat.getInstance());
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
panel.add(textFieldFrontToNodeRatio, gbc);
++gridy;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Front Redistribution Method"), gbc);
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
panel.add(comboBoxRedistMode, gbc);
++gridy;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Full Redistribution Mode"), gbc);
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
panel.add(comboBoxRedistVersion, gbc);
++gridy;
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
gbc.anchor = GridBagConstraints.LINE_END;
panel.add(new JLabel("Redistribution Frequency"), gbc);
NumberFormatter integerFormatter = new NumberFormatter(NumberFormat.getInstance());
integerFormatter.setValueClass(Integer.class);
integerFormatter.setMinimum(1);
integerFormatter.setMaximum(Integer.MAX_VALUE);
textFieldRedistributionFrequency = new JFormattedTextField(integerFormatter);
gbc = new java.awt.GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = gridy;
gbc.fill = java.awt.GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
gbc.insets = new java.awt.Insets(4, 4, 4, 4);
textFieldRedistributionFrequency.setToolTipText("integer only");
panel.add(textFieldRedistributionFrequency, gbc);
comboBoxRedistMode.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (c instanceof JLabel) {
JLabel lbl = (JLabel) c;
lbl.setText(((RedistributionMode) value).getLabel());
}
return c;
}
});
comboBoxRedistVersion.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (c instanceof JLabel) {
JLabel lbl = (JLabel) c;
lbl.setText(((RedistributionVersion) value).getLabel());
}
return c;
}
});
comboBoxExtrapolationMethod.setRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
// TODO Auto-generated method stub
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (c instanceof JLabel) {
JLabel lbl = (JLabel) c;
lbl.setText(((ExtrapolationMethod) value).getLabel());
}
return c;
}
});
return panel;
}
use of javax.swing.DefaultListCellRenderer in project vcell by virtualcell.
the class PDEPlotControlPanel method initConnections.
/**
* Initializes connections
* @exception java.lang.Exception The exception description.
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
getJTextField1().addActionListener(ivjEventHandler);
getJTextField1().addFocusListener(ivjEventHandler);
getDefaultListModelCivilized1().addListDataListener(ivjEventHandler);
getViewFunctionButton().addActionListener(ivjEventHandler);
getPlotVariableJList().setModel(getDefaultListModelCivilized1());
getJSliderTime().getModel().addChangeListener(ivjEventHandler);
getPlotVariableJList().addListSelectionListener(ivjEventHandler);
getPlotVariableJList().setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel c = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (dataInfoProvider == null) {
if (value instanceof DataIdentifier) {
DataIdentifier var = (DataIdentifier) value;
if (var.getVariableType() == VariableType.POSTPROCESSING) {
setToolTipText(getText());
setText(var.getName());
}
}
return this;
}
// System.out.println("rendering object "+value+" of type "+value.getClass());
DataIdentifier var = (DataIdentifier) value;
c.setText(var.getName());
c.setToolTipText("dataInfoProvier not found");
DataSymbolMetadataResolver dataSymbolMetadataResolver = dataInfoProvider.getSimulationModelInfo().getDataSymbolMetadataResolver();
if (dataSymbolMetadataResolver != null && dataSymbolMetadataResolver.getDataSymbolMetadata(var.getName()) != null) {
DataSymbolMetadata dsm = dataSymbolMetadataResolver.getDataSymbolMetadata(var.getName());
String tooltipString = "dataInfoProvider found, but identifier " + var.getName() + " not found";
if (dsm == null) {
tooltipString = "did not find info on variable " + var.getDisplayName();
} else {
c.setText(var.getName() + " [" + dsm.unit + "]");
tooltipString = dsm.tooltipString;
}
c.setToolTipText(tooltipString);
}
return this;
}
});
}
use of javax.swing.DefaultListCellRenderer in project vcell by virtualcell.
the class MIRIAMAnnotationEditor method getJComboBoxURI.
/**
* This method initializes jComboBoxURI
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBoxURI() {
if (jComboBoxURI == null) {
jComboBoxURI = new JComboBox();
DefaultComboBoxModel defaultComboBoxModel = new DefaultComboBoxModel();
for (DataType dataType : vcMetaData.getMiriamManager().getAllDataTypes().values()) {
defaultComboBoxModel.addElement(dataType);
}
jComboBoxURI.setModel(defaultComboBoxModel);
jComboBoxURI.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
return super.getListCellRendererComponent(list, ((DataType) value).getDataTypeName(), index, isSelected, cellHasFocus);
}
});
}
return jComboBoxURI;
}
use of javax.swing.DefaultListCellRenderer in project vcell by virtualcell.
the class ODESolverPlotSpecificationPanel method initConnections.
/**
* Initializes connections
* @exception java.lang.Exception The exception description.
*/
@SuppressWarnings({ "serial", "unchecked" })
private void initConnections() throws java.lang.Exception {
// user code begin {1}
// user code end
getFilterPanel().addPropertyChangeListener(ivjEventHandler);
getYAxisChoice().addListSelectionListener(ivjEventHandler);
this.addPropertyChangeListener(ivjEventHandler);
getXAxisComboBox_frm().addItemListener(ivjEventHandler);
getLogSensCheckbox().addActionListener(ivjEventHandler);
getSensitivityParameterSlider().addChangeListener(ivjEventHandler);
connPtoP1SetTarget();
connPtoP3SetTarget();
getYAxisChoice().setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
ODEDataInterface mdi = getMyDataInterface();
if (mdi == null) {
return this;
}
String varName = (String) value;
ColumnDescription cd = null;
try {
cd = mdi.getColumnDescription(varName);
} catch (ObjectNotFoundException e) {
e.printStackTrace();
}
if (cd instanceof FunctionColumnDescription && ((FunctionColumnDescription) cd).getIsUserDefined()) {
if (function_icon == null) {
function_icon = new ImageIcon(getClass().getResource("/icons/function_icon.png"));
}
setIcon(function_icon);
}
if (mdi.getDataSymbolMetadataResolver() != null && mdi.getDataSymbolMetadataResolver().getDataSymbolMetadata(varName) != null) {
DataSymbolMetadata dsm = mdi.getDataSymbolMetadataResolver().getDataSymbolMetadata(varName);
String tooltipString = dsm.tooltipString;
if (tooltipString == null) {
tooltipString = varName;
}
setToolTipText(tooltipString);
}
return this;
}
});
}
use of javax.swing.DefaultListCellRenderer in project vcell by virtualcell.
the class VCellModelSelectionPanel method initializeComponents.
private void initializeComponents() {
setLayout(new BorderLayout());
listModel = new DefaultListModel<>();
list = new JList<>(listModel);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(new DefaultListCellRenderer());
list.setFixedCellWidth(200);
JScrollPane leftScrollPane = new JScrollPane(list);
ImageIcon imageIcon = new ImageIcon();
imageLabel = new JLabel(imageIcon);
imageScrollPane = new JScrollPane(imageLabel);
imageScrollPane.setMinimumSize(new Dimension(0, 200));
parameterListPanel = new ModelParameterListPanel();
parameterListPanel.setPreferredSize(new Dimension(-1, 200));
JScrollPane parameterScrollPane = new JScrollPane(parameterListPanel);
parameterScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, imageScrollPane, parameterScrollPane);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftScrollPane, verticalSplitPane);
verticalSplitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, event -> {
displayImageOfSelectedModel();
});
add(splitPane, BorderLayout.CENTER);
list.addListSelectionListener(e -> {
if (!e.getValueIsAdjusting()) {
selectedModel = list.getSelectedValue();
displayImageOfSelectedModel();
parameterListPanel.setModel(selectedModel);
}
});
}
Aggregations