Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.ToggleButton


        pb.setTitle(tip);
        return pb;
    }

    private ToggleButton createToggleButton(ImageResource img, String tip) {
        final ToggleButton tb = new ToggleButton(new Image(img));
        tb.addClickHandler(handler);
        tb.setTitle(tip);
        return tb;
    }
View Full Code Here


                                 columnMeta.getHeader() );
        }
    }

    public ToggleButton createToggleButton() {
        final ToggleButton button = new ToggleButton( COLUMN_PICKER_IMAGE );
        final PopupPanel popup = new PopupPanel( true );
        popup.addAutoHidePartner( button.getElement() );
        popup.addCloseHandler( new CloseHandler<PopupPanel>() {
            public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
                button.setDown( false );
            }
        } );
        VerticalPanel popupContent = new VerticalPanel();
        for ( final ColumnMeta<T> columnMeta : columnMetaList ) {
            final CheckBox checkBox = new CheckBox( columnMeta.getHeader().getValue() );
            checkBox.setValue( columnMeta.isVisible() );
            checkBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() {
                public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
                    boolean visible = booleanValueChangeEvent.getValue();
                    if ( visible ) {
                        // WORKAROUND because CellTable does not support insertColumn at this time
                        for ( ColumnMeta<T> resettingColumnMeta : columnMetaList ) {
                            if ( resettingColumnMeta.isVisible() ) {
                                cellTable.removeColumn( resettingColumnMeta.getColumn() );
                            }
                        }
                        columnMeta.setVisible( visible );
                        for ( ColumnMeta<T> resettingColumnMeta : columnMetaList ) {
                            if ( resettingColumnMeta.isVisible() ) {
                                cellTable.addColumn( resettingColumnMeta.getColumn(),
                                                     resettingColumnMeta.getHeader() );
                            }
                        }
                    } else {
                        columnMeta.setVisible( visible );
                        cellTable.removeColumn( columnMeta.getColumn() );
                    }
                }
            } );
            popupContent.add( checkBox );
        }
        popup.add( popupContent );
        button.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                if ( button.isDown() ) {
                    popup.setPopupPosition( button.getAbsoluteLeft(),
                                            button.getAbsoluteTop() + button.getOffsetHeight() );
                    popup.show();
                } else {
                    popup.hide(false);
                }
            }
View Full Code Here

  }

  private ToggleButtonBean targetBean;

  public ToggleButtonBindings(Action source) {
    this(source, new ToggleButton());

    // Action.NAME
    addBinding(Action.NAME, BeanProperty.<Action, String> create(Action.NAME),
        BeanProperty.<ToggleButtonBean, String> create("text"));
  }
View Full Code Here

    pushButton.addClickListener(action);
    return pushButton;
  }

  private ToggleButton createToggleButton(Action action) {
    ToggleButton toggleButton = new ToggleButton();
    if (action.getText() != null) {
      toggleButton.setText(action.getText());
    }
    if (action.getTitle() != null) {
      toggleButton.getTitle();
    }
    toggleButton.addClickListener(action);
    return toggleButton;
  }
View Full Code Here

    pb.setTitle(tip);
    return pb;
  }

  private ToggleButton createToggleButton(ImageResource img, String tip) {
    ToggleButton tb = new ToggleButton(new Image(img));
    tb.addClickHandler(handler);
    tb.setTitle(tip);
    return tb;
  }
View Full Code Here

    pb.setTitle(tip);
    return pb;
  }

  private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) {
    ToggleButton tb = new ToggleButton(img.createImage());
    tb.addClickHandler(new ToolbarClickHandler());
    tb.setTitle(tip);
    return tb;
  }
View Full Code Here

    pb.setTitle(tip);
    return pb;
  }

  private ToggleButton createToggleButton(AbstractImagePrototype img, String tip) {
    ToggleButton tb = new ToggleButton(img.createImage());
    tb.addClickListener(listener);
    tb.setTitle(tip);
    return tb;
  }
View Full Code Here

    disabledPushButton.ensureDebugId("cwCustomButton-push-disabled");
    disabledPushButton.setEnabled(false);
    pushPanel.add(disabledPushButton);

    // Add a normal ToggleButton
    ToggleButton normalToggleButton = new ToggleButton(
        new Image(Showcase.images.gwtLogo()));
    normalToggleButton.ensureDebugId("cwCustomButton-toggle-normal");
    togglePanel.add(normalToggleButton);

    // Add a disabled ToggleButton
    ToggleButton disabledToggleButton = new ToggleButton(
        new Image(Showcase.images.gwtLogo()));
    disabledToggleButton.ensureDebugId("cwCustomButton-toggle-disabled");
    disabledToggleButton.setEnabled(false);
    togglePanel.add(disabledToggleButton);

    // Return the panel
    return vpanel;
  }
View Full Code Here

    pb.setTitle(tip);
    return pb;
  }

  private ToggleButton createToggleButton(ImageResource img, String tip) {
    ToggleButton tb = new ToggleButton(new Image(img));
    tb.addClickHandler(handler);
    tb.setTitle(tip);
    return tb;
  }
View Full Code Here

                                 columnMeta.getHeader() );
        }
    }

    public ToggleButton createToggleButton() {
        final ToggleButton button = new ToggleButton( COLUMN_PICKER_IMAGE );
        final PopupPanel popup = new PopupPanel( true );
        popup.addAutoHidePartner( button.getElement() );
        popup.addCloseHandler( new CloseHandler<PopupPanel>() {
            public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {
                button.setDown( false );
            }
        } );
        VerticalPanel popupContent = new VerticalPanel();
        for ( final ColumnMeta<T> columnMeta : columnMetaList ) {
            final CheckBox checkBox = new CheckBox( columnMeta.getHeader().getValue() );
            checkBox.setValue( columnMeta.isVisible() );
            checkBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() {
                public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
                    boolean visible = booleanValueChangeEvent.getValue();
                    if ( visible ) {
                        // WORKAROUND because CellTable does not support insertColumn at this time
                        for ( ColumnMeta<T> resettingColumnMeta : columnMetaList ) {
                            if ( resettingColumnMeta.isVisible() ) {
                                cellTable.removeColumn( resettingColumnMeta.getColumn() );
                            }
                        }
                        columnMeta.setVisible( visible );
                        for ( ColumnMeta<T> resettingColumnMeta : columnMetaList ) {
                            if ( resettingColumnMeta.isVisible() ) {
                                cellTable.addColumn( resettingColumnMeta.getColumn(),
                                                     resettingColumnMeta.getHeader() );
                            }
                        }
                    } else {
                        columnMeta.setVisible( visible );
                        cellTable.removeColumn( columnMeta.getColumn() );
                    }
                }
            } );
            popupContent.add( checkBox );
        }
        popup.add( popupContent );
        button.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                if ( button.isDown() ) {
                    popup.setPopupPosition( button.getAbsoluteLeft(),
                                            button.getAbsoluteTop() + button.getOffsetHeight() );
                    popup.show();
                } else {
                    popup.hide(false);
                }
            }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.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.