DatastreamsPane owner)
throws Exception {
super(gramps, owner, versions.get(0).getID());
m_pid = pid;
m_versions = versions.toArray(new Datastream[]{});
Datastream mostRecent = versions.get(0);
m_mostRecent = mostRecent;
m_owner = owner;
m_labelDims = new JLabel("Control Group").getPreferredSize();
new TextContentEditor(); // causes it to be registered if not already
new ImageContentViewer(); // causes it to be registered if not already
new SVGContentViewer(); // causes it to be registered if not already
new RDFTupleEditor(); // causes it to be registered if not already
// mainPane(commonPane, versionPane)
// NORTH: commonPane(state, controlGroup)
// LEFT: labels
JLabel idLabel = new JLabel("ID");
JLabel stateLabel = new JLabel("State");
JLabel versionableLabel = new JLabel("Versionable");
JLabel controlGroupLabel = new JLabel("Control Group");
JLabel[] leftCommonLabels =
new JLabel[] {idLabel, controlGroupLabel, stateLabel,
versionableLabel};
// RIGHT: values
String[] comboBoxStrings = {"Active", "Inactive", "Deleted"};
m_stateComboBox = new JComboBox(comboBoxStrings);
Administrator.constrainHeight(m_stateComboBox);
if (mostRecent.getState().equals("A")) {
m_stateComboBox.setSelectedIndex(0);
m_stateComboBox.setBackground(Administrator.ACTIVE_COLOR);
} else if (mostRecent.getState().equals("I")) {
m_stateComboBox.setSelectedIndex(1);
m_stateComboBox.setBackground(Administrator.INACTIVE_COLOR);
} else {
m_stateComboBox.setSelectedIndex(2);
m_stateComboBox.setBackground(Administrator.DELETED_COLOR);
}
m_stateComboBox.addActionListener(dataChangeListener);
m_stateComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
String curState;
if (m_stateComboBox.getSelectedIndex() == 1) {
curState = "I";
m_stateComboBox.setBackground(Administrator.INACTIVE_COLOR);
} else if (m_stateComboBox.getSelectedIndex() == 2) {
curState = "D";
m_stateComboBox.setBackground(Administrator.DELETED_COLOR);
} else {
curState = "A";
m_stateComboBox.setBackground(Administrator.ACTIVE_COLOR);
}
m_owner.colorTabForState(m_mostRecent.getID(), curState);
}
});
String[] comboBoxStrings2 =
{"Updates will create new version",
"Updates will replace most recent version"};
m_versionableComboBox = new JComboBox(comboBoxStrings2);
Administrator.constrainHeight(m_versionableComboBox);
m_versionableComboBox
.setSelectedIndex(mostRecent.isVersionable() ? NEW_VERSION_ON_UPDATE
: REPLACE_ON_UPDATE);
m_versionableComboBox.addActionListener(dataChangeListener);
JTextArea controlGroupValueLabel =
new JTextArea(getControlGroupString(mostRecent
.getControlGroup().toString()));
controlGroupValueLabel.setBackground(Administrator.BACKGROUND_COLOR);
controlGroupValueLabel.setEditable(false);
JComponent[] leftCommonValues =
new JComponent[] {new JLabel(mostRecent.getID()),
controlGroupValueLabel, m_stateComboBox,
m_versionableComboBox};
JPanel leftCommonPane = new JPanel();
GridBagLayout leftCommonGridBag = new GridBagLayout();