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

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

Introduction

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

Prototype

public HorizontalPanel() 

Source Link

Document

Creates an empty horizontal panel.

Usage

From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardMainPanel.java

License:Apache License

private void initUi() {
    mainPanel = new VerticalPanel();
    mainPanel.setWidth("300px");
    mainPanel.setSpacing(4);//from   w w w .j ava2s .c o  m

    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.setWidth("100%");
    HorizontalPanel logoutPanel = new HorizontalPanel();
    Image logoutImage = new Image(MdConstants.IMG_LOGOUT);
    logoutImage.getElement().getStyle().setCursor(Cursor.POINTER);
    logoutImage.setSize("16px", "16px");
    logoutImage.setTitle("Log Out");
    logoutImage.getElement().getStyle().setProperty("cursor", "hand");
    logoutImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    HTML logOutLabel = new HTML("<u><font size=-2>Log Out </font></u>");
    logOutLabel.setHeight("10px");
    // logOutLabel.setStyleName("logoutButton");
    logOutLabel.setStylePrimaryName("logoutButton");
    logOutLabel.getElement().getStyle().setProperty("right", "5px");
    // logOutLabel.getElement().getStyle().setProperty("cursor", "hand");
    logOutLabel.getElement().getStyle().setCursor(Cursor.POINTER);
    logOutLabel.setWidth("100%");
    logOutLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    logoutPanel.add(logOutLabel);
    logoutPanel.add(logoutImage);
    logoutPanel.setSpacing(2);

    logoutPanel.setCellHorizontalAlignment(logoutImage, HasHorizontalAlignment.ALIGN_RIGHT);
    logoutPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);

    titlePanel.getElement().getStyle().setProperty("marginLeft", "50");
    titleLabel = new HTML("<font size=4>&nbsp;</font>");
    titleLabel.getElement().setId("dashboardTitleLabel");

    titlePanel.add(logoutPanel);
    titlePanel.add(titleLabel);

    titlePanel.setCellHorizontalAlignment(logoutPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    DecoratorPanel titleDecor = new DecoratorPanel();
    titleDecor.setWidth("250px");
    titleDecor.setHeight("30px");
    mainPanel.add(titlePanel);

    mainPanel.setCellVerticalAlignment(logOutLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.setCellVerticalAlignment(titleLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    Image image = new Image(MdConstants.IMG_TOOLS);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    adminConsoleButton = new PushButton(image);
    adminConsoleButton.getElement().setId("adminConsoleButton");
    adminConsoleButton.setSize("50px", MdConstants.IMG_SIZE);
    adminConsoleButton.setTitle("Show Admin Console");
    adminConsoleButton.setEnabled(false);
    adminConsoleButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole console = new AdminConsole(controller);
        }
    });

    editorDecorator = new DecoratorPanel();
    editorDecorator.setTitle("Dashboard Editor");
    editorDecorator.setWidth("315px");

    toolstripPanel = new DashboardToolStripBar(this);

    dashboardListBox = new ListBox(false);
    dashboardListBox.getElement().setId("dashboardListBox");
    dashboardListBox.setWidth("295px");
    dashboardListBox.setVisibleItemCount(10);
    dashboardListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            dashboardListChanged();
        }
    });

    notesArea = new TextArea();
    notesArea.setVisibleLines(2);
    notesArea.setWidth("290px");
    notesArea.setHeight("50px");
    notesArea.getElement().setId("notesTextArea");

    VerticalPanel editorVerticalPanel = new VerticalPanel();
    editorVerticalPanel.setSpacing(4);
    editorVerticalPanel.add(toolstripPanel);
    editorVerticalPanel.add(dashboardListBox);
    editorVerticalPanel.add(new HTML("<font size=-1><b>Dashboard Notes:</b></font></br>"));
    editorVerticalPanel.add(notesArea);
    editorVerticalPanel.setCellVerticalAlignment(toolstripPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    editorVerticalPanel.setCellHorizontalAlignment(toolstripPanel, HasHorizontalAlignment.ALIGN_CENTER);
    editorDecorator.setWidget(editorVerticalPanel);

    settingsPanel = new DashboardSettingsPanel(this);

    mainPanel.add(editorDecorator);
    mainPanel.add(settingsPanel);
    // mainPanel.add(adminConsoleButton);

    mainPanel.setCellVerticalAlignment(editorDecorator, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(editorDecorator, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(settingsPanel, HasVerticalAlignment.ALIGN_TOP);
    mainPanel.setCellHorizontalAlignment(settingsPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(adminConsoleButton, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(adminConsoleButton, HasHorizontalAlignment.ALIGN_CENTER);

    this.add(mainPanel);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardSettingsPanel.java

License:Apache License

private void init() {

    periodSetting = new SettingsOption("Period");
    periodSetting.getElement().setId("periodSetting");
    periodSetting.getList().getElement().setId("periodSettingListBox");
    periodSetting.getCheckBox().getElement().setId("periodSettingCheckBox");
    ListBox box = periodSetting.getList();
    for (Period p : Period.values()) {
        box.addItem(p.getDisplayValue(), p.getSymbol());
    }/*ww  w  . j  a v  a2 s.c o m*/
    granularitySetting = new SettingsOption("Granularity");
    granularitySetting.getElement().setId("granularitySetting");
    granularitySetting.getList().getElement().setId("granularitySettingListBox");
    granularitySetting.getCheckBox().getElement().setId("granularitySettingCheckBox");
    box = granularitySetting.getList();
    box.addItem("", "");
    for (Granularity g : Granularity.values()) {
        box.addItem(g.getDisplayValue(), g.getSymbol());
    }

    VerticalPanel settingsPanel = new VerticalPanel();
    settingsPanel.setSpacing(8);
    settingsPanel.setWidth("290px");
    Image helpImage = new Image(MdConstants.IMG_QUESTION_MARK);
    helpImage.setSize("20px", "20px");
    helpImage.setTitle(
            "Dashboard level settings override individual chart settings for all charts in this dashboard.");
    HorizontalPanel labelPanel = new HorizontalPanel();

    datetimePicker = new CalendarPicker("dashboard", false);
    datetimePicker.addDashboardSettingsUpdatedHandler(new DashboardSettingsUpdatedHandler());

    labelPanel.add(new HTML("<b>Dashboard Settings</b>"));
    labelPanel.add(helpImage);
    labelPanel.add(new HTML("</br>"));

    settingsPanel.add(labelPanel);
    settingsPanel.add(new HTML("<hr>"));
    settingsPanel.add(periodSetting);
    settingsPanel.add(datetimePicker);
    settingsPanel.add(new HTML("<hr>"));
    settingsPanel.add(granularitySetting);
    // settingsPanel.add(new NumberSpinner(0));

    this.setWidget(settingsPanel);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.AuthenticationDialog.java

License:Apache License

public AuthenticationDialog(Md_sandbox application, List<Site> siteList) {
    this.application = application;

    mainPanel = new HorizontalPanel();
    mainPanel.getElement().getStyle().setProperty("backgroundColor", "#477E7E");

    warningPanel = new VerticalPanel();
    warningPanel.setWidth("450px");
    // warningPanel.setWidth("100%");
    warningPanel.setHeight("100%");
    warningPanel.setSpacing(20);//from  w  w  w  .j av  a 2  s  .  c o m
    warningPanel.getElement().getStyle().setProperty("backgroundColor", "#477E7E");

    loginPanel = new VerticalPanel();
    loginPanel.setWidth("450px");
    // loginPanel.setWidth("100%");
    loginPanel.setSpacing(4);
    loginPanel.getElement().getStyle().setProperty("backgroundColor", "#FFFFFF");

    warningMessage = new HTML(warningMessageText);
    warningMessage.getElement().getStyle().setProperty("color", "white");
    warningMessage.getElement().getStyle().setProperty("fontSize", "10px");
    warningMessage.setWordWrap(true);
    warningMessage.setHeight("100%");
    // warningMessage.setWidth("100%");

    titleLabel = new HTML("<h2>CDS METRICS DASHBOARD</h2>");

    vaLogo = new Image(MdConstants.IMG_VA_LOGO);
    vaLogo.setPixelSize(160, 160);
    vaLogo.getElement().getStyle().setProperty("marginTop", "20px");

    facilityListBox = new ListBox();
    facilityListBox.setVisibleItemCount(1);
    facilityListBox.getElement().setId("facilityListBox");
    for (Site s : siteList) {
        facilityListBox.addItem(s.getName(), s.getSiteCode());
    }
    // facilityListBox.setWidth("100%");

    accessCode = new PasswordTextBox();
    accessCode.getElement().setId("accessCode");
    accessCode.setMaxLength(80);
    // accessCode.setWidth("100%");

    verifyCode = new PasswordTextBox();
    verifyCode.getElement().setId("verifyCode");
    verifyCode.setMaxLength(80);
    // verifyCode.setWidth("100%");

    signInButton = new Button("Sign In");
    signInButton.getElement().getStyle().setProperty("background", "#477E7E");
    signInButton.getElement().getStyle().setProperty("color", "white");
    signInButton.getElement().getStyle().setProperty("fontSize", "10px");
    signInButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            signInButtonClicked();
        }
    });

    warningPanel.add(warningMessage);
    warningPanel.setCellVerticalAlignment(warningMessage, HasVerticalAlignment.ALIGN_MIDDLE);

    loginPanel.add(vaLogo);
    loginPanel.add(titleLabel);
    loginPanel.add(createFormPanel("Select a Facility", facilityListBox));
    loginPanel.add(createFormPanel("Access Code", accessCode));
    loginPanel.add(createFormPanel("Vefify Code", verifyCode));
    loginPanel.add(signInButton);

    loginPanel.setCellHorizontalAlignment(vaLogo, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(facilityListBox, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(accessCode, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(verifyCode, HasHorizontalAlignment.ALIGN_CENTER);
    loginPanel.setCellHorizontalAlignment(signInButton, HasHorizontalAlignment.ALIGN_RIGHT);

    mainPanel.add(warningPanel);
    mainPanel.add(loginPanel);

    mainPanel.setCellVerticalAlignment(warningPanel, HasVerticalAlignment.ALIGN_MIDDLE);

    this.setTitle("CDS DASHBOARD LOGIN");
    this.setWidget(mainPanel);
    this.setModal(true);
    this.setGlassEnabled(true);
    this.removeStyleName("gwt-DialogBox");
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.AuthenticationDialog.java

License:Apache License

/**
 * Creates a consistent sized panel for form elements
 * /*from   ww w  .  j  a  v  a 2 s .c o  m*/
 * @param fieldName
 * @param widget
 * @return
 */
private HorizontalPanel createFormPanel(String fieldName, FocusWidget widget) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(4);
    HTML nameLabel = new HTML(fieldName + ": ");
    nameLabel.setWidth("115px");
    // Weird workaround - the PasswordTextBoxes render wider than the ListBoxes, even when set to
    // the same size
    if (widget instanceof ListBox) {
        widget.setWidth("325px");
    } else {
        widget.setWidth("315px");
    }

    panel.add(nameLabel);
    panel.add(widget);
    panel.setCellHorizontalAlignment(nameLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    return panel;
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.CreateDashboardDialog.java

License:Apache License

private void init() {
    this.setWidth("375px");
    this.setText("Create New Dashboard");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML("<b>Name:</b>"));
    nameBox = new TextBox();
    nameBox.getElement().setId("createDashboardNameTextBox");
    nameBox.setWidth("290px");
    nameBox.addKeyUpHandler(new KeyUpHandler() {
        @Override/*w  w w.  ja  v  a2 s.  co m*/
        public void onKeyUp(KeyUpEvent event) {
            createButton.setEnabled(nameBox.getValue().length() > 0);
        }
    });
    notesArea = new TextArea();
    notesArea.setWidth("290px");
    notesArea.getElement().setId("createDashboardNotesArea");
    dialogVPanel.add(nameBox);
    dialogVPanel.add(new HTML("<br><b>Dashboard Notes:</b>"));
    dialogVPanel.add(notesArea);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    // // Add a close button at the bottom of the dialog
    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    createButton = new PushButton(image);
    createButton.setEnabled(false);
    createButton.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    createButton.getElement().setId("createDashboardOkButton");
    createButton.setTitle("Create new dashboard");
    createButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            createButtonClicked();
        }
    });
    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    cancelButton = new PushButton(image);
    cancelButton.getElement().setId("createDashboardCancelButton");
    cancelButton.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    cancelButton.setTitle("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CreateDashboardDialog.this.hide();
        }
    });

    HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogButtonPanel.setSpacing(8);
    dialogButtonPanel.add(createButton);
    dialogButtonPanel.add(cancelButton);
    dialogVPanel.add(dialogButtonPanel);

    dialogVPanel.setSpacing(4);
    dialogVPanel.setCellHorizontalAlignment(dialogButtonPanel, HasHorizontalAlignment.ALIGN_CENTER);
    dialogVPanel.setCellVerticalAlignment(dialogButtonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    this.setWidget(dialogVPanel);
    this.setGlassEnabled(true);
    this.setModal(true);
    this.center();
    nameBox.setFocus(true);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.DeleteDashboardDialog.java

License:Apache License

private void init() {
    this.setWidth("300px");
    this.setText("Delete Dashboard?");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.setWidth("300px");
    dialogVPanel.setSpacing(8);//from  www  . j  a v a 2 s  . com
    dialogVPanel.add(new HTML("Are you sure you'ld like to delete this Dashboard?</br></br><b>"
            + dashboardListBox.getItemText(dashboardListBox.getSelectedIndex()) + "</b>"));
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);

    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    PushButton okButton = new PushButton(image);
    okButton.getElement().setId("deleteDashboardOkButton");
    okButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            String dashboardId = dashboardListBox.getValue(dashboardListBox.getSelectedIndex());
            parent.getController().deleteDashboard(dashboardId);
            DeleteDashboardDialog.this.hide();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    PushButton cancelButton = new PushButton(image);
    cancelButton.getElement().setId("deleteDashboardCancelButton");
    cancelButton.setTitle("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            DeleteDashboardDialog.this.hide();
        }
    });

    HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogButtonPanel.setSpacing(4);
    dialogButtonPanel.add(okButton);
    dialogButtonPanel.add(cancelButton);
    dialogVPanel.add(dialogButtonPanel);

    this.setWidget(dialogVPanel);
    this.setModal(true);
    this.setGlassEnabled(true);
    this.center();
}

From source file:com.cognitivemedicine.metricsdashboard.client.dialogs.SaveAsDashboardDialog.java

License:Apache License

private void init() {
    this.setWidth("300px");
    // dialogBox.ensureDebugId("cwDialogBox");
    this.setText("Save As");

    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.add(new HTML("<b>Dashboard Name:</b>"));
    nameBox = new TextBox();
    nameBox.setWidth("265px");
    nameBox.setValue("Copy of " + existingTitle);
    nameBox.getElement().setId("saveAsNameBox");
    nameBox.addKeyUpHandler(new KeyUpHandler() {
        @Override/*from  www . j a  v  a  2  s  .  c o  m*/
        public void onKeyUp(KeyUpEvent event) {
            createButton.setEnabled(nameBox.getValue().length() > 0);
        }
    });
    dialogVPanel.add(nameBox);
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);

    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    createButton = new PushButton(image);
    createButton.setTitle("Save Dashboard");
    createButton.getElement().setId("saveAsOkButton");
    createButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            createButtonClicked();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    cancelButton = new PushButton(image);
    cancelButton.setTitle("Cancel");
    cancelButton.getElement().setId("saveAsOkButton");
    cancelButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            SaveAsDashboardDialog.this.hide();
        }
    });

    HorizontalPanel dialogButtonPanel = new HorizontalPanel();
    dialogVPanel.setSpacing(4);
    dialogButtonPanel.add(createButton);
    dialogButtonPanel.add(cancelButton);
    dialogVPanel.add(dialogButtonPanel);

    this.setGlassEnabled(true);
    this.setWidget(dialogVPanel);
    this.setModal(true);
    this.center();
    nameBox.setFocus(true);
    nameBox.selectAll();
}

From source file:com.cognitivemedicine.metricsdashboard.client.widgets.CalendarPicker.java

License:Apache License

public Widget buildDatePickerPanel() {
    dateBox = new DateBox();
    if (isWide) {
        dateBox.setWidth("260px");
    } else {/* w ww  .  j  a  v a 2s . co  m*/
        dateBox.setWidth("140px");
    }
    dateBox.setHeight("13px");
    dateBox.getElement().setId(idPrefix + "DateBox");
    dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));

    // Date date = new Date();
    // date.setTime(System.currentTimeMillis() + (1000 * 60 * 60 * 24));
    // dateBox.getDatePicker().setTransientEnabledOnDates(true, date);
    // dateBox.setEnd
    // dateBox.getDatePicker().setYearArrowsVisible(true);
    // dateBox.getDatePicker().setYearAndMonthDropdownVisible(true);
    // dateBox.getDatePicker().setVisibleYearCount(51);

    datePanel = new HorizontalPanel();
    if (isWide) {
        datePanel.setWidth("280px");
    } else {
        datePanel.setWidth("230px");
    }

    datePanel.setSpacing(4);

    HTML label = new HTML("End Date:");
    if (isWide) {
        label.setWidth("115px");
    } else {
        label.setWidth("72px");
    }
    datePanel.add(label);
    datePanel.add(dateBox);

    datePanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_RIGHT);
    return datePanel;
}

From source file:com.cognitivemedicine.metricsdashboard.client.widgets.CalendarPicker.java

License:Apache License

private HorizontalPanel buildTimePanel() {
    timePanel = new HorizontalPanel();
    if (isWide) {
        timePanel.setWidth("400px");
    } else {/*w  w w . j a  va 2s  .  c  om*/
        timePanel.setWidth("230px");
    }
    // timePanel.setWidth("250px");
    timePanel.setSpacing(4);

    hourList = new ListBox();
    hourList.getElement().setId(idPrefix + "HourList");
    hourList.setVisibleItemCount(1);
    for (int i = 1; i <= 12; i++) {
        hourList.addItem(String.valueOf(i));
    }

    minuteBox = new TextBox();
    minuteBox.getElement().setId(idPrefix + "MinutesBox");
    minuteBox.setValue("00");
    minuteBox.setEnabled(false);
    minuteBox.setHeight("13px");

    amPmList = new ListBox();
    amPmList.getElement().setId(idPrefix + "AmPmList");
    amPmList.setVisibleItemCount(1);
    amPmList.addItem("AM");
    amPmList.addItem("PM");

    if (isWide) {
        minuteBox.setWidth("20px");
        amPmList.setWidth("50px");
        hourList.setWidth("45px");
    } else {
        minuteBox.setWidth("20px");
        amPmList.setWidth("50px");
        hourList.setWidth("45px");
    }

    // this.setCellVerticalAlignment(checkBox, HasVerticalAlignment.ALIGN_MIDDLE);
    HTML label = new HTML("End Time:");
    if (isWide) {
        label.setWidth("105px");
    } else {
        label.setWidth("70px");
    }
    timePanel.add(label);
    if (isWide) {
        Label spacer = new Label("");
        spacer.setWidth("20px");
        timePanel.add(spacer);
    }

    timePanel.add(hourList);
    timePanel.add(new HTML(":"));
    timePanel.add(minuteBox);
    timePanel.add(amPmList);

    timePanel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_RIGHT);
    return timePanel;
}

From source file:com.company.application.carrental.client.view.screens.DriverApplicationTab.java

private ADKPanel buildBasicTab() {
    formPanel = new ADKPanel("basicPanel");

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHeight("700");
    verticalPanel.setSpacing(2);/*w ww .jav a2  s . c o  m*/

    saveApplicationButton = new ADKButton("saveApplicationButton", "Save", new ADKButtonListener() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            super.componentSelected(ce);

            DriverMasterClientDto masterClientDto = getApplicationFormData();

            mediator.saveDriverApplication(masterClientDto);
        }
    });

    ToolBar toolBar = new ToolBar();
    // ADKCustomHelpList adkCustomHelpList =
    // new ADKCustomHelpList("driverApplicationHelpList", "Search Driver",
    // "car_rental", "driver_master", false, 100, 200);
    // toolBar.add(adkCustomHelpList);

    List<String> outputColumns = getDriverHelplistColumns();

    driverAppHelpList = new ADKCustomHelpList("driverApplicationHelpList", "Search Driver", "car_rental",
            "driver_master", "Driver_FullName", "Driver_FullName", outputColumns, false, 100, 200);

    ((ColumnConfig) driverAppHelpList.getColumnsConfigList().get(0)).setHidden(true);

    EventType specialEvent = new EventType(800);
    driverAppHelpList.setSpecialEventOnGridSelection(true, specialEvent);
    driverAppHelpList.getHelpList().addListener(specialEvent, new Listener<BaseEvent>() {

        public void handleEvent(BaseEvent be) {
            mediator.searchDriverApplication((Integer) driverAppHelpList.getModelValue().get("Driver_Id"));
        }
    });

    toolBar.add(driverAppHelpList);
    toolBar.add(new FillToolItem());
    toolBar.add(saveApplicationButton);
    // toolBar.add(new ToolButton(ToolButton.REFRESH));
    verticalPanel.add(toolBar);

    applicationNoTextField = new TextField();
    applicationDateField = new DateField();
    applicationStatusTextField = new TextField();
    applicationRemarksTextField = new TextArea();
    userTextField = new TextField();

    HorizontalPanel appPanel = new HorizontalPanel();
    appPanel.add(createTopFieldLabel(applicationNoTextField, "Application No"));
    appPanel.add(createTopFieldLabel(applicationDateField, "Application Date"));
    appPanel.add(createTopFieldLabel(applicationStatusTextField, "Application Status"));
    appPanel.add(createTopFieldLabel(applicationRemarksTextField, "Application Remarks"));
    appPanel.add(createTopFieldLabel(userTextField, "User"));

    FieldSet appFieldSet = new FieldSet();
    appFieldSet.setHeadingText("Application");
    appFieldSet.setCollapsible(true);
    appFieldSet.setWidth(850);
    appFieldSet.add(appPanel);

    verticalPanel.add(appFieldSet);

    fullNameTextField = new TextField<String>();
    primaryContactTextField = new TextField();
    currentAreaTextField = new TextField();
    genderTextField = new TextField();
    dobDateField = new DateField();

    appPanel = new HorizontalPanel();
    appPanel.setSpacing(10);
    appPanel.add(createTopFieldLabel(fullNameTextField, "Full Name"));
    appPanel.add(createTopFieldLabel(primaryContactTextField, "Primary Contact"));
    appPanel.add(createTopFieldLabel(currentAreaTextField, "Current Area"));
    // verticalPanel.add(appPanel);
    //
    // appPanel = new HorizontalPanel();
    // appPanel.setSpacing(5);
    appPanel.add(createTopFieldLabel(genderTextField, "Gender"));
    appPanel.add(createTopFieldLabel(dobDateField, "DOB"));

    basicFieldSet = new FieldSet();
    basicFieldSet.setHeadingText("Basic Details");
    basicFieldSet.setCollapsible(true);
    basicFieldSet.setWidth(1000);
    basicFieldSet.add(appPanel);

    verticalPanel.add(basicFieldSet);

    licenseNoTextField = new TextField();

    LicenseTypeProperties licenseTypeProperties = GWT.create(LicenseTypeProperties.class);
    ListStore store = new ListStore(licenseTypeProperties.value());
    store.add(new CarType("LMV", "LMV"));
    store.add(new CarType("HMV", "HMV"));
    licenseTypeCombo = new ComboBox(store, licenseTypeProperties.name());

    licenseExpiryDateField = new DateField();

    appPanel = new HorizontalPanel();
    appPanel.setSpacing(5);
    appPanel.add(createTopFieldLabel(licenseNoTextField, "License No"));
    appPanel.add(createTopFieldLabel(licenseTypeCombo, "License Type"));
    appPanel.add(createTopFieldLabel(licenseExpiryDateField, "License Expiry Date"));

    FieldSet licenseFieldSet = new FieldSet();
    licenseFieldSet.setHeadingText("License");
    // licenseFieldSet.setCollapsible(true);
    licenseFieldSet.setWidth(550);
    licenseFieldSet.setHeight(100);
    licenseFieldSet.add(appPanel);

    HorizontalPanel parentPanel = new HorizontalPanel();
    parentPanel.setSpacing(5);
    parentPanel.add(licenseFieldSet);

    HorizontalPanel jobPrefPanel = new HorizontalPanel();

    FieldSet indiFieldSet = new FieldSet();
    indiFieldSet.setHeadingText("Individual");
    indiFieldSet.add(buildJobPrefPanel());
    jobPrefPanel.add(indiFieldSet);

    FieldSet companyFieldSet = new FieldSet();
    companyFieldSet.setHeadingText("Company");
    companyFieldSet.add(buildJobPrefPanel());
    jobPrefPanel.add(companyFieldSet);

    FieldSet jobPrefFieldSet = new FieldSet();
    jobPrefFieldSet.setHeadingText("Job Preference");
    // jobPrefFieldSet.setCollapsible(true);
    jobPrefFieldSet.setWidth(600);
    jobPrefFieldSet.setHeight(100);
    jobPrefFieldSet.add(jobPrefPanel);

    parentPanel.add(jobPrefFieldSet);
    verticalPanel.add(parentPanel);

    TextField totalExpTextField = new TextField();
    TextField curSalTextField = new TextField();
    TextField expSalTextField = new TextField();

    appPanel = new HorizontalPanel();
    appPanel.setSpacing(5);
    appPanel.add(createTopFieldLabel(totalExpTextField, "Total Exp"));
    appPanel.add(createTopFieldLabel(curSalTextField, "Current Salary"));
    appPanel.add(createTopFieldLabel(expSalTextField, "Expected Salary"));
    // verticalPanel.add(appPanel);

    medicalHistoryTextArea = new TextArea();
    eyeSightTextArea = new TextArea();
    diabetesTextArea = new TextArea();
    accidentHistoryTextArea = new TextArea();

    // appPanel = new HorizontalPanel();
    // appPanel.setSpacing(5);
    appPanel.add(createTopFieldLabel(medicalHistoryTextArea, "Medical History"));
    appPanel.add(createTopFieldLabel(eyeSightTextArea, "Eye Sight"));
    appPanel.add(createTopFieldLabel(diabetesTextArea, "Diabetes"));
    appPanel.add(createTopFieldLabel(accidentHistoryTextArea, "Accident History"));
    verticalPanel.add(appPanel);

    TextField driverRefNameTextField = new TextField();
    TextField driverRefNoTextField = new TextField();

    HorizontalLayoutContainer driverReferencePanel = new HorizontalLayoutContainer();
    Margins margins = new Margins(0, 5, 0, 0);
    HorizontalLayoutData horizontalLayoutData = new HorizontalLayoutData(200, 100, margins);
    driverReferencePanel.add(createTopFieldLabel(driverRefNameTextField, "Driver Reference Name"),
            horizontalLayoutData);
    driverReferencePanel.add(createTopFieldLabel(driverRefNoTextField, "Driver Reference Number"),
            horizontalLayoutData);

    FieldSet driverReferenceFieldSet = new FieldSet();
    driverReferenceFieldSet.setSize("450", "80");
    driverReferenceFieldSet.setHeadingText("Driver Reference");
    driverReferenceFieldSet.setCollapsible(true);
    driverReferenceFieldSet.add(driverReferencePanel);

    parentPanel = new HorizontalPanel();
    parentPanel.setSpacing(5);
    parentPanel.add(buildCarType());
    parentPanel.add(driverReferenceFieldSet);

    verticalPanel.add(parentPanel);

    formPanel.add(verticalPanel);
    return formPanel;
}