Search in sources :

Example 1 with LongField

use of com.sun.messaging.jmq.admin.apps.console.util.LongField 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)

Aggregations

IntegerField (com.sun.messaging.jmq.admin.apps.console.util.IntegerField)1 LabelledComponent (com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent)1 LongField (com.sun.messaging.jmq.admin.apps.console.util.LongField)1 JCheckBox (javax.swing.JCheckBox)1 JComboBox (javax.swing.JComboBox)1 JTextField (javax.swing.JTextField)1