Example usage for com.vaadin.server ThemeResource ThemeResource

List of usage examples for com.vaadin.server ThemeResource ThemeResource

Introduction

In this page you can find the example usage for com.vaadin.server ThemeResource ThemeResource.

Prototype

public ThemeResource(String resourceId) 

Source Link

Document

Creates a resource.

Usage

From source file:de.gedoplan.webclients.vaadin.VaadinDemoUi.java

public MenuBar createMenu() {
    User user = userProvider.get();//from  w w  w. j  av a 2  s. co  m
    MenuBar mainMenu = new MenuBar();
    mainMenu.setWidth(100, Unit.PERCENTAGE);
    mainMenu.setStyleName("main");
    mainMenu.addItem("", new ThemeResource("images/vaadin-logo.png"),
            e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_INDEX)).setStyleName("logo");
    if (user.isInRole(User.UserRole.ADMIN)) {
        mainMenu.addItem(Messages.menu_customer.value(),
                e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_CUSTOMERS));
    }
    mainMenu.addItem(Messages.menu_orders.value(), e -> navigator.navigateTo(Konstanten.VAADIN_VIEW_ORDERS));
    if (user.isInRole(User.UserRole.CUSTOMER)) {
        mainMenu.addItem(Messages.menu_customerdetails.value(), e -> navigator
                .navigateTo(Konstanten.VAADIN_VIEW_CUSTOMER_DETAILS + "/" + user.getCustomerID()));
    }
    MenuBar.MenuItem userMenu = mainMenu.addItem(user.getLogin(), null);
    userMenu.setStyleName("align-right");
    userMenu.addItem(Messages.logout.value(), e -> {
        try {
            JaasAccessControl.logout();
            VaadinSession.getCurrent().close();
            Page.getCurrent().setLocation(Konstanten.VAADIN_LOGIN_PATH);
        } catch (ServletException ex) {
            Logger.getLogger(VaadinDemoUi.class.getName()).log(Level.SEVERE, null, ex);
        }
    });
    return mainMenu;
}

From source file:de.kaiserpfalzEdv.office.ui.web.widgets.about.AboutPanel.java

License:Apache License

@PostConstruct
public void init() {
    Image logo = new Image(null, new ThemeResource("../images/lichti-wappen.png"));
    logo.setId("about-logo");
    logo.setAlternateText("Logo: Kaiserpfalz EDV-Service");
    logo.setWidth(150f, Unit.PIXELS);// w  ww .  j ava  2 s.c o  m
    logo.setHeight(170f, Unit.PIXELS);
    logo.setCaption("Kaiserpfalz EDV-Service");

    addComponent(logo);
    setComponentAlignment(logo, Alignment.MIDDLE_CENTER);

    Label name = new Label(
            "<div style='text-align: center;'><b>" + application.get(ApplicationMetaData.APPLICATION_NAME)
                    + "</b>" + "<br/>" + "<i><small>Version "
                    + application.get(ApplicationMetaData.APPLICATION_VERSION) + "</small></i></div>",
            ContentMode.HTML);
    name.setWidth(200f, Unit.PIXELS);
    addComponent(name);
    setComponentAlignment(name, Alignment.MIDDLE_CENTER);

    addComponent(new Label(""));
    addComponent(new Label("License: " + license.getId()));
    addComponent(new Label("Licensee: " + license.getLicensee()));
    addComponent(new Label(""));
    addComponent(new Label("Issued: " + license.getIssueDate()));
    addComponent(new Label("Issuer: " + license.getIssuer()));
    addComponent(new Label(""));
    addComponent(new Label("Valid (Time): " + license.getStart() + " - " + license.getExpiry()));
    addComponent(new Label("Valid (Version): " + license.getVersionRange().getStart() + " - "
            + license.getVersionRange().getEnd()));

    LOG.trace("Initialized: {}", this);
    LOG.trace("  application: {}", application);
    LOG.trace("  license: {}", license);
}

From source file:de.kaiserpfalzEdv.vaadin.about.AboutViewImpl.java

License:Apache License

private void initalizeOverview() {
    overviewLayout = createGridLayout(2, 3);
    overviewLayout.setHeight(300f, PIXELS);
    overviewLayout.setWidth(100f, PERCENTAGE);
    overviewLayout.setColumnExpandRatio(0, 70f);
    overviewLayout.setColumnExpandRatio(1, 30f);
    overviewLayout.setRowExpandRatio(0, 33f);
    overviewLayout.setRowExpandRatio(1, 33f);
    overviewLayout.setRowExpandRatio(2, 33f);

    Image logo = new Image("", new ThemeResource("img/logo.png"));
    logo.setHeight(300f, PIXELS);/* w w  w  . j  av  a  2  s. c om*/
    logo.setWidth(300f, PIXELS);
    overviewLayout.addComponent(logo, 0, 0, 0, 2);

    overviewLayout.addComponent(createOverviewLabel("about.application"), 1, 0);
    overviewLayout.addComponent(createOverviewLabel("about.version"), 1, 1);
    overviewLayout.addComponent(createManufactorLabel("about.manufactor"), 1, 2);

    mainLayout.addComponent(overviewLayout);
}

From source file:de.kaiserpfalzEdv.vaadin.menu.impl.MenuImpl.java

License:Apache License

@Inject
public MenuImpl(final Authenticator accessControl, final EventBus bus, final I18NHandler i18n,
        final List<View> allViews) {
    this.accessControl = accessControl;
    this.bus = bus;
    this.i18n = i18n;
    this.allViews = allViews;

    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from  ww  w  .j a v a2 s  .c om
    Label title = new Label(translate("application.name"));
    title.addStyleName(ValoTheme.LABEL_H3);
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/table-logo.png"));
    image.setStyleName("logo");
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem(translate("button.logout.caption"), FontAwesome.valueOf(translate("button.logout.icon")),
            selectedItem -> {
                VaadinSession.getCurrent().getSession().invalidate();
                Page.getCurrent().reload();
            });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button(translate("application.name"), new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(ValoTheme.BUTTON_SMALL);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(FontAwesome.NAVICON);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}

From source file:de.symeda.sormas.ui.caze.CaseDataForm.java

License:Open Source License

@Override
protected void addFields() {
    if (person == null || disease == null) {
        return;/*w ww . j  a v  a2  s.  co m*/
    }

    // Add fields
    addFields(CaseDataDto.UUID, CaseDataDto.REPORT_DATE, CaseDataDto.REPORTING_USER,
            CaseDataDto.DISTRICT_LEVEL_DATE, CaseDataDto.REGION_LEVEL_DATE, CaseDataDto.NATIONAL_LEVEL_DATE,
            CaseDataDto.CLASSIFICATION_DATE, CaseDataDto.CLASSIFICATION_USER,
            CaseDataDto.CLASSIFICATION_COMMENT, CaseDataDto.NOTIFYING_CLINIC,
            CaseDataDto.NOTIFYING_CLINIC_DETAILS, CaseDataDto.CLINICIAN_NAME, CaseDataDto.CLINICIAN_PHONE,
            CaseDataDto.CLINICIAN_EMAIL);

    // Button to automatically assign a new epid number
    Button assignNewEpidNumberButton = new Button(
            I18nProperties.getCaption(Captions.actionAssignNewEpidNumber));
    CssStyles.style(assignNewEpidNumberButton, ValoTheme.BUTTON_PRIMARY, CssStyles.FORCE_CAPTION);
    getContent().addComponent(assignNewEpidNumberButton, ASSIGN_NEW_EPID_NUMBER_LOC);
    assignNewEpidNumberButton.setVisible(false);

    TextField epidField = addField(CaseDataDto.EPID_NUMBER, TextField.class);
    epidField.setInvalidCommitted(true);
    CssStyles.style(epidField, CssStyles.ERROR_COLOR_PRIMARY);

    assignNewEpidNumberButton.addClickListener(e -> {
        epidField.setValue(FacadeProvider.getCaseFacade().generateEpidNumber(getValue().toReference()));
    });

    addField(CaseDataDto.CASE_CLASSIFICATION, OptionGroup.class);
    addField(CaseDataDto.INVESTIGATION_STATUS, OptionGroup.class);
    addField(CaseDataDto.OUTCOME, OptionGroup.class);
    addField(CaseDataDto.SEQUELAE, OptionGroup.class);
    addFields(CaseDataDto.INVESTIGATED_DATE, CaseDataDto.OUTCOME_DATE, CaseDataDto.SEQUELAE_DETAILS);

    ComboBox diseaseField = addDiseaseField(CaseDataDto.DISEASE, false);
    addField(CaseDataDto.DISEASE_DETAILS, TextField.class);
    addField(CaseDataDto.PLAGUE_TYPE, OptionGroup.class);
    addField(CaseDataDto.DENGUE_FEVER_TYPE, OptionGroup.class);

    addField(CaseDataDto.CASE_ORIGIN, TextField.class);
    TextField healthFacilityDetails = addField(CaseDataDto.HEALTH_FACILITY_DETAILS, TextField.class);
    addField(CaseDataDto.REGION, ComboBox.class);
    addField(CaseDataDto.DISTRICT, ComboBox.class);
    addField(CaseDataDto.COMMUNITY, ComboBox.class);
    addField(CaseDataDto.HEALTH_FACILITY, ComboBox.class);
    ComboBox surveillanceOfficerField = addField(CaseDataDto.SURVEILLANCE_OFFICER, ComboBox.class);
    surveillanceOfficerField.setNullSelectionAllowed(true);
    addField(CaseDataDto.POINT_OF_ENTRY, ComboBox.class);
    addField(CaseDataDto.POINT_OF_ENTRY_DETAILS, TextField.class);

    addFields(CaseDataDto.PREGNANT, CaseDataDto.VACCINATION, CaseDataDto.VACCINATION_DOSES,
            CaseDataDto.VACCINATION_INFO_SOURCE, CaseDataDto.SMALLPOX_VACCINATION_SCAR,
            CaseDataDto.SMALLPOX_VACCINATION_RECEIVED, CaseDataDto.VACCINATION_DATE);

    // Set initial visibilities

    initializeVisibilitiesAndAllowedVisibilities(disease, viewMode);

    // Set requirements that don't need visibility changes and read only status

    setRequired(true, CaseDataDto.REPORT_DATE, CaseDataDto.CASE_CLASSIFICATION,
            CaseDataDto.INVESTIGATION_STATUS, CaseDataDto.OUTCOME, CaseDataDto.DISEASE);
    setSoftRequired(true, CaseDataDto.INVESTIGATED_DATE, CaseDataDto.OUTCOME_DATE, CaseDataDto.PLAGUE_TYPE,
            CaseDataDto.SURVEILLANCE_OFFICER);
    FieldHelper.setReadOnlyWhen(getFieldGroup(), CaseDataDto.INVESTIGATED_DATE,
            CaseDataDto.INVESTIGATION_STATUS, Arrays.asList(InvestigationStatus.PENDING), false);
    setReadOnly(true, CaseDataDto.UUID, CaseDataDto.REPORTING_USER, CaseDataDto.CLASSIFICATION_USER,
            CaseDataDto.CLASSIFICATION_DATE, CaseDataDto.REGION, CaseDataDto.DISTRICT, CaseDataDto.COMMUNITY,
            CaseDataDto.HEALTH_FACILITY, CaseDataDto.HEALTH_FACILITY_DETAILS, CaseDataDto.POINT_OF_ENTRY,
            CaseDataDto.POINT_OF_ENTRY_DETAILS, CaseDataDto.CASE_ORIGIN);
    setReadOnly(!UserProvider.getCurrent().hasUserRight(UserRight.CASE_CHANGE_DISEASE), CaseDataDto.DISEASE);
    setReadOnly(!UserProvider.getCurrent().hasUserRight(UserRight.CASE_INVESTIGATE),
            CaseDataDto.INVESTIGATION_STATUS, CaseDataDto.INVESTIGATED_DATE);
    setReadOnly(!UserProvider.getCurrent().hasUserRight(UserRight.CASE_CLASSIFY),
            CaseDataDto.CASE_CLASSIFICATION, CaseDataDto.OUTCOME, CaseDataDto.OUTCOME_DATE);

    // Set conditional visibilities - ALWAYS call isVisibleAllowed before
    // dynamically setting the visibility

    if (isVisibleAllowed(CaseDataDto.PREGNANT)) {
        setVisible(person.getSex() == Sex.FEMALE, CaseDataDto.PREGNANT);
    }
    if (isVisibleAllowed(CaseDataDto.VACCINATION_DOSES)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_DOSES, CaseDataDto.VACCINATION,
                Arrays.asList(Vaccination.VACCINATED), true);
    }
    if (isVisibleAllowed(CaseDataDto.VACCINATION_INFO_SOURCE)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_INFO_SOURCE,
                CaseDataDto.VACCINATION, Arrays.asList(Vaccination.VACCINATED), true);
    }
    if (isVisibleAllowed(CaseDataDto.DISEASE_DETAILS)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.DISEASE_DETAILS),
                CaseDataDto.DISEASE, Arrays.asList(Disease.OTHER), true);
        FieldHelper.setRequiredWhen(getFieldGroup(), CaseDataDto.DISEASE,
                Arrays.asList(CaseDataDto.DISEASE_DETAILS), Arrays.asList(Disease.OTHER));
    }
    if (isVisibleAllowed(CaseDataDto.PLAGUE_TYPE)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), Arrays.asList(CaseDataDto.PLAGUE_TYPE), CaseDataDto.DISEASE,
                Arrays.asList(Disease.PLAGUE), true);
    }
    if (isVisibleAllowed(CaseDataDto.SMALLPOX_VACCINATION_SCAR)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.SMALLPOX_VACCINATION_SCAR,
                CaseDataDto.SMALLPOX_VACCINATION_RECEIVED, Arrays.asList(YesNoUnknown.YES), true);
    }
    if (isVisibleAllowed(CaseDataDto.VACCINATION_DATE)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_DATE,
                CaseDataDto.SMALLPOX_VACCINATION_RECEIVED, Arrays.asList(YesNoUnknown.YES), true);
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.VACCINATION_DATE, CaseDataDto.VACCINATION,
                Arrays.asList(Vaccination.VACCINATED), true);
    }
    if (isVisibleAllowed(CaseDataDto.OUTCOME_DATE)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.OUTCOME_DATE, CaseDataDto.OUTCOME,
                Arrays.asList(CaseOutcome.DECEASED, CaseOutcome.RECOVERED, CaseOutcome.UNKNOWN), true);
    }
    if (isVisibleAllowed(CaseDataDto.SEQUELAE)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.SEQUELAE, CaseDataDto.OUTCOME,
                Arrays.asList(CaseOutcome.RECOVERED, CaseOutcome.UNKNOWN), true);
    }
    if (isVisibleAllowed(CaseDataDto.SEQUELAE_DETAILS)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.SEQUELAE_DETAILS, CaseDataDto.SEQUELAE,
                Arrays.asList(YesNoUnknown.YES), true);
    }
    if (isVisibleAllowed(CaseDataDto.NOTIFYING_CLINIC_DETAILS)) {
        FieldHelper.setVisibleWhen(getFieldGroup(), CaseDataDto.NOTIFYING_CLINIC_DETAILS,
                CaseDataDto.NOTIFYING_CLINIC, Arrays.asList(HospitalWardType.OTHER), true);
    }
    setVisible(UserProvider.getCurrent().hasUserRight(UserRight.CASE_MANAGEMENT_ACCESS),
            CaseDataDto.CLINICIAN_NAME, CaseDataDto.CLINICIAN_PHONE, CaseDataDto.CLINICIAN_EMAIL);

    // Other initializations

    if (disease == Disease.MONKEYPOX) {
        Image smallpoxVaccinationScarImg = new Image(null,
                new ThemeResource("img/smallpox-vaccination-scar.jpg"));
        CssStyles.style(smallpoxVaccinationScarImg, CssStyles.VSPACE_3);
        getContent().addComponent(smallpoxVaccinationScarImg, SMALLPOX_VACCINATION_SCAR_IMG);

        // Set up initial image visibility
        getContent().getComponent(SMALLPOX_VACCINATION_SCAR_IMG).setVisible(getFieldGroup()
                .getField(CaseDataDto.SMALLPOX_VACCINATION_RECEIVED).getValue() == YesNoUnknown.YES);

        // Set up image visibility listener
        getFieldGroup().getField(CaseDataDto.SMALLPOX_VACCINATION_RECEIVED).addValueChangeListener(e -> {
            getContent().getComponent(SMALLPOX_VACCINATION_SCAR_IMG)
                    .setVisible(e.getProperty().getValue() == YesNoUnknown.YES);
        });
    }

    List<String> medicalInformationFields = Arrays.asList(CaseDataDto.PREGNANT, CaseDataDto.VACCINATION,
            CaseDataDto.SMALLPOX_VACCINATION_RECEIVED);

    for (String medicalInformationField : medicalInformationFields) {
        if (getFieldGroup().getField(medicalInformationField).isVisible()) {
            Label medicalInformationCaptionLabel = new Label(
                    I18nProperties.getString(Strings.headingMedicalInformation));
            medicalInformationCaptionLabel.addStyleName(CssStyles.H3);
            getContent().addComponent(medicalInformationCaptionLabel, MEDICAL_INFORMATION_LOC);
            break;
        }
    }

    Label paperFormDatesLabel = new Label(I18nProperties.getString(Strings.headingPaperFormDates));
    paperFormDatesLabel.addStyleName(CssStyles.H3);
    getContent().addComponent(paperFormDatesLabel, PAPER_FORM_DATES_LOC);

    // Automatic case classification rules button - invisible for other diseases
    if (disease != Disease.OTHER) {
        Button classificationRulesButton = new Button(I18nProperties.getCaption(Captions.info),
                VaadinIcons.INFO_CIRCLE);
        CssStyles.style(classificationRulesButton, ValoTheme.BUTTON_PRIMARY, CssStyles.FORCE_CAPTION);
        classificationRulesButton.addClickListener(e -> {
            ControllerProvider.getCaseController().openClassificationRulesPopup(getValue());
        });
        getContent().addComponent(classificationRulesButton, CLASSIFICATION_RULES_LOC);
    }

    addValueChangeListener(e -> {
        diseaseField.addValueChangeListener(new DiseaseChangeListener(diseaseField, getValue().getDisease()));

        // Replace classification user if case has been automatically classified
        if (getValue().getClassificationDate() != null && getValue().getClassificationUser() == null) {
            getField(CaseDataDto.CLASSIFICATION_USER).setVisible(false);
            Label classifiedBySystemLabel = new Label(I18nProperties.getCaption(Captions.system));
            classifiedBySystemLabel.setCaption(
                    I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, CaseDataDto.CLASSIFIED_BY));
            getContent().addComponent(classifiedBySystemLabel, CLASSIFIED_BY_SYSTEM_LOC);
        }

        setEpidNumberError(epidField, assignNewEpidNumberButton, getValue().getEpidNumber());

        epidField.addValueChangeListener(f -> {
            setEpidNumberError(epidField, assignNewEpidNumberButton, (String) f.getProperty().getValue());
        });

        // Set health facility details visibility and caption
        if (getValue().getHealthFacility() != null) {
            boolean otherHealthFacility = getValue().getHealthFacility().getUuid()
                    .equals(FacilityDto.OTHER_FACILITY_UUID);
            boolean noneHealthFacility = getValue().getHealthFacility().getUuid()
                    .equals(FacilityDto.NONE_FACILITY_UUID);
            boolean detailsVisible = otherHealthFacility || noneHealthFacility;

            if (isVisibleAllowed(healthFacilityDetails)) {
                healthFacilityDetails.setVisible(detailsVisible);
            }

            if (otherHealthFacility) {
                healthFacilityDetails.setCaption(I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX,
                        CaseDataDto.HEALTH_FACILITY_DETAILS));
            }
            if (noneHealthFacility) {
                healthFacilityDetails.setCaption(
                        I18nProperties.getPrefixCaption(CaseDataDto.I18N_PREFIX, NONE_HEALTH_FACILITY_DETAILS));
            }
        } else {
            setVisible(false, CaseDataDto.CLINICIAN_NAME, CaseDataDto.CLINICIAN_PHONE,
                    CaseDataDto.CLINICIAN_EMAIL);
        }

        // Set health facility/point of entry visibility based on case origin
        if (getValue().getCaseOrigin() == CaseOrigin.POINT_OF_ENTRY) {
            setVisible(true, CaseDataDto.POINT_OF_ENTRY);
            setVisible(getValue().getPointOfEntry().isOtherPointOfEntry(), CaseDataDto.POINT_OF_ENTRY_DETAILS);

            if (getValue().getHealthFacility() == null) {
                setVisible(false, CaseDataDto.COMMUNITY, CaseDataDto.HEALTH_FACILITY,
                        CaseDataDto.HEALTH_FACILITY_DETAILS);
            }
        } else {
            setVisible(false, CaseDataDto.POINT_OF_ENTRY, CaseDataDto.POINT_OF_ENTRY_DETAILS);
        }

        // Hide case origin from port health users
        if (UserRole.isPortHealthUser(UserProvider.getCurrent().getUserRoles())) {
            setVisible(false, CaseDataDto.CASE_ORIGIN);
        }
    });
}

From source file:de.symeda.sormas.ui.importer.ImportProgressLayout.java

License:Open Source License

private void initializeInfoComponents() {
    progressCircle = new ProgressBar();
    progressCircle.setIndeterminate(true);
    CssStyles.style(progressCircle, "v-progressbar-indeterminate-large");

    errorIcon = new Image(null, new ThemeResource("img/error-icon.png"));
    errorIcon.setHeight(35, Unit.PIXELS);
    errorIcon.setWidth(35, Unit.PIXELS);
    successIcon = new Image(null, new ThemeResource("img/success-icon.png"));
    successIcon.setHeight(35, Unit.PIXELS);
    successIcon.setWidth(35, Unit.PIXELS);
    warningIcon = new Image(null, new ThemeResource("img/warning-icon.png"));
    warningIcon.setHeight(35, Unit.PIXELS);
    warningIcon.setWidth(35, Unit.PIXELS);
}

From source file:de.symeda.sormas.ui.login.LoginScreen.java

License:Open Source License

private CssLayout buildLoginInformation() {
    CssLayout loginInformation = new CssLayout();
    loginInformation.setStyleName("login-information");

    VerticalLayout innerLayout = new VerticalLayout();
    innerLayout.setSizeFull();//from w w  w. ja  va 2 s.co m

    Image img = new Image(null, new ThemeResource("img/sormas-logo-big.png"));
    img.setHeight(240, Unit.PIXELS);
    innerLayout.addComponent(img);
    innerLayout.setComponentAlignment(img, Alignment.TOP_CENTER);
    innerLayout.setExpandRatio(img, 0);

    Label loginInfoText = new Label("<h1>SORMAS</h1>"
            + "<h2 style='color:white'>Surveillance, Outbreak Response Management and Analysis System</h2>"
            + "<h3 style='color:white; text-transform:uppercase'>&#9679; Disease Prevention<br>&#9679; Disease Detection<br>&#9679; Outbreak Response</h3>",
            ContentMode.HTML);
    loginInfoText.setWidth(100, Unit.PERCENTAGE);
    innerLayout.addComponent(loginInfoText);
    innerLayout.setExpandRatio(loginInfoText, 1);

    Label loginInfoCopyright = new Label(" 2019 SORMAS. All Rights Reserved.");
    loginInfoCopyright.setWidth(100, Unit.PERCENTAGE);
    innerLayout.addComponent(loginInfoCopyright);
    innerLayout.setExpandRatio(loginInfoCopyright, 0);
    innerLayout.setComponentAlignment(loginInfoCopyright, Alignment.BOTTOM_LEFT);

    loginInformation.addComponent(innerLayout);
    return loginInformation;
}

From source file:de.symeda.sormas.ui.Menu.java

License:Open Source License

public Menu(Navigator navigator) {
    this.navigator = navigator;
    setPrimaryStyleName(ValoTheme.MENU_ROOT);
    menuPart = new CssLayout();
    menuPart.addStyleName(ValoTheme.MENU_PART);

    // header of the menu
    final HorizontalLayout top = new HorizontalLayout();
    top.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    top.addStyleName(ValoTheme.MENU_TITLE);
    top.setSpacing(true);//from   w  ww.j a  v a2s  . c om
    Label title = new Label("SORMAS");
    title.setSizeUndefined();
    Image image = new Image(null, new ThemeResource("img/sormas-logo.png"));
    CssStyles.style(image, ValoTheme.MENU_LOGO, ValoTheme.BUTTON_LINK);
    image.addClickListener(new MouseEvents.ClickListener() {
        @Override
        public void click(MouseEvents.ClickEvent event) {
            SormasUI.get().getNavigator().navigateTo(SurveillanceDashboardView.VIEW_NAME);
        }
    });
    top.addComponent(image);
    top.addComponent(title);
    menuPart.addComponent(top);

    // logout menu item
    MenuBar logoutMenu = new MenuBar();
    logoutMenu.addItem(I18nProperties.getCaption(Captions.actionLogout) + " ("
            + UserProvider.getCurrent().getUserName() + ")", VaadinIcons.SIGN_OUT, new Command() {
                @Override
                public void menuSelected(MenuItem selectedItem) {
                    LoginHelper.logout();
                }
            });

    logoutMenu.addStyleName("user-menu");
    menuPart.addComponent(logoutMenu);

    // button for toggling the visibility of the menu when on a small screen
    final Button showMenu = new Button(I18nProperties.getCaption(Captions.menu), new Button.ClickListener() {
        @Override
        public void buttonClick(final Button.ClickEvent event) {
            if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) {
                menuPart.removeStyleName(VALO_MENU_VISIBLE);
            } else {
                menuPart.addStyleName(VALO_MENU_VISIBLE);
            }
        }
    });
    showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY);
    showMenu.addStyleName(VALO_MENU_TOGGLE);
    showMenu.setIcon(VaadinIcons.MENU);
    menuPart.addComponent(showMenu);

    // container for the navigation buttons, which are added by addView()
    menuItemsLayout = new CssLayout();
    menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS);
    menuPart.addComponent(menuItemsLayout);

    addComponent(menuPart);
}

From source file:de.symeda.sormas.ui.symptoms.SymptomsForm.java

License:Open Source License

private void setUpMonkeypoxVisibilities() {
    // Monkeypox picture resemblance fields
    FieldHelper.setVisibleWhen(getFieldGroup(), monkeypoxImageFieldIds, SymptomsDto.LESIONS,
            Arrays.asList(SymptomState.YES), true);

    // Set up images
    Image lesionsImg1 = new Image(null, new ThemeResource("img/monkeypox-lesions-1.png"));
    CssStyles.style(lesionsImg1, CssStyles.VSPACE_3);
    Image lesionsImg2 = new Image(null, new ThemeResource("img/monkeypox-lesions-2.png"));
    CssStyles.style(lesionsImg2, CssStyles.VSPACE_3);
    Image lesionsImg3 = new Image(null, new ThemeResource("img/monkeypox-lesions-3.png"));
    CssStyles.style(lesionsImg3, CssStyles.VSPACE_3);
    Image lesionsImg4 = new Image(null, new ThemeResource("img/monkeypox-lesions-4.png"));
    CssStyles.style(lesionsImg4, CssStyles.VSPACE_3);
    getContent().addComponent(lesionsImg1, MONKEYPOX_LESIONS_IMG1);
    getContent().addComponent(lesionsImg2, MONKEYPOX_LESIONS_IMG2);
    getContent().addComponent(lesionsImg3, MONKEYPOX_LESIONS_IMG3);
    getContent().addComponent(lesionsImg4, MONKEYPOX_LESIONS_IMG4);

    List<String> monkeypoxImages = Arrays.asList(MONKEYPOX_LESIONS_IMG1, MONKEYPOX_LESIONS_IMG2,
            MONKEYPOX_LESIONS_IMG3, MONKEYPOX_LESIONS_IMG4);

    // Set up initial visibility
    boolean lesionsSetToYes = getFieldGroup().getField(SymptomsDto.LESIONS).getValue() == SymptomState.YES;
    for (String monkeypoxImage : monkeypoxImages) {
        getContent().getComponent(monkeypoxImage).setVisible(lesionsSetToYes);
    }//w  w  w.j  a  v a 2  s .  c o m

    // Set up image visibility listener
    getFieldGroup().getField(SymptomsDto.LESIONS).addValueChangeListener(e -> {
        for (String monkeypoxImage : monkeypoxImages) {
            getContent().getComponent(monkeypoxImage)
                    .setVisible(e.getProperty().getValue() == SymptomState.YES);
        }
    });
}

From source file:de.uni_tuebingen.qbic.qbicmainportlet.DataHandler.java

License:Open Source License

public ThemeResource setExperimentStatusColor(String status) {
    ThemeResource resource = null;//from  w  w  w  .j ava 2 s  .  c o m
    if (status.equals("FINISHED")) {
        resource = new ThemeResource("green_light.png");
    } else if (status.equals("DELAYED")) {
        resource = new ThemeResource("yellow_light.png");
    } else if (status.equals("STARTED")) {
        resource = new ThemeResource("grey_light.png");
    } else if (status.equals("FAILED")) {
        resource = new ThemeResource("red_light.png");
    } else {
        resource = new ThemeResource("red_light.png");
    }

    // image.setWidth("15px");
    // image.setHeight("15px");\
    return resource;
}