use of cbit.vcell.client.configuration.PythonConfigurationPanel3 in project vcell by virtualcell.
the class VCellConfigurationPanel method initialize.
private void initialize() {
generalConfigurationPanel = new GeneralConfigurationPanel();
generalConfigurationPanel.setName("generalConfigurationPanel");
pythonConfigurationPanel = new PythonConfigurationPanel3();
pythonConfigurationPanel.setName("pythonConfigurationPanel");
comsolConfigurationPanel = new ComsolConfigurationPanel();
comsolConfigurationPanel.setName("comsolConfigurationPanel");
bioNetGenConfigurationPanel = new BioNetGenConfigurationPanel();
bioNetGenConfigurationPanel.setName("bioNetGenConfigurationPanel");
configurationOptionsTree = new javax.swing.JTree();
configurationOptionsTreeModel = new ConfigurationOptionsTreeModel(configurationOptionsTree);
configurationOptionsTree.setModel(configurationOptionsTreeModel);
configurationOptionsTree.setEditable(false);
configurationOptionsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
configurationOptionsTree.setRootVisible(false);
configurationOptionsTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
ConfigurationModelNode cmn = (ConfigurationModelNode) e.getNewLeadSelectionPath().getLastPathComponent();
ConfigurationOptionsTreeFolderNode cotfn = (ConfigurationOptionsTreeFolderNode) cmn.getUserObject();
switch(cotfn.getFolderClass()) {
case GENERAL_NODE:
splitPane.setRightComponent(generalConfigurationPanel);
break;
case PYTHON_NODE:
splitPane.setRightComponent(pythonConfigurationPanel);
break;
case COMSOL_NODE:
splitPane.setRightComponent(comsolConfigurationPanel);
break;
case BIONETGEN_NODE:
splitPane.setRightComponent(bioNetGenConfigurationPanel);
break;
}
}
});
JScrollPane treePanel = new javax.swing.JScrollPane(configurationOptionsTree);
// Border margin = new EmptyBorder(5,3,1,1);
// treePanel.setBorder(margin);
Dimension dim = new Dimension(150, 300);
// code that contributes to prevent resizing horizontally
treePanel.setPreferredSize(dim);
treePanel.setMinimumSize(dim);
treePanel.setMaximumSize(dim);
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT) {
// all code below to make it impossible to move the divider
private final int location = 150;
{
// so that the left component cannot be resized
setDividerLocation(location);
// left component is fixed width
setResizeWeight(0);
// this also makes resizing impossible
setDividerSize(0);
// no UI widget on the divider to quickly expand / collapse
setOneTouchExpandable(false);
}
@Override
public int getDividerLocation() {
return location;
}
@Override
public int getLastDividerLocation() {
return location;
}
};
splitPane.setLeftComponent(treePanel);
splitPane.setRightComponent(generalConfigurationPanel);
// ---------------------------------------------------------------------------
JPanel okCancelPanel = new JPanel();
okCancelPanel.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1;
// fake cell used for filling all the vertical empty space
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.WEST;
okCancelPanel.add(new JLabel(""), gbc);
// gbc = new GridBagConstraints();
// gbc.gridx = 1;
// gbc.gridy = 0;
// gbc.insets = new Insets(0, 0, 4, 2); // top, left, bottom, right
// okCancelPanel.add(getOkButton(), gbc);
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.insets = new Insets(0, 2, 4, 4);
okCancelPanel.add(getCloseButton(), gbc);
// --------------------------------------------------------------------------------
setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(1, 1, 1, 1);
add(splitPane, gbc);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(1, 1, 1, 1);
add(okCancelPanel, gbc);
// configurationOptionsTree.addTreeSelectionListener(eventHandler);
// configurationOptionsTree.addMouseListener(eventHandler);
configurationOptionsTreeModel.populateTree();
}
Aggregations