Example usage for com.vaadin.ui CssLayout CssLayout

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

Introduction

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

Prototype

public CssLayout() 

Source Link

Document

Constructs an empty CssLayout.

Usage

From source file:gov.va.ehtac.appsonfhir.ui.LogoutView.java

License:Open Source License

private void buildView() {
    CssLayout content = new CssLayout();
    content.setWidth("100%");
    setCaption("Logout / End Session");

    VerticalComponentGroup vGroup = new VerticalComponentGroup();
    logoutAction = new Label(
            "<div style='color:#333;'><p>You have requested to end your session, if true continue by clicking the \"Ok\" button.</p></div>",
            Label.CONTENT_XHTML);
    Button okBTN = new Button("Ok");
    okBTN.addListener(new Button.ClickListener() {

        @Override/*from  w  w w .  j ava  2s  .  c  o  m*/
        public void buttonClick(ClickEvent event) {
            ((HealthElementsTouchKitUI) UI.getCurrent()).getSession().close();
        }
    });
    vGroup.addComponent(logoutAction);
    vGroup.addComponent(okBTN);
    content.addComponent(vGroup);
    setContent(content);

}

From source file:gov.va.ehtac.appsonfhir.ui.PatientSearch.java

private Popover getPopoverResults() {
    popover = new Popover();
    popover.setModal(true);//  w  w w . j  a  v a 2  s .co m
    popover.setClosable(true);
    popover.setWidth("500px");
    popover.setHeight("350px");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption("Search Results");

    CssLayout layout2 = new CssLayout();
    createTable();
    layout2.addComponent(searchTable);

    Button selectPatient = new Button("Select", new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
                Object rowId = searchTable.getValue();
                if (rowId != null) {
                    String id = (String) searchTable.getContainerProperty(rowId, "patientid").getValue();
                    String last = (String) searchTable.getContainerProperty(rowId, "lastname").getValue();
                    String first = (String) searchTable.getContainerProperty(rowId, "firstname").getValue();
                    String gender = (String) searchTable.getContainerProperty(rowId, "gender").getValue();
                    String dob = (String) searchTable.getContainerProperty(rowId, "dob").getValue();
                    PatientSearchResults results = (PatientSearchResults) searchTable
                            .getContainerProperty(rowId, "oResults").getValue();
                    session.setPatientId(id);
                    session.setPatientNameAgeGenderDisplay(last + ", " + first + " " + gender + " " + dob);
                    patientDisplayName.setValue(session.getPatientNameAgeGenderDisplay());
                    System.out.println("PATIENT NameAgeGender: " + session.getPatientNameAgeGenderDisplay()
                            + " PATIENT ID: " + session.getPatientId());
                    System.out.println(results.getPayload());
                    popover.close();
                    grabAllPatientData();
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    });
    layout2.addComponent(selectPatient);

    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            popover.removeFromParent();
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setLeftComponent(close);
    navView.setRightComponent(selectPatient);

    popover.setContent(navView);

    return popover;
}

From source file:gov.va.ehtac.appsonfhir.ui.ProfileView.java

License:Open Source License

private void buildView() {
    session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes();
    CssLayout content = new CssLayout();
    content.setWidth("100%");
    setCaption("Profile View");

    VerticalComponentGroup vGroup = new VerticalComponentGroup();
    profileAction = new Label(
            "<div style='color:#333;'><p>This screen allows the user to modify their <b>Privacy on FHIR</b> "
                    + "Purpose of Use, and Security Level for local Access Control Decisions.</d></div>",
            Label.CONTENT_XHTML);

    vGroup.addComponent(profileAction);//from  w  w w.  ja  va 2  s  .  co m

    //Label identityLBL = new Label("<b>Identity</b>", Label.CONTENT_XHTML);
    TextField providerIdFLD = new TextField("Provider ID/Email Address");
    providerIdFLD.setEnabled(false);
    TextField userIdFLD = new TextField("User ID");
    userIdFLD.setEnabled(false);
    PasswordField userpassFLD = new PasswordField("Password");
    userpassFLD.setEnabled(false);

    providerIdFLD.setValue(session.getProviderId());
    userIdFLD.setValue(session.getUserId());
    userpassFLD.setValue("ds4p");

    providerIdFLD.setWidth("400px");
    userIdFLD.setWidth("400px");
    userpassFLD.setWidth("400px");

    VerticalComponentGroup vGroup2 = new VerticalComponentGroup();
    vGroup2.setCaption("Identity");
    //vGroup.addComponent(identityLBL);
    vGroup2.addComponent(providerIdFLD);
    vGroup2.addComponent(userIdFLD);
    vGroup2.addComponent(userpassFLD);

    //Label permissionsLBL = new Label("<b>Access Control Setting and Permissions</b>", Label.CONTENT_XHTML);
    pouCBX = new ComboBox("Current Purpose of Use");
    NavigationButton resourceNavBTN = new NavigationButton("Resource Privileges");
    confCBX = new ComboBox("Security Level");
    NavigationButton sensitivityNavBTN = new NavigationButton("Sensitivity Privileges");

    pouCBX.setWidth("400px");
    confCBX.setWidth("400px");
    pouCBX.setTextInputAllowed(false);
    confCBX.setTextInputAllowed(false);

    populateConfCBX();
    populatePouCBX();

    confCBX.setEnabled(true);

    VerticalComponentGroup vGroup3 = new VerticalComponentGroup();
    vGroup3.setCaption("Use and Permission Settings");
    //vGroup.addComponent(permissionsLBL);
    vGroup3.addComponent(pouCBX);
    vGroup3.addComponent(resourceNavBTN);
    vGroup3.addComponent(confCBX);
    vGroup3.addComponent(sensitivityNavBTN);

    pouCBX.setValue(session.getPurposeOfUse());
    confCBX.setValue(session.getSecurityLevel());

    //Label organizationLBL = new Label("<b>Organization Info</b>", Label.CONTENT_XHTML);
    TextField organizationFLD = new TextField("Organization");
    TextField organizationUnitFLD = new TextField("Facility");
    TextField organizationIdFLD = new TextField("Home Community");

    organizationFLD.setValue("Military Health Systems");
    organizationUnitFLD.setValue("Navy Medical Center San Diego - NMCSD");
    organizationIdFLD.setValue("2.16.840.1.113883.4.349");

    organizationFLD.setEnabled(false);
    organizationUnitFLD.setEnabled(false);
    organizationIdFLD.setEnabled(false);

    organizationFLD.setWidth("400px");
    organizationUnitFLD.setWidth("400px");
    organizationIdFLD.setWidth("400px");

    VerticalComponentGroup vGroup4 = new VerticalComponentGroup();
    vGroup4.setCaption("Organization Info");
    //vGroup.addComponent(organizationLBL);
    vGroup4.addComponent(organizationFLD);
    vGroup4.addComponent(organizationUnitFLD);
    vGroup4.addComponent(organizationIdFLD);

    //Label locationLBL = new Label("<b>Location</b>", Label.CONTENT_XHTML);
    TextField cityFLD = new TextField("City");
    TextField stateFLD = new TextField("State");
    TextField zipFLD = new TextField("Zip Code");
    TextField countryFLD = new TextField("Country");

    //set defaults and disable
    cityFLD.setValue("San Diego");
    stateFLD.setValue("CA");
    zipFLD.setValue("92104");
    countryFLD.setValue("U.S.A");

    cityFLD.setEnabled(false);
    stateFLD.setEnabled(false);
    zipFLD.setEnabled(false);
    countryFLD.setEnabled(false);

    cityFLD.setWidth("400px");
    stateFLD.setWidth("400px");
    zipFLD.setWidth("400px");
    countryFLD.setWidth("400px");
    VerticalComponentGroup vGroup5 = new VerticalComponentGroup();
    vGroup5.setCaption("Location Info");
    //vGroup.addComponent(locationLBL);
    vGroup5.addComponent(cityFLD);
    vGroup5.addComponent(stateFLD);
    vGroup5.addComponent(zipFLD);
    vGroup5.addComponent(countryFLD);

    pouCBX.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String val = (String) pouCBX.getValue();
            session.setPurposeOfUse(val);
        }
    });

    confCBX.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String val = (String) confCBX.getValue();
            session.setSecurityLevel(val);
        }
    });

    pouCBX.setImmediate(true);
    confCBX.setImmediate(true);

    content.addComponent(vGroup);
    content.addComponent(vGroup2);
    content.addComponent(vGroup3);
    content.addComponent(vGroup4);
    content.addComponent(vGroup5);
    setContent(content);

}

From source file:gov.va.ehtac.myappsonfhir.ui.ImmunizationRequest.java

private Popover getPopoverResults(String umaResults) {
    popover = new Popover();
    popover.setModal(true);/*  w  w  w  .j  a  v a  2 s. co m*/
    popover.setClosable(true);
    popover.setWidth("500px");
    popover.setHeight("350px");
    CssLayout popLayout = new CssLayout();
    popLayout.setSizeFull();

    NavigationView navView = new NavigationView(popLayout);
    navView.setCaption("Request Completed");
    Label lbl = new Label(umaResults);

    CssLayout layout2 = new CssLayout();
    layout2.addComponent(lbl);
    setTable();
    layout2.addComponent(immunizationTable);
    popLayout.addComponent(layout2);

    Button close = new Button(null, new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            popover.removeFromParent();
        }
    });
    close.setIcon(new ThemeResource("../runo/icons/64/cancel.png"));
    navView.setRightComponent(close);
    popover.setContent(navView);

    return popover;
}

From source file:gov.va.ehtac.myappsonfhir.ui.LogoutView.java

License:Open Source License

private void buildView() {
    CssLayout content = new CssLayout();
    content.setWidth("100%");
    setCaption("Logout / End Session");

    VerticalComponentGroup vGroup = new VerticalComponentGroup();
    logoutAction = new Label(
            "<div style='color:#333;'><p>You have requested to end your session, if true continue by clicking the \"Ok\" button.</p></div>",
            Label.CONTENT_XHTML);
    Button okBTN = new Button("Ok");
    okBTN.addListener(new Button.ClickListener() {

        @Override//from   w  w  w .  j a  v a2 s  .  c  o m
        public void buttonClick(ClickEvent event) {
            ((HealthElementsForPatientTouchKitUI) UI.getCurrent()).getSession().close();
        }
    });
    vGroup.addComponent(logoutAction);
    vGroup.addComponent(okBTN);
    content.addComponent(vGroup);
    setContent(content);

}

From source file:info.magnolia.messages.app.MessagesViewImpl.java

License:Open Source License

@Inject
public MessagesViewImpl(SimpleTranslator i18n) {

    this.i18n = i18n;

    // create form and data item
    final Message message = new Message(); // message POJO
    BeanItem<Message> messageItem = new BeanItem<Message>(message);

    final FieldGroup form = new FieldGroup();
    form.setItemDataSource(messageItem);

    Field<String> subjectField = createSubjectTextField();
    Field<String> messageBodyField = createMessageBodyTextField();
    Field<?> typeField = createTypeSelectionField();
    Field<?> scopeField = createScopeSelectionField();
    userOrGroupIdField = createUserOrGroupIdTextField();

    // disable user/group field if not necessary
    scopeField.addValueChangeListener(new ValueChangeListener() {

        @Override//from www  . j  a va2 s .co m
        public void valueChange(ValueChangeEvent event) {
            updateUserOrGroupField((String) event.getProperty().getValue());
        }
    });

    form.bind(subjectField, "title");
    form.bind(messageBodyField, "content");
    form.bind(typeField, "type");
    form.bind(scopeField, "scope");
    form.bind(userOrGroupIdField, "user");
    // FieldGroup overrides fields' own enabled property with its own.
    updateUserOrGroupField(message.getScope());

    FormLayout layout = new FormLayout();
    layout.addComponent(subjectField);
    layout.addComponent(messageBodyField);
    layout.addComponent(typeField);
    layout.addComponent(scopeField);
    layout.addComponent(userOrGroupIdField);

    layout.setSpacing(true);
    layout.setMargin(false);
    layout.setWidth("100%");

    // send button
    NativeButton sendButton = new NativeButton(i18n.translate("messages-app.app.button.sendMessage"),
            new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    try {
                        form.commit();
                        String subject = message.getTitle();
                        String content = message.getContent();
                        MessageType type = message.getType();
                        String scope = message.getScope();

                        if (MESSAGE_SCOPE_LOCAL.equals(scope)) {
                            listener.handleLocalMessage(type, subject, content);
                        } else if (MESSAGE_SCOPE_GLOBAL.equals(scope)) {
                            listener.handleGlobalMessage(type, subject, content);
                        } else if (MESSAGE_SCOPE_GROUP.equals(scope)) {
                            // message is bound to FieldGroup - hence the group name is to be retrieved from the user field of the message
                            final String groupName = message.getUser();
                            listener.handleGroupMessage(groupName, type, subject, content);
                        } else {
                            // User...
                            final String userName = message.getUser();
                            listener.handleUserMessage(userName, type, subject, content);
                        }
                    } catch (CommitException e) {

                    }
                }
            });
    sendButton.addStyleName("btn-dialog");
    sendButton.addStyleName("commit");

    // reset button
    NativeButton resetButton = new NativeButton(i18n.translate("messages-app.app.button.reset"),
            new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    message.reset();
                    form.discard();
                }
            });
    resetButton.addStyleName("btn-dialog");
    resetButton.addStyleName("cancel");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addStyleName("buttons");
    buttons.setSpacing(true);
    buttons.addComponent(sendButton);
    buttons.addComponent(resetButton);
    layout.addComponent(buttons);

    // intro text
    Label intro = new Label(i18n.translate("messages-app.app.label.intro"), ContentMode.HTML);
    intro.addStyleName("intro");

    CssLayout container = new CssLayout();
    container.setSizeFull();
    container.addStyleName("small-app-panel");
    container.addComponent(layout);

    CssLayout root = new CssLayout();
    root.setSizeFull();
    root.setWidth("900px");
    root.setStyleName("small-app");
    root.addComponent(intro);
    root.addComponent(container);

    component = root;
}

From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesForm.java

License:Open Source License

private void init() {
    addStyleName("favorites-form");
    final VerticalLayout favoriteForm = new VerticalLayout();
    favoriteEntryForm = new InternalFavoriteEntryForm();
    favoriteGroupForm = new InternalFavoriteGroupForm();

    tabsheet = new TabSheet();
    tabsheet.addStyleName("favorites-tabs");
    tabsheet.addTab(favoriteEntryForm, i18n.translate("favorites.form.favorite.add"));
    tabsheet.addTab(favoriteGroupForm, i18n.translate("favorites.form.group.add"));

    tabsheet.addSelectedTabChangeListener(new SelectedTabChangeListener() {

        @Override// w ww  .j a v  a2 s  .co  m
        public void selectedTabChange(SelectedTabChangeEvent event) {
            if (event.getTabSheet().getSelectedTab() instanceof InternalFavoriteEntryForm) {
                favoriteGroupForm.removeEnterKeyShortcutListener();
                favoriteEntryForm.addEnterKeyShortcutListener();
            } else {
                favoriteEntryForm.removeEnterKeyShortcutListener();
                favoriteGroupForm.addEnterKeyShortcutListener();
            }
        }
    });

    final CssLayout header = new CssLayout();
    header.addStyleName("dialog-header");
    header.setSizeFull();
    header.addLayoutClickListener(new LayoutClickListener() {
        @Override
        public void layoutClick(LayoutClickEvent event) {
            // change the visibility of the group- and favorite-items
            if (event.getClickedComponent() == editIcon || event.getChildComponent() == editLabel) {
                if (!listener.hasItems() || listener.itemsAreEditable()) {
                    listener.setToInitialState();
                } else {
                    listener.setItemsEditable(true);
                }
            } else {
                // just open || close the FavoritesForm
                if (isOpen()) {
                    close();
                } else {
                    open();
                }
            }
        }
    });

    // add
    final Label addNewIcon = new Label();
    addNewIcon.setSizeUndefined();
    addNewIcon.addStyleName("icon");
    addNewIcon.addStyleName("icon-add-fav");
    final Label addNewLabel = new Label(i18n.translate("favorites.form.add"));
    addNewLabel.setSizeUndefined();
    addNewLabel.addStyleName("title");

    // edit
    editIcon = new Label();
    editIcon.setSizeUndefined();
    editIcon.addStyleName(EDIT_ACTION_STYLENAME);
    editIcon.addStyleName("icon");
    editIcon.addStyleName("icon-edit");

    editLabel = new Label(i18n.translate("favorites.form.favorite.edit"));
    editLabel.setSizeUndefined();
    editLabel.addStyleName("title");
    editLabel.addStyleName(EDIT_ACTION_STYLENAME);

    // arrow
    arrowIcon = new Label();
    arrowIcon.setSizeUndefined();
    arrowIcon.addStyleName("icon");
    arrowIcon.addStyleName("arrow");
    arrowIcon.addStyleName("icon-arrow2_n");

    // assemble
    header.addComponent(addNewIcon);
    header.addComponent(addNewLabel);
    header.addComponent(editIcon);
    header.addComponent(editLabel);
    header.addComponent(arrowIcon);
    favoriteForm.addComponent(header);
    favoriteForm.addComponent(tabsheet);

    // form is closed initially
    close();
    setCompositionRoot(favoriteForm);
}

From source file:info.magnolia.ui.admincentral.shellapp.favorites.FavoritesGroup.java

License:Open Source License

private void construct(final AbstractJcrNodeAdapter favoritesGroup, final FavoritesView.Listener listener) {
    wrapper = new CssLayout();
    wrapper.addStyleName("favorites-group-title");

    this.enterKeyShortcutListener = new EnterKeyShortcutListener(listener);
    this.escapeKeyShortcutListener = new EscapeKeyShortcutListener();

    this.relPath = favoritesGroup.getNodeName();
    this.title = favoritesGroup.getItemProperty(AdmincentralNodeTypes.Favorite.TITLE).getValue().toString();

    titleField = new TextField();
    titleField.setValue(title);/*from   w  w w  . j av a  2 s  . c o m*/
    titleField.setReadOnly(true);
    titleField.addFocusListener(new FocusListener() {

        @Override
        public void focus(FocusEvent event) {
            titleField.addShortcutListener(enterKeyShortcutListener);
            titleField.addShortcutListener(escapeKeyShortcutListener);
        }
    });

    titleField.addBlurListener(new BlurListener() {

        @Override
        public void blur(BlurEvent event) {
            titleField.removeShortcutListener(enterKeyShortcutListener);
            titleField.removeShortcutListener(escapeKeyShortcutListener);
        }
    });

    wrapper.addComponent(titleField);

    editButton = new NativeButton();
    editButton.setHtmlContentAllowed(true);
    editButton.setCaption("<span class=\"icon-edit\"></span>");
    editButton.addStyleName("favorite-action");
    editButton.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            doEditTitle(listener);
        }
    });
    editButton.setVisible(false);
    wrapper.addComponent(editButton);

    removeButton = new NativeButton();
    removeButton.setHtmlContentAllowed(true);
    removeButton.setCaption("<span class=\"icon-trash\"></span>");
    removeButton.addStyleName("favorite-action");
    removeButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            shell.openConfirmation(MessageStyleTypeEnum.WARNING,
                    i18n.translate("favorites.group.confirmation.title"),
                    i18n.translate("confirmation.cannot.undo"), i18n.translate("confirmation.delete.yes"),
                    i18n.translate("confirmation.no"), false, new ConfirmationCallback() {

                        @Override
                        public void onSuccess() {
                            listener.removeGroup(relPath);
                        }

                        @Override
                        public void onCancel() {
                            // no op
                        }
                    });
        }
    });
    removeButton.setVisible(false);
    wrapper.addComponent(removeButton);
    dragAndDropWrapper = new GroupDragAndDropWrapper(wrapper, listener, this);
    addComponent(dragAndDropWrapper);
}

From source file:info.magnolia.ui.dialog.formdialog.FormBuilder.java

License:Open Source License

public View buildView(FormDefinition formDefinition, Item item) {

    final CssLayout view = new CssLayout();
    view.setSizeFull();/*from   w w w .j  av  a 2  s.  co m*/

    for (TabDefinition tabDefinition : formDefinition.getTabs()) {
        List<FieldDefinition> fields = tabDefinition.getFields();
        if (fields.size() == 0) { // skip empty tabs
            continue;
        }
        for (final FieldDefinition fieldDefinition : fields) {
            final FieldFactory formField = fieldFactoryFactory.createFieldFactory(fieldDefinition, item);
            if (formField == null) {
                continue;
            }
            formField.setComponentProvider(componentProvider);

            final View fieldView = formField.getView();

            view.addComponent(fieldView.asVaadinComponent());

        }
    }
    return new View() {
        @Override
        public Component asVaadinComponent() {
            return view;
        }
    };
}

From source file:info.magnolia.ui.form.field.factory.AbstractFieldFactory.java

License:Open Source License

@Override
public View getView() {
    final CssLayout fieldView = new CssLayout();
    fieldView.setStyleName("field-view");

    Label label = new Label();
    label.setSizeUndefined();/*from   ww  w. java 2 s .  c  om*/
    label.setCaption(getFieldDefinition().getLabel());

    if (getFieldDefinition().getClass().isAssignableFrom(TextFieldDefinition.class)) {
        final TextFieldDefinition textFieldDefinition = (TextFieldDefinition) getFieldDefinition();
        if (textFieldDefinition.getRows() > 0) {
            label.addStyleName("textarea");
        }
    }
    if (definition.getConverterClass() != null) {
        Converter converter = initializeConverter(definition.getConverterClass());
        label.setConverter(converter);
    }

    Property<?> property = initializeProperty();

    label.setPropertyDataSource(property);

    fieldView.addComponent(label);

    return new View() {
        @Override
        public Component asVaadinComponent() {
            return fieldView;
        }
    };
}