Search in sources :

Example 1 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent 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;
}
Also used : LabelValuePanel(com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout)

Example 2 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent 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;
}
Also used : LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent) JCheckBox(javax.swing.JCheckBox) LongField(com.sun.messaging.jmq.admin.apps.console.util.LongField) JComboBox(javax.swing.JComboBox) IntegerField(com.sun.messaging.jmq.admin.apps.console.util.IntegerField) JTextField(javax.swing.JTextField)

Example 3 with LabelledComponent

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

the class ObjStoreConFactoryPropsDialog method doOK.

@Override
public void doOK() {
    String lookupName = lookupLabel.getText();
    lookupName = lookupName.trim();
    if (lookupName == null || lookupName.equals("")) {
        JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_LOOKUP_NAME), acr.getString(acr.I_OBJSTORE_CF_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_NO_LOOKUP_NAME), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
        return;
    }
    int type = ObjAdminEvent.QCF;
    AdministeredObject tempObj = null;
    if (cfLabel.getText().equals(acr.getString(acr.I_QCF))) {
        type = ObjAdminEvent.QCF;
        tempObj = new com.sun.messaging.QueueConnectionFactory();
    } else if (cfLabel.getText().equals(acr.getString(acr.I_TCF))) {
        type = ObjAdminEvent.TCF;
        tempObj = new com.sun.messaging.TopicConnectionFactory();
    } else if (cfLabel.getText().equals(acr.getString(acr.I_CF))) {
        type = ObjAdminEvent.CF;
        tempObj = new com.sun.messaging.ConnectionFactory();
    } else if (cfLabel.getText().equals(acr.getString(acr.I_XAQCF))) {
        type = ObjAdminEvent.XAQCF;
        tempObj = new com.sun.messaging.XAQueueConnectionFactory();
    } else if (cfLabel.getText().equals(acr.getString(acr.I_XATCF))) {
        type = ObjAdminEvent.XATCF;
        tempObj = new com.sun.messaging.XATopicConnectionFactory();
    } else if (cfLabel.getText().equals(acr.getString(acr.I_XACF))) {
        type = ObjAdminEvent.XACF;
        tempObj = new com.sun.messaging.XAConnectionFactory();
    }
    /*
         * Conn Factory Object Properties. Go through each of the cfProps, get the userdata which is the property name, get the
         * value, set it in props.
         */
    Properties props = tempObj.getConfiguration();
    String propName, propValue, propType = null, propLabel = null;
    for (int i = 0; i < cfProps.size(); i++) {
        LabelledComponent cfItem = (LabelledComponent) cfProps.elementAt(i);
        propName = (String) cfItem.getClientData();
        if (propName == null) {
            continue;
        }
        // Remove this propName from the props, no longer applies.
        if (!(cfItem.getComponent().isEnabled())) {
            props.remove(propName);
            continue;
        }
        try {
            propType = tempObj.getPropertyType(propName);
            propLabel = tempObj.getPropertyLabel(propName);
        } catch (jakarta.jms.JMSException jmsex) {
            JOptionPane.showOptionDialog(this, jmsex.toString(), acr.getString(acr.I_OBJSTORE_CF_PROPS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
            return;
        }
        if (propType == null) {
            continue;
        }
        propValue = getValue(cfItem.getComponent(), propType).trim();
        // so no need to set to "".
        if (propValue.equals("")) {
            continue;
        }
        try {
            // Calling setProperty() will verify if this value is valid.
            tempObj.setProperty(propName, propValue.trim());
            props.put(propName, propValue.trim());
        } catch (jakarta.jms.JMSException jmsex) {
            if (jmsex instanceof com.sun.messaging.InvalidPropertyValueException) {
                JOptionPane.showOptionDialog(this, acr.getString(acr.E_INVALID_VALUE, propLabel), acr.getString(acr.I_OBJSTORE_CF_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_INVALID_VALUE), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
            } else {
                JOptionPane.showOptionDialog(this, jmsex.toString(), acr.getString(acr.I_OBJSTORE_CF_PROPS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
            }
            return;
        }
    }
    ObjAdminEvent oae = new ObjAdminEvent(this, ObjAdminEvent.UPDATE_CONN_FACTORY);
    ObjStore os = osConFactoryCObj.getObjStore();
    /*
         * Set values in the event.
         */
    oae.setLookupName(lookupName);
    oae.setObjStore(os);
    oae.setFactoryType(type);
    oae.setObjProperties(props);
    if (checkBox.isSelected()) {
        oae.setReadOnly(true);
    } else {
        oae.setReadOnly(false);
    }
    oae.setOKAction(true);
    fireAdminEventDispatched(oae);
}
Also used : ObjStore(com.sun.messaging.jmq.admin.objstore.ObjStore) ObjAdminEvent(com.sun.messaging.jmq.admin.apps.console.event.ObjAdminEvent) Properties(java.util.Properties) AdministeredObject(com.sun.messaging.AdministeredObject) LabelledComponent(com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent)

Example 4 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent 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;
}
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) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup) JLabel(javax.swing.JLabel) IntegerField(com.sun.messaging.jmq.admin.apps.console.util.IntegerField) JSeparator(javax.swing.JSeparator)

Example 5 with LabelledComponent

use of com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent 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);
}
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) JTextField(javax.swing.JTextField)

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