Search in sources :

Example 1 with BrokerAdminEvent

use of com.sun.messaging.jmq.admin.event.BrokerAdminEvent in project openmq by eclipse-ee4j.

the class ActionManager method initActions.

/*
     * Creates all actions
     */
private static int initActions(ActionManager manager) {
    Action tmpAction;
    int activeFlags = 0;
    Hashtable table = manager.actionTable;
    final EventListenerList ell = manager.aListeners;
    tmpAction = new AbstractAction(acr.getString(acr.I_ADD), AGraphics.adminImages[AGraphics.ADD]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.ADD_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(ADD, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_DELETE), AGraphics.adminImages[AGraphics.DELETE]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.DELETE_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(DELETE, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_PREFERENCES), AGraphics.adminImages[AGraphics.PREFERENCES]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            System.err.println("Preferences");
        }
    };
    activeFlags |= addAction(PREFERENCES, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_EXIT)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            ConsoleActionEvent cae = new ConsoleActionEvent(this, ConsoleActionEvent.EXIT);
            fireAdminEventDispatched(cae, ell);
        }
    };
    activeFlags |= addAction(EXIT, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_ABOUT)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            ConsoleActionEvent cae = new ConsoleActionEvent(this, ConsoleActionEvent.ABOUT);
            fireAdminEventDispatched(cae, ell);
        }
    };
    activeFlags |= addAction(ABOUT, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_PROPERTIES), AGraphics.adminImages[AGraphics.PROPERTIES]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.PROPS_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(PROPERTIES, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_SHUTDOWN_BROKER), AGraphics.adminImages[AGraphics.SHUTDOWN]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.SHUTDOWN_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(SHUTDOWN, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_RESTART_BROKER), AGraphics.adminImages[AGraphics.RESTART]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.RESTART_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(RESTART, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_PAUSE), AGraphics.adminImages[AGraphics.PAUSE]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.PAUSE_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(PAUSE, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_RESUME), AGraphics.adminImages[AGraphics.RESUME]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.RESUME_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(RESUME, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_CONNECT), AGraphics.adminImages[AGraphics.CONNECT_TO_OBJSTORE]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.CONNECT_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(CONNECT, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_DISCONNECT), AGraphics.adminImages[AGraphics.DISCONNECT_FROM_OBJSTORE]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.DISCONNECT_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(DISCONNECT, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_EXPAND_ALL), AGraphics.adminImages[AGraphics.EXPAND_ALL]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            ConsoleActionEvent cae = new ConsoleActionEvent(this, ConsoleActionEvent.EXPAND_ALL);
            fireAdminEventDispatched(cae, ell);
        }
    };
    activeFlags |= addAction(EXPAND_ALL, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_COLLAPSE_ALL), AGraphics.adminImages[AGraphics.COLLAPSE_ALL]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            ConsoleActionEvent cae = new ConsoleActionEvent(this, ConsoleActionEvent.COLLAPSE_ALL);
            fireAdminEventDispatched(cae, ell);
        }
    };
    activeFlags |= addAction(COLLAPSE_ALL, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_REFRESH), AGraphics.adminImages[AGraphics.REFRESH]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            ConsoleActionEvent cae = new ConsoleActionEvent(this, ConsoleActionEvent.REFRESH);
            fireAdminEventDispatched(cae, ell);
        }
    };
    activeFlags |= addAction(REFRESH, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_PURGE_BROKER_DEST), AGraphics.adminImages[AGraphics.PURGE]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            DialogEvent de = new DialogEvent(this);
            de.setDialogType(DialogEvent.PURGE_DIALOG);
            fireAdminEventDispatched(de, ell);
        }
    };
    activeFlags |= addAction(PURGE, tmpAction, table);
    tmpAction = new AbstractAction(acr.getString(acr.I_QUERY_BROKER), AGraphics.adminImages[AGraphics.QUERY_BROKER]) {

        @Override
        public void actionPerformed(ActionEvent e) {
            BrokerAdminEvent bae = new BrokerAdminEvent(this, BrokerAdminEvent.QUERY_BROKER);
            fireAdminEventDispatched(bae, ell);
        }
    };
    activeFlags |= addAction(QUERY_BROKER, tmpAction, table);
    return activeFlags;
}
Also used : ConsoleActionEvent(com.sun.messaging.jmq.admin.apps.console.event.ConsoleActionEvent) BrokerAdminEvent(com.sun.messaging.jmq.admin.event.BrokerAdminEvent) AbstractAction(javax.swing.AbstractAction) Action(javax.swing.Action) DialogEvent(com.sun.messaging.jmq.admin.apps.console.event.DialogEvent) Hashtable(java.util.Hashtable) ConsoleActionEvent(com.sun.messaging.jmq.admin.apps.console.event.ConsoleActionEvent) ActionEvent(java.awt.event.ActionEvent) EventListenerList(javax.swing.event.EventListenerList) AbstractAction(javax.swing.AbstractAction)

Example 2 with BrokerAdminEvent

use of com.sun.messaging.jmq.admin.event.BrokerAdminEvent in project openmq by eclipse-ee4j.

the class BrokerDestPropsDialog method doOK.

@Override
public void doOK() {
    BrokerAdminEvent bae = new BrokerAdminEvent(this, BrokerAdminEvent.UPDATE_DEST);
    DestinationInfo destInfo = getUpdateDestinationInfo();
    bae.setDestinationInfo(destInfo);
    bae.setOKAction(true);
    fireAdminEventDispatched(bae);
}
Also used : BrokerAdminEvent(com.sun.messaging.jmq.admin.event.BrokerAdminEvent) DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo)

Example 3 with BrokerAdminEvent

use of com.sun.messaging.jmq.admin.event.BrokerAdminEvent in project openmq by eclipse-ee4j.

the class BrokerPasswdDialog method doOK.

@Override
public void doOK() {
    /*
         * Note: Not forcing the username and password to be mandatory, since the plugin authentication can require anything.
         */
    String usernameValue = username.getText().trim();
    /*
         * if (usernameValue.equals("")) { JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_PROP_VALUE, "username"),
         * acr.getString(acr.I_BROKER), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
         * username.requestFocus(); return; }
         */
    String passwordValue = password.getText().trim();
    /*
         * if (passwordValue.equals("")) { JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_PROP_VALUE, "password"),
         * acr.getString(acr.I_BROKER), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
         * password.requestFocus(); return; }
         */
    BrokerAdminEvent bae = new BrokerAdminEvent(this, BrokerAdminEvent.UPDATE_LOGIN);
    bae.setUsername(usernameValue);
    bae.setPassword(passwordValue);
    bae.setOKAction(true);
    fireAdminEventDispatched(bae);
    username.requestFocus();
    if ((usernameValue.length() != 0) && (passwordValue.length() == 0)) {
        password.requestFocus();
    }
}
Also used : BrokerAdminEvent(com.sun.messaging.jmq.admin.event.BrokerAdminEvent)

Example 4 with BrokerAdminEvent

use of com.sun.messaging.jmq.admin.event.BrokerAdminEvent in project openmq by eclipse-ee4j.

the class BrokerDestAddDialog method doOK.

@Override
public void doOK() {
    String destName = nameTF.getText();
    destName = destName.trim();
    int intValue;
    long longValue;
    BrokerAdminEvent bae = new BrokerAdminEvent(this, BrokerAdminEvent.ADD_DEST);
    // Destination name is a must.
    if (!isValidString(destName)) {
        JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_BROKER_DEST_NAME), acr.getString(acr.I_ADD_BROKER_DEST), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
        return;
    } else {
        bae.setDestinationName(destName);
    }
    /*
         * QUEUE-specifics.
         */
    if (queueRB.isSelected()) {
        bae.setDestinationTypeMask(DestType.DEST_TYPE_QUEUE);
        if (activeConsumerUnlimitedRB.isSelected()) {
            bae.setActiveConsumers(UNLIMITED_VALUE_NEG1);
        } else {
            intValue = Integer.parseInt(activeConsumerIF.getText());
            bae.setActiveConsumers(intValue);
        }
        if (failoverConsumerUnlimitedRB.isSelected()) {
            bae.setFailoverConsumers(UNLIMITED_VALUE_NEG1);
        } else {
            intValue = Integer.parseInt(failoverConsumerIF.getText());
            bae.setFailoverConsumers(intValue);
        }
    /*
             * TOPIC-specifics.
             */
    } else if (topicRB.isSelected()) {
        bae.setDestinationTypeMask(DestType.DEST_TYPE_TOPIC);
    }
    if (maxProducerUnlimitedRB.isSelected()) {
        bae.setMaxProducers(UNLIMITED_VALUE_NEG1);
    } else {
        intValue = Integer.parseInt(maxProducerIF.getText());
        bae.setMaxProducers(intValue);
    }
    // decides to change its default value...
    if (queueSizeLimitUnlimitedRB.isSelected()) {
        bae.setMaxMesgBytes(UNLIMITED_VALUE_NEG1);
    } else {
        longValue = queueSizeLimitBF.getValue();
        bae.setMaxMesgBytes(longValue);
    }
    if (queueMessageLimitUnlimitedRB.isSelected()) {
        bae.setMaxMesg(UNLIMITED_VALUE_NEG1);
    } else {
        String s = queueMessageLimitTF.getText();
        try {
            intValue = Integer.parseInt(s);
        } catch (NumberFormatException nfe) {
            /*
                 * Should never happen since queueMessageLimitTF is an IntegerField.
                 */
            intValue = -1;
        }
        if (intValue != -1) {
            bae.setMaxMesg(intValue);
        }
    }
    if (destMaxSizePerMsgUnlimitedRB.isSelected()) {
        bae.setMaxPerMesgSize(UNLIMITED_VALUE_NEG1);
    } else {
        longValue = destMaxSizePerMsgBF.getValue();
        bae.setMaxPerMesgSize(longValue);
    }
    bae.setOKAction(true);
    fireAdminEventDispatched(bae);
}
Also used : BrokerAdminEvent(com.sun.messaging.jmq.admin.event.BrokerAdminEvent)

Example 5 with BrokerAdminEvent

use of com.sun.messaging.jmq.admin.event.BrokerAdminEvent in project openmq by eclipse-ee4j.

the class BrokerDestPropsDialog method doPurge.

private void doPurge() {
    if ((selectedRow > -1) && (selectedDurName != null) && (selectedClientID != null)) {
        /*
             * Dispatch the admin event.
             */
        BrokerAdminEvent bae = new BrokerAdminEvent(this, BrokerAdminEvent.PURGE_DUR);
        bae.setDurableName(selectedDurName);
        bae.setClientID(selectedClientID);
        bae.setOKAction(false);
        fireAdminEventDispatched(bae);
    }
}
Also used : BrokerAdminEvent(com.sun.messaging.jmq.admin.event.BrokerAdminEvent)

Aggregations

BrokerAdminEvent (com.sun.messaging.jmq.admin.event.BrokerAdminEvent)10 ConsoleActionEvent (com.sun.messaging.jmq.admin.apps.console.event.ConsoleActionEvent)1 DialogEvent (com.sun.messaging.jmq.admin.apps.console.event.DialogEvent)1 SizeString (com.sun.messaging.jmq.util.SizeString)1 DestinationInfo (com.sun.messaging.jmq.util.admin.DestinationInfo)1 ActionEvent (java.awt.event.ActionEvent)1 Hashtable (java.util.Hashtable)1 Properties (java.util.Properties)1 AbstractAction (javax.swing.AbstractAction)1 Action (javax.swing.Action)1 EventListenerList (javax.swing.event.EventListenerList)1