@Override public void setReadOnly(boolean readOnly) { field.setReadOnly(readOnly); }
@Override public void setReadOnly(boolean readOnly) { super.setReadOnly(readOnly); // reflect to internal field getInternalField().setReadOnly(readOnly); }
@Override public Field createField(Item item, Object propertyId, Component uiContext) { if (!isPropertyVisible(propertyId)) { return null; } BeanItem<DictionaryItemWrapper> beanItem = Lang2.assumeType(item, BeanItem.class); DictionaryItemWrapper bean = beanItem.getBean(); Field field = _VALUES.equals(propertyId) ? createItemValuesField(application, source, bean.getValueType()) : new TextField(source.getMessage("dict.item." + propertyId)); field.setWidth("100%"); if (isPropertyEditable(propertyId)) { field.setRequired(isPropertyRequired(propertyId)); field.setRequiredError(source.getMessage("dict.item." + propertyId + ".required")); } else { field.setReadOnly(true); } return field; }
ret.setReadOnly(true); ret.setCaption(""); ret.setStyleName("readOnly");
@Override public void bind() { panel.removeAllComponents(); ValidationObject o = (ValidationObject)getContext(); BeanItem<ValidationObject> beanItem = new BeanItem<>(o); m_maduraSessionManager.getValidationSession().bind(o); fieldGroup = m_maduraSessionManager.createMaduraFieldGroup(); Layout actions = createButtons(); log.debug("park:{}",(park.isEnabled()?"enabled":"disabled")); Map<String,Field<?>> fields = fieldGroup.buildAndBind(m_fieldList,beanItem); for (Field<?> f:fields.values()) { if (isReadOnlyForm()) { f.setReadOnly(true); f.setEnabled(false); } panel.addComponent(f); } m_referenceField = fields.get(m_referenceName); m_launcher = (m_processInstance==null || m_processInstance.getId()== 0); park.setVisible(!isLauncher()); panel.addComponent(actions); if (isReadOnlyForm()) { park.setReadOnly(true); park.setEnabled(false); okay.setReadOnly(true); okay.setEnabled(false); } log.debug("park:{}",(park.isEnabled()?"enabled":"disabled")); } @Override
@Override public void selectionChanged(SelectionChangedEvent changeEvent) { if (parameter != null) { try { blockListenerOrValidators = true; setData(changeEvent.getSelectedBean()); setItemId(changeEvent.getSelectedItemId()); final BeanItem beanItem = new BeanItem(changeEvent.getSelectedBean(), parameter.getEditablePropertyName(), parameter.getNonEditablePropertyName()); // this is a hack, but we need to know if the selection changed beanItem.addItemProperty("selected", changeEvent.getSelectedItem().getItemProperty("selected")); captionLabel.setValue(String.format("<b>%s</b>", parameter.getCaption())); fieldGroup = new FieldGroup(); fieldGroup.setBuffered(false); fieldGroup.bind(selectedField, "selected"); fieldGroup.bind(editableField, parameter.getEditablePropertyName()); fieldGroup.bind(nonEditableField, parameter.getNonEditablePropertyName()); fieldGroup.setItemDataSource(beanItem); fieldGroup.getField(parameter.getNonEditablePropertyName()).setCaption(parameter.getNonEditablePropertyCaption()); fieldGroup.getField(parameter.getNonEditablePropertyName()).setReadOnly(true); fieldGroup.getField(parameter.getEditablePropertyName()).setCaption(parameter.getEditablePropertyCaption()); fieldGroup.getField(parameter.getEditablePropertyName()).setReadOnly(false); updateEnabledState(); UIHelper.validateField(editableField, true); } finally { blockListenerOrValidators = false; } } }
public OneFieldWindow(RulesPlugin rulesPlugin, FieldMetadata fieldMetadata, MaduraSessionManager maduraSessionManager, final String submitStyle) { main = new VerticalLayout(); setContent(main); setModal(true); main.setMargin(true); main.setSpacing(true); main.setWidth("320px"); MaduraPropertyWrapper maduraPropertyWrapper = maduraSessionManager.getMaduraPropertyWrapper(fieldMetadata); FieldFactory fieldFactory = maduraSessionManager.getFieldFactory(); Field<?> field = fieldFactory.createFieldByPropertyType(maduraPropertyWrapper); field.setReadOnly(true); main.addComponent(field); HorizontalLayout buttons = new HorizontalLayout(); main.addComponent(buttons); Button buttonOK = fieldFactory.createButton("OK", new Button.ClickListener(){ private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { close(); }}); if (submitStyle != null) { buttonOK.setClickShortcut(KeyCode.ENTER ); buttonOK.addStyleName(submitStyle); } buttons.addComponent(buttonOK); buttons.setComponentAlignment(buttonOK, Alignment.BOTTOM_RIGHT); }
for (Object o : f.getItemPropertyIds()) { Field tmpField = f.getField(o); tmpField.setReadOnly(true);