use of com.sun.messaging.jmq.admin.apps.console.util.IntegerField in project openmq by eclipse-ee4j.
the class ObjStoreConFactoryDialog method makeLabelledComponent.
private LabelledComponent makeLabelledComponent(AdministeredObject aobj, String propName) {
LabelledComponent lc = null;
String propType = null;
String propLabel = null;
String propDefault = null;
try {
propType = aobj.getPropertyType(propName);
propLabel = aobj.getPropertyLabel(propName);
propDefault = aobj.getProperty(propName);
} catch (Exception e) {
System.out.println("Exception for property: " + propName + e);
}
if (propType.equals(AdministeredObject.AO_PROPERTY_TYPE_LIST)) {
String listValues = aobj.getPropertyListValues(propName);
String[] comboValues = stringToArray(listValues, "|");
// Remove any "..." from menu, not yet implemented
comboValues = omitOtherValues(comboValues);
// subst any "..." values for "Other..."
changeOtherValues(comboValues);
if (comboValues != null) {
lc = new LabelledComponent(propLabel + ":", new JComboBox(comboValues));
JComboBox comp = (JComboBox) lc.getComponent();
comp.addActionListener(this);
lc.setClientData(propName);
}
extraItems = new LabelledComponent[0];
} else if (propType.equals(AdministeredObject.AO_PROPERTY_TYPE_INTEGER)) {
if (propDefault == null) {
lc = new LabelledComponent(propLabel + ":", new IntegerField(Integer.MIN_VALUE, Integer.MAX_VALUE, propDefault, 7));
} else {
lc = new LabelledComponent(propLabel + ":", new IntegerField(Integer.MIN_VALUE, Integer.MAX_VALUE, 7));
}
lc.setClientData(propName);
} else if (propType.equals(AdministeredObject.AO_PROPERTY_TYPE_LONG)) {
if (propDefault == null) {
lc = new LabelledComponent(propLabel + ":", new LongField(Long.MIN_VALUE, Long.MAX_VALUE, propDefault, 7));
} else {
lc = new LabelledComponent(propLabel + ":", new LongField(Long.MIN_VALUE, Long.MAX_VALUE, 7));
}
lc.setClientData(propName);
} else if (propType.equals(AdministeredObject.AO_PROPERTY_TYPE_BOOLEAN)) {
lc = new LabelledComponent(propLabel + ":", new JCheckBox());
lc.setClientData(propName);
} else if (propType.equals(AdministeredObject.AO_PROPERTY_TYPE_STRING)) {
lc = new LabelledComponent(propLabel + ":", new JTextField(15));
lc.setClientData(propName);
} else {
lc = new LabelledComponent(propLabel + ":", new JTextField(15));
lc.setClientData(propName);
}
return lc;
}
use of com.sun.messaging.jmq.admin.apps.console.util.IntegerField in project openmq by eclipse-ee4j.
the class BrokerServicePropsDialog method createWorkPanel.
@Override
public JPanel createWorkPanel() {
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;
}
use of com.sun.messaging.jmq.admin.apps.console.util.IntegerField in project openmq by eclipse-ee4j.
the class BrokerQueryDialog method makeBasicTab.
public JPanel makeBasicTab() {
JPanel workPanel;
GridBagLayout workGridbag;
GridBagConstraints workConstraints;
LabelledComponent tmpLabelC;
LabelledComponent[] lvpItems;
LabelValuePanel lvp;
workPanel = new JPanel();
workGridbag = new GridBagLayout();
workPanel.setLayout(workGridbag);
workConstraints = new GridBagConstraints();
workConstraints.gridx = 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;
/*
* Removed metric interval lvpItems = new LabelledComponent[6];
*/
lvpItems = new LabelledComponent[7];
versionLbl = new JLabel();
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_VERSION_STR), versionLbl);
lvpItems[0] = tmpLabelC;
instanceNameLbl = new JLabel();
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_INSTANCE_NAME), instanceNameLbl);
lvpItems[1] = tmpLabelC;
portTF = new IntegerField(0, Integer.MAX_VALUE, 10);
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_PORT), portTF);
lvpItems[2] = tmpLabelC;
autoCreateTopicCkb = new JCheckBox();
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_ACREATE_TOPICS), autoCreateTopicCkb);
lvpItems[3] = tmpLabelC;
autoCreateQueueCkb = new JCheckBox();
autoCreateQueueCkb.addActionListener(this);
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_ACREATE_QUEUES), autoCreateQueueCkb);
lvpItems[4] = tmpLabelC;
/*
* Active Consumers
*/
activeConsumerIF = new IntegerField(0, Integer.MAX_VALUE, 10);
activeConsumerSF = new SpecialValueField(activeConsumerIF, acr.getString(acr.I_BROKER_UNLIMITED));
activeConsumerLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_AUTOCREATED_ACTIVE_CONSUMER), activeConsumerSF, LabelledComponent.NORTH);
lvpItems[5] = activeConsumerLabelC;
/*
* Failover Consumers
*/
failoverConsumerIF = new IntegerField(0, Integer.MAX_VALUE, 10);
failoverConsumerSF = new SpecialValueField(failoverConsumerIF, acr.getString(acr.I_BROKER_UNLIMITED));
failoverConsumerLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_AUTOCREATED_FAILOVER_CONSUMER), failoverConsumerSF, LabelledComponent.NORTH);
lvpItems[6] = failoverConsumerLabelC;
lvp = new LabelValuePanel(lvpItems, 4, 5);
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
return (workPanel);
}
use of com.sun.messaging.jmq.admin.apps.console.util.IntegerField in project openmq by eclipse-ee4j.
the class BrokerQueryDialog method makeMsgTab.
public JPanel makeMsgTab() {
JPanel workPanel;
GridBagLayout workGridbag;
GridBagConstraints workConstraints;
LabelledComponent tmpLabelC;
LabelledComponent[] lvpItems;
LabelValuePanel lvp;
workPanel = new JPanel();
workGridbag = new GridBagLayout();
workPanel.setLayout(workGridbag);
workConstraints = new GridBagConstraints();
workConstraints.gridx = 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];
maxNumMsgsInMemDskTF = new IntegerField(0, Integer.MAX_VALUE, 10);
maxNumMsgsInMemDskSF = new SpecialValueField(maxNumMsgsInMemDskTF, acr.getString(acr.I_BROKER_UNLIMITED));
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_MAX_MSGS_IN_MEM_DSK), maxNumMsgsInMemDskSF, LabelledComponent.NORTH);
lvpItems[0] = tmpLabelC;
maxTtlSizeMsgsInMemDskBF = new BytesField(0, Integer.MAX_VALUE, "0", 10);
maxTtlSizeMsgsInMemDskSF = new SpecialValueField(maxTtlSizeMsgsInMemDskBF, acr.getString(acr.I_BROKER_UNLIMITED));
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_MAX_TTL_SIZE_MSGS_IN_MEM_DSK), maxTtlSizeMsgsInMemDskSF, LabelledComponent.NORTH);
lvpItems[1] = tmpLabelC;
maxMsgSizeBF = new BytesField(0, Integer.MAX_VALUE, "0", 10);
maxMsgSizeSF = new SpecialValueField(maxMsgSizeBF, acr.getString(acr.I_BROKER_UNLIMITED));
tmpLabelC = new LabelledComponent(acr.getString(acr.I_BROKER_MAX_MSG_SIZE), maxMsgSizeSF, LabelledComponent.NORTH);
lvpItems[2] = tmpLabelC;
lvp = new LabelValuePanel(lvpItems, 4, 5);
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
return (workPanel);
}
use of com.sun.messaging.jmq.admin.apps.console.util.IntegerField in project openmq by eclipse-ee4j.
the class BrokerDialog method createWorkPanel.
@Override
public JPanel createWorkPanel() {
JPanel workPanel = new JPanel();
GridBagLayout workGridbag = new GridBagLayout();
workPanel.setLayout(workGridbag);
GridBagConstraints workConstraints = new GridBagConstraints();
JPanel brokerPanel = new JPanel();
GridBagLayout brokerGridbag = new GridBagLayout();
brokerPanel.setLayout(brokerGridbag);
GridBagConstraints brokerConstraints = new GridBagConstraints();
brokerConstraints.gridx = 0;
brokerConstraints.gridy = 0;
brokerConstraints.anchor = GridBagConstraints.EAST;
JLabel l = new JLabel(acr.getString(acr.I_BROKER_NAME));
brokerGridbag.setConstraints(l, brokerConstraints);
brokerPanel.add(l);
brokerConstraints.gridx = 1;
brokerConstraints.gridy = 0;
brokerConstraints.anchor = GridBagConstraints.WEST;
brokerConstraints.insets = new Insets(0, 5, 0, 0);
brokerNameTF = new JTextField(20);
brokerGridbag.setConstraints(brokerNameTF, brokerConstraints);
brokerPanel.add(brokerNameTF);
LabelledComponent[] items;
items = new LabelledComponent[4];
hostTF = new JTextField(DEFAULT_BROKER_HOST, 10);
items[0] = new LabelledComponent(acr.getString(acr.I_BROKER_HOST), hostTF);
portTF = new IntegerField(0, Integer.MAX_VALUE, DEFAULT_PRIMARY_PORT, 10);
items[1] = new LabelledComponent(acr.getString(acr.I_BROKER_PORT), portTF);
userTF = new JTextField(BrokerAdmin.DEFAULT_ADMIN_USERNAME, 10);
items[2] = new LabelledComponent(acr.getString(acr.I_BROKER_USERNAME), userTF);
passwdTF = new JPasswordField("", 10);
items[3] = new LabelledComponent(acr.getString(acr.I_BROKER_PASSWD), passwdTF);
LabelValuePanel lvp = new LabelValuePanel(items, 4, 4);
workConstraints.gridx = 0;
workConstraints.anchor = GridBagConstraints.WEST;
workConstraints.fill = GridBagConstraints.NONE;
workConstraints.ipadx = 0;
workConstraints.ipady = 0;
workConstraints.weightx = 1.0;
workConstraints.gridy = 0;
workGridbag.setConstraints(brokerPanel, workConstraints);
workPanel.add(brokerPanel);
workConstraints.gridy = 1;
workConstraints.insets = new Insets(10, 0, 0, 0);
workConstraints.fill = GridBagConstraints.HORIZONTAL;
JSeparator sep = new JSeparator();
workGridbag.setConstraints(sep, workConstraints);
workPanel.add(sep);
workConstraints.gridy = 2;
// reset
workConstraints.insets = new Insets(0, 0, 0, 0);
workConstraints.fill = GridBagConstraints.NONE;
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
ta = new JTextArea(acr.getString(acr.W_SAVE_AS_CLEAR_TEXT));
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
Color bgColor = brokerPanel.getBackground();
ta.setBackground(bgColor);
Color fgColor = l.getForeground();
ta.setForeground(fgColor);
ta.setFont(l.getFont());
// Find longer of:
// 1) Broker Label: ______
// 2) LabelValuePanel
int width1 = l.getPreferredSize().width + 5 + brokerNameTF.getPreferredSize().width;
int width2 = lvp.getPreferredSize().width;
if (width1 >= width2) {
ta.setSize(width1, 1);
} else {
ta.setSize(width2, 1);
}
ta.setEditable(false);
Dimension textSize = ta.getPreferredSize();
ta.setSize(textSize);
workConstraints.gridy = 3;
workGridbag.setConstraints(ta, workConstraints);
workPanel.add(ta);
return (workPanel);
}
Aggregations