Example usage for com.vaadin.ui ComboBox ComboBox

List of usage examples for com.vaadin.ui ComboBox ComboBox

Introduction

In this page you can find the example usage for com.vaadin.ui ComboBox ComboBox.

Prototype

public ComboBox() 

Source Link

Document

Constructs an empty combo box without a caption.

Usage

From source file:org.escidoc.browser.ui.maincontent.OrgUnitView.java

License:Open Source License

private void handleLayoutListeners() {
    if (orgUnitController.hasAccess()) {

        vlLeft.addListener(new LayoutClickListener() {
            private static final long serialVersionUID = 1L;

            @Override/*from ww w .  j  a  v  a2 s . co  m*/
            public void layoutClick(final LayoutClickEvent event) {
                // Get the child component which was clicked
                if (event.getChildComponent() != null) {
                    // Is Label?
                    if (event.getChildComponent().getClass().getCanonicalName() == "com.vaadin.ui.Label") {
                        final Label child = (Label) event.getChildComponent();
                        if ((child.getDescription() == ViewConstants.DESC_STATUS)) {
                            reSwapComponents();
                            oldComponent = event.getClickedComponent();
                            swapComponent = editStatus(child.getValue().toString().replace(status, ""));
                            vlLeft.replaceComponent(oldComponent, swapComponent);
                        }
                    }
                    // else {
                    // getWindow().showNotification(
                    // "The click was over a " + event.getChildComponent().getClass().getCanonicalName()
                    // + event.getChildComponent().getStyleName());
                    // }
                } else {
                    reSwapComponents();
                }
            }

            private Component editStatus(final String publicStatus) {
                final ComboBox cmbStatus = new ComboBox();
                cmbStatus.setInvalidAllowed(false);
                cmbStatus.setNullSelectionAllowed(false);
                final String pubStatus = publicStatus.toUpperCase();
                if (publicStatus.equals(PublicStatus.CREATED.toString())) {
                    cmbStatus.setNullSelectionItemId(PublicStatus.CREATED.toString().toUpperCase());
                    cmbStatus.addItem(PublicStatus.OPENED.toString().toUpperCase());
                } else if (publicStatus.equals(PublicStatus.OPENED.toString())) {
                    cmbStatus.setNullSelectionItemId(PublicStatus.OPENED.toString().toUpperCase());
                    cmbStatus.addItem(PublicStatus.CLOSED.toString().toUpperCase());
                } else if (publicStatus.equals(PublicStatus.CLOSED.toString())) {
                    cmbStatus.setNullSelectionItemId(PublicStatus.WITHDRAWN.toString().toUpperCase());
                } else {
                    cmbStatus.addItem(PublicStatus.valueOf(pubStatus));
                }
                cmbStatus.select(1);

                return cmbStatus;
            }

            /**
             * Switch the component back to the original component (Label) after inline editing
             */
            private void reSwapComponents() {
                if (swapComponent != null) {
                    if (swapComponent instanceof Label) {
                        ((Label) oldComponent).setValue(((TextArea) swapComponent).getValue());
                    } else if ((swapComponent instanceof ComboBox)
                            && ((ComboBox) swapComponent).getValue() != null) {
                        ((Label) oldComponent).setValue(
                                status + ((ComboBox) swapComponent).getValue().toString().toUpperCase());
                        if (((ComboBox) swapComponent).getValue().toString().toUpperCase()
                                .equals(PublicStatus.OPENED.toString())) {
                            orgUnitController.openOU();
                        }
                        if (((ComboBox) swapComponent).getValue().toString().toUpperCase()
                                .equals(PublicStatus.WITHDRAWN.toString())) {
                            orgUnitController.withdrawOU();
                        } else if (((ComboBox) swapComponent).getValue().toString().toUpperCase()
                                .equals(PublicStatus.CLOSED.toString())) {
                            orgUnitController.closeOU();
                        }
                    }
                    vlLeft.replaceComponent(swapComponent, oldComponent);
                    swapComponent = null;
                }
            }

        });
    }

}

From source file:org.escidoc.browser.ui.maincontent.SearchAdvancedView.java

License:Open Source License

public SearchAdvancedView(final Router router, final EscidocServiceLocation serviceLocation) {
    this.router = router;
    this.serviceLocation = serviceLocation;
    setWidth("100.0%");
    setHeight("85%");
    setMargin(true);/*from w w w  .  jav a2  s .  co m*/

    // CssLayout to hold the BreadCrumb
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setWidth("60%");
    cssLayout.setCaption("Advanced Search");
    // Css Hack * Clear Div
    final Label lblClear = new Label();
    lblClear.setStyleName("clear");

    txtTitle = new TextField();
    txtTitle.setInputPrompt("Title");
    txtTitle.setImmediate(false);
    txtDescription = new TextField();
    txtDescription.setInputPrompt("Description");
    txtDescription.setImmediate(false);
    // Clean Divs
    cssLayout.addComponent(lblClear);

    txtCreator = new TextField();
    txtCreator.setInputPrompt("Creator");
    txtCreator.setImmediate(false);
    // DatePicker for CreationDate
    creationDate = new PopupDateField();
    creationDate.setInputPrompt("Creation date");
    creationDate.setResolution(PopupDateField.RESOLUTION_DAY);
    creationDate.setImmediate(false);

    // Dropdown for MimeType
    final String[] mimetypes = new String[] { "application/octet-stream", "text/html", "audio/aiff",
            "video/avi", "image/bmp", "application/book", "text/plain", "image/gif", "image/jpeg", "audio/midi",
            "video/quicktime", "audio/mpeg", "application/xml", "text/xml" };
    mimes = new ComboBox();

    for (final String mimetype : mimetypes) {
        mimes.addItem(mimetype);
    }
    mimes.setInputPrompt("Mime Types");
    mimes.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH);
    mimes.setImmediate(true);

    // Dropdown for Resource Type
    final String[] resourcearr = new String[] { "Context", "Container", "Item" };
    resource = new ComboBox();
    for (final String element : resourcearr) {
        resource.addItem(element);
    }
    resource.setInputPrompt("Resource Type");
    resource.setFilteringMode(Filtering.FILTERINGMODE_OFF);
    resource.setImmediate(true);

    txtFullText = new TextField();
    txtFullText.setInputPrompt("FullText");
    txtFullText.setImmediate(false);

    final Button bSearch = new Button("Search", this, "onClick");
    bSearch.setDescription("Search Tooltip");

    // Placing the elements in the design:
    txtTitle.setWidth("50%");
    txtTitle.setStyleName("floatleft paddingtop20 ");
    cssLayout.addComponent(txtTitle);

    txtDescription.setWidth("50%");
    txtDescription.setStyleName("floatright paddingtop20 ");
    cssLayout.addComponent(txtDescription);

    txtCreator.setWidth("50%");
    txtCreator.setStyleName("floatleft paddingtop20");
    cssLayout.addComponent(txtCreator);

    creationDate.setWidth("50%");
    creationDate.setStyleName("floatright");
    cssLayout.addComponent(creationDate);

    // Clean Divs
    cssLayout.addComponent(lblClear);

    mimes.setWidth("45%");
    mimes.setStyleName("floatleft");
    cssLayout.addComponent(mimes);

    resource.setWidth("45%");
    resource.setStyleName("floatright");
    cssLayout.addComponent(resource);

    txtFullText.setWidth("70%");
    txtFullText.setStyleName("floatleft");
    cssLayout.addComponent(txtFullText);

    bSearch.setStyleName("floatright");
    cssLayout.addComponent(bSearch);

    addComponent(cssLayout);
    this.setComponentAlignment(cssLayout, VerticalLayout.ALIGNMENT_HORIZONTAL_CENTER,
            VerticalLayout.ALIGNMENT_VERTICAL_CENTER);
}

From source file:org.escidoc.browser.ui.view.helpers.ItemPropertiesVH.java

License:Open Source License

private void handleLayoutListeners() {
    if (controller.canUpdateItem()) {
        vlPropertiesLeft.addListener(new LayoutClickListener() {

            @Override//from  w w w.ja v  a  2  s  .c o  m
            public void layoutClick(final LayoutClickEvent event) {
                // Get the child component which was clicked

                if (event.getChildComponent() != null) {

                    // Is Label?
                    if (event.getChildComponent().getClass().getCanonicalName().equals("com.vaadin.ui.Label")) {
                        final Label child = (Label) event.getChildComponent();
                        if ((child.getDescription() == ViewConstants.DESC_STATUS2)
                                && (!lblStatus.getValue().equals(status + "withdrawn"))) {
                            reSwapComponents();
                            oldComponent = event.getClickedComponent();
                            swapComponent = editStatus(child.getValue().toString().replace(status, ""));
                            vlPropertiesLeft.replaceComponent(oldComponent, swapComponent);
                        } else if (child.getDescription() == ViewConstants.DESC_LOCKSTATUS) {
                            reSwapComponents();
                            oldComponent = event.getClickedComponent();
                            swapComponent = editLockStatus(child.getValue().toString().replace(status, ""));
                            vlPropertiesLeft.replaceComponent(oldComponent, swapComponent);
                        }
                    }
                } else {
                    reSwapComponents();
                }
            }

            /**
             * Switch the component back to the original component (Label) after inline editing
             */
            private void reSwapComponents() {

                if (swapComponent != null) {
                    if (swapComponent instanceof Label) {
                        ((Label) oldComponent).setValue(((TextArea) swapComponent).getValue());
                    } else if ((swapComponent instanceof ComboBox)
                            && ((ComboBox) swapComponent).getValue() != null) {
                        ((Label) oldComponent).setValue(status + ((ComboBox) swapComponent).getValue());
                        // Because there should be no comment-window on
                        // Delete Operation
                        if (!(((ComboBox) swapComponent).getValue().equals("delete"))) {
                            addCommentWindow();
                        } else {
                            updateItem("");
                        }
                    }
                    vlPropertiesLeft.replaceComponent(swapComponent, oldComponent);
                    swapComponent = null;
                }
            }

            private Component editLockStatus(final String lockStatus) {
                final ComboBox cmbLockStatus = new ComboBox();
                cmbLockStatus.setNullSelectionAllowed(false);
                if (lockStatus.contains("unlocked")) {
                    cmbLockStatus.addItem(LockStatus.LOCKED.toString().toLowerCase());
                } else {
                    cmbLockStatus.addItem(LockStatus.UNLOCKED.toString().toLowerCase());
                }
                cmbLockStatus.select(Integer.valueOf(1));
                return cmbLockStatus;

            }

            private Component editStatus(final String publicStatus) {
                final ComboBox cmbStatus = new ComboBox();
                cmbStatus.setInvalidAllowed(false);
                cmbStatus.setNullSelectionAllowed(false);
                final String pubStatus = publicStatus.toUpperCase();
                if (publicStatus.equals("pending")) {
                    cmbStatus.addItem(PublicStatus.PENDING.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.SUBMITTED.toString().toLowerCase());
                    cmbStatus.setNullSelectionItemId(PublicStatus.PENDING.toString().toLowerCase());

                    if (hasAccessDelResource()) {
                        cmbStatus.addItem("delete");
                    }
                } else if (publicStatus.equals("submitted")) {
                    cmbStatus.setNullSelectionItemId(PublicStatus.SUBMITTED.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.SUBMITTED.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.IN_REVISION.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.RELEASED.toString().toLowerCase());
                } else if (publicStatus.equals("in_revision")) {
                    cmbStatus.setNullSelectionItemId(PublicStatus.IN_REVISION.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.IN_REVISION.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.SUBMITTED.toString().toLowerCase());
                } else if (publicStatus.equals("released")) {
                    cmbStatus.setNullSelectionItemId(PublicStatus.RELEASED.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.RELEASED.toString().toLowerCase());
                    cmbStatus.addItem(PublicStatus.WITHDRAWN.toString().toLowerCase());
                } else if (publicStatus.equals("withdrawn")) {
                    lblStatus.setValue("withdrawn");
                } else {
                    cmbStatus.addItem(PublicStatus.valueOf(pubStatus));
                }
                cmbStatus.select(Integer.valueOf(1));

                return cmbStatus;
            }

            private boolean hasAccessDelResource() {
                try {
                    return repositories.pdp().forCurrentUser().isAction(ActionIdConstants.DELETE_CONTAINER)
                            .forResource(resourceProxy.getId()).permitted();
                } catch (final UnsupportedOperationException e) {
                    mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
                    e.printStackTrace();
                    return false;
                } catch (final EscidocClientException e) {
                    mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
                    e.printStackTrace();
                    return false;
                } catch (final URISyntaxException e) {
                    mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE);
                    e.printStackTrace();
                    return false;
                }
            }

            public void addCommentWindow() {
                subwindow = new Window(ViewConstants.SUBWINDOW_EDIT);
                subwindow.setModal(true);
                // Configure the windws layout; by default a VerticalLayout
                final VerticalLayout layout = (VerticalLayout) subwindow.getContent();
                layout.setMargin(true);
                layout.setSpacing(true);
                layout.setSizeUndefined();

                final TextArea editor = new TextArea("Your Comment");
                editor.setRequired(true);
                editor.setRequiredError("The Field may not be empty.");

                final HorizontalLayout hl = new HorizontalLayout();

                final Button close = new Button("Update", new Button.ClickListener() {

                    private static final long serialVersionUID = 1424933077274899865L;

                    // inline click-listener
                    @Override
                    public void buttonClick(final ClickEvent event) {
                        // close the window by removing it from the
                        // parent window
                        updateItem(editor.getValue().toString());
                        (subwindow.getParent()).removeWindow(subwindow);
                    }
                });
                final Button cancel = new Button("Cancel", new Button.ClickListener() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        (subwindow.getParent()).removeWindow(subwindow);
                    }
                });

                hl.addComponent(close);
                hl.addComponent(cancel);

                subwindow.addComponent(editor);
                subwindow.addComponent(hl);
                mainWindow.addWindow(subwindow);
            }

            private void updatePublicStatus(final Item item, final String comment) {
                Preconditions.checkNotNull(item, "Item is null");
                Preconditions.checkNotNull(comment, "Comment is null");
                // Update PublicStatus if there is a change
                if (!resourceProxy.getVersionStatus()
                        .equals(lblCurrentVersionStatus.getValue().toString().replace(status, ""))) {
                    String publicStatusTxt = lblCurrentVersionStatus.getValue().toString().replace(status, "")
                            .toUpperCase();
                    if (publicStatusTxt.equals("DELETE")) {
                        new ResourceDeleteConfirmation(item, repositories.item(), mainWindow);
                    }
                    try {
                        repositories.item().changePublicStatus(item,
                                lblCurrentVersionStatus.getValue().toString().replace(status, "").toUpperCase(),
                                comment);
                        if (publicStatusTxt.equals("SUBMITTED")) {
                            mainWindow.showNotification(new Window.Notification(ViewConstants.SUBMITTED,
                                    Notification.TYPE_TRAY_NOTIFICATION));
                        } else if (publicStatusTxt.equals("IN_REVISION")) {
                            mainWindow.showNotification(new Window.Notification(ViewConstants.IN_REVISION,
                                    Notification.TYPE_TRAY_NOTIFICATION));
                        } else if (publicStatusTxt.equals("RELEASED")) {
                            mainWindow.showNotification(new Window.Notification(ViewConstants.RELEASED,
                                    Notification.TYPE_TRAY_NOTIFICATION));
                        } else if (publicStatusTxt.equals("WITHDRAWN")) {
                            mainWindow.showNotification(new Window.Notification(ViewConstants.WITHDRAWN,
                                    Notification.TYPE_TRAY_NOTIFICATION));
                        }
                    } catch (EscidocClientException e) {
                        mainWindow.showNotification(new Window.Notification(ViewConstants.ERROR, e.getMessage(),
                                Notification.TYPE_ERROR_MESSAGE));
                    }
                }
            }

            private void updateLockStatus(final Item item, final String comment) {
                if (!resourceProxy.getLockStatus()
                        .equals(lblLockstatus.getValue().toString().replace(lockStatus, ""))) {
                    String lockStatusTxt = lblLockstatus.getValue().toString().replace(lockStatus, "")
                            .toUpperCase();
                    try {
                        if (lockStatusTxt.contains("LOCKED")) {
                            repositories.item().lockResource(item, comment);
                            mainWindow.showNotification(new Window.Notification(ViewConstants.LOCKED,
                                    Notification.TYPE_TRAY_NOTIFICATION));
                        } else {
                            repositories.item().unlockResource(item, comment);
                            mainWindow.showNotification(new Window.Notification(ViewConstants.UNLOCKED,
                                    Notification.TYPE_TRAY_NOTIFICATION));
                        }

                    } catch (EscidocClientException e) {
                        mainWindow.showNotification(new Window.Notification(ViewConstants.ERROR, e.getMessage(),
                                Notification.TYPE_ERROR_MESSAGE));
                    }
                }
            }

            private void updateItem(final String comment) {
                Item item;
                try {
                    item = repositories.item().findItemById(resourceProxy.getId());
                    if (resourceProxy.getLockStatus().equals("unlocked")) {
                        updatePublicStatus(item, comment);
                        // retrive the container to get the last
                        // modifiaction date.
                        item = repositories.item().findItemById(resourceProxy.getId());
                        updateLockStatus(item, comment);
                    } else {
                        updateLockStatus(item, comment);
                        updatePublicStatus(item, comment);
                    }
                } catch (final EscidocClientException e) {
                    LOG.debug("Infrastructure Exception " + e.getLocalizedMessage());
                }
            }

        });
    }

}

From source file:org.generationcp.breeding.manager.crosses.NurseryTemplateConditionsComponent.java

License:Open Source License

protected void initializeComponents() {

    nid = new TextField();

    comboBoxBreedingMethod = new ComboBox();
    comboBoxBreedingMethod.setImmediate(true);
    comboBoxBreedingMethod.setNullSelectionAllowed(true);

    methodId = new TextField();
    methodId.setImmediate(true);//from  w  ww  .  java  2 s . c o m

    comboBoxSiteName = new ComboBox();
    comboBoxSiteName.setImmediate(true);
    comboBoxSiteName.setNullSelectionAllowed(true);

    siteId = new TextField();
    siteId.setImmediate(true);

    comboBoxBreedersName = new ComboBox();
    comboBoxBreedersName.setImmediate(true);
    comboBoxBreedersName.setNullSelectionAllowed(true);

    breederId = new TextField();
    breederId.setImmediate(true);

    femaleListName = new TextField();
    femaleListId = new TextField();
    maleListName = new TextField();
    maleListId = new TextField();

    generateConditionsTable();
    addComponent(nurseryConditionsTable);

    buttonArea = layoutButtonArea();
    addComponent(buttonArea);

}

From source file:org.generationcp.breeding.manager.crossingmanager.AdditionalDetailsBreedingMethodComponent.java

License:Open Source License

@Override
public void afterPropertiesSet() throws Exception {
    setHeight("130px");
    setWidth("700px");

    selectOptionLabel = new Label();

    crossingMethodOptionGroup = new OptionGroup();
    crossingMethodOptionGroup.addItem(CrossingMethodOption.SAME_FOR_ALL_CROSSES);
    crossingMethodOptionGroup.setItemCaption(CrossingMethodOption.SAME_FOR_ALL_CROSSES,
            messageSource.getMessage(Message.CROSSING_METHOD_WILL_BE_THE_SAME_FOR_ALL_CROSSES));
    crossingMethodOptionGroup.addItem(CrossingMethodOption.BASED_ON_PARENTAL_LINES);
    crossingMethodOptionGroup.setItemCaption(CrossingMethodOption.BASED_ON_PARENTAL_LINES,
            messageSource.getMessage(Message.CROSSING_METHOD_WILL_BE_SET_BASED_ON_STATUS_OF_PARENTAL_LINES));
    crossingMethodOptionGroup.select(CrossingMethodOption.BASED_ON_PARENTAL_LINES);
    crossingMethodOptionGroup.setImmediate(true);
    crossingMethodOptionGroup.addListener(new Property.ValueChangeListener() {
        @Override/*from  w  w w . ja  v  a2  s .c om*/
        public void valueChange(ValueChangeEvent event) {
            if (crossingMethodOptionGroup.getValue().equals(CrossingMethodOption.SAME_FOR_ALL_CROSSES)) {
                selectCrossingMethodLabel.setEnabled(true);
                crossingMethodComboBox.setEnabled(true);
                crossingMethodComboBox.focus();
            } else {
                selectCrossingMethodLabel.setEnabled(false);
                crossingMethodComboBox.setEnabled(false);
                crossingMethodComboBox.removeAllItems();
            }
        }
    });

    selectCrossingMethodLabel = new Label();
    selectCrossingMethodLabel.setEnabled(false);

    crossingMethodComboBox = new ComboBox();
    crossingMethodComboBox.setWidth("400px");
    crossingMethodComboBox.setEnabled(false);
    // Change ComboBox back to TextField when it loses focus
    crossingMethodComboBox.addListener(crossingMethodComboboxFocusListener);

    //layout components
    addComponent(selectOptionLabel, "top:25px;left:20px");
    addComponent(crossingMethodOptionGroup, "top:35px;left:20px");
    addComponent(selectCrossingMethodLabel, "top:105px;left:20px");
    addComponent(crossingMethodComboBox, "top:85px;left:180px");

    methods = germplasmDataManager.getMethodsByType("GEN");
}

From source file:org.generationcp.breeding.manager.crossingmanager.AdditionalDetailsCrossInfoComponent.java

License:Open Source License

@Override
public void afterPropertiesSet() throws Exception {
    setHeight("95px");
    setWidth("700px");

    harvestDateLabel = new Label();

    harvestDtDateField = new DateField();
    harvestDtDateField.setResolution(DateField.RESOLUTION_DAY);
    harvestDtDateField.setDateFormat(CrossingManagerMain.DATE_FORMAT);

    harvestLocationLabel = new Label();

    harvestLocComboBox = new ComboBox();
    harvestLocComboBox.setWidth("400px");
    harvestLocComboBox.setNullSelectionAllowed(true);

    // layout components
    addComponent(harvestDateLabel, "top:30px;left:20px");
    addComponent(harvestDtDateField, "top:10px;left:140px");
    addComponent(harvestLocationLabel, "top:60px;left:20px");
    addComponent(harvestLocComboBox, "top:40px;left:140px");

    locations = germplasmDataManager.getAllBreedingLocations();
    populateHarvestLocation();/*ww w  .ja  va  2 s . c  o m*/
}

From source file:org.generationcp.breeding.manager.crossingmanager.CrossingManagerDetailsComponent.java

License:Open Source License

@Override
public void afterPropertiesSet() throws Exception {
    setHeight("300px");
    setWidth("800px");

    germplasmListNameLabel = new Label();
    germplasmListDescriptionLabel = new Label();
    germplasmListTypeLabel = new Label();
    germplasmListDateLabel = new Label();
    germplasmListName = new TextField();
    germplasmListDescription = new TextField();
    germplasmListType = new ComboBox();
    germplasmListDate = new DateField();

    backButton = new Button();
    backButton.setData(BACK_BUTTON_ID);//  w  w w .ja  v a 2s .  c  o m
    doneButton = new Button();
    doneButton.setData(DONE_BUTTON_ID);

    germplasmListName.setWidth("450px");
    germplasmListDescription.setWidth("450px");
    germplasmListType.setWidth("450px");
    germplasmListType.setNullSelectionAllowed(false);

    addComponent(germplasmListNameLabel, "top:50px; left:30px;");
    addComponent(germplasmListDescriptionLabel, "top:80px; left:30px;");
    addComponent(germplasmListTypeLabel, "top:110px; left:30px;");
    addComponent(germplasmListDateLabel, "top:140px; left:30px;");

    addComponent(germplasmListName, "top:30px; left:200px;");
    addComponent(germplasmListDescription, "top:60px; left:200px;");
    addComponent(germplasmListType, "top:90px; left:200px;");
    addComponent(germplasmListDate, "top:120px; left:200px;");

    addComponent(backButton, "top:260px; left: 625px;");
    addComponent(doneButton, "top:260px; left: 700px;");

    germplasmListDate.setResolution(DateField.RESOLUTION_DAY);
    germplasmListDate.setDateFormat(CrossingManagerMain.DATE_FORMAT);
    germplasmListDate.setResolution(DateField.RESOLUTION_DAY);
    germplasmListDate.setValue(new Date());

    initializeListTypeComboBox();

    CrossingManagerImportButtonClickListener listener = new CrossingManagerImportButtonClickListener(this);
    doneButton.addListener(listener);
    backButton.addListener(listener);
}

From source file:org.hip.vif.web.util.ConfigurableSelect.java

License:Open Source License

private static ComboBox createSelect(final String[] inItems) {
    final ComboBox outSelect = new ComboBox();
    for (final String lItem : inItems) {
        outSelect.addItem(lItem);/*from  w  ww . ja  v  a2 s  . com*/
    }
    return outSelect;
}

From source file:org.hip.vif.web.util.MemberViewHelper.java

License:Open Source License

/** Creates the drop down to select the member's address (i.e. 'Mr','Mrs')
 *
 * @param inMember {@link Member}//  w  w w.  ja  va 2s .c  om
 * @return {@link ComboBox} */
public static ComboBox getMemberAddress(final Member inMember) {
    final IMessages lMessages = Activator.getMessages();
    final ComboBox out = new ComboBox();
    addItem(out, -1, "-"); //$NON-NLS-1$
    addItem(out, 0, lMessages.getMessage("ui.member.editor.select.male")); //$NON-NLS-1$
    addItem(out, 1, lMessages.getMessage("ui.member.editor.select.female")); //$NON-NLS-1$
    out.select(BeanWrapperHelper.getInteger(MemberHome.KEY_SEX, inMember));
    out.setStyleName("vif-input"); //$NON-NLS-1$
    out.setWidth(80, Unit.PIXELS);
    out.setNullSelectionAllowed(false);
    return out;
}

From source file:org.iespuigcastellar.attendancemanager.screenlayouts.NoModalWindowTeacherMainLayout.java

License:Open Source License

private void initLayout() {

    datePopupDateField = new PopupDateField("");
    datePopupDateField.setDescription(app.locale.getString("TEACHERMAINLAYOUT_DATEFIELD_DESCRIPTION"));
    datePopupDateField.setValue(new java.util.Date());
    datePopupDateField.setResolution(PopupDateField.RESOLUTION_DAY);
    datePopupDateField.setImmediate(true);
    datePopupDateField.addListener(ValueChangeEvent.class, this, "changedDate");

    classblockComboBox = new ComboBox();
    classblockComboBox.setInputPrompt(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_INPUTPROMPT"));
    classblockComboBox.setDescription(app.locale.getString("TEACHERMAINLAYOUT_CLASSBLOCK_DESCRIPTION"));
    classblockComboBox.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS);
    classblockComboBox.setImmediate(true);
    classblockComboBox.addContainerProperty("name", String.class, "");
    classblockComboBox.setItemCaptionPropertyId("name");
    classblockComboBox.addListener(ValueChangeEvent.class, this, "changedClassblock");

    Button logoutButton = new Button(app.locale.getString("TEACHERMAINLAYOUT_LOGOUTBUTTON_CAPTION"));

    logoutButton.addListener(new Button.ClickListener() {

        @Override/*from   w  ww  .  java 2  s.c om*/
        public void buttonClick(ClickEvent event) {
            Logger.log("User " + app.user.getLogin() + " closes session");
            app.storage.close();
            getApplication().close();
        }
    });

    GridLayout optionsGridLayout = new GridLayout(2, 1);
    HorizontalLayout haLayout = new HorizontalLayout();

    haLayout.setSpacing(true);
    //haLayout.setWidth("100%"); // Fix layout errors, but bad display
    haLayout.addComponent(new PasswordChangeLayout());
    haLayout.addComponent(datePopupDateField);
    haLayout.addComponent(classblockComboBox);

    optionsGridLayout.addComponent(haLayout);
    optionsGridLayout.addComponent(logoutButton);
    optionsGridLayout.setComponentAlignment(logoutButton, Alignment.TOP_RIGHT);
    optionsGridLayout.setWidth("100%");

    addComponent(optionsGridLayout);

    table.setSizeFull();
    table.setImmediate(true);
    table.setColumnReorderingAllowed(true);
    table.setColumnCollapsingAllowed(true);
    table.addContainerProperty("Name", String.class, null);
    table.addContainerProperty("Surname 1", String.class, null);
    table.addContainerProperty("Surname 2", String.class, null);
    table.addContainerProperty("Miss", CheckBox.class, null);
    table.addContainerProperty("Excused", CheckBox.class, null);
    table.addContainerProperty("Delay", CheckBox.class, null);
    table.addContainerProperty("Expulsion", CheckBox.class, null);

    table.setColumnExpandRatio("Name", 1);
    table.setColumnExpandRatio("Surname 1", 1);
    table.setColumnExpandRatio("Surname 2", 1);

    table.setColumnHeaders(new String[] { app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_NAME"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME1"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_SURNAME2"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_MISS"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXCUSED"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_DELAY"),
            app.locale.getString("TEACHERMAINLAYOUT_TABLECOLUMN_EXPULSION") });
    addComponent(table);
    setExpandRatio(table, 1);
    setSizeFull();
}