private boolean nobodyWantsAround(SortItem<T> item) { boolean res = true; for (SortItem<T> o : list) { if (o.getAround().contains(item)) { res = false; break; } } return res; }
private SortItem<T> getInmost() { SortItem<T> res = null; for (SortItem<T> o : list) { if (o.getWithin().isEmpty() && nobodyWantsAround(o)) { res = o; break; } } return res; }
/** * 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; }
private void remove(SortItem<T> item) { list.remove(item); for (SortItem<T> o : list) { o.getWithin().remove(item); } }
/** 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); }
/** Pause for a while. */ protected void pause() throws Exception { if (stopRequested) { throw new Exception("Sort Algorithm"); } parent.pause(parent.h1, parent.h2); }