Example usage for com.google.gwt.user.client.ui DockPanel DockPanel

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

Introduction

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

Prototype

public DockPanel() 

Source Link

Document

Creates an empty dock panel.

Usage

From source file:bwbv.rlt.client.ui.HeaderPane.java

License:Apache License

/**
 * Constructs a new HeaderPane that displays the given text.
 * //  w w  w. j  a v a2  s. com
 * @param titleText
 *            The text this header should show as a title.
 */
public HeaderPane(ClientState clientState, ClientController clientController) {
    this.clientState = clientState;
    this.clientController = clientController;
    clientState.addChangeListener(ClientState.ChangeListener.USERCHANGED_EVENT, this);

    main = new DockPanel();
    main.add(new Label("BWBV RLT Online"), DockPanel.CENTER);
    reset();
    initWidget(main);
    setStyleName("HeaderPane");
}

From source file:cc.alcina.framework.gwt.client.stdlayout.MainTabPanel.java

License:Apache License

public MainTabPanel(ArrayList<IsWidget> buttons) {
    super();//  w  ww .ja  v  a  2s .c  o m
    this.buttons = buttons;
    VerticalPanel vp = (VerticalPanel) getWidget();
    dockPanel = new DockPanel();
    dockPanel.setStyleName("alcina-MainMenu");
    dockPanel.setWidth("100%");
    mainMenuContainer = new FlowPanel();
    mainMenuContainer.setStyleName("alcina-MainMenuContainer");
    mainMenuContainer.add(dockPanel);
    tabBarProt = (TabBar) vp.getWidget(0);
    vp.remove(tabBarProt);
    if (isWrapCenterContainer()) {
        centerContainer = new SpanPanel();
        centerContainer.add(tabBarProt);
        dockPanel.add(centerContainer, DockPanel.CENTER);
    } else {
        dockPanel.add(tabBarProt, DockPanel.CENTER);
    }
    bp = createButtonsPanel();
    refreshButtonPanelVis();
    dockPanel.add(bp, DockPanel.EAST);
    dockPanel.setCellHorizontalAlignment(bp, DockPanel.ALIGN_RIGHT);
    vp.insert(mainMenuContainer, 0);
    customizeDock();
    vp.insert(toolbarHolder, 1);
    vp.getWidget(1).setWidth("100%");
    noTabContentHolder.setVisible(false);
    noTabContentHolder.setStyleName("content alcina-ContentFrame alcina-MainContent");
    vp.add(noTabContentHolder);
    vp.setWidth("100%");
    addBeforeSelectionHandler(new BeforeSelectionHandler<Integer>() {
        public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {
            int tabIndex = event.getItem();
            getDeckPanel().setVisible(tabIndex >= 0);
            if (tabIndex != -1) {
                noTabContentHolder.clear();
            }
            noTabContentHolder.setVisible(tabIndex == -1);
        }
    });
}

From source file:co.fxl.gui.gwt.GWTLayout.java

License:Open Source License

@Override
public IDockPanel dock() {
    setComponent(new DockPanel());
    return (IDockPanel) (panel.element = new GWTDockPanel(panel));
}

From source file:com.apress.progwt.client.calculator.Calculator.java

License:Apache License

public Calculator() {

    DockPanel dockPanel = new DockPanel();

    Grid controls = new Grid(5, 2);
    Grid numbersP = new Grid(4, 3);

    // initialize the 1-9 buttons
    for (int row = 0; row < 3; row++) {
        for (int col = 0; col < 3; col++) {
            numbersP.setWidget(row, col, new NumberButton(this, row * 3 + col + 1));
        }/* w w w  .ja  va 2 s  .c  om*/
    }
    numbersP.setWidget(3, 0, new NumberButton(this, 0));
    numbersP.setWidget(3, 1, new NumberButton(this, "."));
    numbersP.setWidget(3, 2, new ControlButton(this, new ControlAction(this, "+/-") {
        @Override
        public boolean isMultiArg() {
            return false;
        }

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return -1 * current;
        }
    }));

    controls.setWidget(0, 0, new ControlButton(this, new ControlAction(this, "/") {

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return previous / current;
        }
    }));

    controls.setWidget(0, 1, new ControlButton(this, new ControlAction(this, "sqrt") {
        @Override
        public boolean isMultiArg() {
            return false;
        }

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return Math.sqrt(current);
        }
    }));

    controls.setWidget(1, 0, new ControlButton(this, new ControlAction(this, "*") {
        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return previous * current;
        }
    }));
    controls.setWidget(1, 1, new ControlButton(this, new ControlAction(this, "%") {
        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return previous % current;
        }
    }));
    controls.setWidget(2, 0, new ControlButton(this, new ControlAction(this, "-") {
        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return previous - current;
        }
    }));
    controls.setWidget(2, 1, new ControlButton(this, new ControlAction(this, "1/x") {
        @Override
        public boolean isMultiArg() {
            return false;
        }

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return 1 / current;
        }
    }));
    controls.setWidget(3, 0, new ControlButton(this, new ControlAction(this, "+") {
        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return previous + current;
        }
    }));
    controls.setWidget(3, 1, new ControlButton(this, new ControlAction(this, "=") {
        @Override
        public boolean isMultiArg() {
            return false;
        }

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            if (lastAction == null) {
                return current;
            }
            return lastAction.performAction(null, previous, current);
        }

    }));

    controls.setWidget(4, 0, new ControlButton(this, new ControlAction(this, "bksp") {
        @Override
        public boolean isMultiArg() {
            return false;
        }

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            String cStr = current + "";
            if (cStr.endsWith(".0")) {
                cStr = cStr.substring(0, cStr.length() - 3);
            } else {
                cStr = cStr.substring(0, cStr.length() - 1);
            }
            if (cStr.equals("")) {
                cStr = "0";
            }
            return Double.parseDouble(cStr);
        }

    }));

    controls.setWidget(4, 1, new ControlButton(this, new ControlAction(this, "clear") {
        @Override
        public boolean isMultiArg() {
            return false;
        }

        @Override
        public double performAction(ControlAction lastAction, double previous, double current) {
            return 0;
        }
    }));

    dockPanel.add(numbersP, DockPanel.CENTER);
    dockPanel.add(controls, DockPanel.EAST);

    inputBox = new TextBox();
    inputBox.addStyleName("ResultBox");
    dockPanel.add(inputBox, DockPanel.NORTH);

    ticker = new TextArea();
    ticker.setSize("7em", "140px");

    MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
    oracle.add("Jill");
    oracle.add("Jeff");
    oracle.add("James");
    oracle.add("Jennifer");

    SuggestBox box = new SuggestBox(oracle);
    box.addEventHandler(new SuggestionHandler() {
        public void onSuggestionSelected(SuggestionEvent suggE) {
            String selected = suggE.getSelectedSuggestion().getReplacementString();
            // do something with selected suggestion
        }
    });

    dockPanel.add(box, DockPanel.SOUTH);

    HorizontalPanel mainP = new HorizontalPanel();
    mainP.add(dockPanel);
    mainP.add(ticker);

    initWidget(mainP);

    setResult(0);

}

From source file:com.audata.client.admin.SetPasswordDialog.java

License:Open Source License

public SetPasswordDialog(UserPanel parent) {
    this.setText(LANG.set_password_Text());

    DockPanel outer = new DockPanel();
    outer.setSpacing(4);/*www  .java 2  s  .  co  m*/

    outer.add(new Image("images/48x48/security.gif"), DockPanel.WEST);

    VerticalPanel formPanel = new VerticalPanel();

    HorizontalPanel pass1Panel = new HorizontalPanel();
    Label l1 = new Label(LANG.password_Text());
    l1.addStyleName("audoc-label");
    l1.setWidth("120px");

    pass1Panel.add(l1);
    this.pass1 = new PasswordTextBox();
    pass1Panel.add(this.pass1);
    formPanel.add(pass1Panel);

    HorizontalPanel pass2Panel = new HorizontalPanel();

    Label l2 = new Label(LANG.password_reenter_Text());
    l2.addStyleName("audoc-label");
    l2.setWidth("120px");
    pass2Panel.add(l2);
    this.pass2 = new PasswordTextBox();
    pass2Panel.add(this.pass2);
    formPanel.add(pass2Panel);

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(5);

    this.setButton = new Button(LANG.set_password_Text());
    this.setButton.addClickListener(this);
    buttonPanel.add(this.setButton);

    this.cancelButton = new Button(LANG.cancel_Text());
    this.cancelButton.addClickListener(this);
    buttonPanel.add(this.cancelButton);

    formPanel.add(buttonPanel);
    formPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    outer.add(formPanel, DockPanel.SOUTH);
    formPanel.setSpacing(4);
    outer.setSpacing(8);
    setWidget(outer);
}

From source file:com.audata.client.authentication.LoginDialog.java

License:Open Source License

public LoginDialog(AuDoc parent) {
    this.parent = parent;
    setText(CONSTANTS.welcome_Text());

    // Create a DockPanel to contain the 'about' label and the 'OK' button.
    DockPanel outer = new DockPanel();
    outer.setSpacing(4);/*ww w.j  a va 2 s . c om*/

    outer.add(new Image("images/48x48/security.gif"), DockPanel.WEST);

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.setSpacing(1);

    HorizontalPanel userPanel = new HorizontalPanel();
    this.username = new TextBox();
    Label l = new Label(CONSTANTS.username_Text());
    l.addStyleName("audoc-label");
    l.setWidth("85px");
    userPanel.add(l);
    userPanel.add(this.username);
    formPanel.add(userPanel);

    HorizontalPanel passPanel = new HorizontalPanel();
    this.password = new PasswordTextBox();
    l = new Label(CONSTANTS.password_Text());
    l.addStyleName("audoc-label");
    l.setWidth("85px");
    passPanel.add(l);
    passPanel.add(this.password);
    formPanel.add(passPanel);

    HorizontalPanel langPanel = new HorizontalPanel();
    l = new Label(CONSTANTS.lang_Text());
    l.addStyleName("audoc-label");
    l.setWidth("85px");
    langPanel.add(l);
    formPanel.add(langPanel);

    this.languages = new ListBox();
    this.populateLocales();
    this.languages.setWidth("146px");

    langPanel.add(this.languages);

    this.languages.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            //refreshes the browser in the selected locale
            Location loc = WindowUtils.getLocation();
            String path = loc.getProtocol() + "//" + loc.getHost() + loc.getPath();
            String locale = languages.getValue(languages.getSelectedIndex());
            Window.open(path + "?locale=" + locale, "_self", "");
        }
    });

    this.loginButton = new Button(CONSTANTS.login_Text(), this);
    formPanel.add(loginButton);
    formPanel.setCellHorizontalAlignment(this.loginButton, HasAlignment.ALIGN_RIGHT);
    outer.add(formPanel, DockPanel.SOUTH);

    HTML text = new HTML(CONSTANTS.message_Text());
    text.setStyleName("audoc-LoginDialogText");
    outer.add(text, DockPanel.CENTER);

    // Add a bit of spacing and margin to the dock to keep the components from
    // being placed too closely together.
    outer.setSpacing(8);
    this.setWidget(outer);
}

From source file:com.audata.client.feedback.SimpleDialog.java

License:Open Source License

private SimpleDialog(int type, String title, String message, ResponseListener listener) {
    this.listener = listener;
    this.type = type;
    this.setText(title);
    this.addStyleName("audoc-simpleDialog");

    DockPanel main = new DockPanel();

    main.setSpacing(4);//w  ww  .j  a  v a 2 s . co m
    HorizontalPanel butPanel = new HorizontalPanel();
    butPanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
    butPanel.setSpacing(4);
    switch (type) {
    case SimpleDialog.TYPE_ERROR:
        main.add(new Image("images/48x48/error.gif"), DockPanel.WEST);
        this.close = new Button("Close");
        this.close.addClickListener(this);
        butPanel.add(this.close);
        break;
    case SimpleDialog.TYPE_MESSAGE:
        main.add(new Image("images/48x48/udf.gif"), DockPanel.WEST);
        this.close = new Button("Close");
        this.close.addClickListener(this);
        butPanel.add(this.close);
        break;
    case SimpleDialog.TYPE_QUERY:
        main.add(new Image("images/48x48/help.gif"), DockPanel.WEST);
        this.ok = new Button("Ok");
        this.ok.addClickListener(this);
        this.cancel = new Button("Cancel");
        this.cancel.addClickListener(this);
        butPanel.add(this.ok);
        butPanel.add(this.cancel);
        break;
    }
    VerticalPanel p = new VerticalPanel();
    p.setSpacing(15);
    p.add(new Label(message));
    p.add(butPanel);
    p.setCellHorizontalAlignment(butPanel, HasAlignment.ALIGN_RIGHT);
    main.add(p, DockPanel.EAST);
    this.setWidget(main);
    this.setPopupPosition(0, 0);
}

From source file:com.audata.client.rapidbooking.RapidBookingDialog.java

License:Open Source License

public RapidBookingDialog() {
    setText(CONSTANTS.rapid_title_Text());
    DockPanel outer = new DockPanel();
    outer.setSpacing(4);//from  w w  w .ja v a  2  s .  c o m

    outer.add(new Image("images/48x48/checkout.gif"), DockPanel.WEST);

    VerticalPanel form = new VerticalPanel();
    form.setSpacing(4);

    this.checkin = new RadioButton("ActionGroup", CONSTANTS.check_in_Text());
    this.checkin.addClickListener(this);
    this.checkin.setChecked(true);
    this.checkin.addStyleName("audoc-label");
    form.add(this.checkin);
    this.checkout = new RadioButton("ActionGroup", CONSTANTS.checkout_Text());
    this.checkout.addClickListener(this);
    this.checkout.addStyleName("audoc-label");
    form.add(this.checkout);

    this.userPanel = new HorizontalPanel();
    Label l = new Label(CONSTANTS.user_Text());
    l.addStyleName("audoc-label");
    userPanel.add(l);
    this.users = new ListBox();
    userPanel.add(this.users);
    userPanel.setCellWidth(l, "100px");
    this.userPanel.setVisible(false);
    form.add(this.userPanel);

    HorizontalPanel recnumPanel = new HorizontalPanel();
    Label r = new Label(CONSTANTS.rec_num_Text());
    r.addStyleName("audoc-label");
    recnumPanel.add(r);
    this.recnum = new TextBox();
    recnumPanel.add(this.recnum);
    recnumPanel.setCellWidth(r, "100px");
    form.add(recnumPanel);

    HorizontalPanel butPanel = new HorizontalPanel();
    butPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    butPanel.setSpacing(4);
    this.closeButton = new Button(CONSTANTS.close_Text());
    this.closeButton.addClickListener(this);
    butPanel.add(this.closeButton);

    this.okButton = new Button(CONSTANTS.ok_Text());
    this.okButton.addClickListener(this);
    butPanel.add(this.okButton);
    //       butPanel.setWidth("100%");
    form.add(butPanel);

    String template = "<span class=\"rapid_processed\">#0 #1</span>";
    this.processed = new HTMLButtonList("images/16x16/treerec.gif", template, false);
    this.processed.setWidth("100%");
    this.processed.setHeight("75px");
    form.add(this.processed);

    outer.add(form, DockPanel.NORTH);
    if (AuDoc.state.getItem("isAdmin") == "true") {
        this.getUsers();
    } else {
        String username = (String) AuDoc.state.getItem("username");
        String forename = (String) AuDoc.state.getItem("forename");
        String surname = (String) AuDoc.state.getItem("surname");
        this.users.addItem(surname + ", " + forename, username);
    }
    this.setWidget(outer);
}

From source file:com.audata.client.widgets.CaptionButton.java

License:Open Source License

public CaptionButton() {
    main = new DockPanel();
    initWidget(main);//from w  ww .j a va 2 s  .c o m
    main.setSpacing(4);
    main.setStyleName("captionButton");

    image = new Image();
    main.add(image, DockPanel.WEST);
    main.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_LEFT);
    main.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    image.setStyleName("captionButton-Icon");
    image.setUrl("images/48x48/admin.gif");

    caption = new HTML("New Label");
    main.add(caption, DockPanel.EAST);
    main.setCellHorizontalAlignment(caption, HasHorizontalAlignment.ALIGN_LEFT);
    main.setCellVerticalAlignment(caption, HasVerticalAlignment.ALIGN_MIDDLE);
    caption.setStyleName("captionButton-caption");
    //setWidth("100%");
}

From source file:com.bramosystems.oss.player.core.client.PlayerUtil.java

License:Apache License

/**
 * Returns a widget that may be used to notify the user when a required plugin
 * is not available.  The widget provides a link to the plugin download page.
 *
 * <h4>CSS Style Rules</h4>/*  w ww.j av  a  2  s.  c  o  m*/
 * <ul>
 * <li>.player-MissingPlugin { the missing plugin widget }</li>
 * <li>.player-MissingPlugin-title { the title section }</li>
 * <li>.player-MissingPlugin-message { the message section }</li>
 * </ul>
 *
 * @param plugin the missing plugin
 * @param title the title of the message
 * @param message descriptive message to notify user about the missing plugin
 * @param asHTML {@code true} if {@code message} should be interpreted as HTML,
 *          {@code false} otherwise.
 *
 * @return missing plugin widget.
 * @since 0.6
 */
public static Widget getMissingPluginNotice(final Plugin plugin, String title, String message, boolean asHTML) {
    DockPanel dp = new DockPanel() {

        @Override
        public void onBrowserEvent(Event event) {
            super.onBrowserEvent(event);
            switch (event.getTypeInt()) {
            case Event.ONCLICK:
                if (plugin.getDownloadURL().length() > 0) {
                    Window.open(plugin.getDownloadURL(), "dwnload", "");
                }
            }
        }
    };
    dp.setHorizontalAlignment(DockPanel.ALIGN_LEFT);
    dp.sinkEvents(Event.ONCLICK);
    dp.setWidth("200px");

    Label titleLb = null, msgLb = null;
    if (asHTML) {
        titleLb = new HTML(title);
        msgLb = new HTML(message);
    } else {
        titleLb = new Label(title);
        msgLb = new Label(message);
    }

    dp.add(titleLb, DockPanel.NORTH);
    dp.add(msgLb, DockPanel.CENTER);

    titleLb.setStylePrimaryName("player-MissingPlugin-title");
    msgLb.setStylePrimaryName("player-MissingPlugin-message");
    dp.setStylePrimaryName("player-MissingPlugin");

    DOM.setStyleAttribute(dp.getElement(), "cursor", "pointer");
    return dp;
}