Package nextapp.echo2.app

Examples of nextapp.echo2.app.RadioButton


   
    /**
     * Test behavior of <code>ButtonGroup</code>s.
     */
    public void testButtonGroup() {
        RadioButton radioButton1 = new RadioButton();
        RadioButton radioButton2 = new RadioButton();
        RadioButton radioButton3 = new RadioButton();
       
        // Test selection state of single button prior to setting group.
        assertFalse(radioButton1.isSelected());
        radioButton1.setSelected(true);
        assertTrue(radioButton1.isSelected());
        radioButton1.setSelected(false);
        assertFalse(radioButton1.isSelected());
       
        // Add Buttons to group.
        ButtonGroup buttonGroup = new ButtonGroup();
        radioButton1.setGroup(buttonGroup);
        radioButton2.setGroup(buttonGroup);
       
        // Ensure mutual exclusivity between buttons in button group.
        radioButton1.setSelected(true);
        assertTrue(radioButton1.isSelected());
        radioButton2.setSelected(true);
        assertTrue(radioButton2.isSelected());
        assertFalse(radioButton1.isSelected());
        radioButton1.setSelected(true);
        assertTrue(radioButton1.isSelected());
        assertFalse(radioButton2.isSelected());
       
        // Create selected button independent of button group (no effect).
        radioButton3.setSelected(true);
        assertTrue(radioButton1.isSelected());
        assertFalse(radioButton2.isSelected());
        assertTrue(radioButton3.isSelected());
       
        // Add selected button to button group: ensure new selected button becomes group selection.
        radioButton3.setGroup(buttonGroup);
        assertFalse(radioButton1.isSelected());
        assertFalse(radioButton2.isSelected());
        assertTrue(radioButton3.isSelected());
       
        // Remove selected button from button group: ensure no effect other than group removal.
        radioButton3.setGroup(null);
        assertFalse(radioButton1.isSelected());
        assertFalse(radioButton2.isSelected());
        assertTrue(radioButton3.isSelected());

        // Select new button in button group: ensure no effect on button that was removed.
        radioButton2.setSelected(true);
        assertFalse(radioButton1.isSelected());
        assertTrue(radioButton2.isSelected());
        assertTrue(radioButton3.isSelected());
       
        // Set model state of button in group to selected: ensure button is selected in group.
        ((ToggleButtonModel) radioButton1.getModel()).setSelected(true);
        assertTrue(radioButton1.isSelected());
        assertFalse(radioButton2.isSelected());
View Full Code Here


        if (buttons == null || !changedButton.isSelected()) {
            return;
        }
        Iterator buttonIt = buttons.iterator();
        while (buttonIt.hasNext()) {
            RadioButton button = (RadioButton) buttonIt.next();
            if (!button.equals(changedButton)) {
                button.setSelected(false);
            }
        }
    }
View Full Code Here

        this.getBtnMain().setBackground(Color.WHITE);
        this.getBtnMain().setBorder(BorderEx.NONE);
        this.getBtnMain().setRolloverBackground(Color.WHITE);
        this.getBtnMain().setRolloverBorder(BorderEx.NONE);

        this.setToggleIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setTogglePressedIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setToggleRolloverIcon(new ResourceImageReference(IMG_DROPDOWN));
       

        /*
        this.getBtnMain().addActionListener(new ActionListener() {

View Full Code Here

     * @param title The title of the button
     */
    public JbsAccPaneButton(String imgFileName, String title) {
        super();
        try {
            ResourceImageReference ref = new ResourceImageReference(Styles.getIconPath() + imgFileName);
            this.setIcon(ref);
        } catch (Exception e) {
            logger.debug(Styles.getIconPath() + imgFileName + " not found.");
        }
        this.setStyleName("Default");
View Full Code Here

        this.setBorder(BorderEx.NONE);
        this.setRolloverBorder(BorderEx.NONE);
        this.setTarget(this.getBtnMain());
        this.setPopUp(this.getMnuMain());
        this.setToggleIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setTogglePressedIcon(new ResourceImageReference(IMG_DROPDOWN));
        this.setToggleRolloverIcon(new ResourceImageReference(IMG_DROPDOWN));
    }
View Full Code Here

    private Logger logger = Logger.getLogger(BtnToolbar.class);
    private static final long serialVersionUID = 176100334500789000L;

    public BtnToolbar(String imgFileName) {
        super();
        ResourceImageReference ref = new ResourceImageReference(Styles.getIconPath() + imgFileName);
        if (ref != null) {
            this.setIcon(ref);
        } else {
            logger.warn("Image " + imgFileName + " not found.");
        }
View Full Code Here

                    break; // no icon
            }

            if (iconName != null) {
                final String imagePath = Styles.getIconPath(); //"../resource/images/";
                messageIcons[messageType] = new ResourceImageReference(
                        imagePath + iconName, new JbsExtent(ICON_HEIGHT), new JbsExtent(ICON_HEIGHT));
            }
        }

        return messageIcons[messageType];
View Full Code Here

    public void addControl(String groupName, Component control) {
        this.addControl(groupName, groupName, control);
    }

    public void addSeparator(String groupName) {
        Row row = new Row();
        ColumnLayoutData layout = new ColumnLayoutData();
        layout.setHeight(new JbsExtent(15, JbsExtent.PX));
        row.setLayoutData(layout);
        this.addControl(groupName, row);
    }
View Full Code Here

        spMain.add(pnMain);
    }

    protected JbsContentPane initPnButtons() {
        pnButtons = new JbsContentPane();
        Row mainRow = new Row();
        mainRow.setAlignment(new Alignment(Alignment.RIGHT, Alignment.DEFAULT));
        mainRow.setInsets(new Insets(new JbsExtent(5), new JbsExtent(5)));

        btnOK = new JbsButton(JbsL10N.getString("Generic.ok"));
        btnOK.setAlignmentHorizontal(Alignment.CENTER);
        btnOK.setWidth(new JbsExtent(80));
        btnOK.addActionListener(new ActionListener() {

            private static final long serialVersionUID = 1L;

            public void actionPerformed(ActionEvent arg0) {
                postDialog();
            }
        });
        mainRow.add(btnOK);

        btnCancel = new JbsButton(JbsL10N.getString("Generic.cancel"));
        btnCancel.setAlignmentHorizontal(Alignment.CENTER);
        btnCancel.setWidth(new JbsExtent(80));
        btnCancel.addActionListener(new ActionListener() {

            private static final long serialVersionUID = 1L;

            public void actionPerformed(ActionEvent arg0) {
                cancelDialog();
            }
        });
        mainRow.add(btnCancel);

        /*
        KeyStrokeListener ks = new KeyStrokeListener();
        ks.addKeyCombination(KeyStrokeListener.VK_RETURN,"OK");
        ks.addKeyCombination(KeyStrokeListener.VK_ESCAPE,"CANCEL");
        ks.addActionListener(new ActionListener() {
        private static final long serialVersionUID = 1L;
        public void actionPerformed(ActionEvent arg0) {
        if (arg0.getActionCommand().equals("OK"))
        postDialog();
        else if (arg0.getActionCommand().equals("CANCEL"))
        cancelDialog();
        }
        });
        mainRow.add(ks);
        mainRow.add(this.createKeyStrokeListener());
         */
        mainRow.add(this.getKeystrokeListener());
        pnButtons.add(mainRow);
        return pnButtons;
    }
View Full Code Here

        JbsLabel label = new JbsLabel(str);
        colMain.add(label);
    }
   
    public void addBlankLine() {
        Row row = new Row();
        ColumnLayoutData layout = new ColumnLayoutData();
        layout.setHeight(new JbsExtent(15,JbsExtent.PX));
        row.setLayoutData(layout);
        colMain.add(row);
    }
View Full Code Here

TOP

Related Classes of nextapp.echo2.app.RadioButton

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.