Example usage for com.google.gwt.user.client.ui DialogBox show

List of usage examples for com.google.gwt.user.client.ui DialogBox show

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui DialogBox show.

Prototype

@Override
    public void show() 

Source Link

Usage

From source file:$.HelloPlugins.java

License:Apache License

@Override
    public void onModuleLoad() {
        Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png");
        Button button = new Button("Click me");

        VerticalPanel vPanel = new VerticalPanel();
        vPanel.setWidth("100%");
        vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
        vPanel.add(img);//  w w  w .  j  a va 2  s. c  om
        vPanel.add(button);

        RootPanel.get().add(vPanel);

        // Create the dialog box
        final DialogBox dialogBox = new DialogBox();

        // The content of the dialog comes from a User specified Preference
        dialogBox.setText("Hello from GWT Gerrit UI plugin");
        dialogBox.setAnimationEnabled(true);
        Button closeButton = new Button("Close");
        VerticalPanel dialogVPanel = new VerticalPanel();
        dialogVPanel.setWidth("100%");
        dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
        dialogVPanel.add(closeButton);

        closeButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialogBox.hide();
            }
        });

        // Set the contents of the Widget
        dialogBox.setWidget(dialogVPanel);

        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialogBox.center();
                dialogBox.show();
            }
        });
    }

From source file:asquare.gwt.tests.coordinates.client.Demo.java

License:Apache License

public void onModuleLoad() {
    DialogBox dialog = new DialogBox() {
        {/*from  ww  w  .j a va 2  s.c om*/
            addDomHandler(new MouseDownHandler() {
                public void onMouseDown(MouseDownEvent event) {
                    Debug.println("DialogBox.onMouseDown(" + event.getX() + "," + event.getY() + ")");
                }
            }, MouseDownEvent.getType());
        }
    };
    dialog.setText("Dialog Caption");
    Image image = new Image("one.gif");
    DOM.setStyleAttribute(image.getElement(), "height", "100px");
    DOM.setStyleAttribute(image.getElement(), "width", "200px");

    dialog.setWidget(image);
    dialog.show();
    dialog.setPopupPosition(200, 200);

    Debug.enable();
    if (!GWT.isScript())
        DebugConsole.getInstance().disable();

    new DebugHierarchyInspector().install();
    new DebugElementDumpInspector().install();
    new DebugEventListener('a', Event.ONMOUSEDOWN, "Absolute position inspector") {
        protected void doEvent(Event event) {
            Element target = DOM.eventGetTarget(event);
            Debug.println(getTagName(target) + "[absLeft=" + DOM.getAbsoluteLeft(target) + ",absTop="
                    + DOM.getAbsoluteTop(target) + "]");
        }
    }.install();

    new DebugEventListener('o', Event.ONMOUSEDOWN, "Offset hierarchy inspector") {
        protected void doEvent(Event event) {
            Element target = DOM.eventGetTarget(event);
            printOffsetHierarchy(target);
        }
    }.install();

    new DebugEventListener().install();
}

From source file:asquare.gwt.tests.rtldrag.client.Demo.java

License:Apache License

public void onModuleLoad() {
    final DialogBox dialog = new DialogBox();
    dialog.setSize("200px", "100px");
    DOM.setStyleAttribute(dialog.getElement(), "border", "solid 1px black");
    dialog.setText("Drag me off the right side of the page");
    dialog.show();

    Debug.installEventTracer('e', Event.ONMOUSEMOVE);
}

From source file:burrito.client.crud.input.RelatedEntityEditAnchor.java

License:Apache License

public RelatedEntityEditAnchor(final String relatedEntityClassName,
        final EditForm.SaveCancelListener listener) {
    final String newLabel = CrudLabelHelper.getString(relatedEntityClassName.replace('.', '_') + "_new");
    setText(newLabel);//from  w  ww .  ja v  a  2s .c om
    addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            final DialogBox box = new CrudEntityEditDialogBox(newLabel, relatedEntityClassName, -1L,
                    new EditForm.SaveCancelListener() {

                        public void onSave() {
                            popup.setTextAndShow(labels.entityAddedAndCanBeSelected());
                            listener.onSave();
                        }

                        public void onPartialSave(String warning) {
                            throw new UnsupportedOperationException();
                        }

                        public void onCancel() {
                            listener.onCancel();
                        }
                    });
            box.addStyleName("k5-RelationSelectionListWrapper-entity-edit");
            box.center();
            box.show();
        }
    });
}

From source file:cc.alcina.framework.gwt.client.ide.ContentViewFactory.java

License:Apache License

public void popupEdit(Object bean, String title, final PermissibleActionListener okListener) {
    FlowPanel fp = new FlowPanel();
    final DialogBox dialog = new GlassDialogBox();
    dialog.setText(title);//  w w w  .ja v  a  2 s . c  o  m
    dialog.add(fp);
    setNoCaption(true);
    setCancelButton(true);
    PaneWrapperWithObjects view = createBeanView(bean, true, new PermissibleActionListener() {
        @Override
        public void vetoableAction(PermissibleActionEvent evt) {
            dialog.hide();
            if (evt.getAction().getClass() == ViewAction.class) {
                okListener.vetoableAction(evt);
            }
        }
    }, false, true);
    fp.add(view);
    dialog.center();
    dialog.show();
}

From source file:ch.unifr.pai.twice.layout.client.eclipseLayout.MiceSplitLayoutPanel.java

License:Apache License

/**
 * Removes the widget from the root layout and presents it in a dialog box.
 * //from www  .  j  a v a 2s  . c o  m
 * @param w
 */
private void toDialog(ResizableDecoratorPanel w) {
    if (isInFullscreenMode) {
        w = originSlotOfCurrentFullscreenWidget;
        releaseFullScreen();
    }
    final ResizableDecoratorPanel finalSlot = w;
    MiceDialogCaption caption;
    final DialogBox dbox = new DialogBox(false, false, (caption = new MiceDialogCaption()));
    caption.setHandlers(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            closeDialog(dbox);
            makeFullScreen(finalSlot);
        }
    }, new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            closeDialog(dbox);
        }
    });
    dialogs.put(dbox, w);
    dbox.setPopupPosition(w.getAbsoluteLeft(), w.getAbsoluteTop());
    Widget element = slots.get(w);
    dbox.setWidget(element);
    widthOfDialogsOriginalSlots.put(w, getSizeForWidget(w));
    dbox.show();
    if (getWidgetDirection(w) == Direction.CENTER) {
        ResizableDecoratorPanel lastAddedDecoratorPanel = getLastAddedNonDialogSlot();
        if (lastAddedDecoratorPanel != null) {
            setWidgetToSlot((ResizableDecoratorPanel) getCenter(), slots.get(lastAddedDecoratorPanel));
            setWidgetSize(lastAddedDecoratorPanel, 0);
            originsOfCenterReplacements.put(lastAddedDecoratorPanel, getSizeForWidget(lastAddedDecoratorPanel));
        }
    } else {
        setWidgetSize(w, 0);
    }
    onResize();
}

From source file:client.argon.panel.ArgonEndpointListPanel.java

License:Open Source License

@Override
public final void execute(final String type, final Vector checked, final ExecutionCallbackHandler callback) {

    if (type.compareTo("Enable/Disable") == 0) {

        RpcRequest.argon().disableEndpoint(checked, callback);

    } else if (type.compareTo("Modify") == 0) {
        final DialogBox info = new InfoDialog("Failure", type + " is not yet supported");
        info.center();/*from   w w w  .  ja  v a  2 s  .  c om*/
        info.show();
        callback.onFailure(new Throwable(new RuntimeException()));
    } else if (type.compareTo("Delete") == 0) {
        RpcRequest.argon().removeEndpoint(checked, callback);
    }

}

From source file:client.argon.panel.ArgonInternalLinkListPanel.java

License:Open Source License

@Override
public final void execute(final String type, final Vector checked, final ExecutionCallbackHandler callback) {

    if (type.compareTo("Enable/Disable") == 0) {

        RpcRequest.argon().disableInternalLink(checked, callback);

    } else if (type.compareTo("Modify") == 0) {
        final DialogBox info = new InfoDialog("Failure", type + " is not yet supported");
        info.center();/*from   w ww . j  a  v  a 2 s.c  o  m*/
        info.show();
        callback.onFailure(new Throwable(new RuntimeException()));
    } else if (type.compareTo("Delete") == 0) {
        RpcRequest.argon().removeInternalLink(checked, callback);
    }

}

From source file:client.argon.panel.ArgonRouterListPanel.java

License:Open Source License

@Override
public final void execute(final String type, final Vector checked, final ExecutionCallbackHandler callback) {

    if (type.compareTo("Disable") == 0) {
        final DialogBox info = new InfoDialog("Failure", type + " is not yet supported");
        info.center();/*from   w w w . j ava 2  s  .  c o m*/
        info.show();
        callback.onFailure(new Throwable(new RuntimeException()));
    } else if (type.compareTo("Modify") == 0) {
        final DialogBox info = new InfoDialog("Failure", type + " is not yet supported");
        info.center();
        info.show();
        callback.onFailure(new Throwable(new RuntimeException()));
    } else if (type.compareTo("Delete") == 0) {
        RpcRequest.argon().removeRouter(checked, callback);
    }

}

From source file:client.template.panel.ListPanel.java

License:Open Source License

/**
 * Shows the popup.//ww  w  .j a v  a2  s . c  o  m
 * 
 * @param row
 *            Table Row
 * @param col
 *            Table Column
 */
private void showPopUp(final int row, final int col) {
    if (false == this.checkCol(col, this.popupCells)) {
        return;
    }

    final TableRow rowData = this.map.get(row);

    final DialogBox dialog = (rowData.getDialog() == null) ? this.defaultDialog : rowData.getDialog();

    dialog.show();
    dialog.center();
}