public String getId() { return getOneToManyAssociation().getName(); }
protected AddItemToCollectionTask(final Context context, final NakedObject target, final OneToManyAssociation fld) { super(context, "Add to collection", "", target, 1); names[0] = fld.getName(); descriptions[0] = fld.getDescription(); fieldSpecifications[0] = fld.getSpecification(); initialState[0] = null; optional[0] = true; // TODO add defaults and options this.field = fld; }
public AddItemToCollectionTask(final Context context, final NakedObject target, final OneToManyAssociation fld) { super(context, "Add to collection", "", target, 1); names[0] = fld.getName(); descriptions[0] = fld.getDescription(); fieldSpecifications[0] = fld.getSpecification(); initialState[0] = null; optional[0] = true; // TODO add defaults and options this.field = fld; }
public static Table createTable( final Context context, final String id, final NakedObject object, final OneToManyAssociation collectionField) { final NakedObject collection = collectionField.get(object); final String name = collectionField.getName(); final NakedObjectSpecification type = collectionField.getSpecification(); final String summary = "Table showing elements of " + name + " field"; return createTable(context, collectionField != null, collection, summary, type); }
public static Table createTable( final Context context, final String id, final NakedObject object, final OneToManyAssociation collectionField) { final NakedObject collection = collectionField.get(object); final String name = collectionField.getName(); final NakedObjectSpecification type = collectionField.getSpecification(); final String summary = "Table showing elements of " + name + " field"; return createTable(context, collectionField != null, collection, summary, type); }
@Override protected void doExecute(final Context context, final ViewPane content, final NakedObject object, final String field) { final String id = context.mapObject(object); final NakedObjectSpecification specification = object.getSpecification(); final OneToManyAssociation collection = (OneToManyAssociation) specification.getAssociation(field); NakedObjectsContext.getPersistenceSession().resolveField(object, collection); context.addCollectionFieldCrumb(collection.getName()); content.add(context.getComponentFactory().createHeading(collection.getName())); final Table table = TableUtil.createTable(context, id, object, collection); content.add(table); if (collection.isUsable(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) { content.add(context.getComponentFactory().createAddOption(id, collection.getId())); } }
@Override protected void doExecute(final Context context, final ViewPane content, final NakedObject object, final String field) { final String id = context.mapObject(object); final NakedObjectSpecification specification = object.getSpecification(); final OneToManyAssociation collection = (OneToManyAssociation) specification.getAssociation(field); NakedObjectsContext.getPersistenceSession().resolveField(object, collection); context.addCollectionFieldCrumb(collection.getName()); content.add(context.getComponentFactory().createHeading(collection.getName())); final Table table = TableBuilder.createTable(context, id, object, collection); content.add(table); if (collection.isUsable(NakedObjectsContext.getAuthenticationSession(), object).isAllowed()) { content.add(context.getComponentFactory().createAddOption(id, collection.getId())); } }