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

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

Introduction

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

Prototype

DockLayoutConstant WEST

To view the source code for com.google.gwt.user.client.ui DockPanel WEST.

Click Source Link

Document

Specifies that a widget be added at the west edge of the dock.

Usage

From source file:ca.upei.ic.timetable.client.ApplicationView.java

License:Apache License

public ApplicationView(ApplicationController app) {
    app_ = app;//from  w  ww.j  a  v a 2  s.co m

    // hide the root panel first
    hide();

    // create the application view elements
    // we are using a horizontal split panel to host the left side (course view)
    // and the right side (calendar view)
    DockPanel panel = GWT.create(DockPanel.class);
    panel.setSize("980px", "580px");

    final View findCourseView = app_.getFindCourseController().getView();

    // find course button
    final Button findCourseButton = GWT.create(Button.class);
    findCourseButton.setText("Find Course...");
    findCourseButton.setPixelSize(250, 28);
    findCourseButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            findCourseView.show();
        }

    });
    // message view
    final View messageView = app_.getMessageController().getView();

    // course view
    final View courseView = app_.getCourseController().getView();
    courseView.getWidget().setWidth("340px");

    // calendar view
    final View calendarView = app_.getCourseCalendarController().getView();

    // top panel
    HorizontalPanel topPanel = GWT.create(HorizontalPanel.class);
    topPanel.add(findCourseButton);
    headerPanel_ = GWT.create(HorizontalPanel.class);
    SimplePanel topleft = PanelUtils.simplePanel(new HTML(""), 61, 28);
    headerPanel_.add(topleft);

    // add headers
    for (int i = 1; i < 6; i++) {
        SimplePanel header = GWT.create(SimplePanel.class);
        header.addStyleName("gridHeaderCell");
        header.setPixelSize(128, 28);
        header.add(new HTML(headerStrings[i]));
        headerPanel_.add(header);
    }

    topPanel.add(headerPanel_);

    // add elements to the dock panel
    // to north (top bar)
    panel.add(PanelUtils.horizontalPanel(findCourseButton, headerPanel_), DockPanel.NORTH);
    // to west (left side bar)
    panel.add(PanelUtils.verticalPanel(
            PanelUtils.decoratorPanel(PanelUtils.scrollPanel(courseView.getWidget(), 240, 555)),
            PanelUtils.horizontalPanel(ButtonUtils.button("Clear", 125, 25, new ClickListener() {
                public void onClick(Widget sender) {
                    app_.getCourseController().clear();
                }
            }, null), ButtonUtils.button("Print...", 125, 25, new ClickListener() {
                public void onClick(Widget sender) {
                    Element wrapper = DOM.createDiv();
                    Element header = (Element) headerPanel_.getElement().cloneNode(true);
                    wrapper.appendChild(header);
                    CalendarPanel calendar = (CalendarPanel) app_.getCourseCalendarController().getView()
                            .getWidget();
                    int height = calendar.getRealHeight();
                    Element calendarElement = (Element) calendar.getElement().cloneNode(true);
                    DOM.setStyleAttribute(calendarElement, "page-break-inside", "avoid");
                    DOM.setStyleAttribute(calendarElement, "height", (height + 50) + "px");
                    wrapper.appendChild(calendarElement);
                    app_.print("Main.css", wrapper.getInnerHTML());
                }
            }, null))), DockPanel.WEST);
    // to center (content)
    panel.add(calendarView.getWidget(), DockPanel.CENTER);

    // to footer (copyright)
    panel.add(new HTML(
            "&copy; 2008 University of Prince Edward Island. This is an <a href=\"http://github.com/upei/\">open-source project</a> licensed under Apache License 2.0."),
            DockPanel.SOUTH);

    // add the horizontal panel
    RootPanel.get().add(panel);
}

From source file:client.ManagementGui.java

License:Open Source License

/**
 * Build the whole panel./*www  .j a v a2s . c o m*/
 */
public final void onModuleLoad() {
    ManagementGui.instance = this;

    this.logoPanel.setWidth("100%");

    this.rightPanel.addStyleName("rightPanel");
    this.rightPanel.setWidth("100%");

    this.resTree.addStyleName("treeMenu");

    this.topologyTree.addStyleName("treeMenu");

    this.argonTree.addStyleName("treeMenu");

    this.stackPanel.setWidth("200");

    this.stackPanel.add(this.resTree, this.createImageHtml("journal.png", "Reservation"), true);
    this.stackPanel.add(this.topologyTree, this.createImageHtml("connect.png", "Tools"), true);
    this.stackPanel.add(this.argonTree, this.createImageHtml("database.png", "Argon"), true);
    this.stackPanel.add(this.renameTree, "About", true);

    this.dock.add(this.logoPanel, DockPanel.NORTH);
    this.dock.add(LoggingPanel.getPanel(), DockPanel.SOUTH);
    this.dock.add(this.stackPanel, DockPanel.WEST);
    this.dock.add(this.rightPanel, DockPanel.CENTER);

    this.dock.setWidth("100%");

    this.dock.setSpacing(4);
    this.dock.setCellWidth(this.rightPanel, "100%");

    Window.addWindowResizeListener(this);
    Window.enableScrolling(true);
    Window.setMargin("0px");

    RootPanel.get().add(this.dock);

    DeferredCommand.addCommand(new Command() {
        public void execute() {
            ManagementGui.this.onWindowResized(Window.getClientWidth(), Window.getClientHeight());
        }
    });

    this.onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}

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

License:Open Source License

@Override
public void add(Widget widget) {
    // if (!(widget instanceof ScrollPanel))
    // widget.getElement().getStyle().setOverflow(Overflow.HIDDEN);
    DockLayoutConstant location = positions.remove(0);
    container.widget.add(widget, location);
    if (widget instanceof HasHorizontalAlignment) {
        ((HasHorizontalAlignment) widget).setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    }/*ww  w.  ja  v  a  2 s.c om*/
    if (widget instanceof HasVerticalAlignment) {
        ((HasVerticalAlignment) widget).setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    }
    if (location.equals(DockPanel.SOUTH) || location.equals(DockPanel.NORTH)
            || location.equals(DockPanel.CENTER)) {
        container.widget.setCellWidth(widget, "100%");
        widget.setWidth("100%");
    }
    if (location.equals(DockPanel.EAST) || location.equals(DockPanel.WEST)
            || location.equals(DockPanel.CENTER)) {
        container.widget.setCellHeight(widget, height != -1 ? height + "px" : "100%");
        widget.setHeight(height != -1 ? height + "px" : "100%");
    }
}

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

License:Open Source License

@Override
public IContainer left() {
    setPosition(DockPanel.WEST);
    return add();
}

From source file:com.apress.progwt.client.widget.datepicker.CalendarTraversalPanel.java

License:Apache License

private void init() {
    this.setHeight(18 + "px");
    drawTitle();/*from  ww w. j  av  a  2s.  c  o  m*/

    this.prevMonth.setWidth(23 + "px");
    this.nextMonth.setWidth(23 + "px");

    DOM.setAttribute(prevMonth.getElement(), "title", "Previous Month");
    DOM.setAttribute(prevYear.getElement(), "title", "Previous Year");
    DOM.setAttribute(nextMonth.getElement(), "title", "Next Month");
    DOM.setAttribute(nextYear.getElement(), "title", "Next Year");

    HorizontalPanel prevButtons = new HorizontalPanel();
    prevMonth.setStyleName("monthYearTraversorBtn");
    prevYear.setStyleName("monthYearTraversorBtn");
    prevButtons.add(prevYear);
    prevButtons.add(prevMonth);

    HorizontalPanel nextButtons = new HorizontalPanel();
    nextMonth.setStyleName("monthYearTraversorBtn");
    nextYear.setStyleName("monthYearTraversorBtn");
    nextButtons.add(nextMonth);
    nextButtons.add(nextYear);

    this.add(prevButtons, DockPanel.WEST);
    this.setCellHorizontalAlignment(prevButtons, DockPanel.ALIGN_LEFT);
    this.add(nextButtons, DockPanel.EAST);
    this.setCellHorizontalAlignment(nextButtons, DockPanel.ALIGN_RIGHT);
    this.add(monthYearDesc, DockPanel.CENTER);
    this.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
    this.setCellHorizontalAlignment(this.monthYearDesc, HasAlignment.ALIGN_CENTER);
    this.setCellVerticalAlignment(this.monthYearDesc, HasAlignment.ALIGN_MIDDLE);
    this.setCellWidth(monthYearDesc, "100%");
    monthYearDesc.setStyleName("monthYearTraversor");

    this.setStyleName("monthYearTraversor");
}

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);/*  w  w w .  j a va  2 s.c o  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. co m*/

    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);//from w ww  . j  a va 2 s. c o  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);//w w  w.  j ava  2 s  .  com

    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   www .ja v a  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%");
}