protected void initTimeZoneFields() { Map<String, String> options = new TreeMap<>(); for (String id : TimeZone.getAvailableIDs()) { TimeZone timeZone = TimeZone.getTimeZone(id); options.put(timeZones.getDisplayNameLong(timeZone), id); } timeZoneLookup.setOptionsMap(options); timeZoneAutoField.setCaption(messages.getMainMessage("timeZone.auto")); timeZoneAutoField.setDescription(messages.getMainMessage("timeZone.auto.descr")); timeZoneAutoField.addValueChangeListener(e -> timeZoneLookup.setEnabled(!Boolean.TRUE.equals(e.getValue()))); UserTimeZone userTimeZone = userManagementService.loadOwnTimeZone(); timeZoneLookup.setValue(userTimeZone.name); timeZoneAutoField.setValue(userTimeZone.auto); }
protected void createFtsSwitch() { ftsSwitch = uiComponents.create(CheckBox.class); ftsSwitch.setCaption(getMainMessage("filter.ftsSwitch")); ftsSwitch.setValue(filterMode == FilterMode.FTS_MODE); ftsSwitch.addValueChangeListener(e -> { filterMode = Boolean.TRUE.equals(e.getValue()) ? FilterMode.FTS_MODE : FilterMode.GENERIC_MODE; switchFilterMode(filterMode); }); ftsSwitch.setVisible(modeSwitchVisible); }
protected void addAttribute(Set<LoggedAttribute> enabledAttributes, String name, boolean editable) { CheckBox checkBox = factory.createComponent(CheckBox.class); if (enabledAttributes != null && isEntityHaveAttribute(name, enabledAttributes)) { checkBox.setValue(true); } checkBox.setId(name); checkBox.setCaption(name); checkBox.setEditable(editable); checkBox.addValueChangeListener(e -> checkAllCheckboxes()); attributesBoxScroll.add(checkBox); }
protected void createTimeZoneField() { FieldGroup.FieldConfig timeZoneFc = fieldGroupRight.getFieldNN("timeZone"); HBoxLayout hbox = uiComponents.create(HBoxLayout.class); hbox.setSpacing(true); timeZoneLookup = uiComponents.create(LookupField.TYPE_STRING); timeZoneLookup.setDatasource(timeZoneFc.getTargetDatasource(), timeZoneFc.getProperty()); timeZoneLookup.setRequired(false); MetaClass userMetaClass = userDs.getMetaClass(); timeZoneLookup.setEditable(fieldGroupRight.isEditable() && security.isEntityAttrUpdatePermitted(userMetaClass, timeZoneFc.getProperty())); Map<String, String> options = new TreeMap<>(); for (String id : TimeZone.getAvailableIDs()) { TimeZone timeZone = TimeZone.getTimeZone(id); options.put(timeZones.getDisplayNameLong(timeZone), id); } timeZoneLookup.setOptionsMap(options); hbox.add(timeZoneLookup); CheckBox autoDetectField = uiComponents.create(CheckBox.class); autoDetectField.setDatasource(timeZoneFc.getTargetDatasource(), "timeZoneAuto"); autoDetectField.setCaption(messages.getMainMessage("timeZone.auto")); autoDetectField.setDescription(messages.getMainMessage("timeZone.auto.descr")); autoDetectField.setAlignment(Alignment.MIDDLE_RIGHT); autoDetectField.setEditable(fieldGroupRight.isEditable() && security.isEntityAttrUpdatePermitted(userMetaClass, "timeZoneAuto")); hbox.add(autoDetectField); hbox.expand(timeZoneLookup); timeZoneFc.setComponent(hbox); }