List of usage examples for com.vaadin.ui CheckBox setValue
@Override public void setValue(Boolean value)
From source file:org.hip.vif.admin.groupedit.ui.GroupListView.java
License:Open Source License
private CheckBox createCheck(final GroupWrapper inEntry) { final CheckBox out = new CheckBox(); out.setImmediate(true);//from w ww . j a v a 2 s. co m out.setValue(inEntry.isChecked()); if (inEntry.getIsDeletable()) { out.setEnabled(!confirmationMode); } else { out.setEnabled(false); } out.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { inEntry.setChecked(((CheckBox) inEvent.getProperty()).getValue()); } }); return out; }
From source file:org.hip.vif.admin.groupedit.ui.ParticipantListView.java
License:Open Source License
private CheckBox createCheck(final ParticipantBean inEntry, final VIFViewHelper.IConfirmationModeChecker inChecker) { final CheckBox out = new CheckBox(); out.setImmediate(true);/*from w w w . java2 s.c om*/ out.setValue(inEntry.isChecked()); if (inEntry.isAdmin()) { out.setEnabled(false); } else { out.setEnabled(!inChecker.inConfirmationMode()); } out.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { inEntry.setChecked(((CheckBox) inEvent.getProperty()).getValue()); } }); return out; }
From source file:org.hip.vif.forum.usersettings.ui.SubscriptionListView.java
License:Open Source License
/** Creates a check box for the list entries to switch the range of the subscription. * * @param inEntry {@link SubscriptionBean} * @param inTask {@link SubscriptionsManageTask} * @param inMessages {@link IMessages}//from w w w . j a v a2 s . com * @return {@link CheckBox} */ public CheckBox createCheck(final SubscriptionBean inEntry, final SubscriptionsManageTask inTask, final IMessages inMessages) { final CheckBox out = new CheckBox(); out.setImmediate(true); out.setValue(inEntry.getLocal()); out.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { // NOPMD final boolean isLocal = ((CheckBox) inEvent.getProperty()).getValue(); inEntry.setChecked(isLocal); try { inTask.changeRange(inEntry, isLocal); Notification.show(inMessages.getMessage("msg.question.subscription.updated"), //$NON-NLS-1$ Type.TRAY_NOTIFICATION); } catch (final VException | SQLException exc) { Notification.show(inMessages.getMessage("errmsg.subscription.change"), Type.WARNING_MESSAGE); //$NON-NLS-1$ } } }); return out; }
From source file:org.hip.vif.web.util.VIFViewHelper.java
License:Open Source License
/** Helper method to create check boxes for generated table columns. * * @param inEntry {@link ISelectableBean} * @param inChecker {@link IConfirmationModeChecker} an instance checking whether the view is in confirmation mode * or not, <code>null</code> if no such functionality is needed * @return {@link CheckBox} *//*from w ww. j a v a 2 s . com*/ @SuppressWarnings("serial") public static CheckBox createCheck(final ISelectableBean inEntry, final IConfirmationModeChecker inChecker) { final CheckBox out = new CheckBox(); out.setImmediate(true); out.setValue(inEntry.isChecked()); out.setEnabled(inChecker == null ? true : !inChecker.inConfirmationMode()); out.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent inEvent) { // NOPMD inEntry.setChecked(((CheckBox) inEvent.getProperty()).getValue()); } }); return out; }
From source file:org.iespuigcastellar.attendancemanager.screenlayouts.NoModalWindowTeacherMainLayout.java
License:Open Source License
/** Loads students data into table. */ public void loadTable(int idgroup) { table.removeAllItems();/*from w w w. j av a 2 s . co m*/ Collection<Student> collection = app.storage.studentsOfGroup(idgroup); for (Iterator<Student> it = collection.iterator(); it.hasNext();) { Student student = it.next(); CheckBox missCheckBox = new CheckBox(); missCheckBox.setData(student); if (app.storage.existsMiss(Miss.MISS, (Date) datePopupDateField.getValue(), ((Classblock) classblockComboBox.getValue()).getID(), student.getID())) { missCheckBox.setValue(true); } missCheckBox.setImmediate(true); missCheckBox.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Student student = (Student) event.getButton().getData(); Miss miss = new Miss(0, Miss.MISS, (Date) datePopupDateField.getValue(), "", student.getID(), app.user.getID(), ((Classblock) classblockComboBox.getValue()).getIDSubject(), ((Classblock) classblockComboBox.getValue()).getID()); if ((Boolean) event.getButton().getValue()) { app.storage.addMiss(miss); } else { // Delete Miss app.storage.deleteMiss(Miss.MISS, miss.getDate(), miss.getIDStudent(), miss.getIDClassblock()); } updateEnabledCheckBoxes(student); } }); CheckBox excusedmissCheckBox = new CheckBox(); excusedmissCheckBox.setData(student); if (app.storage.existsMiss(Miss.EXCUSED_MISS, (Date) datePopupDateField.getValue(), ((Classblock) classblockComboBox.getValue()).getID(), student.getID())) { excusedmissCheckBox.setValue(true); } excusedmissCheckBox.setImmediate(true); excusedmissCheckBox.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Student student = (Student) event.getButton().getData(); Miss miss = new Miss(0, Miss.EXCUSED_MISS, (Date) datePopupDateField.getValue(), "", student.getID(), app.user.getID(), ((Classblock) classblockComboBox.getValue()).getIDSubject(), ((Classblock) classblockComboBox.getValue()).getID()); if ((Boolean) event.getButton().getValue()) { // New Miss app.storage.addMiss(miss); } else { // Delete Miss app.storage.deleteMiss(Miss.EXCUSED_MISS, miss.getDate(), miss.getIDStudent(), miss.getIDClassblock()); } updateEnabledCheckBoxes(student); } }); CheckBox delayCheckBox = new CheckBox(); delayCheckBox.setData(student); if (app.storage.existsMiss(Miss.DELAY, (Date) datePopupDateField.getValue(), ((Classblock) classblockComboBox.getValue()).getID(), student.getID())) { delayCheckBox.setValue(true); } delayCheckBox.setImmediate(true); delayCheckBox.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Student student = (Student) event.getButton().getData(); Miss miss = new Miss(0, Miss.DELAY, (Date) datePopupDateField.getValue(), "", student.getID(), app.user.getID(), ((Classblock) classblockComboBox.getValue()).getIDSubject(), ((Classblock) classblockComboBox.getValue()).getID()); if ((Boolean) event.getButton().getValue()) { app.storage.addMiss(miss); } else { app.storage.deleteMiss(Miss.DELAY, miss.getDate(), miss.getIDStudent(), miss.getIDClassblock()); } updateEnabledCheckBoxes(student); } }); CheckBox expulsionCheckBox = new CheckBox(); expulsionCheckBox.setData(student); if (app.storage.existsMiss(Miss.EXPULSION, (Date) datePopupDateField.getValue(), ((Classblock) classblockComboBox.getValue()).getID(), student.getID())) { expulsionCheckBox.setValue(true); } expulsionCheckBox.setImmediate(true); expulsionCheckBox.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Student student = (Student) event.getButton().getData(); Miss miss = new Miss(0, Miss.EXPULSION, (Date) datePopupDateField.getValue(), "", student.getID(), app.user.getID(), ((Classblock) classblockComboBox.getValue()).getIDSubject(), ((Classblock) classblockComboBox.getValue()).getID()); if ((Boolean) event.getButton().getValue()) { app.storage.addMiss(miss); } else { app.storage.deleteMiss(Miss.EXPULSION, miss.getDate(), miss.getIDStudent(), miss.getIDClassblock()); } updateEnabledCheckBoxes(student); } }); Object row[] = { student.getName(), student.getSurname1(), student.getSurname2(), missCheckBox, excusedmissCheckBox, delayCheckBox, expulsionCheckBox }; table.addItem(row, new Integer(student.getID())); updateEnabledCheckBoxes(student); } }
From source file:org.ikasan.dashboard.ui.administration.panel.UserDirectoryManagementPanel.java
License:BSD License
protected void init() { this.setWidth("100%"); this.setHeight("100%"); VerticalLayout layout = new VerticalLayout(); layout.setMargin(true);/*w ww.jav a 2 s.c o m*/ Panel securityAdministrationPanel = new Panel(); securityAdministrationPanel.setStyleName("dashboard"); securityAdministrationPanel.setWidth("100%"); securityAdministrationPanel.setHeight("100%"); GridLayout gridLayout = new GridLayout(2, 25); gridLayout.setSpacing(true); gridLayout.setWidth("100%"); gridLayout.setHeight("100%"); gridLayout.setMargin(true); gridLayout.setColumnExpandRatio(0, 0.3f); gridLayout.setColumnExpandRatio(1, 0.7f); authenticationMethodCombo.addItem(LOCAL_AUTHENTICATION); authenticationMethodCombo.setItemCaption(LOCAL_AUTHENTICATION, LOCAL_AUTHENTICATION.getCaption()); authenticationMethodCombo.addItem(LDAP_LOCAL_AUTHENTICATION); authenticationMethodCombo.setItemCaption(LDAP_LOCAL_AUTHENTICATION, LDAP_LOCAL_AUTHENTICATION.getCaption()); authenticationMethodCombo.addItem(LDAP_AUTHENTICATION); authenticationMethodCombo.setItemCaption(LDAP_AUTHENTICATION, LDAP_AUTHENTICATION.getCaption()); authenticationMethodDropdownValuesMap.put(LOCAL_AUTHENTICATION.getValue(), LOCAL_AUTHENTICATION); authenticationMethodDropdownValuesMap.put(LDAP_LOCAL_AUTHENTICATION.getValue(), LDAP_LOCAL_AUTHENTICATION); authenticationMethodDropdownValuesMap.put(LDAP_AUTHENTICATION.getValue(), LDAP_AUTHENTICATION); final Label serverSettings = new Label("Server Settings"); serverSettings.setStyleName("large-bold"); gridLayout.addComponent(serverSettings, 0, 0); final Label directoryNameLabel = new Label("Directory Name:"); directoryNameLabel.setSizeUndefined(); this.directoryName = new TextField(); this.directoryName.setWidth("400px"); this.directoryName.setRequired(true); gridLayout.addComponent(directoryNameLabel, 0, 1); gridLayout.addComponent(this.directoryName, 1, 1); gridLayout.setComponentAlignment(directoryNameLabel, Alignment.MIDDLE_RIGHT); final Label ldapServerUrlLabel = new Label("LDAP Server URL:"); ldapServerUrlLabel.setSizeUndefined(); this.ldapServerUrl = new TextField(); this.ldapServerUrl.setWidth("400px"); gridLayout.addComponent(ldapServerUrlLabel, 0, 2); gridLayout.addComponent(this.ldapServerUrl, 1, 2); this.ldapServerUrl.setRequired(true); gridLayout.setComponentAlignment(ldapServerUrlLabel, Alignment.MIDDLE_RIGHT); Label hostnameExample = new Label("Hostname of server running LDAP. Example: ldap://ldap.example.com:389"); gridLayout.addComponent(hostnameExample, 1, 3); final Label ldapBindUserDnLabel = new Label("Username:"); ldapBindUserDnLabel.setSizeUndefined(); this.ldapBindUserDn = new TextField(); this.ldapBindUserDn.setWidth("400px"); this.ldapBindUserDn.setRequired(true); gridLayout.addComponent(ldapBindUserDnLabel, 0, 4); gridLayout.addComponent(this.ldapBindUserDn, 1, 4); gridLayout.setComponentAlignment(ldapBindUserDnLabel, Alignment.MIDDLE_RIGHT); Label usernameExample = new Label("User to log into LDAP. Example: cn=user,DC=domain,DC=name"); gridLayout.addComponent(usernameExample, 1, 5); final Label ldapBindUserPasswordLabel = new Label("Password:"); ldapBindUserPasswordLabel.setSizeUndefined(); this.ldapBindUserPassword = new PasswordField(); this.ldapBindUserPassword.setWidth("100px"); this.ldapBindUserPassword.setRequired(true); gridLayout.addComponent(ldapBindUserPasswordLabel, 0, 6); gridLayout.addComponent(this.ldapBindUserPassword, 1, 6); gridLayout.setComponentAlignment(ldapBindUserPasswordLabel, Alignment.MIDDLE_RIGHT); final Label ldapSchema = new Label("LDAP Schema"); ldapSchema.setStyleName("large-bold"); gridLayout.addComponent(ldapSchema, 0, 7); final Label ldapUserSearchDnLabel = new Label("User DN:"); ldapUserSearchDnLabel.setSizeUndefined(); this.ldapUserSearchDn = new TextField(); this.ldapUserSearchDn.setRequired(true); this.ldapUserSearchDn.setWidth("400px"); gridLayout.addComponent(ldapUserSearchDnLabel, 0, 8); gridLayout.setComponentAlignment(ldapUserSearchDnLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.ldapUserSearchDn, 1, 8); Label userDnExample = new Label("The base DN to use when searching for users."); gridLayout.addComponent(userDnExample, 1, 9); final Label applicationSecurityBaseDnLabel = new Label("Group DN:"); applicationSecurityBaseDnLabel.setSizeUndefined(); this.applicationSecurityBaseDn = new TextField(); this.applicationSecurityBaseDn.setRequired(true); this.applicationSecurityBaseDn.setWidth("400px"); gridLayout.addComponent(applicationSecurityBaseDnLabel, 0, 10); gridLayout.setComponentAlignment(applicationSecurityBaseDnLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.applicationSecurityBaseDn, 1, 10); Label groupDnExample = new Label("The base DN to use when searching for groups."); gridLayout.addComponent(groupDnExample, 1, 11); final Label ldapAttributes = new Label("LDAP Attributes"); ldapAttributes.setStyleName("large-bold"); CheckBox checkbox = new CheckBox("Populate default attributes"); checkbox.setValue(false); checkbox.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); if (value == true) { ldapUserSearchFilter.setValue(LDAP_USER_SEARCH_FILTER); emailAttributeName.setValue(EMAIL_ATTRIBUTE_NAME); userAccountNameAttributeName.setValue(USER_ACCOUNT_NAME_ATTRIBUTE_NAME); accountTypeAttributeName.setValue(ACCOUNT_TYPE_ATTRIBUTE_NAME); firstNameAttributeName.setValue(FIRST_NAME_ATTRIBUTE_NAME); surnameAttributeName.setValue(SURNAME_ATTRIBUTE_NAME); departmentAttributeName.setValue(DEPARTMENT_ATTRIBUTE_NAME); ldapUserDescriptionAttributeName.setValue(LDAP_USER_DESCRIPTION_ATTRIBUTE_NAME); memberofAttributeName.setValue(MEMBER_OF_ATTRIBUTE_NAME); applicationSecurityGroupAttributeName.setValue(APPLICATION_SECURITY_GROUP_ATTRIBUTE_NAME); applicationSecurityDescriptionAttributeName .setValue(APPLICATION_SECURITY_DESCRIPTION_ATTRIBUTE_NAME); } else { ldapUserSearchFilter.setValue(""); emailAttributeName.setValue(""); userAccountNameAttributeName.setValue(""); accountTypeAttributeName.setValue(""); firstNameAttributeName.setValue(""); surnameAttributeName.setValue(""); departmentAttributeName.setValue(""); ldapUserDescriptionAttributeName.setValue(""); memberofAttributeName.setValue(""); applicationSecurityGroupAttributeName.setValue(""); applicationSecurityDescriptionAttributeName.setValue(""); } } }); checkbox.setImmediate(true); gridLayout.addComponent(ldapAttributes, 0, 12); gridLayout.addComponent(checkbox, 1, 12); final Label userSearchFieldLabel = new Label("User Search Filter:"); userSearchFieldLabel.setSizeUndefined(); this.ldapUserSearchFilter = new TextField(); this.ldapUserSearchFilter.setWidth("300px"); this.ldapUserSearchFilter.setRequired(true); gridLayout.addComponent(userSearchFieldLabel, 0, 13); gridLayout.setComponentAlignment(userSearchFieldLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.ldapUserSearchFilter, 1, 13); final Label emailAttributeNameLabel = new Label("Email:"); emailAttributeNameLabel.setSizeUndefined(); this.emailAttributeName = new TextField(); this.emailAttributeName.setWidth("300px"); this.emailAttributeName.setRequired(true); gridLayout.addComponent(emailAttributeNameLabel, 0, 14); gridLayout.setComponentAlignment(emailAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.emailAttributeName, 1, 14); final Label userAccountNameAttributeNameLabel = new Label("Account Name:"); userAccountNameAttributeNameLabel.setSizeUndefined(); this.userAccountNameAttributeName = new TextField(); this.userAccountNameAttributeName.setWidth("300px"); this.userAccountNameAttributeName.setRequired(true); gridLayout.addComponent(userAccountNameAttributeNameLabel, 0, 15); gridLayout.setComponentAlignment(userAccountNameAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.userAccountNameAttributeName, 1, 15); final Label accountTypeAttributeNameLabel = new Label("Account Type:"); accountTypeAttributeNameLabel.setSizeUndefined(); this.accountTypeAttributeName = new TextField(); this.accountTypeAttributeName.setWidth("300px"); this.accountTypeAttributeName.setRequired(true); gridLayout.addComponent(accountTypeAttributeNameLabel, 0, 16); gridLayout.setComponentAlignment(accountTypeAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.accountTypeAttributeName, 1, 16); final Label firstNameAttributeNameLabel = new Label("First Name:"); firstNameAttributeNameLabel.setSizeUndefined(); this.firstNameAttributeName = new TextField(); this.firstNameAttributeName.setWidth("300px"); this.firstNameAttributeName.setRequired(true); gridLayout.addComponent(firstNameAttributeNameLabel, 0, 17); gridLayout.setComponentAlignment(firstNameAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.firstNameAttributeName, 1, 17); final Label surnameAttributeNameLabel = new Label("Surname:"); surnameAttributeNameLabel.setSizeUndefined(); this.surnameAttributeName = new TextField(); this.surnameAttributeName.setWidth("300px"); this.surnameAttributeName.setRequired(true); gridLayout.addComponent(surnameAttributeNameLabel, 0, 18); gridLayout.setComponentAlignment(surnameAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.surnameAttributeName, 1, 18); final Label departmentAttributeNameLabel = new Label("User Department:"); departmentAttributeNameLabel.setSizeUndefined(); this.departmentAttributeName = new TextField(); this.departmentAttributeName.setWidth("300px"); this.departmentAttributeName.setRequired(true); gridLayout.addComponent(departmentAttributeNameLabel, 0, 19); gridLayout.setComponentAlignment(departmentAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.departmentAttributeName, 1, 19); final Label ldapUserDescriptionAttributeNameLabel = new Label("User Description:"); ldapUserDescriptionAttributeNameLabel.setSizeUndefined(); this.ldapUserDescriptionAttributeName = new TextField(); this.ldapUserDescriptionAttributeName.setWidth("300px"); this.ldapUserDescriptionAttributeName.setRequired(true); gridLayout.addComponent(ldapUserDescriptionAttributeNameLabel, 0, 20); gridLayout.setComponentAlignment(ldapUserDescriptionAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.ldapUserDescriptionAttributeName, 1, 20); final Label memberOfAttributeNameLabel = new Label("Member Of:"); memberOfAttributeNameLabel.setSizeUndefined(); this.memberofAttributeName = new TextField(); this.memberofAttributeName.setWidth("300px"); this.memberofAttributeName.setRequired(true); gridLayout.addComponent(memberOfAttributeNameLabel, 0, 21); gridLayout.setComponentAlignment(memberOfAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.memberofAttributeName, 1, 21); final Label applicationSecurityGroupAttributeNameLabel = new Label("Group Name:"); applicationSecurityGroupAttributeNameLabel.setSizeUndefined(); this.applicationSecurityGroupAttributeName = new TextField(); this.applicationSecurityGroupAttributeName.setWidth("300px"); this.applicationSecurityGroupAttributeName.setRequired(true); gridLayout.addComponent(applicationSecurityGroupAttributeNameLabel, 0, 22); gridLayout.setComponentAlignment(applicationSecurityGroupAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.applicationSecurityGroupAttributeName, 1, 22); final Label applicationSecurityAttributeNameLabel = new Label("Group Description:"); applicationSecurityAttributeNameLabel.setSizeUndefined(); this.applicationSecurityDescriptionAttributeName = new TextField(); this.applicationSecurityDescriptionAttributeName.setWidth("300px"); this.applicationSecurityDescriptionAttributeName.setRequired(true); gridLayout.addComponent(applicationSecurityAttributeNameLabel, 0, 23); gridLayout.setComponentAlignment(applicationSecurityAttributeNameLabel, Alignment.MIDDLE_RIGHT); gridLayout.addComponent(this.applicationSecurityDescriptionAttributeName, 1, 23); final BeanItem<AuthenticationMethod> authenticationMethodItem = new BeanItem<AuthenticationMethod>( authenticationMethod); this.directoryName.setPropertyDataSource(authenticationMethodItem.getItemProperty("name")); this.ldapServerUrl.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapServerUrl")); this.ldapBindUserDn.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserDn")); this.ldapBindUserPassword .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserPassword")); this.ldapUserSearchDn .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchBaseDn")); this.ldapUserSearchFilter .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchFilter")); this.emailAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("emailAttributeName")); this.userAccountNameAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("userAccountNameAttributeName")); this.accountTypeAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("accountTypeAttributeName")); this.applicationSecurityBaseDn .setPropertyDataSource(authenticationMethodItem.getItemProperty("applicationSecurityBaseDn")); this.applicationSecurityGroupAttributeName.setPropertyDataSource( authenticationMethodItem.getItemProperty("applicationSecurityGroupAttributeName")); this.departmentAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("departmentAttributeName")); this.firstNameAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("firstNameAttributeName")); this.surnameAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("surnameAttributeName")); this.ldapUserDescriptionAttributeName.setPropertyDataSource( authenticationMethodItem.getItemProperty("ldapUserDescriptionAttributeName")); this.applicationSecurityDescriptionAttributeName.setPropertyDataSource( authenticationMethodItem.getItemProperty("applicationSecurityDescriptionAttributeName")); this.memberofAttributeName .setPropertyDataSource(authenticationMethodItem.getItemProperty("memberofAttributeName")); Button saveButton = new Button("Save"); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { logger.info("saving auth method: " + authenticationMethod); authenticationMethod.setMethod(SecurityConstants.AUTH_METHOD_LDAP); if (authenticationMethod.getOrder() == null) { authenticationMethod.setOrder(securityService.getNumberOfAuthenticationMethods() + 1); } securityService.saveOrUpdateAuthenticationMethod(authenticationMethod); } catch (RuntimeException e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); Notification.show("Error trying to save the authentication method!", sw.toString(), Notification.Type.ERROR_MESSAGE); return; } Notification.show("Saved!"); } }); GridLayout buttonLayout = new GridLayout(1, 1); buttonLayout.setWidth("200px"); buttonLayout.setHeight("20px"); buttonLayout.addComponent(saveButton); gridLayout.addComponent(buttonLayout, 0, 24, 1, 24); VerticalLayout wrapperLayout = new VerticalLayout(); wrapperLayout.addComponent(gridLayout); wrapperLayout.setComponentAlignment(gridLayout, Alignment.TOP_CENTER); securityAdministrationPanel.setContent(wrapperLayout); layout.addComponent(securityAdministrationPanel); this.setContent(layout); }
From source file:org.jpos.qi.system.LogListenerView.java
License:Open Source License
public LogEvent log(LogEvent event) { String r = event.getRealm();//from w w w . ja v a 2 s. c o m CheckBox cb = realms.get(r); if (cb != null) { if (!cb.getValue()) return event; // ignore } else { getSession().getLockInstance().lock(); try { cb = new CheckBox(r); cb.setValue(true); realms.put(r, cb); realmsLayout.setSizeUndefined(); } finally { if (getSession() != null) getSession().getLockInstance().unlock(); } realmsLayout.addComponent(cb); } sp.out(key, new FrozenLogEvent(event), BUFFER_TIMEOUT); return event; }
From source file:org.jumpmind.metl.ui.views.admin.GroupEditPanel.java
License:Open Source License
public GroupEditPanel(ApplicationContext context, Group group) { this.context = context; this.group = group; FormLayout layout = new FormLayout(); TextField nameField = new TextField("Group Name", StringUtils.trimToEmpty(group.getName())); nameField.addValueChangeListener(new NameChangeListener()); layout.addComponent(nameField);//from w w w. ja va 2 s . c om nameField.focus(); CheckBox readOnly = new CheckBox("Read Only"); readOnly.setImmediate(true); readOnly.setValue(group.isReadOnly()); readOnly.addValueChangeListener(new ReadOnlyChangeListener()); layout.addComponent(readOnly); TwinColSelect privSelect = new TwinColSelect(); for (Privilege priv : Privilege.values()) { privSelect.addItem(priv.name()); } lastPrivs = new HashSet<String>(); for (GroupPrivilege groupPriv : group.getGroupPrivileges()) { lastPrivs.add(groupPriv.getName()); } privSelect.setValue(lastPrivs); privSelect.setRows(20); privSelect.setNullSelectionAllowed(true); privSelect.setMultiSelect(true); privSelect.setImmediate(true); privSelect.setLeftColumnCaption("Available privileges"); privSelect.setRightColumnCaption("Selected privileges"); privSelect.addValueChangeListener(new PrivilegeChangeListener()); layout.addComponent(privSelect); addComponent(layout); setMargin(true); }
From source file:org.jumpmind.metl.ui.views.design.PropertySheet.java
License:Open Source License
@SuppressWarnings("unchecked") protected void addCommonComponentSettings(FormLayout formLayout, Object obj) { List<Object> list = (List<Object>) obj; List<Component> components = new ArrayList<Component>(list.size()); // Check if all selected components support the enabled property // TODO: Support more than the enable component. // Look for all common parameters. boolean supportEnable = true; boolean enabled = true; for (Object o : list) { if (o instanceof FlowStep) { Component component = ((FlowStep) o).getComponent(); if (!hasSetting(component, AbstractComponentRuntime.ENABLED)) { supportEnable = false;// w ww . j a v a 2 s .co m break; } if (enabled && !component.getBoolean(AbstractComponentRuntime.ENABLED, true)) { enabled = false; } components.add(component); } else { supportEnable = false; break; } } // Create the enabled field if all selected components support the // enabled setting. if (components.size() != 0 && supportEnable) { final CheckBox checkBox = new CheckBox("Enabled"); checkBox.setImmediate(true); checkBox.setRequired(true); checkBox.setValue(enabled); checkBox.addValueChangeListener((event) -> { for (final Component component : components) { saveSetting(AbstractComponentRuntime.ENABLED, checkBox.getValue().toString(), component); } if (listener != null) { listener.componentChanged(components); } }); checkBox.setReadOnly(readOnly); formLayout.addComponent(checkBox); } }
From source file:org.jumpmind.metl.ui.views.design.PropertySheet.java
License:Open Source License
protected void addComponentShared(FormLayout formLayout, final Component component) { final CheckBox checkBox = new CheckBox("Shared"); checkBox.setImmediate(true);/* www. j a v a 2 s . c o m*/ if (component.isShared()) { checkBox.setValue(true); } else { checkBox.setValue(false); } checkBox.setRequired(true); checkBox.setDescription("Whether this component can be reused"); checkBox.addValueChangeListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { // TODO: Don't allow unshare if component is already on more // than 1 flow? // TODO: Refresh palette for the existing flow to have this item // display in shared definitions component.setShared((boolean) event.getProperty().getValue()); context.getConfigurationService().save(component); } }); checkBox.setReadOnly(readOnly); formLayout.addComponent(checkBox); }