JPanel workPanel;
GridBagLayout workGridbag;
GridBagConstraints workConstraints;
LabelledComponent tmpLabelC;
LabelledComponent lvpItems[];
LabelValuePanel lvp;
JSeparator sep;
workPanel = new JPanel();
workGridbag = new GridBagLayout();
workPanel.setLayout(workGridbag);
workConstraints = new GridBagConstraints();
/*
* Initialize.
*/
workConstraints.gridx = 0;
workConstraints.gridy = 0;
workConstraints.anchor = GridBagConstraints.WEST;
workConstraints.fill = GridBagConstraints.NONE;
workConstraints.insets = new Insets(5, 0, 5, 0);
workConstraints.ipadx = 0;
workConstraints.ipady = 0;
workConstraints.weightx = 1.0;
lvpItems = new LabelledComponent[3];
svcName = new JLabel();
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_NAME) + ":",
svcName);
workGridbag.setConstraints(tmpLabelC, workConstraints);
lvpItems[0] = tmpLabelC;
// for radio buttons for dynamic / static port number
JPanel servicePanel = new JPanel();
GridBagLayout serviceGridbag = new GridBagLayout();
servicePanel.setLayout(serviceGridbag);
GridBagConstraints serviceConstraints = new GridBagConstraints();
/*
* Initialize.
*/
serviceConstraints.anchor = GridBagConstraints.WEST;
serviceConstraints.insets = new Insets(0, 0, 0, 0);
serviceConstraints.gridx = 0;
serviceConstraints.gridy = 0;
dynamicPortButton = new JRadioButton();
dynamicPortButton.addActionListener(this);
serviceGridbag.setConstraints(dynamicPortButton, serviceConstraints);
servicePanel.add(dynamicPortButton);
serviceConstraints.gridx = 0;
serviceConstraints.gridy = 1;
staticPortButton = new JRadioButton();
staticPortButton.addActionListener(this);
serviceGridbag.setConstraints(staticPortButton, serviceConstraints);
servicePanel.add(staticPortButton);
ButtonGroup servicePortGroup = new ButtonGroup();
servicePortGroup.add(dynamicPortButton);
servicePortGroup.add(staticPortButton);
serviceConstraints.gridx = 1;
serviceConstraints.gridy = 0;
JLabel dynamicLabel = new JLabel(acr.getString(acr.I_DYNAMIC_CAP) + ":");
serviceGridbag.setConstraints(dynamicLabel, serviceConstraints);
servicePanel.add(dynamicLabel);
serviceConstraints.gridx = 1;
serviceConstraints.gridy = 1;
JLabel staticLabel = new JLabel(acr.getString(acr.I_STATIC_CAP) + ":");
serviceGridbag.setConstraints(staticLabel, serviceConstraints);
servicePanel.add(staticLabel);
serviceConstraints.gridx = 2;
serviceConstraints.gridy = 0;
serviceConstraints.insets = new Insets(0, 5, 0, 0);
dynamicPortLabel = new JLabel();
serviceGridbag.setConstraints(dynamicPortLabel, serviceConstraints);
servicePanel.add(dynamicPortLabel);
serviceConstraints.gridx = 2;
serviceConstraints.gridy = 1;
serviceConstraints.insets = new Insets(0, 5, 0, 0);
staticPortIF = new IntegerField(0, Integer.MAX_VALUE, 15);
staticPortIF.setEnabled(false);
serviceGridbag.setConstraints(staticPortIF, serviceConstraints);
servicePanel.add(staticPortIF);
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_PORT)+":",
servicePanel, LabelledComponent.NORTH);
workGridbag.setConstraints(tmpLabelC, workConstraints);
lvpItems[1] = tmpLabelC;
// Set this so that we can enable/disable this component
svcPortComponent = lvpItems[1];
svcState = new JLabel();
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_STATE)+":",
svcState);
workGridbag.setConstraints(tmpLabelC, workConstraints);
lvpItems[2] = tmpLabelC;
lvp = new LabelValuePanel(lvpItems, 4, 0);
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
workConstraints.gridy = 1;
sep = new JSeparator();
workConstraints.fill = GridBagConstraints.HORIZONTAL;
workGridbag.setConstraints(sep, workConstraints);
workPanel.add(sep);
/*
* Reset
*/
workConstraints.fill = GridBagConstraints.NONE;
workConstraints.gridy = 2;
lvpItems = new LabelledComponent[2];
allocatedThreads = new JLabel();
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_CUR_THREADS) + ":",
allocatedThreads);
workGridbag.setConstraints(tmpLabelC, workConstraints);
lvpItems[0] = tmpLabelC;
numConnections = new JLabel();
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_NUM_CXN) + ":",
numConnections);
workGridbag.setConstraints(tmpLabelC, workConstraints);
lvpItems[1] = tmpLabelC;
lvp = new LabelValuePanel(lvpItems, 4, 0);
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
workConstraints.gridy = 3;
sep = new JSeparator();
workConstraints.fill = GridBagConstraints.HORIZONTAL;
workGridbag.setConstraints(sep, workConstraints);
workPanel.add(sep);
/*
* Reset
*/
workConstraints.fill = GridBagConstraints.NONE;
workConstraints.gridy = 4;
lvpItems = new LabelledComponent[2];
minThreads = new IntegerField(0, Integer.MAX_VALUE, 15);
minThreads.addActionListener(this);
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_MIN_THREADS) + ":",
minThreads);
workGridbag.setConstraints(tmpLabelC, workConstraints);
workPanel.add(tmpLabelC);
lvpItems[0] = tmpLabelC;
maxThreads = new IntegerField(0, Integer.MAX_VALUE, 15);
maxThreads.addActionListener(this);
tmpLabelC = new LabelledComponent(
ar.getString(ar.I_JMQCMD_SVC_MAX_THREADS) + ":",
maxThreads);
workGridbag.setConstraints(tmpLabelC, workConstraints);
lvpItems[1] = tmpLabelC;
lvp = new LabelValuePanel(lvpItems, 4, 0);
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
return workPanel;
}