Search in sources :

Example 16 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent in project openmq by eclipse-ee4j.

the class ObjStorePasswdDialog method createWorkPanel.

@Override
public JPanel createWorkPanel() {
    JPanel workPanel = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    workPanel.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    LabelledComponent[] items = new LabelledComponent[2];
    principalText = new JTextField(20);
    principalText.addActionListener(this);
    items[0] = new LabelledComponent(Context.SECURITY_PRINCIPAL + ":", principalText);
    credentialsText = new JPasswordField(20);
    credentialsText.addActionListener(this);
    items[1] = new LabelledComponent(Context.SECURITY_CREDENTIALS + ":", credentialsText);
    LabelValuePanel lvp = new LabelValuePanel(items, 5, 5);
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.WEST;
    gridbag.setConstraints(lvp, c);
    workPanel.add(lvp);
    return (workPanel);
}
Also used : LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent) LabelValuePanel(com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JPasswordField(javax.swing.JPasswordField) JTextField(javax.swing.JTextField)

Example 17 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent in project openmq by eclipse-ee4j.

the class ObjStoreConFactoryDialog method layoutGroupProperties.

private JPanel layoutGroupProperties(String[] props, AdministeredObject aobj) {
    LabelledComponent[] items;
    items = new LabelledComponent[props.length];
    int k = 0;
    // XXX addExtra means add the 6 extra props.
    // XXX
    addExtra = false;
    for (int i = 0; i < props.length; i++) {
        items[k++] = makeLabelledComponent(aobj, props[i]);
        // XXX temporarily appending the extra list props.
        if (addExtra) {
            for (int j = 0; j < extraItems.length; j++) {
                items[k++] = extraItems[j];
            }
            addExtra = false;
        }
    }
    LabelValuePanel lvp = new LabelValuePanel(items, 5, 5);
    // 
    for (int i = 0; i < items.length; i++) {
        cfProps.add(items[i]);
    }
    return (lvp);
}
Also used : LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent) LabelValuePanel(com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel)

Example 18 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent in project openmq by eclipse-ee4j.

the class ObjStoreConFactoryPropsDialog method show.

public void show(ObjStoreConFactoryCObj osConFactoryCObj) {
    this.osConFactoryCObj = osConFactoryCObj;
    // 
    // Set fields to current object values.
    // 
    lookupLabel.setText(osConFactoryCObj.getLookupName());
    Object object = osConFactoryCObj.getObject();
    if (object instanceof com.sun.messaging.XAQueueConnectionFactory) {
        cfLabel.setText(acr.getString(acr.I_XAQCF));
    } else if (object instanceof com.sun.messaging.XATopicConnectionFactory) {
        cfLabel.setText(acr.getString(acr.I_XATCF));
    } else if (object instanceof com.sun.messaging.XAConnectionFactory) {
        cfLabel.setText(acr.getString(acr.I_XACF));
    } else if (object instanceof com.sun.messaging.QueueConnectionFactory) {
        cfLabel.setText(acr.getString(acr.I_QCF));
    } else if (object instanceof com.sun.messaging.TopicConnectionFactory) {
        cfLabel.setText(acr.getString(acr.I_TCF));
    } else if (object instanceof com.sun.messaging.ConnectionFactory) {
        cfLabel.setText(acr.getString(acr.I_CF));
    }
    // 
    // Go through each of the component items, get the clientData
    // which is the property name, then get the value of the
    // property from the current adminObj.
    // 
    String propName = null;
    String propType = null;
    String value = null;
    AdministeredObject adminObj = (AdministeredObject) object;
    for (int i = 0; i < cfProps.size(); i++) {
        LabelledComponent cfItem = (LabelledComponent) cfProps.elementAt(i);
        JComponent comp = cfItem.getComponent();
        propName = (String) cfItem.getClientData();
        if (propName == null) {
            continue;
        }
        try {
            if (comp.isEnabled()) {
                propType = adminObj.getPropertyType(propName);
                value = adminObj.getProperty(propName);
                setValue(comp, propType, value);
                // setting.
                if (comp instanceof JComboBox) {
                    doComboBox((JComboBox) comp);
                }
            }
        } catch (Exception e) {
            System.err.println(e.toString() + ": " + propName);
        }
    }
    // now we should be able to set values.
    AdministeredObject tempObj2 = new com.sun.messaging.QueueConnectionFactory();
    setOtherValues(tempObj2, true);
    // Set read-only box
    if (adminObj.isReadOnly()) {
        checkBox.setSelected(true);
    } else {
        checkBox.setSelected(false);
    }
    /*
         * Set focus to first text item. if (props.size() > 0) textItems[0].requestFocus();
         */
    // Go back to first tab.
    tabbedPane.setSelectedIndex(0);
    setVisible(true);
}
Also used : JComboBox(javax.swing.JComboBox) JComponent(javax.swing.JComponent) AdministeredObject(com.sun.messaging.AdministeredObject) LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent) AdministeredObject(com.sun.messaging.AdministeredObject)

Example 19 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent 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);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) JRadioButton(javax.swing.JRadioButton) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JTextField(javax.swing.JTextField) Properties(java.util.Properties) JSeparator(javax.swing.JSeparator) LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent) GridLayout(java.awt.GridLayout) LabelValuePanel(com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel) Enumeration(java.util.Enumeration) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JCheckBox(javax.swing.JCheckBox) AdministeredObject(com.sun.messaging.AdministeredObject) ButtonGroup(javax.swing.ButtonGroup)

Aggregations

LabelledComponent (com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent)19 LabelValuePanel (com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel)14 GridBagConstraints (java.awt.GridBagConstraints)13 GridBagLayout (java.awt.GridBagLayout)13 JPanel (javax.swing.JPanel)13 Insets (java.awt.Insets)9 JLabel (javax.swing.JLabel)8 JTextField (javax.swing.JTextField)8 JComboBox (javax.swing.JComboBox)7 IntegerField (com.sun.messaging.jmq.admin.apps.console.util.IntegerField)6 JCheckBox (javax.swing.JCheckBox)6 JSeparator (javax.swing.JSeparator)6 AdministeredObject (com.sun.messaging.AdministeredObject)5 SpecialValueField (com.sun.messaging.jmq.admin.apps.console.util.SpecialValueField)4 BytesField (com.sun.messaging.jmq.admin.apps.console.util.BytesField)3 Color (java.awt.Color)3 Dimension (java.awt.Dimension)3 GridLayout (java.awt.GridLayout)3 Properties (java.util.Properties)3 JComponent (javax.swing.JComponent)3