Package org.apache.isis.core.metamodel.facets.object.membergroups

Examples of org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet


     */
    public String asJson(ObjectSpecification objectSpec) {
        final LayoutMetadata metadata = new LayoutMetadata();
        metadata.setColumns(Lists.<ColumnRepr>newArrayList());
       
        final MemberGroupLayoutFacet mglf = objectSpec.getFacet(MemberGroupLayoutFacet.class);
        final ColumnSpans columnSpans = mglf.getColumnSpans();
       
        Set<String> actionIdsForAssociations = Sets.newTreeSet();
       
        ColumnRepr columnRepr;
       
View Full Code Here


            return 0;
        }
    }

    public static List<String> orderByMemberGroups(ObjectSpecification objSpec, Set<String> groupNamesToOrder, MemberGroupLayoutHint memberGroupLayoutHint) {
        final MemberGroupLayoutFacet facet = objSpec.getFacet(MemberGroupLayoutFacet.class);
        final List<String> leftColumnGroupNames = Lists.newArrayList(groupNamesToOrder);
       
        // not expected to happen
        if(facet == null) {
            return leftColumnGroupNames;
        }
       
        if(memberGroupLayoutHint == MemberGroupLayoutHint.MIDDLE) {
            return facet.getColumnSpans().getMiddle()>0? facet.getMiddle(): Collections.<String>emptyList();
        }
        if(memberGroupLayoutHint == MemberGroupLayoutHint.RIGHT) {
            return facet.getColumnSpans().getRight()>0? facet.getRight(): Collections.<String>emptyList();
        }
       
        // else left; per the requested order, including any groups not mentioned in either list,
        // but excluding any groups in the middle or right columns
        final List<String> groupNamedInRequiredOrder = facet.getLeft();
        final List<String> order = order(leftColumnGroupNames, groupNamedInRequiredOrder);
       
        if(facet.getColumnSpans().getMiddle() > 0) {
            order.removeAll(facet.getMiddle());
        }
        if(facet.getColumnSpans().getRight() > 0) {
            order.removeAll(facet.getRight());
        }
        return order;
    }
View Full Code Here

    private Visitor newValidatorVisitor() {
        return new MetaModelValidatorVisiting.Visitor() {

            @Override
            public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
                MemberGroupLayoutFacet facet = objectSpec.getFacet(MemberGroupLayoutFacet.class);
                ColumnSpans columnSpans = facet.getColumnSpans();
                final List<String> middle = facet.getMiddle();
                final List<String> right = facet.getRight();
                final int numCollections = numCollectionsOf(objectSpec);

                if(columnSpans.getMiddle() == 0 && !middle.isEmpty()) {
                    validationFailures.add("%s MemberGroupLayout: middle (property) column is 0 for ColumnSpans (%s), but groups have been listed (%s).  NB: ColumnSpans may have been defaulted if could not be parsed.", objectSpec.getIdentifier().getClassName(), columnSpans.name(), middle);
                }
View Full Code Here

    // sorting
    // //////////////////////////////////////////////////////////////////////
   
    protected List<ObjectAssociation> sortAssociations(final List<ObjectAssociation> associations) {
        final DeweyOrderSet orderSet = DeweyOrderSet.createOrderSet(associations);
        final MemberGroupLayoutFacet memberGroupLayoutFacet = this.getFacet(MemberGroupLayoutFacet.class);
       
        if(memberGroupLayoutFacet != null) {
            final List<String> groupOrder = Lists.newArrayList();
            groupOrder.addAll(memberGroupLayoutFacet.getLeft());
            groupOrder.addAll(memberGroupLayoutFacet.getMiddle());
            groupOrder.addAll(memberGroupLayoutFacet.getRight());
           
            orderSet.reorderChildren(groupOrder);
        }
        final List<ObjectAssociation> orderedAssociations = Lists.newArrayList();
        sortAssociations(orderSet, orderedAssociations);
View Full Code Here

     */
    public String asJson(ObjectSpecification objectSpec) {
        final LayoutMetadata metadata = new LayoutMetadata();
        metadata.setColumns(Lists.<ColumnRepr>newArrayList());
       
        final MemberGroupLayoutFacet mglf = objectSpec.getFacet(MemberGroupLayoutFacet.class);
        final ColumnSpans columnSpans = mglf.getColumnSpans();
       
        Set<String> actionIdsForAssociations = Sets.newTreeSet();
       
        ColumnRepr columnRepr;
       
View Full Code Here

    private Visitor newValidatorVisitor() {
        return new MetaModelValidatorVisiting.Visitor() {

            @Override
            public boolean visit(ObjectSpecification objectSpec, ValidationFailures validationFailures) {
                MemberGroupLayoutFacet facet = objectSpec.getFacet(MemberGroupLayoutFacet.class);
                ColumnSpans columnSpans = facet.getColumnSpans();
                final List<String> middle = facet.getMiddle();
                final List<String> right = facet.getRight();
                final int numCollections = numCollectionsOf(objectSpec);

                if(columnSpans.getMiddle() == 0 && !middle.isEmpty()) {
                    validationFailures.add("%s MemberGroupLayout: middle (property) column is 0 for ColumnSpans (%s), but groups have been listed (%s).  NB: ColumnSpans may have been defaulted if could not be parsed.", objectSpec.getIdentifier().getClassName(), columnSpans.name(), middle);
                }
View Full Code Here

    // sorting
    // //////////////////////////////////////////////////////////////////////
   
    protected List<ObjectAssociation> sortAssociations(final List<ObjectAssociation> associations) {
        final DeweyOrderSet orderSet = DeweyOrderSet.createOrderSet(associations);
        final MemberGroupLayoutFacet memberGroupLayoutFacet = this.getFacet(MemberGroupLayoutFacet.class);
       
        if(memberGroupLayoutFacet != null) {
            final List<String> groupOrder = Lists.newArrayList();
            groupOrder.addAll(memberGroupLayoutFacet.getLeft());
            groupOrder.addAll(memberGroupLayoutFacet.getMiddle());
            groupOrder.addAll(memberGroupLayoutFacet.getRight());
           
            orderSet.reorderChildren(groupOrder);
        }
        final List<ObjectAssociation> orderedAssociations = Lists.newArrayList();
        sortAssociations(orderSet, orderedAssociations);
View Full Code Here

     */
    public String asJson(ObjectSpecification objectSpec) {
        final LayoutMetadata metadata = new LayoutMetadata();
        metadata.setColumns(Lists.<ColumnRepr>newArrayList());
       
        final MemberGroupLayoutFacet mglf = objectSpec.getFacet(MemberGroupLayoutFacet.class);
        final ColumnSpans columnSpans = mglf.getColumnSpans();
       
        Set<String> actionIdsForAssociations = Sets.newTreeSet();
       
        ColumnRepr columnRepr;
       
View Full Code Here

    // sorting
    // //////////////////////////////////////////////////////////////////////
   
    protected List<ObjectAssociation> sortAssociations(final List<ObjectAssociation> associations) {
        final DeweyOrderSet orderSet = DeweyOrderSet.createOrderSet(associations);
        final MemberGroupLayoutFacet memberGroupLayoutFacet = this.getFacet(MemberGroupLayoutFacet.class);
       
        if(memberGroupLayoutFacet != null) {
            final List<String> groupOrder = Lists.newArrayList();
            groupOrder.addAll(memberGroupLayoutFacet.getLeft());
            groupOrder.addAll(memberGroupLayoutFacet.getMiddle());
            groupOrder.addAll(memberGroupLayoutFacet.getRight());
           
            orderSet.reorderChildren(groupOrder);
        }
        final List<ObjectAssociation> orderedAssociations = Lists.newArrayList();
        sortAssociations(orderSet, orderedAssociations);
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.