List of usage examples for com.vaadin.ui HorizontalLayout setDefaultComponentAlignment
@Override public void setDefaultComponentAlignment(Alignment defaultAlignment)
From source file:com.save.client.ClientInformationForm.java
FormLayout clientInformationForm() { form.setMargin(false);/*ww w .j a va 2 s . c o m*/ form.setWidth("100%"); form.addStyleName("light"); form.setReadOnly(readOnly); form.setImmediate(true); editClientBtn = new Button(EDIT_BUTTON_CAPTION, editBtnListener); editClientBtn.setEnabled(false); cancelBtn = new Button(CANCEL_BUTTON_CAPTION, cancelBtnListener); cancelBtn.setEnabled(false); newClientBtn = new Button(NEW_BUTTON_CAPTION, newBtnListener); client = new TextField("Name: "); client.setWidth("50%"); client.setRequired(true); client.setRequiredError("Required Name!"); form.addComponent(client); province.setInputPrompt("Select Province.."); province.setRequired(true); province.setRequiredError("Required Province!"); city.setInputPrompt("Select City.."); city.setRequired(true); city.setRequiredError("Required City/Town!"); province.addValueChangeListener(new ProvincePropertyChangeListener(city)); province.setWidth("100%"); form.addComponent(province); city.setWidth("100%"); form.addComponent(city); address = new TextField("Street/Brgy: "); address.setWidth("50%"); address.setRequired(true); address.setRequiredError("Required Street/Brgy!"); form.addComponent(address); landline = new TextField("Landline No: "); landline.setWidth("50%"); landline.setRequired(true); landline.setRequiredError("Required Contact No!"); form.addComponent(landline); mobile = new TextField("Mobile No: "); mobile.setWidth("50%"); mobile.setRequired(true); mobile.setRequiredError("Required Contact No!"); form.addComponent(mobile); setAsDistributor = new OptionGroup("Distributor"); setAsDistributor.addItems("Yes", "No"); setAsDistributor.addStyleName("horizontal"); setAsDistributor.setRequired(readOnly); setAsDistributor.setRequiredError("Set option(Y/N) As Distrbutor!"); setAsDistributor.addValueChangeListener(distributorCheckboxListener); form.addComponent(setAsDistributor); clientType.setWidth("90%"); clientType.setRequired(true); clientType.setRequiredError("Required Client Type!"); clientType.setVisible(false); form.addComponent(clientType); if (getClientId() != 0) { editClientBtn.setEnabled(true); Client c = clientService.getClientDataById(getClientId()); client.setValue(c.getClientName().toUpperCase()); province.setValue(c.getProvince().getProvinceId()); city.setValue(c.getCityId()); address.setValue(c.getStreet()); landline.setValue(c.getLandline()); mobile.setValue(c.getMobile()); if (c.getAsDistributor() == 0) { setAsDistributor.setValue("No"); clientType.setVisible(true); clientType.setValue(c.getClientType()); } else { setAsDistributor.setValue("Yes"); clientType.setVisible(false); clientType.setValue("distributor"); } } form.setReadOnly(true); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, true, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(editClientBtn); footer.addComponent(cancelBtn); footer.addComponent(newClientBtn); removeBtn = new Button("Remove Account"); removeBtn.addClickListener(removeBtnListener); form.addComponent(removeBtn); disableFields(false); return form; }
From source file:com.save.employee.PersonalInformationForm.java
public PersonalInformationForm(HorizontalSplitPanel hsplit, int employeeId, Grid grid, Object itemId) { this.hsplit = hsplit; this.employeeId = employeeId; this.grid = grid; this.itemId = itemId; setMargin(new MarginInfo(true, true, false, false)); setWidth("80%"); addStyleName("light"); editBtn = new Button(BUTTON_CAPTION, editBtnListener); editBtn.setEnabled(false);/*from www . jav a2 s .c om*/ cancelBtn = new Button("CANCEL"); cancelBtn.setEnabled(false); newEntryBtn = new Button("NEW ACCOUNT"); employeeNoField = new TextField("Employee ID: "); employeeNoField.setWidth("50%"); employeeNoField.setRequired(true); employeeNoField.setRequiredError("Required Employee ID!"); addComponent(employeeNoField); firstname = new TextField("Firstname: "); firstname.setWidth("50%"); firstname.setRequired(true); firstname.setRequiredError("Required Firstname!"); addComponent(firstname); middlename = new TextField("Middlename: "); middlename.setWidth("50%"); middlename.setRequired(true); middlename.setRequiredError("Required Middlename!"); addComponent(middlename); lastname = new TextField("Lastname: "); lastname.setWidth("50%"); lastname.setRequired(true); lastname.setRequiredError("Required Lastname!"); addComponent(lastname); gender = new OptionGroup("Gender: "); gender.addItem("Female"); gender.addItem("Male"); gender.addStyleName("horizontal"); addComponent(gender); status = new ComboBox("Status: "); status.setNullSelectionAllowed(false); status.addItem("Single"); status.addItem("Married"); status.addItem("Widow"); status.addItem("Separated"); addComponent(status); birthday = new DateField("Birthday"); birthday.setValue(new Date()); addComponent(birthday); if (getEmployeeId() != 0) { Employee e = es.getEmployeesPersonalDataById(getEmployeeId()); employeeNoField.setValue(e.getEmployeeNo()); firstname.setValue(e.getFirstname()); middlename.setValue(e.getMiddlename()); lastname.setValue(e.getLastname()); gender.setValue(CommonUtilities.capitalizeFirstLetter(e.getGender())); status.setValue(e.getPersonalStatus()); birthday.setValue((e.getDob() == null) ? new Date() : e.getDob()); editBtn.setEnabled(true); cancelBtn.setEnabled(true); } setReadOnly(true); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); addComponent(footer); footer.addComponent(editBtn); footer.addComponent(cancelBtn); footer.addComponent(newEntryBtn); removeBtn = new Button("REMOVE ACCOUNT"); removeBtn.addClickListener(removeBtnListener); addComponent(removeBtn); cancelBtn.addClickListener((Button.ClickEvent event) -> { setReadOnly(false); addStyleName("light"); editBtn.setCaption(BUTTON_CAPTION); editBtn.removeStyleName("primary"); setReadOnly(true); disableFields(false); newEntryBtn.setEnabled(true); }); newEntryBtn.addClickListener((Button.ClickEvent event) -> { setReadOnly(true); addStyleName("light"); editBtn.setCaption(BUTTON_CAPTION); editBtn.removeStyleName("primary"); Window sub = new CreateNewAccountWindow(getHsplit()); UI.getCurrent().addWindow(sub); }); disableFields(false); }
From source file:com.selzlein.lojavirtual.vaadin.core.NavigationMenu.java
License:Open Source License
private void buildTopMenu() { final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); final Label title = new Label("<h3>LSPS <strong>ProcessApplication</strong></h3>", ContentMode.HTML); title.setSizeUndefined();/*from w w w . j ava2 s . c o m*/ top.addComponent(title); top.setExpandRatio(title, 1); this.addComponent(top); final NavigationMenu menuWrapp = this; final Button showMenu = new Button("Menu", new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (menuWrapp.getStyleName().contains("valo-menu-visible")) { menuWrapp.removeStyleName("valo-menu-visible"); } else { menuWrapp.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); this.addComponent(showMenu); }
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 w w w .j av a 2 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.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 w w .j a v a 2s . co m 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
@Override protected void addFields() { if (disease == null || symptomsContext == null) { // workaround to stop initialization until disease is set return;//from w w w.j a v a2 s . com } // Add fields DateField onsetDateField = addField(SymptomsDto.ONSET_DATE, DateField.class); ComboBox onsetSymptom = addField(SymptomsDto.ONSET_SYMPTOM, ComboBox.class); if (symptomsContext == SymptomsContext.CASE) { onsetDateField.addValidator(new DateComparisonValidator(onsetDateField, caze.getHospitalization().getAdmissionDate(), true, false, I18nProperties.getValidationError(Validations.beforeDateSoft, onsetDateField.getCaption(), I18nProperties.getPrefixCaption(HospitalizationDto.I18N_PREFIX, HospitalizationDto.ADMISSION_DATE)))); onsetDateField.setInvalidCommitted(true); } ComboBox temperature = addField(SymptomsDto.TEMPERATURE, ComboBox.class); for (Float temperatureValue : SymptomsHelper.getTemperatureValues()) { temperature.addItem(temperatureValue); temperature.setItemCaption(temperatureValue, SymptomsHelper.getTemperatureString(temperatureValue)); } if (symptomsContext == SymptomsContext.CASE) { temperature.setCaption(I18nProperties.getCaption(Captions.symptomsMaxTemperature)); } addField(SymptomsDto.TEMPERATURE_SOURCE); ComboBox bloodPressureSystolic = addField(SymptomsDto.BLOOD_PRESSURE_SYSTOLIC, ComboBox.class); bloodPressureSystolic.addItems(SymptomsHelper.getBloodPressureValues()); ComboBox bloodPressureDiastolic = addField(SymptomsDto.BLOOD_PRESSURE_DIASTOLIC, ComboBox.class); bloodPressureDiastolic.addItems(SymptomsHelper.getBloodPressureValues()); ComboBox heartRate = addField(SymptomsDto.HEART_RATE, ComboBox.class); heartRate.addItems(SymptomsHelper.getHeartRateValues()); ComboBox respiratoryRate = addField(SymptomsDto.RESPIRATORY_RATE, ComboBox.class); respiratoryRate.addItems(SymptomsHelper.getRespiratoryRateValues()); ComboBox weight = addField(SymptomsDto.WEIGHT, ComboBox.class); for (Integer weightValue : SymptomsHelper.getWeightValues()) { weight.addItem(weightValue); weight.setItemCaption(weightValue, SymptomsHelper.getDecimalString(weightValue)); } ComboBox height = addField(SymptomsDto.HEIGHT, ComboBox.class); height.addItems(SymptomsHelper.getHeightValues()); ComboBox midUpperArmCircumference = addField(SymptomsDto.MID_UPPER_ARM_CIRCUMFERENCE, ComboBox.class); for (Integer circumferenceValue : SymptomsHelper.getMidUpperArmCircumferenceValues()) { midUpperArmCircumference.addItem(circumferenceValue); midUpperArmCircumference.setItemCaption(circumferenceValue, SymptomsHelper.getDecimalString(circumferenceValue)); } ComboBox glasgowComaScale = addField(SymptomsDto.GLASGOW_COMA_SCALE, ComboBox.class); glasgowComaScale.addItems(SymptomsHelper.getGlasgowComaScaleValues()); addFields(SymptomsDto.FEVER, SymptomsDto.VOMITING, SymptomsDto.DIARRHEA, SymptomsDto.BLOOD_IN_STOOL, SymptomsDto.NAUSEA, SymptomsDto.ABDOMINAL_PAIN, SymptomsDto.HEADACHE, SymptomsDto.MUSCLE_PAIN, SymptomsDto.FATIGUE_WEAKNESS, SymptomsDto.SKIN_RASH, SymptomsDto.NECK_STIFFNESS, SymptomsDto.SORE_THROAT, SymptomsDto.COUGH, SymptomsDto.RUNNY_NOSE, SymptomsDto.DIFFICULTY_BREATHING, SymptomsDto.CHEST_PAIN, SymptomsDto.CONJUNCTIVITIS, SymptomsDto.EYE_PAIN_LIGHT_SENSITIVE, SymptomsDto.KOPLIKS_SPOTS, SymptomsDto.THROBOCYTOPENIA, SymptomsDto.OTITIS_MEDIA, SymptomsDto.HEARINGLOSS, SymptomsDto.DEHYDRATION, SymptomsDto.ANOREXIA_APPETITE_LOSS, SymptomsDto.REFUSAL_FEEDOR_DRINK, SymptomsDto.JOINT_PAIN, SymptomsDto.HICCUPS, SymptomsDto.BACKACHE, SymptomsDto.EYES_BLEEDING, SymptomsDto.JAUNDICE, SymptomsDto.DARK_URINE, SymptomsDto.STOMACH_BLEEDING, SymptomsDto.RAPID_BREATHING, SymptomsDto.SWOLLEN_GLANDS, SymptomsDto.SYMPTOMS_COMMENTS, SymptomsDto.UNEXPLAINED_BLEEDING, SymptomsDto.GUMS_BLEEDING, SymptomsDto.INJECTION_SITE_BLEEDING, SymptomsDto.NOSE_BLEEDING, SymptomsDto.BLOODY_BLACK_STOOL, SymptomsDto.RED_BLOOD_VOMIT, SymptomsDto.DIGESTED_BLOOD_VOMIT, SymptomsDto.COUGHING_BLOOD, SymptomsDto.BLEEDING_VAGINA, SymptomsDto.SKIN_BRUISING, SymptomsDto.BLOOD_URINE, SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS, SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS_TEXT, SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS, SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT, SymptomsDto.LESIONS, SymptomsDto.LESIONS_THAT_ITCH, SymptomsDto.LESIONS_SAME_STATE, SymptomsDto.LESIONS_SAME_SIZE, SymptomsDto.LESIONS_DEEP_PROFOUND, SymptomsDto.LESIONS_FACE, SymptomsDto.LESIONS_LEGS, SymptomsDto.LESIONS_SOLES_FEET, SymptomsDto.LESIONS_PALMS_HANDS, SymptomsDto.LESIONS_THORAX, SymptomsDto.LESIONS_ARMS, SymptomsDto.LESIONS_GENITALS, SymptomsDto.LESIONS_ALL_OVER_BODY, SymptomsDto.LYMPHADENOPATHY_AXILLARY, SymptomsDto.LYMPHADENOPATHY_CERVICAL, SymptomsDto.LYMPHADENOPATHY_INGUINAL, SymptomsDto.CHILLS_SWEATS, SymptomsDto.BEDRIDDEN, SymptomsDto.ORAL_ULCERS, SymptomsDto.PAINFUL_LYMPHADENITIS, SymptomsDto.BLACKENING_DEATH_OF_TISSUE, SymptomsDto.BUBOES_GROIN_ARMPIT_NECK, SymptomsDto.BULGING_FONTANELLE, SymptomsDto.PHARYNGEAL_ERYTHEMA, SymptomsDto.PHARYNGEAL_EXUDATE, SymptomsDto.OEDEMA_FACE_NECK, SymptomsDto.OEDEMA_LOWER_EXTREMITY, SymptomsDto.LOSS_SKIN_TURGOR, SymptomsDto.PALPABLE_LIVER, SymptomsDto.PALPABLE_SPLEEN, SymptomsDto.MALAISE, SymptomsDto.SUNKEN_EYES_FONTANELLE, SymptomsDto.SIDE_PAIN, SymptomsDto.FLUID_IN_LUNG_CAVITY, SymptomsDto.TREMOR, SymptomsDto.BILATERAL_CATARACTS, SymptomsDto.UNILATERAL_CATARACTS, SymptomsDto.CONGENITAL_GLAUCOMA, SymptomsDto.CONGENITAL_HEART_DISEASE, SymptomsDto.PIGMENTARY_RETINOPATHY, SymptomsDto.RADIOLUCENT_BONE_DISEASE, SymptomsDto.SPLENOMEGALY, SymptomsDto.MICROCEPHALY, SymptomsDto.MENINGOENCEPHALITIS, SymptomsDto.PURPURIC_RASH, SymptomsDto.DEVELOPMENTAL_DELAY, SymptomsDto.CONGENITAL_HEART_DISEASE_TYPE, SymptomsDto.CONGENITAL_HEART_DISEASE_DETAILS, SymptomsDto.JAUNDICE_WITHIN_24_HOURS_OF_BIRTH, SymptomsDto.PATIENT_ILL_LOCATION); addField(SymptomsDto.LESIONS_ONSET_DATE, DateField.class); // complications addFields(SymptomsDto.ALTERED_CONSCIOUSNESS, SymptomsDto.CONFUSED_DISORIENTED, SymptomsDto.HEMORRHAGIC_SYNDROME, SymptomsDto.HYPERGLYCEMIA, SymptomsDto.HYPOGLYCEMIA, SymptomsDto.MENINGEAL_SIGNS, SymptomsDto.SEIZURES, SymptomsDto.SEPSIS, SymptomsDto.SHOCK); monkeypoxImageFieldIds = Arrays.asList(SymptomsDto.LESIONS_RESEMBLE_IMG1, SymptomsDto.LESIONS_RESEMBLE_IMG2, SymptomsDto.LESIONS_RESEMBLE_IMG3, SymptomsDto.LESIONS_RESEMBLE_IMG4); for (String propertyId : monkeypoxImageFieldIds) { @SuppressWarnings("rawtypes") Field monkeypoxImageField = addField(propertyId); CssStyles.style(monkeypoxImageField, CssStyles.VSPACE_NONE); } // Set initial visibilities initializeVisibilitiesAndAllowedVisibilities(disease, viewMode); if (symptomsContext != SymptomsContext.CLINICAL_VISIT) { setVisible(false, SymptomsDto.BLOOD_PRESSURE_SYSTOLIC, SymptomsDto.BLOOD_PRESSURE_DIASTOLIC, SymptomsDto.HEART_RATE, SymptomsDto.RESPIRATORY_RATE, SymptomsDto.WEIGHT, SymptomsDto.HEIGHT, SymptomsDto.MID_UPPER_ARM_CIRCUMFERENCE, SymptomsDto.GLASGOW_COMA_SCALE); } else { setVisible(false, SymptomsDto.ONSET_SYMPTOM, SymptomsDto.ONSET_DATE); } // Initialize lists conditionalBleedingSymptomFieldIds = Arrays.asList(SymptomsDto.GUMS_BLEEDING, SymptomsDto.INJECTION_SITE_BLEEDING, SymptomsDto.NOSE_BLEEDING, SymptomsDto.BLOODY_BLACK_STOOL, SymptomsDto.RED_BLOOD_VOMIT, SymptomsDto.DIGESTED_BLOOD_VOMIT, SymptomsDto.EYES_BLEEDING, SymptomsDto.COUGHING_BLOOD, SymptomsDto.BLEEDING_VAGINA, SymptomsDto.SKIN_BRUISING, SymptomsDto.STOMACH_BLEEDING, SymptomsDto.BLOOD_URINE, SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS); lesionsFieldIds = Arrays.asList(SymptomsDto.LESIONS_SAME_STATE, SymptomsDto.LESIONS_SAME_SIZE, SymptomsDto.LESIONS_DEEP_PROFOUND, SymptomsDto.LESIONS_THAT_ITCH); lesionsLocationFieldIds = Arrays.asList(SymptomsDto.LESIONS_FACE, SymptomsDto.LESIONS_LEGS, SymptomsDto.LESIONS_SOLES_FEET, SymptomsDto.LESIONS_PALMS_HANDS, SymptomsDto.LESIONS_THORAX, SymptomsDto.LESIONS_ARMS, SymptomsDto.LESIONS_GENITALS, SymptomsDto.LESIONS_ALL_OVER_BODY); unconditionalSymptomFieldIds = Arrays.asList(SymptomsDto.FEVER, SymptomsDto.VOMITING, SymptomsDto.DIARRHEA, SymptomsDto.BLOOD_IN_STOOL, SymptomsDto.NAUSEA, SymptomsDto.ABDOMINAL_PAIN, SymptomsDto.HEADACHE, SymptomsDto.MUSCLE_PAIN, SymptomsDto.FATIGUE_WEAKNESS, SymptomsDto.SKIN_RASH, SymptomsDto.NECK_STIFFNESS, SymptomsDto.SORE_THROAT, SymptomsDto.COUGH, SymptomsDto.RUNNY_NOSE, SymptomsDto.DIFFICULTY_BREATHING, SymptomsDto.CHEST_PAIN, SymptomsDto.CONJUNCTIVITIS, SymptomsDto.EYE_PAIN_LIGHT_SENSITIVE, SymptomsDto.KOPLIKS_SPOTS, SymptomsDto.THROBOCYTOPENIA, SymptomsDto.OTITIS_MEDIA, SymptomsDto.HEARINGLOSS, SymptomsDto.DEHYDRATION, SymptomsDto.ANOREXIA_APPETITE_LOSS, SymptomsDto.REFUSAL_FEEDOR_DRINK, SymptomsDto.JOINT_PAIN, SymptomsDto.HICCUPS, SymptomsDto.BACKACHE, SymptomsDto.JAUNDICE, SymptomsDto.DARK_URINE, SymptomsDto.RAPID_BREATHING, SymptomsDto.SWOLLEN_GLANDS, SymptomsDto.UNEXPLAINED_BLEEDING, SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS, SymptomsDto.LESIONS, SymptomsDto.LYMPHADENOPATHY_AXILLARY, SymptomsDto.LYMPHADENOPATHY_CERVICAL, SymptomsDto.LYMPHADENOPATHY_INGUINAL, SymptomsDto.CHILLS_SWEATS, SymptomsDto.BEDRIDDEN, SymptomsDto.ORAL_ULCERS, SymptomsDto.PAINFUL_LYMPHADENITIS, SymptomsDto.BLACKENING_DEATH_OF_TISSUE, SymptomsDto.BUBOES_GROIN_ARMPIT_NECK, SymptomsDto.BULGING_FONTANELLE, SymptomsDto.PHARYNGEAL_ERYTHEMA, SymptomsDto.PHARYNGEAL_EXUDATE, SymptomsDto.OEDEMA_FACE_NECK, SymptomsDto.OEDEMA_LOWER_EXTREMITY, SymptomsDto.LOSS_SKIN_TURGOR, SymptomsDto.PALPABLE_LIVER, SymptomsDto.PALPABLE_SPLEEN, SymptomsDto.MALAISE, SymptomsDto.SUNKEN_EYES_FONTANELLE, SymptomsDto.SIDE_PAIN, SymptomsDto.FLUID_IN_LUNG_CAVITY, SymptomsDto.TREMOR, SymptomsDto.BILATERAL_CATARACTS, SymptomsDto.UNILATERAL_CATARACTS, SymptomsDto.CONGENITAL_GLAUCOMA, SymptomsDto.CONGENITAL_HEART_DISEASE, SymptomsDto.RADIOLUCENT_BONE_DISEASE, SymptomsDto.SPLENOMEGALY, SymptomsDto.MICROCEPHALY, SymptomsDto.MENINGOENCEPHALITIS, SymptomsDto.DEVELOPMENTAL_DELAY, SymptomsDto.PURPURIC_RASH, SymptomsDto.PIGMENTARY_RETINOPATHY, // complications SymptomsDto.ALTERED_CONSCIOUSNESS, SymptomsDto.CONFUSED_DISORIENTED, SymptomsDto.HEMORRHAGIC_SYNDROME, SymptomsDto.HYPERGLYCEMIA, SymptomsDto.HYPOGLYCEMIA, SymptomsDto.MENINGEAL_SIGNS, SymptomsDto.SEIZURES, SymptomsDto.SEPSIS, SymptomsDto.SHOCK); // Set visibilities FieldHelper.setVisibleWhen(getFieldGroup(), conditionalBleedingSymptomFieldIds, SymptomsDto.UNEXPLAINED_BLEEDING, Arrays.asList(SymptomState.YES), true, SymptomsDto.class, disease); FieldHelper.setVisibleWhen(getFieldGroup(), SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS_TEXT, SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS, Arrays.asList(SymptomState.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT, SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS, Arrays.asList(SymptomState.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), lesionsFieldIds, SymptomsDto.LESIONS, Arrays.asList(SymptomState.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), lesionsLocationFieldIds, SymptomsDto.LESIONS, Arrays.asList(SymptomState.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), SymptomsDto.LESIONS_ONSET_DATE, SymptomsDto.LESIONS, Arrays.asList(SymptomState.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), SymptomsDto.CONGENITAL_HEART_DISEASE_TYPE, SymptomsDto.CONGENITAL_HEART_DISEASE, Arrays.asList(SymptomState.YES), true); FieldHelper.setVisibleWhen(getFieldGroup(), SymptomsDto.CONGENITAL_HEART_DISEASE_DETAILS, SymptomsDto.CONGENITAL_HEART_DISEASE_TYPE, Arrays.asList(CongenitalHeartDiseaseType.OTHER), true); if (isVisibleAllowed(getFieldGroup().getField(SymptomsDto.JAUNDICE_WITHIN_24_HOURS_OF_BIRTH))) { FieldHelper.setVisibleWhen(getFieldGroup(), SymptomsDto.JAUNDICE_WITHIN_24_HOURS_OF_BIRTH, SymptomsDto.JAUNDICE, Arrays.asList(SymptomState.YES), true); } FieldHelper.addSoftRequiredStyle(getField(SymptomsDto.LESIONS_ONSET_DATE)); boolean isInfant = person != null && person.getApproximateAge() != null && ((person.getApproximateAge() <= 12 && person.getApproximateAgeType() == ApproximateAgeType.MONTHS) || person.getApproximateAge() <= 1); if (!isInfant) { getFieldGroup().getField(SymptomsDto.BULGING_FONTANELLE).setVisible(false); } // Handle visibility of lesions locations caption Label lesionsLocationsCaption = new Label(I18nProperties.getCaption(Captions.symptomsLesionsLocations)); CssStyles.style(lesionsLocationsCaption, CssStyles.VSPACE_3); getContent().addComponent(lesionsLocationsCaption, LESIONS_LOCATIONS_LOC); getContent().getComponent(LESIONS_LOCATIONS_LOC) .setVisible(getFieldGroup().getField(SymptomsDto.LESIONS).getValue() == SymptomState.YES); getFieldGroup().getField(SymptomsDto.LESIONS).addValueChangeListener(e -> { getContent().getComponent(LESIONS_LOCATIONS_LOC) .setVisible(e.getProperty().getValue() == SymptomState.YES); }); // Symptoms hint text Label symptomsHint = new Label( I18nProperties.getString(symptomsContext == SymptomsContext.CASE ? Strings.messageSymptomsHint : Strings.messageSymptomsVisitHint), ContentMode.HTML); getContent().addComponent(symptomsHint, SYMPTOMS_HINT_LOC); if (disease == Disease.MONKEYPOX) { setUpMonkeypoxVisibilities(); } if (symptomsContext != SymptomsContext.CASE) { getFieldGroup().getField(SymptomsDto.PATIENT_ILL_LOCATION).setVisible(false); } FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS), Arrays.asList(SymptomsDto.OTHER_HEMORRHAGIC_SYMPTOMS_TEXT), Arrays.asList(SymptomState.YES), disease); FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS), Arrays.asList(SymptomsDto.OTHER_NON_HEMORRHAGIC_SYMPTOMS_TEXT), Arrays.asList(SymptomState.YES), disease); FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(SymptomsDto.LESIONS), lesionsFieldIds, Arrays.asList(SymptomState.YES), disease); FieldHelper.setRequiredWhen(getFieldGroup(), getFieldGroup().getField(SymptomsDto.LESIONS), monkeypoxImageFieldIds, Arrays.asList(SymptomState.YES), disease); addListenerForOnsetFields(onsetSymptom, onsetDateField); Button clearAllButton = new Button(I18nProperties.getCaption(Captions.actionClearAll)); clearAllButton.addStyleName(ValoTheme.BUTTON_LINK); clearAllButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { for (Object symptomId : unconditionalSymptomFieldIds) { getFieldGroup().getField(symptomId).setValue(null); } for (Object symptomId : conditionalBleedingSymptomFieldIds) { getFieldGroup().getField(symptomId).setValue(null); } for (Object symptomId : lesionsFieldIds) { getFieldGroup().getField(symptomId).setValue(null); } for (Object symptomId : lesionsLocationFieldIds) { getFieldGroup().getField(symptomId).setValue(null); } for (Object symptomId : monkeypoxImageFieldIds) { getFieldGroup().getField(symptomId).setValue(null); } } }); Button setEmptyToNoButton = new Button(I18nProperties.getCaption(Captions.symptomsSetClearedToNo)); setEmptyToNoButton.addStyleName(ValoTheme.BUTTON_LINK); setEmptyToNoButton.addClickListener(new ClickListener() { @SuppressWarnings("unchecked") @Override public void buttonClick(ClickEvent event) { for (Object symptomId : unconditionalSymptomFieldIds) { Field<SymptomState> symptom = (Field<SymptomState>) getFieldGroup().getField(symptomId); if (symptom.isVisible() && symptom.getValue() == null) { symptom.setValue(SymptomState.NO); } } for (Object symptomId : conditionalBleedingSymptomFieldIds) { Field<SymptomState> symptom = (Field<SymptomState>) getFieldGroup().getField(symptomId); if (symptom.isVisible() && symptom.getValue() == null) { symptom.setValue(SymptomState.NO); } } for (Object symptomId : lesionsFieldIds) { Field<SymptomState> symptom = (Field<SymptomState>) getFieldGroup().getField(symptomId); if (symptom.isVisible() && symptom.getValue() == null) { symptom.setValue(SymptomState.NO); } } for (Object symptomId : monkeypoxImageFieldIds) { Field<SymptomState> symptom = (Field<SymptomState>) getFieldGroup().getField(symptomId); if (symptom.isVisible() && symptom.getValue() == null) { symptom.setValue(SymptomState.NO); } } } }); // Complications heading - not displayed for Rubella (dirty, should be made generic) Label complicationsHeading = new Label(I18nProperties.getString(Strings.headingComplications)); CssStyles.style(complicationsHeading, CssStyles.H3); if (disease != Disease.CONGENITAL_RUBELLA) { getContent().addComponent(complicationsHeading, COMPLICATIONS_HEADING); } HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.addComponent(clearAllButton); buttonsLayout.addComponent(setEmptyToNoButton); buttonsLayout.setDefaultComponentAlignment(Alignment.MIDDLE_RIGHT); getContent().addComponent(buttonsLayout, BUTTONS_LOC); }
From source file:edu.vserver.exercises.videoMcq.QuestionForm.java
License:Apache License
/** * Builds UI components and the layout for them. *//*from w ww . j ava 2 s . c om*/ private void doLayout() { VerticalLayout questionUI = new VerticalLayout(); HorizontalLayout mainButtons = new HorizontalLayout(); //mainButtons.setMargin(true); mainButtons.setSpacing(true); this.newQuestionBtn.setWidth(100, Unit.PIXELS); this.cancelButton.setWidth(100, Unit.PIXELS); this.saveButton.setWidth(100, Unit.PIXELS); mainButtons.addComponents(this.newQuestionBtn, this.cancelButton, this.saveButton); questionUI.addComponent(mainButtons); this.initTextFields(); this.inputLayout.setSpacing(true); this.inputLayout.setDefaultComponentAlignment(Alignment.TOP_LEFT); VerticalLayout questionLayout = new VerticalLayout(); this.timeLayout.setMargin(new MarginInfo(true, false, true, false)); this.timeLayout.addComponents(new Label("<strong>Time:</strong>", ContentMode.HTML), this.timeLabel, new Label("<strong> / </strong>", ContentMode.HTML), this.durationLabel); this.timeLayout.setSpacing(true); questionLayout.addComponents(this.timeLayout, this.questionField); VerticalLayout correctAnswers = new VerticalLayout(); correctAnswers.addComponents(this.answerField, this.answerDescriptionField); VerticalLayout wrongAnswers = new VerticalLayout(); wrongAnswers.setCaption("Incorrect answer choices"); HorizontalLayout wrongAnswerButtons = new HorizontalLayout(); wrongAnswerButtons.setDefaultComponentAlignment(Alignment.TOP_CENTER); wrongAnswerButtons.setSpacing(true); wrongAnswerButtons.setMargin(true); wrongAnswerButtons.addComponents(this.addIncorrectAnswer, this.clearIncorrectAnswers); Panel wrongAswersScroller = new Panel(); wrongAswersScroller.setSizeUndefined(); wrongAswersScroller.setHeight(100, Unit.PIXELS); wrongAswersScroller.setWidth(215, Unit.PIXELS); wrongAswersScroller.addStyleName("borderless"); wrongAswersScroller.setContent(this.wrongAnswersLayout); wrongAnswers.addComponents(wrongAnswerButtons, wrongAswersScroller); this.inputLayout.addComponents(questionLayout, correctAnswers, wrongAnswers); questionUI.addComponent(this.inputLayout); this.setCompositionRoot(questionUI); }
From source file:edu.vserver.exercises.videoMcq.QuestionWindow.java
License:Apache License
/** * Constructs a question window object for showing the question with the * answer choices and submit- and next-button. *//*from w w w . j ava2 s . c o m*/ public QuestionWindow() { super(); setModal(true); setResizable(false); setClosable(false); addStyleName("questionWindow"); optionGroup.setImmediate(true); optionGroup.addStyleName("answerOptions"); HorizontalLayout dots = new HorizontalLayout(); VerticalLayout v = new VerticalLayout(); v.setSpacing(true); v.setMargin(true); HorizontalLayout btnFooter = new HorizontalLayout(); btnFooter.addStyleName("buttons"); btnFooter.setMargin(true); btnFooter.setSpacing(true); btnFooter.setWidth(100, Unit.PERCENTAGE); btnFooter.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); submitButton = ComponentFactory.createLargeBlueButton("Submit", true, null); submitButton.setEnabled(false); nextButton = ComponentFactory.createLargeBlueButton("Next", true, SPH_Theme.NEXT_ICON_16PX); btnFooter.addComponents(submitButton, nextButton); v.addComponents(qLabel, optionGroup, btnFooter, dots); this.setContent(v); this.createButtonListeners(); }
From source file:es.mdef.clientmanager.ui.GestionClientesUI.java
License:Apache License
private Component getMenuTitleComponent() { final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); final Label title = new Label("<h3><strong>Gestión de clientes</strong></h3>", ContentMode.HTML); title.setSizeUndefined();/* www .j a va 2s . c o m*/ top.addComponent(title); top.setExpandRatio(title, 1); return top; }
From source file:fr.amapj.view.engine.menu.MenuPart.java
License:Open Source License
private CssLayout buildMenu(CssLayout menu, CssLayout menuItemsLayout, List<MenuDescription> allMenus, Navigator navigator, AmapUI ui) { final HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName("valo-menu-title"); menu.addComponent(top);/*from ww w . j a v a 2 s. co m*/ final Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); String nomAmap = new ParametresService().getParametres().nomAmap; Label title = new Label("<h2>" + nomAmap + "</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); final MenuBar settings = new MenuBar(); settings.addStyleName("user-menu"); SessionParameters p = SessionManager.getSessionParameters(); MenuItem settingsItem = settings.addItem(p.userPrenom + " " + p.userNom, null, null); settingsItem.addItem("Se dconnecter", new MenuBar.Command() { @Override public void menuSelected(MenuItem selectedItem) { new PasswordManager().disconnect(); ui.buildLoginView(null, null, null); } }); menu.addComponent(settings); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); boolean first = true; String firstEntry = null; Button firstButton = null; for (MenuDescription menuDescription : allMenus) { final String view = menuDescription.getMenuName().name().toLowerCase(); final String titleView = menuDescription.getMenuName().getTitle(); if (menuDescription.getCategorie() != null) { Label l = new Label(menuDescription.getCategorie(), ContentMode.HTML); l.setPrimaryStyleName("valo-menu-subtitle"); l.addStyleName("h4"); l.setSizeUndefined(); menuItemsLayout.addComponent(l); } final Button b = new Button(titleView, new ClickListener() { @Override public void buttonClick(final ClickEvent event) { setSelected(event.getButton(), menuItemsLayout); navigator.navigateTo("/" + view); } }); b.setId("amapj.menu." + view); b.setHtmlContentAllowed(true); b.setPrimaryStyleName("valo-menu-item"); b.setIcon(menuDescription.getMenuName().getFont()); menuItemsLayout.addComponent(b); viewNameToMenuButton.put("/" + view, b); if (first) { first = false; firstButton = b; firstEntry = view; } } // Gestion de l'url String f = Page.getCurrent().getUriFragment(); if (f != null && f.startsWith("!")) { f = f.substring(1); } if (f == null || f.equals("") || f.equals("/")) { navigateWithProtect(navigator, "/" + firstEntry); setSelected(firstButton, menuItemsLayout); } else { navigateWithProtect(navigator, f); setSelected(viewNameToMenuButton.get(f), menuItemsLayout); } return menu; }