Example #1
0
  /**
   * @param config the component's configuration.
   * @param editable
   */
  public TextArea(TextAreaConfig config, boolean editable) {
    this.config = config;
    this.editable = editable;

    if (config.getPreferenceKey() != null) {
      content =
          VaadinPortletService.getCurrentPortletRequest()
              .getPreferences()
              .getValue(config.getPreferenceKey(), null);
    }
    if (content == null) {
      if (config.getContent() != null) {
        if (config.getContent().getContent().size() > 0) {
          content = convertNodeListToString(config.getContent().getContent());
        }
      }
    }
  }
Example #2
0
  private void storeToPreferences(String changedContent) {
    try {
      PortletPreferences preferences =
          VaadinPortletService.getCurrentPortletRequest().getPreferences();

      preferences.setValue(config.getPreferenceKey(), changedContent);
      preferences.store();

    } catch (ReadOnlyException e) {
      throw new IllegalStateException("Error updating content", e);
    } catch (ValidatorException e) {
      throw new IllegalStateException("Error updating content", e);
    } catch (IOException e) {
      throw new IllegalStateException("Error updating content", e);
    }
  }