use of com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel in project openmq by eclipse-ee4j.
the class ObjStoreConFactoryDialog method makeTopPanel.
/*
* Top Panel
*/
private JPanel makeTopPanel(boolean propsDlg) {
JPanel topPanel = new JPanel();
topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
GridBagLayout gridbag = new GridBagLayout();
topPanel.setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
JPanel panel1 = new JPanel(new GridLayout(0, 1, -1, -1));
LabelledComponent[] items = new LabelledComponent[3];
checkBox = new JCheckBox();
if (propsDlg) {
// Props Conn Factory
lookupLabel = new JLabel(" ");
cfLabel = new JLabel(" ");
items[0] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_LOOKUP_NAME) + ":", lookupLabel);
lookupItem = items[0];
items[1] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_FACTORY_TYPE) + ":", cfLabel);
} else {
// Add Conn Factory
lookupText = new JTextField(25);
String[] factories = { acr.getString(acr.I_CF), acr.getString(acr.I_QCF), acr.getString(acr.I_TCF), acr.getString(acr.I_XACF), acr.getString(acr.I_XAQCF), acr.getString(acr.I_XATCF) };
factoryCombo = new JComboBox(factories);
items[0] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_LOOKUP_NAME) + ":", lookupText);
items[1] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_FACTORY_TYPE) + ":", factoryCombo, LabelledComponent.NORTH);
}
items[2] = new LabelledComponent(acr.getString(acr.I_READONLY) + ":", checkBox);
LabelValuePanel lvp = new LabelValuePanel(items, 5, 5);
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.NORTHWEST;
gridbag.setConstraints(panel1, c);
topPanel.add(panel1);
c.gridx = 0;
c.gridy = 1;
c.anchor = GridBagConstraints.WEST;
gridbag.setConstraints(lvp, c);
topPanel.add(lvp);
return topPanel;
}
use of com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel 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.LabelValuePanel in project openmq by eclipse-ee4j.
the class BrokerDestAddDialog method createWorkPanel.
@Override
public JPanel createWorkPanel() {
JPanel workPanel;
GridBagLayout workGridbag;
GridBagConstraints workConstraints;
workPanel = new JPanel();
workGridbag = new GridBagLayout();
workConstraints = new GridBagConstraints();
workPanel.setLayout(workGridbag);
workConstraints.anchor = GridBagConstraints.WEST;
LabelledComponent[] items = new LabelledComponent[3];
/*
* Destination Name
*/
nameTF = new JTextField("", 20);
items[0] = new LabelledComponent(acr.getString(acr.I_BROKER_DEST_NAME), nameTF);
/*
* Destination Type
*/
JPanel destTypePanel = createDestTypePanel();
items[1] = new LabelledComponent(acr.getString(acr.I_BROKER_DEST_TYPE), destTypePanel, LabelledComponent.NORTH);
/*
* Destination Properties
*/
JPanel destPropsPanel = createDestPropsPanel();
items[2] = new LabelledComponent("", destPropsPanel);
LabelValuePanel lvp = new LabelValuePanel(items, 5, 5);
workConstraints.gridx = 0;
workConstraints.gridy = 4;
workConstraints.gridwidth = 2;
workConstraints.anchor = GridBagConstraints.CENTER;
workGridbag.setConstraints(lvp, workConstraints);
workPanel.add(lvp);
return (workPanel);
}
use of com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel in project openmq by eclipse-ee4j.
the class ObjStoreDestDialog method createWorkPanel.
@Override
public JPanel createWorkPanel() {
boolean propsDlg = false;
if (getTitle().equals(acr.getString(acr.I_OBJSTORE_DEST_PROPS))) {
propsDlg = true;
}
JPanel workPanel = new JPanel();
GridBagLayout gridbag1 = new GridBagLayout();
workPanel.setLayout(gridbag1);
GridBagConstraints c1 = new GridBagConstraints();
JPanel panel1 = new JPanel(new GridLayout(0, 1, -1, -1));
JPanel panel2 = null;
if (!propsDlg) {
panel2 = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
panel2.setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.ipadx = 0;
c.ipady = -8;
c.anchor = GridBagConstraints.WEST;
queueButton = new JRadioButton(acr.getString(acr.I_QUEUE), true);
gridbag.setConstraints(queueButton, c);
panel2.add(queueButton);
c.gridx = 0;
c.gridy = 1;
c.ipadx = 0;
c.ipady = 8;
c.anchor = GridBagConstraints.WEST;
topicButton = new JRadioButton(acr.getString(acr.I_TOPIC));
gridbag.setConstraints(topicButton, c);
panel2.add(topicButton);
ButtonGroup group = new ButtonGroup();
group.add(queueButton);
group.add(topicButton);
}
LabelledComponent[] items = new LabelledComponent[3];
checkBox = new JCheckBox();
if (propsDlg) {
lookupLabel = new JLabel(" ");
destLabel = new JLabel(" ");
items[0] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_LOOKUP_NAME) + ":", lookupLabel);
items[1] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_DEST_TYPE) + ":", destLabel);
} else {
lookupText = new JTextField(25);
items[0] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_LOOKUP_NAME) + ":", lookupText);
items[1] = new LabelledComponent(acr.getString(acr.I_OBJSTORE_DEST_TYPE) + ":", panel2, LabelledComponent.NORTH);
}
items[2] = new LabelledComponent(acr.getString(acr.I_READONLY) + ":", checkBox);
LabelValuePanel lvp = new LabelValuePanel(items, 5, 5);
c1.gridx = 0;
c1.gridy = 0;
c1.anchor = GridBagConstraints.NORTHWEST;
gridbag1.setConstraints(panel1, c1);
workPanel.add(panel1);
c1.gridx = 0;
c1.gridy = 1;
c1.anchor = GridBagConstraints.WEST;
gridbag1.setConstraints(lvp, c1);
workPanel.add(lvp);
JSeparator separator = new JSeparator();
c1.gridx = 0;
c1.gridy = 2;
// reset
c1.ipady = 0;
// reset
c1.anchor = GridBagConstraints.CENTER;
c1.fill = GridBagConstraints.HORIZONTAL;
c1.insets = new Insets(5, 0, 5, 0);
gridbag1.setConstraints(separator, c1);
workPanel.add(separator);
/*
* From here, list the properties on the destination.
*/
AdministeredObject obj = new com.sun.messaging.Topic();
Properties props = obj.getConfiguration();
LabelledComponent[] items2 = new LabelledComponent[props.size()];
textItems = new JTextField[props.size()];
int i = 0;
for (Enumeration e = obj.enumeratePropertyNames(); e.hasMoreElements(); i++) {
String propName = (String) e.nextElement();
try {
textItems[i] = new JTextField((String) props.get(propName), 25);
items2[i] = new LabelledComponent(obj.getPropertyLabel(propName) + ":", textItems[i]);
} catch (Exception ex) {
}
}
LabelValuePanel lvp2 = new LabelValuePanel(items2, 5, 5);
c1.gridx = 0;
c1.gridy = 3;
c1.anchor = GridBagConstraints.WEST;
gridbag1.setConstraints(lvp2, c1);
workPanel.add(lvp2);
// Set width lookup name label to max width of bottom panel.
if (propsDlg) {
int maxWidth = lvp2.getPreferredSize().width;
JComponent c = items[0].getComponent();
Dimension dim = new Dimension(maxWidth - items[0].getLabelWidth() - 20, c.getPreferredSize().height);
c.setPreferredSize(dim);
}
return (workPanel);
}
use of com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel in project openmq by eclipse-ee4j.
the class ObjStoreDialog method createWorkPanel.
@SuppressWarnings("deprecation")
@Override
public JPanel createWorkPanel() {
String[] jndiPropNames = { Context.INITIAL_CONTEXT_FACTORY, Context.OBJECT_FACTORIES, Context.STATE_FACTORIES, Context.URL_PKG_PREFIXES, Context.PROVIDER_URL, Context.DNS_URL, Context.AUTHORITATIVE, Context.BATCHSIZE, Context.REFERRAL, Context.SECURITY_PROTOCOL, Context.SECURITY_AUTHENTICATION, Context.SECURITY_PRINCIPAL, Context.SECURITY_CREDENTIALS, Context.LANGUAGE, Context.APPLET };
boolean propsDlg = false;
if (getTitle().equals(acr.getString(acr.I_OBJSTORE_PROPS))) {
propsDlg = true;
}
JPanel workPanel = new JPanel();
workPanel.setLayout(new BorderLayout());
JPanel panel1 = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
panel1.setLayout(gridbag);
GridBagConstraints c = new GridBagConstraints();
JPanel osPanel = new JPanel();
GridBagLayout gb = new GridBagLayout();
osPanel.setLayout(gb);
GridBagConstraints c1 = new GridBagConstraints();
JLabel storeLabel = new JLabel(acr.getString(acr.I_OBJSTORE_NAME) + ":");
c1.gridx = 0;
c1.gridy = 0;
c1.anchor = GridBagConstraints.NORTHEAST;
gridbag.setConstraints(storeLabel, c1);
osPanel.add(storeLabel);
osText = new JTextField(25);
DocumentListener docListener = new ObjStoreDocumentListener();
osText.getDocument().addDocumentListener(docListener);
c1.gridx = 1;
c1.gridy = 0;
c1.anchor = GridBagConstraints.WEST;
c1.insets = new Insets(0, 5, 0, 0);
gb.setConstraints(osText, c1);
osPanel.add(osText);
c.gridx = 0;
c.gridy = 0;
c1.anchor = GridBagConstraints.WEST;
panel1.add(osPanel);
if (propsDlg) {
checkBox = new JCheckBox(acr.getString(acr.I_CONNECT_AFTER_UPDATES), true);
} else {
checkBox = new JCheckBox(acr.getString(acr.I_CONNECT_UPON_ADDING), true);
}
checkBox.addActionListener(this);
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 3;
// reset
c.insets = new Insets(0, 0, 0, 0);
c.anchor = GridBagConstraints.WEST;
gridbag.setConstraints(checkBox, c);
JSeparator separator = new JSeparator();
c.gridx = 0;
c.gridy = 2;
c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(5, 0, 5, 0);
gridbag.setConstraints(separator, c);
panel1.add(separator);
JLabel jndiLabel = new JLabel(acr.getString(acr.I_OBJSTORE_JNDI_PROPS));
c.gridx = 0;
c.gridy = 3;
c.gridwidth = 3;
// reset
c.anchor = GridBagConstraints.WEST;
// reset
c.insets = new Insets(0, 0, 0, 0);
// reset c.anchor = GridBagConstraints.WEST;
c.fill = GridBagConstraints.NONE;
gridbag.setConstraints(jndiLabel, c);
panel1.add(jndiLabel);
LabelledComponent[] items = new LabelledComponent[3];
comboBox = new JComboBox(jndiPropNames);
comboBox.addActionListener(this);
items[0] = new LabelledComponent(acr.getString(acr.I_NAME) + ":", comboBox);
valueText = new JTextField(40);
valueText.getDocument().addDocumentListener(docListener);
items[1] = new LabelledComponent(acr.getString(acr.I_VALUE) + ":", valueText);
model = new PropsTableModel();
table = new JTable(model);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel lsm = table.getSelectionModel();
lsm.addListSelectionListener(this);
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
items[2] = new LabelledComponent(" ", scrollPane);
lvp = new LabelValuePanel(items, 5, 5);
c.gridx = 0;
c.gridy = 4;
c.gridwidth = 2;
c.anchor = GridBagConstraints.CENTER;
gridbag.setConstraints(lvp, c);
panel1.add(lvp);
//
// Make width of list the same as width of text field and
// 8 rows in height.
//
int width = valueText.getPreferredSize().width;
table.getRowHeight();
table.setPreferredScrollableViewportSize(new Dimension(width, 8 * table.getRowHeight()));
JPanel buttonPanel = new JPanel();
addButton = new JButton(acr.getString(acr.I_DIALOG_ADD));
addButton.addActionListener(this);
delButton = new JButton(acr.getString(acr.I_DIALOG_DELETE));
delButton.addActionListener(this);
delButton.setEnabled(false);
chgButton = new JButton(acr.getString(acr.I_DIALOG_CHANGE));
chgButton.addActionListener(this);
chgButton.setEnabled(false);
buttonPanel.setLayout(new GridLayout(3, 1, 5, 5));
buttonPanel.add(addButton);
buttonPanel.add(delButton);
buttonPanel.add(chgButton);
c.gridx = 2;
c.gridy = 4;
c.gridwidth = 1;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(items[0].getPreferredSize().height + items[1].getPreferredSize().height + 20, 0, 0, 0);
gridbag.setConstraints(buttonPanel, c);
panel1.add(buttonPanel);
String s = acr.getString(acr.W_SAVE_AS_CLEAR_TEXT);
ta = new JTextArea(s);
ta.setLineWrap(true);
ta.setWrapStyleWord(true);
Color bgColor = panel1.getBackground();
ta.setBackground(bgColor);
Color fgColor = jndiLabel.getForeground();
ta.setForeground(fgColor);
ta.setFont(jndiLabel.getFont());
// Find longer length to set length of text area:
// Either 1) ObjectStoreLabel: ___ OR
// 2) Width of LabelValuePanel
int width1 = storeLabel.getPreferredSize().width + 5 + osText.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);
c.gridx = 0;
c.gridy = 5;
c.gridwidth = 3;
c.anchor = GridBagConstraints.WEST;
c.insets = new Insets(5, 0, 5, 0);
gridbag.setConstraints(ta, c);
panel1.add(ta);
workPanel.add(panel1, BorderLayout.NORTH);
return (workPanel);
}
Aggregations