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

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


    protected void createStyles() {
        int index = this.alignmentBox.getSelectedIndex();
        String value = this.alignmentBox.getValue(index);
        Widget widget = getWidget();
        if (widget instanceof HasHorizontalAlignment) {
            HasHorizontalAlignment hw = (HasHorizontalAlignment) widget;
            HorizontalAlignmentConstant align = null;
            if (i18n.AlignLeft().equals(value)) {
                align = HasHorizontalAlignment.ALIGN_LEFT;
            } else if (i18n.AlignRight().equals(value)) {
                align = HasHorizontalAlignment.ALIGN_RIGHT;
            } else if (i18n.AlignCenter().equals(value)) {
                align = HasHorizontalAlignment.ALIGN_CENTER;
            } else if (i18n.AlignJustify().equals(value)) {
                align = HasHorizontalAlignment.ALIGN_JUSTIFY;
            }
            Map<String, Object> dataSnapshot = new HashMap<String, Object>();
            dataSnapshot.put("oldAlignment", hw.getHorizontalAlignment());
            dataSnapshot.put("newAlignment", align);
            dataSnapshot.put("hwidget", hw);
            bus.fireEvent(new UndoableEvent(dataSnapshot, new UndoableHandler() {
                @Override
                public void onEvent(UndoableEvent event) {  }
                @Override
                public void undoAction(UndoableEvent event) {
                    HorizontalAlignmentConstant oldAlignment = (HorizontalAlignmentConstant) event.getData("oldAlignment");
                    HasHorizontalAlignment hwidget = (HasHorizontalAlignment) event.getData("hwidget");
                    hwidget.setHorizontalAlignment(oldAlignment);
                }
                @Override
                public void doAction(UndoableEvent event) {
                    HorizontalAlignmentConstant newAlignment = (HorizontalAlignmentConstant) event.getData("newAlignment");
                    HasHorizontalAlignment hwidget = (HasHorizontalAlignment) event.getData("hwidget");
                    hwidget.setHorizontalAlignment(newAlignment);
                }
            }));
        }
    }
View Full Code Here


    @Override
    public void remove(FBFormItem item) {
        super.remove(item);
        Widget widget = getWidget();
        if (widget instanceof HasHorizontalAlignment) {
            HasHorizontalAlignment hw = (HasHorizontalAlignment) widget;
            hw.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_DEFAULT);
        }
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.HasHorizontalAlignment

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.