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

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

Introduction

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

Prototype

public void setVerticalAlignment(VerticalAlignmentConstant align) 

Source Link

Document

Sets the default vertical alignment to be used for widgets added to this panel.

Usage

From source file:org.openxdata.sharedlib.client.view.SaveFileDialog.java

public void initWidgets(String url, String data, String fileName) {
    actionUrl = url;/* w  w w  .ja  v a2s  .c  o m*/
    form.setAction(actionUrl);
    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    verticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setSpacing(10);
    form.add(verticalPanel);

    txtArea = new TextArea();
    txtArea.setText(data);
    txtArea.setName("filecontents");
    txtArea.setVisible(false);

    txtName = new TextBox();
    txtName.setText(fileName);
    txtName.setName("filename");
    txtName.setWidth("250" + OpenXdataConstants.UNITS);

    verticalPanel.add(txtName);
    verticalPanel.add(txtArea);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setWidth("100%");
    horizontalPanel.setHeight("100%");
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);

    Button button = new Button(constants.save(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            String fileName = txtName.getText();
            if (fileName != null && fileName.trim().length() > 0) {
                String action = actionUrl;
                if (action.contains("?"))
                    action += "&";
                else
                    action += "?";
                action += "filename=" + fileName;

                form.setAction(action);
                ((VerticalPanel) txtName.getParent()).add(txtArea);
                form.submit();
                //hide();

                FormUtil.dlg.setText(constants.processingMsg());
                FormUtil.dlg.center();
            }
        }
    });

    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_LEFT);

    button = new Button(constants.cancel(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
            FormUtil.dlg.hide();
        }
    });

    horizontalPanel.add(button);
    horizontalPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_RIGHT);

    verticalPanel.add(horizontalPanel);

    setWidget(form);

    form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
        public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
            hide();
            FormUtil.dlg.hide();
            Window.Location.replace(form.getAction());
        }
    });

    setText(constants.saveFileAs());
}

From source file:org.otalo.ao.client.UploadDialog.java

License:Apache License

public UploadDialog() {
    setText("Record or Upload Content");
    outer = new FlexTable();
    outer.setSize("100%", "100%");
    uploadForm.setAction(JSONRequest.BASE_URL + AoAPI.RECORD_OR_UPLOAD);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);

    main = new FileUpload();
    main.setName("main");
    main.setTitle("Content");
    mainLabel = new Label("Content:");

    number = new TextBox();
    number.setName("number");
    User moderator = Messages.get().getModerator();
    if (moderator != null)
        // default is the moderator's number
        number.setValue(moderator.getNumber());
    Label numberLabel = new Label("Author Number:");

    saveButton = new Button("Save", new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (!recorder.isRecorded() && !uploadOpt.getValue())
                setErrorMsg("Please either record message or upload it first!");
            else {
                setClickedButton();/*from  w  ww  .ja  va 2 s  .  c  om*/
                if (recordOpt.getValue() == true) {
                    recorder.uploadData(getParams());
                } else {
                    uploadForm.submit();
                }
            }
        }
    });

    cancelButton = new Anchor("Cancel");
    cancelButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (recorder.isRecorded())
                recorder.stopRecording();
            hide();
        }
    });

    recordOpt = new RadioButton("options", "Record");
    recordOpt.setFormValue("record");
    recordOpt.addStyleName("label-txt");
    recordOpt.setValue(true);
    recordOpt.addClickHandler(new OptionClickHandler());

    uploadOpt = new RadioButton("options", "Upload");
    uploadOpt.setFormValue("upload");
    uploadOpt.setValue(false);
    uploadOpt.addStyleName("label-txt");
    uploadOpt.addClickHandler(new OptionClickHandler());

    outer.setWidget(1, 0, recordOpt);
    mainMsgHTML = new HTML("<span id='recordError'></span>");
    mainMsgHTML.addStyleName("upload-top-msg");
    outer.setWidget(1, 1, mainMsgHTML);
    outer.getCellFormatter().getElement(1, 1).getStyle().setTextAlign(TextAlign.JUSTIFY);
    outer.getCellFormatter().getElement(1, 0).getStyle().setTextAlign(TextAlign.LEFT);
    //creating recorder widget
    recorder = new AudioRecorderWidget(JSONRequest.BASE_URL + AoAPI.RECORD_OR_UPLOAD, this);
    outer.setWidget(2, 0, recorder);
    outer.getFlexCellFormatter().setColSpan(2, 0, 2);

    outer.setWidget(4, 0, uploadOpt);
    outer.getFlexCellFormatter().setColSpan(4, 0, 2);
    outer.getCellFormatter().getElement(4, 0).getStyle().setTextAlign(TextAlign.LEFT);

    outer.setWidget(5, 0, mainLabel);
    outer.getCellFormatter().setWordWrap(0, 0, false);
    outer.getCellFormatter().setStyleName(5, 0, "left-align");
    contentPanel.setSpacing(2);
    DOM.setStyleAttribute(contentPanel.getElement(), "textAlign", "left");
    contentPanel.add(main);
    outer.setWidget(5, 1, contentPanel);
    outer.getCellFormatter().setStyleName(5, 1, "left-align-no-margin");
    main.setEnabled(false);
    mainLabel.addStyleName("gray-text");

    if (Messages.get().canManage()) {
        // no author number; but future date option is available

        // Label
        dateLabel = new Label("Broadcast Time: ");
        // Note on bcasting date
        Label dateNote = new Label("Your broadcast will begin 10-15 minutes from the time you specify here");
        dateNote.setStyleName("helptext");

        // Start now option
        now = new RadioButton("when", "Now");
        now.setFormValue("now");

        date = new RadioButton("when");
        date.setFormValue("date");

        // Date Box

        dateBox = new DateBox();
        dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));
        dateBox.addValueChangeHandler(new ValueChangeHandler<Date>() {

            public void onValueChange(ValueChangeEvent<Date> event) {
                now.setValue(false);
                date.setValue(true);
                Date d = event.getValue();
                dateField.setValue(DateTimeFormat.getFormat("MMM-dd-yyyy").format(d));
            }
        });

        // Hour box
        hour = new ListBox();
        hour.setName("hour");
        for (int i = 0; i < 24; i++) {
            String hourStr;
            if (i < 10)
                hourStr = "0" + String.valueOf(i);
            else
                hourStr = String.valueOf(i);

            hour.addItem(hourStr);
        }
        hour.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                now.setValue(false);
                date.setValue(true);

            }
        });

        // Minute box
        min = new ListBox();
        min.setName("min");
        for (int i = 0; i < 60; i += 5) {
            String minStr;
            if (i < 10)
                minStr = "0" + String.valueOf(i);
            else
                minStr = String.valueOf(i);

            min.addItem(minStr);
        }
        min.addChangeHandler(new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                now.setValue(false);
                date.setValue(true);

            }
        });

        int row = outer.getRowCount();
        outer.setWidget(row, 0, dateLabel);
        outer.getCellFormatter().setWordWrap(1, 0, false);

        HorizontalPanel nowPanel = new HorizontalPanel();
        //nowPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
        nowPanel.setSpacing(4);
        nowPanel.add(now);
        DOM.setStyleAttribute(nowPanel.getElement(), "textAlign", "left");
        outer.setWidget(row, 1, nowPanel);

        HorizontalPanel datePicker = new HorizontalPanel();
        datePicker.setSpacing(4);
        datePicker.add(date);
        datePicker.add(dateBox);
        datePicker.add(hour);
        datePicker.add(new Label(":"));
        datePicker.add(min);
        row = outer.getRowCount();

        datePanel = new HorizontalPanel();
        outer.setWidget(row, 0, datePanel);
        DOM.setStyleAttribute(datePicker.getElement(), "textAlign", "left");
        outer.setWidget(row, 1, datePicker);

        row = outer.getRowCount();
        outer.setWidget(row, 1, dateNote);
        outer.getCellFormatter().setWordWrap(row, 1, false);
        dateField = new Hidden("date");
        outer.setWidget(outer.getRowCount(), 0, dateField);
    } else {
        outer.setWidget(7, 0, numberLabel);
        outer.getCellFormatter().setWordWrap(1, 0, false);
        numberPanel.setSpacing(2);
        DOM.setStyleAttribute(numberPanel.getElement(), "textAlign", "left");
        numberPanel.add(number);
        outer.setWidget(7, 1, numberPanel);
    }

    HorizontalPanel buttons = new HorizontalPanel();
    // tables don't obey the setHorizontal of parents, and buttons is a table,
    // so use float instead
    DOM.setStyleAttribute(buttons.getElement(), "cssFloat", "right");
    buttons.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    buttons.add(cancelButton);
    buttons.add(saveButton);

    outer.setWidget(outer.getRowCount(), 1, buttons);

    outer.setWidget(outer.getRowCount(), 0, forumId);
    outer.setWidget(outer.getRowCount(), 0, messageForumId);

    HTML troubleShootLink = new HTML(
            "<a class='trblLink' target=_blank  href='http://awaaz.de/blog/2013/10/record-your-messages-over-web'>Unable to record? Complete the one-time setup instructions</a>");
    int trblCell = outer.getRowCount();
    outer.setWidget(trblCell, 0, troubleShootLink);
    outer.getFlexCellFormatter().setColSpan(trblCell, 0, 2);
    outer.getFlexCellFormatter().addStyleName(trblCell, 0, "left-align");

    HTML brodtime_text = new HTML(
            "<span>Broadcast calls will only be scheduled between 8am and 10pm IST.</span>");
    brodtime_text.addStyleName("brodcast-time-text");
    outer.setWidget(trblCell + 1, 0, brodtime_text);
    outer.getFlexCellFormatter().setColSpan(trblCell + 1, 0, 2);
    outer.getFlexCellFormatter().addStyleName(trblCell + 1, 0, "left-align");

    uploadForm.setWidget(outer);

    setSaveButtonSate();

    setWidget(uploadForm);
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.export.catalog.ExportToCatalogConfirmWindow.java

License:Open Source License

private void addContent() {
    this.hiddenFormItemsPanel = new ExportToCatalogHiddenPanel();
    this.exportToCatalogForm.setWidget(this.hiddenFormItemsPanel);

    this.windowLabel = new Label("Choose the catalog bucket in which to publish " + this.catalogObjectName);
    this.windowLabel.setHeight(30);

    HorizontalPanel exportInfoPanel = new HorizontalPanel();
    exportInfoPanel.setHeight("80px");
    exportInfoPanel.setWidth("640px");
    exportInfoPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    this.bucketList = new ListBox();
    fillBucketList();/*www.  j ava  2 s  .c  om*/
    exportInfoPanel.add(this.bucketList);
    Label commitLabel = new Label("Commit message:");
    commitLabel.setHeight("80px");
    commitLabel.setValign(VerticalAlignment.TOP);
    commitLabel.setAlign(Alignment.RIGHT);
    exportInfoPanel.add(commitLabel);
    this.commitMessage = new TextBox();
    exportInfoPanel.add(this.commitMessage);
    this.revisionLabel = new Label(INITIAL_COMMIT_MESSAGE);
    this.revisionLabel.setHeight("80px");
    this.revisionLabel.setValign(VerticalAlignment.TOP);
    this.revisionLabel.setAlign(Alignment.LEFT);
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setHeight("80px");
    scrollPanel.add(this.revisionLabel);
    exportInfoPanel.add(scrollPanel);

    HLayout buttons = new HLayout();
    buttons.setHeight(40);
    buttons.setMembersMargin(5);
    buttons.setAlign(Alignment.RIGHT);
    buttons.setAlign(VerticalAlignment.BOTTOM);

    IButton ok = new IButton("OK", event -> submitNodeSourceConfiguration());
    ok.setIcon(Images.instance.ok_16().getSafeUri().asString());
    IButton cancel = new IButton("Cancel", event -> hideAndDestroy(this));
    cancel.setIcon(Images.instance.cancel_16().getSafeUri().asString());
    buttons.setMembers(ok, cancel);

    VLayout layout = new VLayout();
    layout.setAlign(VerticalAlignment.TOP);
    layout.setMargin(10);
    layout.setMembersMargin(10);
    layout.addMember(this.windowLabel);
    layout.addMember(exportInfoPanel);
    layout.addMember(buttons);

    addItem(layout);
}

From source file:org.ow2.proactive_grid_cloud_portal.rm.client.nodesource.serialization.ExportToCatalogConfirmWindow.java

License:Open Source License

private void addContent() {
    this.hiddenFormItemsPanel = new ExportToCatalogHiddenPanel();
    this.exportNodeSourceToCatalogForm.setWidget(this.hiddenFormItemsPanel);

    this.windowLabel = new Label(
            "Choose the catalog bucket in which to publish the Node Source " + nodeSourceName);
    this.windowLabel.setHeight(30);

    HorizontalPanel exportInfoPanel = new HorizontalPanel();
    exportInfoPanel.setHeight("80px");
    exportInfoPanel.setWidth("640px");
    exportInfoPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    this.bucketList = new ListBox();
    fillBucketList();//from  w w w  . j a v  a 2  s.c om
    exportInfoPanel.add(this.bucketList);
    Label commitLabel = new Label("Commit message:");
    commitLabel.setHeight("80px");
    commitLabel.setValign(VerticalAlignment.TOP);
    commitLabel.setAlign(Alignment.RIGHT);
    exportInfoPanel.add(commitLabel);
    this.commitMessage = new TextBox();
    exportInfoPanel.add(this.commitMessage);
    this.revisionLabel = new Label(INITIAL_COMMIT_MESSAGE);
    this.revisionLabel.setHeight("80px");
    this.revisionLabel.setValign(VerticalAlignment.TOP);
    this.revisionLabel.setAlign(Alignment.LEFT);
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setHeight("80px");
    scrollPanel.add(this.revisionLabel);
    exportInfoPanel.add(scrollPanel);

    HLayout buttons = new HLayout();
    buttons.setHeight(40);
    buttons.setMembersMargin(5);
    buttons.setAlign(Alignment.RIGHT);
    buttons.setAlign(VerticalAlignment.BOTTOM);

    IButton ok = new IButton("OK", event -> submitNodeSourceConfiguration());
    ok.setIcon(Images.instance.ok_16().getSafeUri().asString());
    IButton cancel = new IButton("Cancel", event -> hideAndDestroy(this));
    cancel.setIcon(Images.instance.cancel_16().getSafeUri().asString());
    buttons.setMembers(ok, cancel);

    VLayout layout = new VLayout();
    layout.setAlign(VerticalAlignment.TOP);
    layout.setMargin(10);
    layout.setMembersMargin(10);
    layout.addMember(this.windowLabel);
    layout.addMember(exportInfoPanel);
    layout.addMember(buttons);

    addItem(layout);
}

From source file:org.pentaho.gwt.widgets.client.wizards.AbstractWizardDialog.java

License:Open Source License

/**
 * layout()/*from ww  w  .j  av  a2s  .c  o  m*/
 * 
 * Lays out the GUI elements. Should only be called ONCE during the objects lifecycle
 */
protected void layout() {
    // Create the overall container to be displayed in the dialog

    SimplePanel deckWrapper = new SimplePanel();
    deckWrapper.setHeight("100%");
    deckWrapper.setWidth("100%");
    deckWrapper.setStyleName("dialog-content");

    DockPanel content = new DockPanel();

    // Create the Steps and add it to the content
    stepsList = new VerticalPanel();
    stepsList.add(new Label(Messages.getString("dialog.steps")));
    steps.setVisibleItemCount(STEPS_COUNT);
    stepsList.add(steps);
    // steps.setSize("30%", "100%");
    content.add(stepsList, DockPanel.WEST);

    // Add the wizardPanels to the Deck and add the deck to the content
    // wizardDeckPanel.setSize("70%", "100%");
    deckWrapper.setWidget(wizardDeckPanel);
    content.add(deckWrapper, DockPanel.CENTER);
    wizardDeckPanel.addStyleName(WIZARD_DECK_PANEL);

    // Add the control buttons
    HorizontalPanel wizardButtonPanel = new HorizontalPanel();
    wizardButtonPanel.setSpacing(2);
    // If we have only one button then we dont need to show the back and next button.
    wizardButtonPanel.add(backButton);
    wizardButtonPanel.add(nextButton);
    wizardButtonPanel.add(finishButton);
    wizardButtonPanel.add(cancelButton);
    wizardButtonPanel.addStyleName(WIZARD_BUTTON_PANEL);

    HorizontalPanel wizardButtonPanelWrapper = new HorizontalPanel();
    wizardButtonPanelWrapper.setWidth("100%"); //$NON-NLS-1$
    wizardButtonPanelWrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    wizardButtonPanelWrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    wizardButtonPanelWrapper.add(wizardButtonPanel);

    content.add(wizardButtonPanelWrapper, DockPanel.SOUTH);
    content.setCellVerticalAlignment(wizardButtonPanelWrapper, HasVerticalAlignment.ALIGN_BOTTOM);

    // Add the content to the dialog
    add(content);
    content.setWidth("100%"); //$NON-NLS-1$
    content.setHeight("100%"); //$NON-NLS-1$
    content.setCellHeight(deckWrapper, "98%");
}

From source file:org.pentaho.mantle.client.dialogs.scheduling.ScheduleEditor.java

License:Open Source License

public ScheduleEditor(ScheduleDialogType type) {
    super();//from  w  w  w  . ja  v  a 2s .co  m
    isBlockoutDialog = (type == ScheduleDialogType.BLOCKOUT);
    startTimePicker = new TimePicker();

    setStylePrimaryName("scheduleEditor"); //$NON-NLS-1$

    scheduleCombo = createScheduleCombo();
    Label l = new Label(Messages.getString("schedule.recurrenceColon"));
    l.getElement().setId(RECURRENCE_LABEL);
    l.setStyleName(SCHEDULE_LABEL);
    add(l);
    add(scheduleCombo);

    SimplePanel hspacer = new SimplePanel();
    hspacer.setWidth("100px"); //$NON-NLS-1$

    if (!isBlockoutDialog) {
        startTimePanel = createStartTimePanel();
        add(startTimePanel);
    } else {

        // Blockout End TimePicker
        Date blockoutEndDate = new Date(defaultDate.getTime());
        addMinutes(defaultDate, 1);
        blockoutEndTimePicker = new TimePicker();
        blockoutEndTimePicker = new TimePicker();
        blockoutEndTimePicker.setTime(blockoutEndDate);

        // Blockout End Caption Panel
        blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE);

        final String[] daysList = new String[365];
        final String[] hoursList = new String[24];
        final String[] minutesList = new String[60];

        // Populate list
        for (Integer i = 0; i < 365; i++) {
            String iStr = i.toString();
            daysList[i] = iStr;

            if (i < 60) {
                minutesList[i] = iStr;
                if (i < 24) {
                    hoursList[i] = iStr;
                }
            }
        }

        // Units of time Drop Down
        daysListBox = new ListBox();
        daysListBox.getElement().setId("daysListBox"); //$NON-NLS-1$
        daysListBox.addStyleName(BLOCKOUT_SELECT);
        populateListItems(daysListBox, daysList, 0, 365);

        final Label daysLabel = new Label(Messages.getString("schedule.dayOrDays"));
        daysLabel.addStyleName(BLOCKOUT_LABEL);
        daysLabel.getElement().setAttribute("for", daysListBox.getElement().getId()); //$NON-NLS-1$

        hoursListBox = new ListBox();
        hoursListBox.getElement().setId("hoursListBox"); //$NON-NLS-1$
        hoursListBox.addStyleName(BLOCKOUT_SELECT);
        populateListItems(hoursListBox, hoursList, 0, 24);

        final Label hoursLabel = new Label(Messages.getString("schedule.hourOrHours"));
        hoursLabel.addStyleName(BLOCKOUT_LABEL);
        hoursLabel.getElement().setAttribute("for", hoursListBox.getElement().getId()); //$NON-NLS-1$

        minutesListBox = new ListBox();
        minutesListBox.getElement().setId("minutesListBox"); //$NON-NLS-1$
        minutesListBox.addStyleName(BLOCKOUT_SELECT);
        populateListItems(minutesListBox, minutesList, 0, 60);
        minutesListBox.setSelectedIndex(1); // default value for Validator

        final Label minutesLabel = new Label(Messages.getString("schedule.minuteOrMinutes"));
        minutesLabel.addStyleName(BLOCKOUT_LABEL);
        minutesLabel.getElement().setAttribute("for", minutesListBox.getElement().getId()); //$NON-NLS-1$

        final HorizontalPanel durationPanel = new HorizontalPanel();
        durationPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        durationPanel.setSpacing(blockoutEndTimePicker.getSpacing());
        durationPanel.add(daysListBox);
        durationPanel.add(daysLabel);
        durationPanel.add(hoursListBox);
        durationPanel.add(hoursLabel);
        durationPanel.add(minutesListBox);
        durationPanel.add(minutesLabel);

        // Bind change handler
        scheduleCombo.addChangeHandler(new ChangeHandler() {

            @Override
            public void onChange(ChangeEvent event) {
                String scheduleType = scheduleCombo.getItemText(scheduleCombo.getSelectedIndex());

                if (ScheduleType.RUN_ONCE.toString().equals(scheduleType)) {
                    show(true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                    populateListItems(daysListBox, daysList, 0, 365);
                    populateListItems(hoursListBox, hoursList, 0, 24);
                    populateListItems(minutesListBox, minutesList, 0, 60);

                } else if (ScheduleType.HOURS.toString().equals(scheduleType)) {
                    hide(true, daysListBox, daysLabel, hoursListBox, hoursLabel);
                    show(true, minutesListBox, minutesLabel);

                    populateListItems(minutesListBox, minutesList, 0, 60);

                } else if (ScheduleType.DAILY.toString().equals(scheduleType)) {
                    hide(true, daysListBox, daysLabel);
                    show(true, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                    populateListItems(hoursListBox, hoursList, 0, 24);
                    populateListItems(minutesListBox, minutesList, 0, 60);

                } else if (ScheduleType.WEEKLY.toString().equals(scheduleType)) {
                    show(true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                    populateListItems(daysListBox, daysList, 0, 7);
                    populateListItems(hoursListBox, hoursList, 0, 24);
                    populateListItems(minutesListBox, minutesList, 0, 60);

                } else if (ScheduleType.MONTHLY.toString().equals(scheduleType)) {
                    show(true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                    populateListItems(daysListBox, daysList, 0, 28);
                    populateListItems(hoursListBox, hoursList, 0, 24);
                    populateListItems(minutesListBox, minutesList, 0, 60);

                } else if (ScheduleType.YEARLY.toString().equals(scheduleType)) {
                    show(true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel);

                    populateListItems(daysListBox, daysList, 0, 365);
                    populateListItems(hoursListBox, hoursList, 0, 24);
                    populateListItems(minutesListBox, minutesList, 0, 60);
                }
            }
        });

        /*
         * Radio Buttons for duration
         */
        durationRadioButton = new RadioButton("durationRadioGroup", "durationRadioButton"); //$NON-NLS-1$ //$NON-NLS-2$
        durationRadioButton.setText(Messages.getString("schedule.duration"));
        durationRadioButton.setValue(Boolean.TRUE);
        durationRadioButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE);
                durationPanel.getElement().getStyle().clearDisplay();
            }
        });

        endTimeRadioButton = new RadioButton("durationRadioGroup", "endTimeRadioButton"); //$NON-NLS-1$ //$NON-NLS-2$
        endTimeRadioButton.setText(Messages.getString("schedule.endTime"));
        endTimeRadioButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                blockoutEndTimePicker.getElement().getStyle().clearDisplay();
                durationPanel.getElement().getStyle().setDisplay(Display.NONE);
            }
        });

        // Radio Buttons Panel
        HorizontalPanel radioButtonsPanel = new HorizontalPanel();
        radioButtonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        radioButtonsPanel.getElement().setId("radio-buttons-panel");
        radioButtonsPanel.add(durationRadioButton);
        radioButtonsPanel.add(endTimeRadioButton);

        // Ends Panel
        VerticalPanel endsPanel = new VerticalPanel();
        endsPanel.add(radioButtonsPanel);
        endsPanel.add(blockoutEndTimePicker);
        endsPanel.add(durationPanel);

        // Blockout period
        CaptionPanel blockoutStartCaptionPanel = new CaptionPanel(Messages.getString("schedule.startTime"));
        blockoutStartCaptionPanel.setStyleName(SCHEDULE_EDITOR_CAPTION_PANEL);
        HorizontalPanel blockoutStartPanel = new HorizontalPanel();
        blockoutStartPanel.getElement().setId("blockout-start-panel");
        blockoutStartPanel.add(getStartTimePicker());
        timeZonePicker = new ListBox();
        timeZonePicker.setStyleName("timeZonePicker");
        timeZonePicker.setVisibleItemCount(1);
        blockoutStartPanel.add(timeZonePicker);
        timeZonePicker.getElement().getParentElement().getStyle().setPaddingTop(5, Unit.PX);

        blockoutStartCaptionPanel.add(blockoutStartPanel);
        populateTimeZonePicker();

        // Ends Caption Panel
        CaptionPanel endCaptionPanel = new CaptionPanel(Messages.getString("schedule.endsCaptionTitle"));
        endCaptionPanel.setStyleName(SCHEDULE_EDITOR_CAPTION_PANEL);
        endCaptionPanel.add(endsPanel);

        VerticalPanel blockoutPanel = new VerticalPanel();
        blockoutPanel.setWidth("100%"); //$NON-NLS-1$
        blockoutPanel.add(blockoutStartCaptionPanel);
        blockoutPanel.add(endCaptionPanel);

        add(blockoutPanel);
    }

    VerticalPanel vp = new VerticalPanel();
    vp.setWidth("100%"); //$NON-NLS-1$
    add(vp);
    setCellHeight(vp, "100%"); //$NON-NLS-1$

    runOnceEditor = new RunOnceEditor(startTimePicker);
    vp.add(runOnceEditor);
    scheduleTypeMap.put(ScheduleType.RUN_ONCE, runOnceEditor);
    runOnceEditor.setVisible(true);

    recurrenceEditor = new RecurrenceEditor(startTimePicker);
    vp.add(recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.SECONDS, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.MINUTES, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.HOURS, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.DAILY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.WEEKLY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.MONTHLY, recurrenceEditor);
    scheduleTypeMap.put(ScheduleType.YEARLY, recurrenceEditor);
    recurrenceEditor.setVisible(false);

    cronEditor = new CronEditor();
    scheduleTypeMap.put(ScheduleType.CRON, cronEditor);
    cronEditor.setVisible(false);

    if (!isBlockoutDialog) {
        vp.add(cronEditor);

        VerticalPanel blockoutButtonPanel = new VerticalPanel();
        blockoutButtonPanel.setWidth("100%"); //$NON-NLS-1$
        // blockoutButtonPanel.setHeight("30%");
        blockoutButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        blockoutButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

        // We want to add a button to check for blockout conflicts
        blockoutCheckButton.setStyleName("pentaho-button"); //$NON-NLS-1$
        blockoutCheckButton.getElement().setId("blockout-check-button"); //$NON-NLS-1$
        blockoutCheckButton.setVisible(false);

        hspacer.setHeight("50px"); //$NON-NLS-1$
        blockoutButtonPanel.add(hspacer);
        blockoutButtonPanel.add(blockoutCheckButton);

        vp.add(hspacer);
        add(blockoutButtonPanel);
    }

    reset(defaultDate);

    configureOnChangeHandler();
}

From source file:org.pentaho.pac.client.scheduler.view.SchedulerToolbar.java

License:Open Source License

private void createToolbar() {

    HorizontalPanel leftPanel = new HorizontalPanel();
    leftPanel.setStyleName("schedToolbar.leftPanel"); //$NON-NLS-1$
    add(leftPanel);//from www .ja v  a 2 s  .com

    HorizontalPanel rightPanel = new HorizontalPanel();
    rightPanel.setStyleName("schedToolbar.rightPanel"); //$NON-NLS-1$
    add(rightPanel);

    createBtn = createPushButton(Messages.getString("createSchedule"), "toolbarCreateBtn", new ClickListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void onClick(Widget sender) {
            if (null != onCreateListener) {
                onCreateListener.onHandle(null);
            }
        }
    });
    leftPanel.add(createBtn);

    updateBtn = createPushButton(Messages.getString("editSchedule"), "toolbarUpdateBtn", new ClickListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void onClick(Widget sender) {
            if (null != onUpdateListener) {
                onUpdateListener.onHandle(null);
            }
        }
    });
    leftPanel.add(updateBtn);

    deleteBtn = createPushButton(Messages.getString("deleteSchedules"), "toolbarDeleteBtn", //$NON-NLS-1$//$NON-NLS-2$
            new ClickListener() {
                public void onClick(Widget sender) {
                    if (null != onDeleteListener) {
                        onDeleteListener.onHandle(null);
                    }
                }
            });
    leftPanel.add(deleteBtn);

    //toolbarDivider
    Image img = new Image("style/images/toolbarDivider.png", 0, 0, 2, 16); //$NON-NLS-1$
    leftPanel.add(img);

    suspendBtn = createPushButton(Messages.getString("suspendSchedules"), "toolbarSuspendBtn", //$NON-NLS-1$//$NON-NLS-2$
            new ClickListener() {
                public void onClick(Widget sender) {
                    if (null != onSuspendListener) {
                        onSuspendListener.onHandle(null);
                    }
                }
            });
    leftPanel.add(suspendBtn);

    resumeBtn = createPushButton(Messages.getString("resumeSchedules"), "toolbarResumeBtn", //$NON-NLS-1$//$NON-NLS-2$
            new ClickListener() {
                public void onClick(Widget sender) {
                    if (null != onResumeListener) {
                        onResumeListener.onHandle(null);
                    }
                }
            });
    leftPanel.add(resumeBtn);

    runNowBtn = createPushButton(Messages.getString("runSchedules"), "toolbarRunNowBtn", new ClickListener() { //$NON-NLS-1$ //$NON-NLS-2$
        public void onClick(Widget sender) {
            if (null != onRunNowListener) {
                onRunNowListener.onHandle(null);
            }
        }
    });
    leftPanel.add(runNowBtn);

    //toolbarDivider
    img = new Image("style/images/toolbarDivider.png", 0, 0, 2, 16); //$NON-NLS-1$
    leftPanel.add(img);

    refreshBtn = createPushButton(Messages.getString("refreshScheduleList"), "toolbarRefreshBtn", //$NON-NLS-1$//$NON-NLS-2$
            new ClickListener() {
                public void onClick(Widget sender) {
                    if (null != onRefreshListener) {
                        onRefreshListener.onHandle(null);
                    }
                }
            });
    leftPanel.add(refreshBtn);

    HorizontalPanel filterPanel = new HorizontalPanel();
    filterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    Label l = new Label(Messages.getString("filterBy")); //$NON-NLS-1$
    filterPanel.add(l);

    filterList = new ListBox();
    filterList.setVisibleItemCount(1);

    filterList.addChangeListener(new ChangeListener() {
        public void onChange(Widget sender) {
            if (null != onFilterListChangeListener) {
                String val = filterList.getValue(filterList.getSelectedIndex());
                onFilterListChangeListener.onHandle(val);
            }
        }
    });
    filterPanel.add(filterList);
    rightPanel.add(filterPanel);

    this.setCellHorizontalAlignment(leftPanel, HasHorizontalAlignment.ALIGN_LEFT);
    this.setCellHorizontalAlignment(rightPanel, HasHorizontalAlignment.ALIGN_RIGHT);
}

From source file:org.pentaho.reporting.platform.plugin.gwt.client.ParameterControllerPanel.java

License:Open Source License

private Widget buildPaginationController(final ProcessingState parametersElement) {
    // need to add/build UI for pagination controls
    final int finalPageCount = parametersElement.getTotalPages();
    final int finalAcceptedPage;
    if (parametersElement.getPage() >= finalPageCount) {
        // we can't accept pages out of range, this can happen if we are on a page and then change a parameter value
        // resulting in a new report with less pages
        // when this happens, we'll just reduce the accepted page
        finalAcceptedPage = Math.max(0, finalPageCount - 1);
    } else {//from w  w w  .  j  a v  a2 s.c o m
        finalAcceptedPage = Math.max(0, parametersElement.getPage());
    }
    // add our default page, so we can keep this between selections of other parameters, otherwise it will not be on the
    // set of params are default back to zero (page 1)
    parameterMap.setSelectedValue("accepted-page", String.valueOf(finalAcceptedPage)); //$NON-NLS-1$

    final Image backToFirstPage = PageImages.images.backToFirstPage().createImage();
    backToFirstPage.setStyleName("pageControllerButton"); //$NON-NLS-1$
    if (finalAcceptedPage <= 0) {
        PageImages.images.backToFirstPageDisabled().applyTo(backToFirstPage);
    } else {
        backToFirstPage.addClickHandler(new GotoFirstPageClickHandler(finalAcceptedPage));
        backToFirstPage.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(final MouseOverEvent event) {
                PageImages.images.backToFirstPageHover().applyTo(backToFirstPage);
            }
        });
        backToFirstPage.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(final MouseOutEvent event) {
                PageImages.images.backToFirstPage().applyTo(backToFirstPage);
            }
        });
    }

    final Image backPage = PageImages.images.backButton().createImage();
    backPage.setStyleName("pageControllerButton"); //$NON-NLS-1$
    if (finalAcceptedPage <= 0) {
        PageImages.images.backButtonDisabled().applyTo(backPage);
    } else {
        backPage.addClickHandler(new GotoPrevPageClickHandler(finalAcceptedPage));
        backPage.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(final MouseOverEvent event) {
                PageImages.images.backButtonHover().applyTo(backPage);
            }
        });
        backPage.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(final MouseOutEvent event) {
                PageImages.images.backButton().applyTo(backPage);
            }
        });
    }

    final Image forwardPage = PageImages.images.forwardButton().createImage();
    forwardPage.setStyleName("pageControllerButton"); //$NON-NLS-1$
    if (finalAcceptedPage + 1 >= finalPageCount) {
        PageImages.images.forwardButtonDisabled().applyTo(forwardPage);
    } else {
        forwardPage.addClickHandler(new GotoNextPageClickHandler(finalAcceptedPage, finalPageCount));
        forwardPage.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(final MouseOverEvent event) {
                PageImages.images.forwardButtonHover().applyTo(forwardPage);
            }
        });
        forwardPage.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(final MouseOutEvent event) {
                PageImages.images.forwardButton().applyTo(forwardPage);
            }
        });
    }

    final Image forwardToLastPage = PageImages.images.forwardToLastPage().createImage();
    forwardToLastPage.setStyleName("pageControllerButton"); //$NON-NLS-1$
    if (finalAcceptedPage + 1 >= finalPageCount) {
        PageImages.images.forwardToLastPageDisabled().applyTo(forwardToLastPage);
    } else {
        forwardToLastPage.addClickHandler(new GotoLastPageClickHandler(finalAcceptedPage, finalPageCount));
        forwardToLastPage.addMouseOverHandler(new MouseOverHandler() {
            public void onMouseOver(final MouseOverEvent event) {
                PageImages.images.forwardToLastPageHover().applyTo(forwardToLastPage);
            }
        });
        forwardToLastPage.addMouseOutHandler(new MouseOutHandler() {
            public void onMouseOut(final MouseOutEvent event) {
                PageImages.images.forwardToLastPage().applyTo(forwardToLastPage);
            }
        });
    }

    pageBox = new TextBox();
    pageBox.setTextAlignment(TextBox.ALIGN_RIGHT);
    pageBox.addKeyUpHandler(new PageInputHandler(pageBox, finalPageCount));
    // pages are zero based, but expose them to the user as 1 based
    if (finalAcceptedPage <= 0) {
        pageBox.setText("1"); //$NON-NLS-1$
    } else {
        pageBox.setText(String.valueOf(finalAcceptedPage + 1)); //$NON-NLS-1$
    }
    pageBox.setVisibleLength(3);

    final HorizontalPanel pageControlPanel = new HorizontalPanel();
    pageControlPanel.setSpacing(1);
    pageControlPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pageControlPanel.add(backToFirstPage);
    pageControlPanel.add(backPage);

    final String pageStr = "&nbsp;&nbsp;" + messages.getString("page", "Page") + "&nbsp;"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
    pageControlPanel.add(new HTML(pageStr));
    pageControlPanel.add(pageBox);
    final String pageCountStr = "&nbsp;" + messages.getString("of", "of") + "&nbsp;" + finalPageCount //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
            + "&nbsp;"; //$NON-NLS-1$
    pageControlPanel.add(new HTML(pageCountStr));

    pageControlPanel.add(forwardPage);
    pageControlPanel.add(forwardToLastPage);

    final HorizontalPanel pageControlPanelWrapper = new HorizontalPanel();
    pageControlPanelWrapper.setStyleName("pageControllerPanel"); //$NON-NLS-1$
    pageControlPanelWrapper.setWidth("100%"); //$NON-NLS-1$
    pageControlPanelWrapper.add(pageControlPanel);

    return pageControlPanelWrapper;
}

From source file:org.pepstock.jem.gwt.client.commons.SimpleFilter.java

License:Open Source License

/**
 * Constructs the panel, using label passed as argument and minimum number of characters to allow the submit and
 * the initial value for text field/*from  w  w w.  ja  va 2 s . c  o  m*/
 * @param labelValue label for text field
 * @param minChar minimum number of characters
 * @param initialValue initial value
 */
public SimpleFilter(String labelValue, String initialValue) {
    // sets fixed height
    setSize(Sizes.HUNDRED_PERCENT, Sizes.toString(Sizes.SEARCHER_WIDGET_HEIGHT));
    setSpacing(6);

    HorizontalPanel subcomponent = new HorizontalPanel();
    subcomponent.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    subcomponent.setSpacing(4);

    Label label = new Label(labelValue);

    if (initialValue != null) {
        textBox.setText(initialValue);
    }

    textBox.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            onSearch(textBox.getText());
        }
    });

    subcomponent.add(label);
    subcomponent.add(textBox);
    add(subcomponent);

    setCellHorizontalAlignment(subcomponent, HasHorizontalAlignment.ALIGN_LEFT);
}

From source file:org.pepstock.jem.gwt.client.panels.administration.SecretUtilityPanel.java

License:Open Source License

/**
 * Creates the UI by the argument (the table)
 *  //  www  .j a v a 2 s  .c  o  m
 * @param nodes table of nodes 
 */
public SecretUtilityPanel() {
    VerticalPanel container = new VerticalPanel();
    setSize(Sizes.HUNDRED_PERCENT, Sizes.HUNDRED_PERCENT);

    secretBox.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if ((secretBox.getText().length() > 0) && (secretBox2.getText().length() > 0)
                    && secretBox.getText().equals(secretBox2.getText())) {

                execButton.setEnabled(true);
            } else {
                execButton.setEnabled(false);
            }

        }
    });

    secretBox2.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if ((secretBox.getText().length() > 0) && (secretBox2.getText().length() > 0)
                    && secretBox.getText().equals(secretBox2.getText())) {
                execButton.setEnabled(true);
            } else {
                execButton.setEnabled(false);
            }

        }
    });

    execButton = new Button("Crypt", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            getEncryptedSecret(secretBox.getText());
        }
    });
    execButton.setEnabled(false);
    execButton.addStyleName(Styles.INSTANCE.common().bigButtonPadding());
    new Tooltip(execButton, "Encrypt your secret text");

    // this size!
    container.setSpacing(10);

    // title
    container.add(new HTML("<h2>Secret utility</h2>"));

    // image and description
    HorizontalPanel imageAndDescription = new HorizontalPanel();
    imageAndDescription.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    Image image = new Image(Images.INSTANCE.keys());
    HTML description = new HTML(
            "This utility allows you to have got an encrypted secret text (password and others) that you could use in your JCL.<br>"
                    + "This function must be use when you define a Common Resource and you want to hide the password value.<br>"
                    + "Calulate the value and copy & paste in your JCL.</p>");
    imageAndDescription.add(image);
    imageAndDescription.add(description);
    imageAndDescription.setCellWidth(description, Sizes.HUNDRED_PERCENT);

    container.add(imageAndDescription);

    FlexTable form = new FlexTable();
    form.setCellPadding(10);

    // Add some standard form options
    form.setHTML(0, 0, "Secret");
    form.setWidget(0, 1, secretBox);
    form.setHTML(1, 0, "Secret (twice to check)");
    form.setWidget(1, 1, secretBox2);

    form.setHTML(2, 0, "");
    form.setWidget(2, 1, execButton);

    form.setHTML(3, 0, "Encrypted secret");
    form.setWidget(3, 1, encrypt);

    form.setHTML(4, 0, "Hash secret");
    form.setWidget(4, 1, hash);

    container.add(form);

    scrollPanel = new ScrollPanel(container);
    add(scrollPanel);

}