/** {@inheritDoc} */
  @Override
  public Component doCreateWidget(Object parent) {
    if (textArea == null) {

      textArea = new TextArea();
      textArea.setSizeFull();
      textArea.addStyleName(CSS_CLASS_CONTROL);
      textArea.setImmediate(true);
      textArea.setNullRepresentation("");
      setupComponent(textArea, getCastedModel());

      associateWidget(textArea, modelAccess.yField);
      if (modelAccess.isCssIdValid()) {
        textArea.setId(modelAccess.getCssID());
      } else {
        textArea.setId(getEditpart().getId());
      }

      property = new ObjectProperty<String>(null, String.class);
      textArea.setPropertyDataSource(property);

      // creates the binding for the field
      createBindings(modelAccess.yField, textArea);

      if (modelAccess.isCssClassValid()) {
        textArea.addStyleName(modelAccess.getCssClass());
      }

      applyCaptions();

      initializeField(textArea);
    }
    return textArea;
  }
 public Field createField(Item item, Object propertyId, Component uiContext) {
   String pid = (String) propertyId;
   PersistentClass entity =
       ConfigurationMapping.getConfigurationEntity(AddressType.class.getName());
   if ("name".equals(pid)) {
     TextField textField =
         new TextField(
             FactoryI18nManager.getI18nManager()
                 .getMessage(Messages.ADDRESS_TYPE_ABM_TABLE_AND_FORM_NAME));
     textField.setNullRepresentation("");
     textField.setRequired(true);
     textField.setMaxLength(ConfigurationMapping.getColumnSize("name", entity));
     return textField;
   } else if ("comment".equals(pid)) {
     TextArea textArea =
         new TextArea(
             FactoryI18nManager.getI18nManager()
                 .getMessage(Messages.ADDRESS_TYPE_ABM_TABLE_AND_FORM_COMMENT));
     textArea.setWidth("250");
     textArea.setHeight("50");
     textArea.setNullRepresentation("");
     textArea.setMaxLength(ConfigurationMapping.getColumnSize("comment", entity));
     //			textArea.setRequired(false);
     //			textArea.setMaxLength(maxLength)
     //			textArea.setHeight(height);
     //			textArea.setWidth(width);
     //			textArea.setEnabled(enabled);
     //			textArea.setIcon(icon);
     return textArea;
   }
   return null;
 }
Пример #3
0
 public CommentLayout() {
   comment = new TextArea("");
   comment.setWidth("1300");
   comment.setHeight("300");
   comment.setNullRepresentation("");
   comment.setMaxLength(254);
   addComponent(comment);
 }
Пример #4
0
  /**
   * The constructor should first build the main layout, set the composition root and then do any
   * custom initialization.
   *
   * <p>The constructor will not be automatically regenerated by the visual editor.
   */
  public KnowledgeViewForm() {
    buildMainLayout();
    setCompositionRoot(mainLayout);

    // TODO add user code here
    idField.setNullRepresentation("");
    versionField.setNullRepresentation("");
    packageNameField.setNullRepresentation("");
    nameField.setNullRepresentation("");
    descriptionField.setNullRepresentation("");
    errorMessageField.setNullRepresentation("");

    fileField.setRequired(true);
  }
Пример #5
0
 @Override
 public Field getField(Object propertyId) {
   if (valueId.equals(propertyId)) {
     TextArea field = new TextArea();
     field.setNullRepresentation("");
     field.setValue(formField.getValue());
     return field;
   }
   if (API.JSON_FORM.equals(propertyId)) {
     ReadOnly field = new ReadOnly(templateRef);
     field.setCaption("Форма");
     return field;
   }
   return null;
 }
Пример #6
0
    @Override
    public Field createField(Item item, Object propertyId, Component uiContext) {
      Field f;

      if ("annexNote".equals(propertyId)) {
        f = new TextArea();
        ((TextArea) f).setInputPrompt("Note at bottom of receipts");
        ((TextArea) f).setColumns(25);
      } else {
        f = super.createField(item, propertyId, uiContext);
      }

      if (f instanceof TextArea) {
        ((TextArea) f).setNullRepresentation("");
      }

      return f;
    }
Пример #7
0
  private void initComponents() {
    nameField.setNullRepresentation("");
    descriptionField.setNullRepresentation("");
    commentField.setNullRepresentation("");
    codeField.setNullRepresentation("");
    vatField.setNullRepresentation("");
    phoneField.setNullRepresentation("");
    faxField.setNullRepresentation("");
    mobileField.setNullRepresentation("");
    facebookIdField.setNullRepresentation("");
    emailField.setNullRepresentation("");

    userOrganizationCollectionField.setCaption("Organizaciones");

    codeField.setRequiredError(codeField.getCaption() + " es un campo requerido");
    clientGroupField.setRequiredError(clientGroupField.getCaption() + " es un campo requerido");
    clientTypeField.setRequiredError(clientTypeField.getCaption() + " es un campo requerido");

    codeField.focus();
  }
Пример #8
0
  private void createEditorArea() {
    Panel editorArea = new Panel();

    GridLayout grid = new GridLayout(2, 3);
    grid.setSizeFull();
    grid.setSpacing(true);
    keyLabel = new Label();
    keyLabel.setValue(Messages.getString("PropertiesEditor_NO_SELECTION_LABEL")); // $NON-NLS-1$
    grid.addComponent(keyLabel, 0, 0, 1, 0);
    grid.setColumnExpandRatio(0, 1.0f);
    grid.setColumnExpandRatio(1, 1.0f);
    orignal = new TextArea();
    orignal.setRows(3);
    orignal.setReadOnly(true);
    orignal.setWidth(100, TextArea.UNITS_PERCENTAGE);

    grid.addComponent(orignal);

    translated = new TextArea();
    translated.setRows(3);
    translated.setInvalidCommitted(true);
    translated.setWidth(100, TextArea.UNITS_PERCENTAGE);

    translated.setNullRepresentation(""); // $NON-NLS-1$
    translated.addListener((TextChangeListener) this);
    translated.setWriteThrough(true);
    translated.setImmediate(true);
    translated.setTextChangeEventMode(TextChangeEventMode.LAZY);
    translated.setTextChangeTimeout(500);

    grid.addComponent(translated);

    orignalComment = new TextArea();
    orignalComment.setReadOnly(true);
    orignalComment.setWidth(100, TextArea.UNITS_PERCENTAGE);
    orignalComment.setRows(3);
    orignalComment.setNullRepresentation(""); // $NON-NLS-1$
    grid.addComponent(orignalComment);

    translatedComment = new TextArea();
    translatedComment.setImmediate(true);
    translatedComment.setWidth(100, TextArea.UNITS_PERCENTAGE);
    translatedComment.setRows(3);

    translatedComment.setNullRepresentation(""); // $NON-NLS-1$
    translatedComment.setInputPrompt(
        Messages.getString("PropertiesEditor_COMMENT_INPUT_PROMPT")); // $NON-NLS-1$
    translatedComment.setWriteThrough(true);
    translatedComment.addListener((TextChangeListener) this);
    grid.addComponent(translatedComment);

    safeButton = new Button();
    safeButton.setEnabled(false);
    safeButton.setCaption(
        Messages.getString("PropertiesEditor_SAVE_BUTTON_CAPTION")); // $NON-NLS-1$
    safeButton.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {

            setDirty(false);
            PropertyPersistenceService propertyPersistence =
                MainDashboard.getCurrent().getPropertyPersistence();
            propertyPersistence.saveProperties(descriptor, target);
            layout
                .getWindow()
                .showNotification(
                    Messages.getString("PropertiesEditor_SAVED_CONFIRMATION_DIALOG_TITLE"),
                    descriptor.getLocation().lastSegment()); // $NON-NLS-1$
          }
        });
    editorArea.setContent(grid);

    HorizontalLayout buttonArea = new HorizontalLayout();
    buttonArea.setSpacing(true);
    layout.addComponent(editorArea);
    layout.setExpandRatio(editorArea, 0);
    buttonArea.addComponent(safeButton);

    Button editTemplate =
        new Button(
            Messages.getString("PropertiesEditor_EDIT_TEMPLATE_BUTTON_CAPTION")); // $NON-NLS-1$
    editTemplate.addListener(
        new ClickListener() {

          @Override
          public void buttonClick(ClickEvent event) {
            BreadCrumb crumb = MainDashboard.getCurrent().getBreadcrumbs();
            crumb.walkTo("?master"); // $NON-NLS-1$
          }
        });
    buttonArea.addComponent(editTemplate);
    layout.addComponent(buttonArea);
    layout.setExpandRatio(buttonArea, 0);
  }
  private Component buildProfileTab() {
    HorizontalLayout root = new HorizontalLayout();
    root.setCaption("Profile");
    root.setIcon(FontAwesome.USER);
    root.setWidth(100.0f, Unit.PERCENTAGE);
    root.setSpacing(true);
    root.setMargin(true);
    root.addStyleName("profile-form");

    VerticalLayout pic = new VerticalLayout();
    pic.setSizeUndefined();
    pic.setSpacing(true);
    Image profilePic = new Image(null, new ThemeResource("img/profile-pic-300px.jpg"));
    profilePic.setWidth(100.0f, Unit.PIXELS);
    pic.addComponent(profilePic);

    Button upload =
        new Button(
            "Change…",
            event -> {
              Notification.show("Not implemented in this demo");
            });
    upload.addStyleName(ValoTheme.BUTTON_TINY);
    pic.addComponent(upload);

    root.addComponent(pic);

    FormLayout details = new FormLayout();
    details.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    root.addComponent(details);
    root.setExpandRatio(details, 1);

    firstNameField = new TextField("First Name");
    details.addComponent(firstNameField);
    lastNameField = new TextField("Last Name");
    details.addComponent(lastNameField);

    titleField = new ComboBox("Title");
    titleField.setInputPrompt("Please specify");
    titleField.addItem("Mr.");
    titleField.addItem("Mrs.");
    titleField.addItem("Ms.");
    titleField.setNewItemsAllowed(true);
    details.addComponent(titleField);

    sexField = new OptionGroup("Sex");
    sexField.addItem(Boolean.FALSE);
    sexField.setItemCaption(Boolean.FALSE, "Female");
    sexField.addItem(Boolean.TRUE);
    sexField.setItemCaption(Boolean.TRUE, "Male");
    sexField.addStyleName("horizontal");
    details.addComponent(sexField);

    Label section = new Label("Contact Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    emailField = new TextField("Email");
    emailField.setWidth("100%");
    emailField.setRequired(true);
    emailField.setNullRepresentation("");
    details.addComponent(emailField);

    locationField = new TextField("Location");
    locationField.setWidth("100%");
    locationField.setNullRepresentation("");
    locationField.setComponentError(new UserError("This address doesn't exist"));
    details.addComponent(locationField);

    phoneField = new TextField("Phone");
    phoneField.setWidth("100%");
    phoneField.setNullRepresentation("");
    details.addComponent(phoneField);

    newsletterField = new OptionalSelect<>();
    newsletterField.addOption(0, "Daily");
    newsletterField.addOption(1, "Weekly");
    newsletterField.addOption(2, "Monthly");
    details.addComponent(newsletterField);

    section = new Label("Additional Info");
    section.addStyleName(ValoTheme.LABEL_H4);
    section.addStyleName(ValoTheme.LABEL_COLORED);
    details.addComponent(section);

    websiteField = new TextField("Website");
    websiteField.setInputPrompt("http://");
    websiteField.setWidth("100%");
    websiteField.setNullRepresentation("");
    details.addComponent(websiteField);

    bioField = new TextArea("Bio");
    bioField.setWidth("100%");
    bioField.setRows(4);
    bioField.setNullRepresentation("");
    details.addComponent(bioField);

    return root;
  }