throw new ReadOnlyException( "Cannot set value for read-only property.");
@Override public void setValue(String newValue) throws ReadOnlyException { if (isReadOnly()) { throw new ReadOnlyException(); } if (file == null) { return; } try { FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter osw = charset == null ? new OutputStreamWriter(fos) : new OutputStreamWriter(fos, charset); BufferedWriter w = new BufferedWriter(osw); w.append(newValue); w.flush(); w.close(); osw.close(); fos.close(); fireValueChange(); } catch (IOException e) { throw new RuntimeException(e); } }
/** * Sets the value of the property. * * Note that since Vaadin 7, no conversions are performed and the value must * be of the correct type. * * @param newValue * the New value of the property. * @throws <code>Property.ReadOnlyException</code> * if the object is in read-only mode */ @Override public void setValue(T newValue) throws Property.ReadOnlyException { // Checks the mode if (isReadOnly()) { throw new Property.ReadOnlyException(); } this.value = newValue; fireValueChange(); } }
/** * Sets the value of the property. * * Note that since Vaadin 7, no conversions are performed and the value must * be of the correct type. * * @param newValue * the New value of the property. * @throws <code>Property.ReadOnlyException</code> * if the object is in read-only mode. * @see #invokeSetMethod(Object) */ @Override public void setValue(T newValue) throws Property.ReadOnlyException { // Checks the mode if (isReadOnly()) { throw new Property.ReadOnlyException(); } invokeSetMethod(newValue); fireValueChange(); }
/** * Sets the value of the property. The new value must be assignable to the * type of this property. * * @param newValue * the New value of the property. * @throws <code>Property.ReadOnlyException</code> * if the object is in read-only mode. * @see #invokeSetMethod(Object) */ @Override public void setValue(T newValue) throws ReadOnlyException { // Checks the mode if (isReadOnly()) { throw new Property.ReadOnlyException(); } invokeSetMethod(newValue); fireValueChange(); }
@Override public void addNewItem(String newItemCaption) { // Checks for readonly if (isReadOnly()) { throw new Property.ReadOnlyException(); } // Adds new option if (addItem(newItemCaption) != null) { // Sets the caption property, if used if (getItemCaptionPropertyId() != null) { getContainerProperty(newItemCaption, getItemCaptionPropertyId()) .setValue(newItemCaption); } if (isMultiSelect()) { Set values = new HashSet((Collection) getValue()); values.add(newItemCaption); setValue(values); } else { setValue(newItemCaption); } } } }
@Override public void setValue(T newValue) throws ReadOnlyException { throw new ReadOnlyException("Generated properties are read only"); }
@Override public void setValue(T newValue) throws ReadOnlyException { throw new ReadOnlyException("Generated properties are read only"); }
@Override public void setValue(Object newValue) throws ReadOnlyException { // Table does not support setting new value with Vaadin API throw new ReadOnlyException(); }
@SuppressWarnings("unchecked") @Override public void setValue(T newValue) throws com.vaadin.v7.data.Property.ReadOnlyException { try { attr.set(bean, newValue); } catch (IOException e) { throw new com.vaadin.v7.data.Property.ReadOnlyException("Can't write " + attr.getName() +": " + e); } }