Package org.gwtoolbox.widget.client.popup.dialog

Examples of org.gwtoolbox.widget.client.popup.dialog.Dialog$Impl


    public SimpleDialogSample() {

        Button openButton = new Button("Open Dialog", new ClickHandler() {
            public void onClick(ClickEvent event) {

                final Dialog dialog = new Dialog(false, true);
                dialog.setCaption("List");
                VerticalPanel main = new VerticalPanel();
                main.setWidth("100%")
                dialog.setWidthPx(300);
                dialog.setResizable(true);

                Label label = new Label("Please select one of the items");
                main.add(label);
                main.setCellHeight(label, "25px");

                final ListBox listBox = new ListBox(false);
                for (String coreName : new String[] { "Item 1" }) {
                    listBox.addItem(coreName, coreName);
                }
                listBox.setVisibleItemCount(5);
                listBox.setSelectedIndex(-1);
                listBox.setWidth("90%");
                listBox.setHeight("100%");
                main.add(listBox);
                main.setCellHorizontalAlignment(listBox, VerticalPanel.ALIGN_CENTER);
                main.setCellHeight(listBox, "120px");

                final SimpleButton okButton = new SimpleButton("OK", new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        dialog.hide();
                        int index = listBox.getSelectedIndex();
                        String coreName = listBox.getValue(index);
                    }
                });
                okButton.setEnabled(false);
                main.add(okButton);
                main.setCellHorizontalAlignment(okButton, VerticalPanel.ALIGN_CENTER);
                main.setCellHeight(okButton, "25px");

                listBox.addChangeHandler(new ChangeHandler() {
                    public void onChange(ChangeEvent event) {
                        okButton.setEnabled(listBox.getSelectedIndex() >= 0);
                    }
                });

                dialog.setWidget(main);

                dialog.setPopupPositionAndShow(new Popup.PositionCallback() {
                    public void setPosition(int offsetWidth, int offsetHeight) {
                        dialog.center();
                    }
                });

                final HandlerRegistration windowResizeHandlerRegistration = Window.addResizeHandler(new ResizeHandler() {
                    public void onResize(ResizeEvent event) {
                        dialog.center();
                    }
                });

                dialog.addCloseHandler(new CloseHandler<Popup>() {
                    public void onClose(CloseEvent<Popup> closeEvent) {
                        windowResizeHandlerRegistration.removeHandler();
                    }
                });
            }
View Full Code Here


                SplitLayout main = new SplitLayout();
                main.addWest(html, 100);
                main.add(closeButton);
                main.setSize("100%", "100%");

                dialog = new Dialog(false, true);
                dialog.setAnimationEnabled(animationType != null);
                if (animationType != null) {
                    dialog.setAnimationType(animationType);
                }
                dialog.setWidget(main);
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.popup.dialog.Dialog$Impl

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.