List of usage examples for com.vaadin.ui Label requestRepaint
@Deprecated @Override public void requestRepaint()
From source file:nz.co.senanque.vaadinsupport.application.MaduraSessionManager.java
License:Apache License
/** * Check all the other fields to ensure they are still valid * this includes any buttons that were registered because they * get disabled if there are errors on the relevant form or * if the requiredness is incomplete.//from w w w . j av a 2s.co m * * @param field */ public void updateOtherFields(AbstractField field) { PermissionManager permissionmanager = getPermissionManager(); Collection<AbstractField> fields = getFields(); Collection<Label> labels = getLabels(); for (Label fieldx : labels) { com.vaadin.data.Property p = fieldx.getPropertyDataSource(); if (p != null && p instanceof LabelProperty) { fieldx.requestRepaint(); } } for (AbstractField fieldx : fields) { if (fieldx.equals(field)) continue; if ((fieldx instanceof Button) && !(fieldx instanceof CheckBox)) { com.vaadin.data.Property p = fieldx.getPropertyDataSource(); if (p != null && p instanceof ButtonProperty) { ((ButtonProperty) p).getPainter().paint((Button) fieldx); fieldx.requestRepaint(); } continue; } if (fieldx instanceof MenuItemWrapper) { MenuItemPainter menuItemPainter = ((MenuItemWrapper) fieldx).getMenuItemPainter(); MenuItem menuItem = (MenuItem) fieldx.getData(); if (menuItemPainter != null) { menuItemPainter.paint(menuItem); fieldx.requestRepaint(); } continue; } MaduraPropertyWrapper property = null; try { property = (MaduraPropertyWrapper) fieldx.getPropertyDataSource(); } catch (Exception e) { // ignore property = null; } if (property != null) { if (logger.isDebugEnabled()) { logger.debug("evaluating field: {}", property.getName()); if (fieldx.isEnabled() != property.isEnabled()) { logger.debug("Enabled: {} {}", fieldx.isEnabled(), property.isEnabled()); } if (fieldx.isReadOnly() != property.isReadOnly()) { logger.debug("ReadOnly: {} {}", fieldx.isReadOnly(), property.isReadOnly()); } if (fieldx.isRequired() != property.isRequired()) { logger.debug("Required: {} {}", fieldx.isRequired(), property.isRequired()); } if (fieldx.isVisible() != property.isVisible()) { logger.debug("Visible: {} {}", fieldx.isVisible(), property.isVisible()); } } fieldx.setEnabled(property.isEnabled()); fieldx.setReadOnly(property.isReadOnly()); fieldx.setRequired(property.isRequired()); fieldx.setVisible(property.isVisible()); // Permissions trump rules if (!permissionmanager.hasPermission(property.getReadPermission())) { fieldx.setVisible(false); } if (!permissionmanager.hasPermission(property.getWritePermission())) { fieldx.setEnabled(false); } if (fieldx instanceof AbstractSelect) { AbstractSelect select = (AbstractSelect) fieldx; List<ChoiceBase> availableList = new ArrayList<ChoiceBase>(); for (ChoiceBase v : property.getAvailableValues()) { availableList.add(v); } logger.debug("{} availableList {}", property.getName(), availableList); Collection<?> itemIds = select.getItemIds(); List<Object> killList = new ArrayList<Object>(); for (Object itemId : itemIds) { if (availableList.contains(itemId)) continue; killList.add(itemId); } for (Object kill : killList) { select.removeItem(kill); } for (ChoiceBase cb : availableList) { select.addItem(cb); } logger.debug("Select {} value \"{}\", updated to {}", new Object[] { property.getName(), select.getValue(), select.getItemIds() }); } } fieldx.requestRepaint(); } }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
private void setMessage(Label label, String message) { if (StringUtils.isNotEmpty(message)) { label.setValue(message);/*from w w w . j a v a 2s .c om*/ label.setVisible(true); } else { label.setVisible(false); } label.requestRepaint(); }
From source file:ru.codeinside.adm.ui.TreeTableOrganization.java
License:Mozilla Public License
private Component buttonEditOrganization(final Organization org, final Label nameLabel) { setSpacing(true);/*from w w w. ja v a 2 s .co m*/ HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); buttons.setMargin(false, true, false, false); addComponent(buttons); final Button createOrg = new Button(" ", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { showOrganizationLabelsAndButtons(org.getId()); final String oldNameOrg = org.getName(); final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); layout.setSpacing(true); panel.addComponent(layout); final Form form = new Form(); form.addField(NAME_ORG, new TextField(NAME_ORG)); form.getField(NAME_ORG).addValidator(new StringLengthValidator( "? 255 ?", 0, 255, true)); form.getField(NAME_ORG).setWidth("500px"); form.getField(NAME_ORG).setValue(oldNameOrg); layout.addComponent(form); HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(true); Button save = new Button("", new Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { try { form.commit(); } catch (Exception e) { return; } String newNameOrg = form.getField(NAME_ORG).getValue().toString(); if (!(newNameOrg.equals(oldNameOrg) || newNameOrg.equals(""))) { org.setName(newNameOrg); AdminServiceProvider.get().updateOrganization(org); treetable.getItem(org.getId()) .getItemProperty(TreeTableOrganization.NAME_PROPERTY) .setValue(newNameOrg); treetable.requestRepaint(); nameLabel.setValue("?: " + newNameOrg); nameLabel.requestRepaint(); // TODO : userInfoPanel //if (AdminServiceProvider.get() // .findEmployeeByLogin(getApplication().getUser().toString()).getOrganization() // .getId() == org.getId()) { // ((AdminApp) getApplication()).getUserInfoPanel().setOrganization(newNameOrg); //} showOrganization(org.getId()); getWindow().showNotification( "? " + oldNameOrg + " "); } else { showOrganization(org.getId()); getWindow().showNotification(" "); } } }); buttons.addComponent(save); addButtonCancel(org, buttons); form.getFooter().addComponent(buttons); } }); buttons.addComponent(createOrg); return buttons; }