Exemple #1
0
  /**
   * Create the default view for this entity. The view contains all properties except References,
   * Collections and BinaryData. It has simple form with VerticalPanel, containing default widgets
   * for all properties, obtained from Property.widget() method
   *
   * @return The default view
   * @see Property
   */
  protected View initDefaultView() {
    View retval = new View(this);

    Form form = new Form(true);
    Panel layout = Panel.column();

    for (Property<? extends Serializable> prop : properties) {
      if (!((prop instanceof Reference)
          || (prop instanceof Collection)
          || (prop.getType().equals(BinaryData.class)))) {
        retval.addProperty(prop);
      }
      layout.add(prop.widget());
    }
    form.setLayout(layout);
    retval.setForm(form);
    if (retval.getProperties().size() > 0) {
      Property<? extends Serializable> prop = retval.getProperties().get(0);
      retval.addSortDescriptor("Default", prop.getLocalizationKey(), SortItem.ascending(prop));
    }
    return retval;
  }