Package nextapp.echo2.app.button

Examples of nextapp.echo2.app.button.ToggleButton


    protected void initPane() {
        Column colMain = new Column();
        colMain.add(this.getLbUserGroups());

        Row rowButtons = new Row();
        rowButtons.setAlignment(new Alignment(Alignment.RIGHT, Alignment.TOP));
        rowButtons.add(this.getBtnAdd());
        rowButtons.add(this.getBtnDelete());
        colMain.add(rowButtons);

        KeyStrokeListener ks = new KeyStrokeListener();
        ks.addKeyCombination(KeyStrokeListener.VK_INSERT, "INSERT");
        ks.addKeyCombination(KeyStrokeListener.VK_DELETE, "DELETE");
        ks.addActionListener(new ActionListener() {

            private static final long serialVersionUID = 1L;

            public void actionPerformed(ActionEvent arg0) {
                if (arg0.getActionCommand().equals("INSERT")) {
                    addGroup();
                } else if (arg0.getActionCommand().equals("DELETE")) {
                    deleteGroup();
                }
            }
        });
        rowButtons.add(ks);


        this.add(colMain);
    }
View Full Code Here


        this.setMaximizable(false);
        this.setKeystrokeListener(this.createKeyStrokeListener());
        this.setPostOnEnterKey(true);
        this.setCancelOnEscKey(true);

        SplitPane spMain = new SplitPane(SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, new JbsExtent(45));

        this.add(spMain);
        spMain.add(initPnButtons());

        pnMain = new JbsContentPane();
        spMain.add(pnMain);
    }
View Full Code Here

     */
    @Override
    protected void initForm() {
        super.initForm();

        ButtonGroup radioGroup = new ButtonGroup();
        Column colMain = new Column();
        Row row1 = new Row();
        row1.setAlignment(Alignment.ALIGN_TOP);
        rbNoDate = new JbsRadioButton();
        rbNoDate.setText(JbsL10N.getString("FmSelectDate.noDate"));
View Full Code Here

        controlsColumn.addButton("Set Custom State Icons", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractButton button) {
                        if (button instanceof ToggleButton) {
                            ToggleButton toggleButton = (ToggleButton) button;
                            toggleButton.setStateIcon(Styles.RG_STATE_ICON);
                            toggleButton.setSelectedStateIcon(Styles.RG_SELECTED_STATE_ICON);
                            toggleButton.setPressedStateIcon(Styles.RG_PRESSED_STATE_ICON);
                            toggleButton.setPressedSelectedStateIcon(Styles.RG_PRESSED_SELECTED_STATE_ICON);
                            toggleButton.setRolloverStateIcon(Styles.RG_ROLLOVER_STATE_ICON);
                            toggleButton.setRolloverSelectedStateIcon(Styles.RG_ROLLOVER_SELECTED_STATE_ICON);
                        }
                    }
                });
            }
        });
        controlsColumn.addButton("Clear Custom State Icons", new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                apply(new Applicator() {
                    public void apply(AbstractButton button) {
                        if (button instanceof ToggleButton) {
                            ToggleButton toggleButton = (ToggleButton) button;
                            toggleButton.setStateIcon(null);
                            toggleButton.setSelectedStateIcon(null);
                            toggleButton.setPressedStateIcon(null);
                            toggleButton.setPressedSelectedStateIcon(null);
                            toggleButton.setRolloverStateIcon(null);
                            toggleButton.setRolloverSelectedStateIcon(null);
                        }
                    }
                });
            }
        });
View Full Code Here

     * @param button the <code>AbstractButton</code> being rendered
     */
    private void renderButtonContent(RenderContext rc, Element buttonContainerElement, AbstractButton button) {
        Node contentNode;
        Document document = rc.getServerMessage().getDocument();
        ToggleButton toggleButton = button instanceof ToggleButton ? (ToggleButton) button : null;
        String elementId = ContainerInstance.getElementId(button);
       
        String text = (String) button.getRenderProperty(AbstractButton.PROPERTY_TEXT);
        ImageReference icon = (ImageReference) button.getRenderProperty(AbstractButton.PROPERTY_ICON);
       
        // Create entities.
        Text textNode = text == null ? null : rc.getServerMessage().getDocument().createTextNode(
                (String) button.getRenderProperty(AbstractButton.PROPERTY_TEXT));
       
        Element iconElement;
        if (icon == null) {
            iconElement = null;
        } else {
            iconElement = ImageReferenceRender.renderImageReferenceElement(rc, ButtonPeer.this, button,
                    IMAGE_ID_ICON);
            iconElement.setAttribute("id", elementId + "_icon");
        }

        Element stateIconElement;
        if (toggleButton == null) {
            stateIconElement = null;
        } else {
            stateIconElement = ImageReferenceRender.renderImageReferenceElement(rc, ButtonPeer.this, button,
                    toggleButton.isSelected() ? IMAGE_ID_SELECTED_STATE_ICON : IMAGE_ID_STATE_ICON);
            stateIconElement.setAttribute("id", elementId + "_stateicon");
        }
       
        int entityCount = (textNode == null ? 0 : 1) + (iconElement == null ? 0 : 1) + (stateIconElement == null ? 0 : 1);
       
View Full Code Here

        if (!button.isRenderEnabled()) {
            itemElement.setAttribute("enabled", "false");
        }

        if (button instanceof ToggleButton) {
            ToggleButton toggleButton = (ToggleButton) button;
            itemElement.setAttribute("toggle", "true");
            itemElement.setAttribute("selected", toggleButton.isSelected() ? "true" : "false");
            itemElement.setAttribute("state-icon", ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_STATE_ICON));
            itemElement.setAttribute("selected-state-icon", ImageTools.getUri(rc, this, toggleButton,
                    IMAGE_ID_SELECTED_STATE_ICON));
           
            if (rolloverEnabled && toggleButton.getRenderProperty(ToggleButton.PROPERTY_ROLLOVER_STATE_ICON) != null
                    && toggleButton.getRenderProperty(ToggleButton.PROPERTY_ROLLOVER_SELECTED_STATE_ICON) != null) {
                itemElement.setAttribute("rollover-state-icon",
                        ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_ROLLOVER_STATE_ICON));
                itemElement.setAttribute("rollover-selected-state-icon",
                        ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_ROLLOVER_SELECTED_STATE_ICON));
            }
            if (pressedEnabled && toggleButton.getRenderProperty(ToggleButton.PROPERTY_PRESSED_STATE_ICON) != null
                    && toggleButton.getRenderProperty(ToggleButton.PROPERTY_PRESSED_SELECTED_STATE_ICON) != null) {
                itemElement.setAttribute("pressed-state-icon",
                        ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_PRESSED_STATE_ICON));
                itemElement.setAttribute("pressed-selected-state-icon",
                        ImageTools.getUri(rc, this, toggleButton, IMAGE_ID_PRESSED_SELECTED_STATE_ICON));
            }
View Full Code Here

    protected void addAction(String actionCommand) {
        EventListener[] listeners = listenerList.getListeners(ActionListener.class);
        for (int i = 0; i < listeners.length; i++) {
            ActionListener actionListener = (ActionListener) listeners[i];
            try {
                actionListener.actionPerformed(new ActionEvent(JbsDialogWindow.this, actionCommand));
            } catch (Throwable t) {
                logger.error("Error adding action.",t);
            }
        }
    }
View Full Code Here

    protected void addAction(String actionCommand) {
        EventListener[] listeners = listenerList.getListeners(ActionListener.class);
        for (int i = 0; i < listeners.length; i++) {
            ActionListener actionListener = (ActionListener) listeners[i];
            try {
                actionListener.actionPerformed(new ActionEvent(PnEditJbsObject.this, actionCommand));
            } catch (Throwable t) {
                logger.error("Error adding action.",t);
            }
        }
    }
View Full Code Here

        EventListener[] listeners = listenerList.getListeners(ActionListener.class);
        for (int i = 0; i < listeners.length; i++) {
            ActionListener actionListener = (ActionListener) listeners[i];
            try {
                actionListener.actionPerformed(
                        new ActionEvent(JbsOptionPane.this, getActionCommand((Component) e.getSource())));
            } catch (Throwable t) {
                ExceptionHandler.handle(t);
            }
        }
View Full Code Here

    protected final String IMG_DROPDOWN = Styles.IMAGE_PATH + "blank.gif";
   
    public JbsMenuLabel(String text) {
        super();
        this.setBtnMain(new JbsButton(""));
        this.getBtnMain().addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                logger.debug("popup");
                setExpanded(!isExpanded());
                collapseAllOther();
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.button.ToggleButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.