Example usage for com.google.gwt.user.client.ui HorizontalPanel add

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

Introduction

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

Prototype

@Override
    public void add(Widget w) 

Source Link

Usage

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

License:Open Source License

public UserPanel() {

    this.dialog = new SetPasswordDialog(this);
    this.setSpacing(5);

    Label title = new Label(LANG.admin_user_Text());
    title.addStyleName("audoc-sectionTitle");
    this.add(title);

    String caption = "<span class=\"user-name\">#0 #1</span><br/>" + "<span class=\"user-username\">#2</span>";
    this.usersBox = new HTMLButtonList("images/48x48/users.gif", caption, false);
    this.usersBox.addStyleName("audoc-users");
    this.usersBox.setPixelSize(300, 250);
    this.usersBox.addClickListener(new UserClickListener(this));

    this.add(this.usersBox);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setSpacing(5);/* ww  w  . ja va  2s.co m*/
    this.newUser = new Button(LANG.new_Text());
    this.newUser.addClickListener(this);

    this.editUser = new Button(LANG.edit_Text());
    this.editUser.addClickListener(this);

    this.delUser = new Button(LANG.delete_Text());
    this.delUser.addClickListener(this);

    this.setPassword = new Button(LANG.set_password_Text());
    this.setPassword.addClickListener(this);

    buttons.add(this.newUser);
    buttons.add(this.editUser);
    buttons.add(this.delUser);
    buttons.add(this.setPassword);

    this.add(buttons);
    this.getUsers();
}

From source file:com.audata.client.AuDoc.java

License:Open Source License

/**
 * Builds the menu bar panel/*from ww w . j  a  va 2  s .  com*/
 * @return HorizontalPanel containing the menu bar
 */
private HorizontalPanel buildMenu() {
    HorizontalPanel menu = new HorizontalPanel();
    menu.addStyleName("menu");
    menu.setWidth("100%");
    menu.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
    menu.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);
    menu.setSpacing(4);

    CaptionButton cb = new CaptionButton();
    cb.setImageUrl("images/48x48/home.gif");
    cb.setCaptionText(LANG.home_Text());
    cb.setOrientation(DockPanel.SOUTH);
    cb.addClickListener(new MenuClickListener(this, AuDoc.SECTION_HOME));
    cb.setTitle(LANG.home_title_Text());
    menu.add(cb);

    CaptionButton cb_1 = new CaptionButton();
    cb_1.setImageUrl("images/48x48/search.gif");
    cb_1.setCaptionText(LANG.search_Text());
    cb_1.setOrientation(DockPanel.SOUTH);
    cb_1.addClickListener(new MenuClickListener(this, AuDoc.SECTION_SEARCH));
    cb_1.setTitle(LANG.search_title_Text());
    menu.add(cb_1);

    CaptionButton cb_2 = new CaptionButton();
    cb_2.addCaptionStyleName("nowrap");
    cb_2.setOrientation(DockPanel.SOUTH);
    cb_2.setImageUrl("images/48x48/newrec.gif");
    cb_2.setCaptionText(LANG.newrec_Text());
    cb_2.addClickListener(new MenuClickListener(this, AuDoc.SECTION_NEW));
    cb_2.setTitle(LANG.newrec_title_Text());
    menu.add(cb_2);

    CaptionButton cb_3 = new CaptionButton();
    cb_3.setImageUrl("images/48x48/reports.gif");
    cb_3.setCaptionText(LANG.report_Text());
    cb_3.setOrientation(DockPanel.SOUTH);
    cb_3.addClickListener(new MenuClickListener(this, AuDoc.SECTION_REPORT));
    cb_3.setTitle(LANG.report_title_Text());
    menu.add(cb_3);

    CaptionButton cb_4 = new CaptionButton();
    cb_4.setImageUrl("images/48x48/checkout.gif");
    cb_4.setCaptionText(LANG.rapid_title_Text());
    cb_4.setOrientation(DockPanel.SOUTH);
    cb_4.addClickListener(new MenuClickListener(this, AuDoc.SECTION_RAPID));
    cb_4.setTitle(LANG.rapid_title_Text());
    menu.add(cb_4);

    this.adminButton = new CaptionButton();
    this.adminButton.setImageUrl("images/48x48/admin.gif");
    this.adminButton.setCaptionText(LANG.admin_Text());
    this.adminButton.setOrientation(DockPanel.SOUTH);
    this.adminButton.setVisible(false);
    this.adminButton.addClickListener(new MenuClickListener(this, AuDoc.SECTION_ADMIN));
    this.adminButton.setTitle(LANG.admin_title_Text());
    menu.add(this.adminButton);
    menu.setCellWidth(this.adminButton, "100%");
    menu.setCellHorizontalAlignment(this.adminButton, HasAlignment.ALIGN_RIGHT);

    return menu;
}

From source file:com.audata.client.AuDoc.java

License:Open Source License

/**
 * Called when a user logs in//from  w  w w  .j  av  a 2 s .  co m
 */
public void onLogin() {

    SecLoader.cacheCaveats();
    SecLoader.cacheSecLevels();

    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(2);
    panel.setWidth("150px");
    panel.add(new Image("images/16x16/users.gif"));
    Label name = new Label(AuDoc.state.getItem("surname") + ", " + AuDoc.state.getItem("forename"));
    name.setWidth("116px");
    name.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
    name.addStyleName("audoc-userNote");
    panel.add(name);
    Image logout = new Image("images/16x16/logout.gif");
    logout.addStyleName("audoc-logoutButton");
    logout.addClickListener(new LogoutListener(this));
    panel.add(logout);
    RootPanel.get("user").add(panel);

    if (AuDoc.state.getItem("isAdmin") == "true") {
        this.adminButton.setVisible(true);
    }

    this.classBrowser.onUpdate();
    this.trayPanel.onUpdate();
    this.checkoutsPanel.onUpdate();
    this.savedSearchPanel.onUpdate();
}

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);//from  w  w  w  .  j  ava  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.checkout.CheckinDialog.java

License:Open Source License

public CheckinDialog(String uuid, String name) {
    this.uuid = uuid;
    this.name = name;
    this.setText(LANG.check_in_msg_Text() + ": " + this.name);

    VerticalPanel main = new VerticalPanel();
    main.setSize("100%", "100%");
    main.setSpacing(3);//from  w  ww . java  2  s .  c  om
    main.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);

    this.undo = new RadioButton("ActionGroup", LANG.check_in_Text());
    this.checkin = new RadioButton("ActionGroup", LANG.check_in_version_Text());
    this.undo.setChecked(true);
    this.undo.addClickListener(this);
    this.checkin.addClickListener(this);
    main.add(this.undo);
    main.add(this.checkin);

    this.upload = new UploadPanel();
    String url = AuDoc.jsonCall.getURL();
    this.upload.setAction(url + "docIO.php");
    this.upload.setEncoding(FormPanel.ENCODING_MULTIPART);
    this.upload.setMethod(FormPanel.METHOD_POST);
    this.upload.setVisible(false);
    main.add(upload);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setSpacing(3);
    this.ok = new Button(LANG.ok_Text());
    this.ok.addClickListener(this);
    buttons.add(this.ok);
    this.cancel = new Button(LANG.cancel_Text());
    this.cancel.addClickListener(this);
    buttons.add(this.cancel);
    main.add(buttons);
    main.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT);

    this.setWidget(main);
}

From source file:com.audata.client.checkout.CheckoutPanel.java

License:Open Source License

public void addRecord(String uuid, String title, String recordType, String cot) {
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth("100%");
    hp.setSpacing(3);/*from ww  w  . j  ava  2 s  .  c o  m*/
    //CaptionButton button = new CaptionButton("images/16x16/treerec.gif",title, CaptionButton.CAPTION_EAST);
    CaptionButton button = new CaptionButton();
    button.setImageUrl("images/16x16/treerec.gif");
    button.setCaptionText(title);

    button.addClickListener(new CheckoutClickListener(this, uuid, recordType, cot));

    Image cButton = new Image("images/16x16/checkouts.gif");
    cButton.addClickListener(new CheckinClickListener(uuid, title));
    cButton.setTitle(LANG.check_in_Text() + " " + title);
    cButton.addStyleName("hand");

    hp.add(button);
    hp.add(cButton);
    hp.setCellVerticalAlignment(cButton, HasAlignment.ALIGN_MIDDLE);
    this.records.add(hp);
}

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 ww  w  .  jav 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.newRecord.Metadata.java

License:Open Source License

private void paintFields() {
    this.main.clear();
    //Display Record Type
    Label type = new Label(this.rTypeName);
    type.setWidth("150px");
    type.addStyleName("audoc-sectionSubTitle");
    this.main.add(type);

    //Add Fields// w w w. j  a  v  a 2s  .  co  m
    for (int i = 0; i < this.fields.size(); i++) {
        Field f = (Field) this.fields.get(i);
        HorizontalPanel hp = new HorizontalPanel();
        hp.setSpacing(5);

        Label l = new Label(f.name);
        l.setWidth("150px");
        l.addStyleName("audoc-label");
        l.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
        Widget w = null;
        w = f.getField();
        Label n = new Label("");
        n.addStyleName("audoc-note");
        switch (f.type) {
        case FieldTypes.TYPE_INT:
            n.setText(LANG.int_Text());
            break;
        case FieldTypes.TYPE_DEC:
            n.setText(LANG.dec_Text());
            break;
        case FieldTypes.TYPE_DATE:
            n.setText(LANG.date_format_Text());
            break;
        case FieldTypes.TYPE_STRING:
            break;
        case FieldTypes.TYPE_KEYWORD:
            break;
        case FieldTypes.TYPE_CLASS:
            n.setText(LANG.req_field_marker_Text());
            n.removeStyleName("audoc-note");
            n.addStyleName("audoc-required");
            break;
        case FieldTypes.TYPE_NOTES:
            break;
        case FieldTypes.TYPE_RECNUM:
            n.setText(LANG.req_field_marker_Text());
            n.removeStyleName("audoc-note");
            n.addStyleName("audoc-required");
        }
        hp.add(l);
        hp.add(w);
        hp.add(n);
        this.main.add(hp);
    }
    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(5);

    Label l = new Label(LANG.document_Text());
    l.setWidth("150px");
    l.addStyleName("audoc-label");
    l.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
    hp.add(l);
    hp.add(this.upload);
    this.main.add(hp);

    Label req = new Label();
    req.setText(LANG.req_field_Text());
    req.addStyleName("audoc-required");
    this.main.add(req);
}

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 ww  .  j ava2s. 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.record.RecNumberDialog.java

License:Open Source License

public RecNumberDialog(String uuid, String recNumber, UpdateListener listener) {
    this.setText(LANG.change_rec_num_Text());
    this.listener = listener;
    this.uuid = uuid;

    VerticalPanel main = new VerticalPanel();

    HorizontalPanel fields = new HorizontalPanel();
    fields.setSpacing(3);/*  ww  w  .  ja va2s.c om*/
    Label l = new Label(LANG.rec_num_Text());
    fields.add(l);
    this.numBox = new TextBox();
    this.numBox.setText(recNumber);
    fields.add(this.numBox);
    main.add(fields);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setSpacing(3);
    this.ok = new Button(LANG.save_Text());
    this.ok.addClickListener(this);
    buttons.add(this.ok);
    this.cancel = new Button(LANG.cancel_Text());
    this.cancel.addClickListener(this);
    buttons.add(this.cancel);
    main.add(buttons);
    main.setCellHorizontalAlignment(buttons, HasAlignment.ALIGN_RIGHT);

    this.setWidget(main);
}