Ejemplo n.º 1
0
 private boolean nobodyWantsAround(SortItem<T> item) {
   boolean res = true;
   for (SortItem<T> o : list) {
     if (o.getAround().contains(item)) {
       res = false;
       break;
     }
   }
   return res;
 }
Ejemplo n.º 2
0
 private SortItem<T> getInmost() {
   SortItem<T> res = null;
   for (SortItem<T> o : list) {
     if (o.getWithin().isEmpty() && nobodyWantsAround(o)) {
       res = o;
       break;
     }
   }
   return res;
 }
Ejemplo n.º 3
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;
  }
Ejemplo n.º 4
0
 private void remove(SortItem<T> item) {
   list.remove(item);
   for (SortItem<T> o : list) {
     o.getWithin().remove(item);
   }
 }
Ejemplo n.º 5
0
 /** Pause for a while and mark item 1 & 2. */
 protected void pause(int H1, int H2) throws Exception {
   if (stopRequested) {
     throw new Exception("Sort Algorithm");
   }
   parent.pause(H1, H2);
 }
Ejemplo n.º 6
0
 /** Pause for a while. */
 protected void pause() throws Exception {
   if (stopRequested) {
     throw new Exception("Sort Algorithm");
   }
   parent.pause(parent.h1, parent.h2);
 }