Example usage for org.apache.wicket.markup.repeater RepeatingView newChildId

List of usage examples for org.apache.wicket.markup.repeater RepeatingView newChildId

Introduction

In this page you can find the example usage for org.apache.wicket.markup.repeater RepeatingView newChildId.

Prototype

public String newChildId() 

Source Link

Document

Generates a unique id string.

Usage

From source file:au.com.scds.isis.viewer.wicket.ui.components.entity.properties.MyEntityPropertiesForm.java

License:Apache License

private boolean addPropertiesInColumn(MarkupContainer markupContainer, MemberGroupLayoutHint hint,
        ColumnSpans columnSpans) {/*  w  w w  .java 2s . c  o m*/
    final int span = hint.from(columnSpans);

    final EntityModel entityModel = (EntityModel) getModel();
    final ObjectAdapter adapter = entityModel.getObject();
    final ObjectSpecification objSpec = adapter.getSpecification();

    final List<ObjectAssociation> associations = visibleProperties(adapter, objSpec, Where.OBJECT_FORMS);

    final RepeatingView memberGroupRv = new RepeatingView(ID_MEMBER_GROUP);
    markupContainer.add(memberGroupRv);

    Map<String, List<ObjectAssociation>> associationsByGroup = ObjectAssociation.Util
            .groupByMemberOrderName(associations);

    final List<String> groupNames = ObjectSpecifications.orderByMemberGroups(objSpec,
            associationsByGroup.keySet(), hint);
    //TODO remove      System.out.println(">>>" + groupNames.toString());

    for (String groupName : groupNames) {
        final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName);
        if (associationsInGroup == null) {
            continue;
        }

        final WebMarkupContainer memberGroupRvContainer = new WebMarkupContainer(memberGroupRv.newChildId());
        memberGroupRv.add(memberGroupRvContainer);
        memberGroupRvContainer.add(new Label(ID_MEMBER_GROUP_NAME, groupName));

        final List<LinkAndLabel> memberGroupActions = Lists.newArrayList();

        final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES);
        memberGroupRvContainer.add(propertyRv);

        @SuppressWarnings("unused")
        Component component;
        for (final ObjectAssociation association : associationsInGroup) {
            final WebMarkupContainer propertyRvContainer = new UiHintPathSignificantWebMarkupContainer(
                    propertyRv.newChildId());
            propertyRv.add(propertyRvContainer);

            addPropertyToForm(entityModel, (OneToOneAssociation) association, propertyRvContainer,
                    memberGroupActions);
        }

        final List<LinkAndLabel> actionsPanel = LinkAndLabel.positioned(memberGroupActions,
                ActionLayout.Position.PANEL);
        final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel.positioned(memberGroupActions,
                ActionLayout.Position.PANEL_DROPDOWN);

        AdditionalLinksPanel.addAdditionalLinks(memberGroupRvContainer, ID_ASSOCIATED_ACTION_LINKS_PANEL,
                actionsPanel, AdditionalLinksPanel.Style.INLINE_LIST);
        AdditionalLinksPanel.addAdditionalLinks(memberGroupRvContainer,
                ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN, actionsPanelDropDown,
                AdditionalLinksPanel.Style.DROPDOWN);
    }

    addClassForSpan(markupContainer, span);
    return !groupNames.isEmpty();
}

From source file:com.apachecon.memories.Gallery.java

License:Apache License

public Gallery(String id, IModel<List<UserFile>> model) {
    super(id);/*  www . ja  v a2  s. c  o  m*/

    RepeatingView frames = new RepeatingView("frames");

    List<List<UserFile>> partitions = Partition.partition(model.getObject(), 12);
    int page = 0;

    for (List<UserFile> files : partitions) {
        WebMarkupContainer container = new WebMarkupContainer(frames.newChildId());
        frames.add(container);

        RepeatingView items = new RepeatingView("items");
        container.add(items);

        for (UserFile file : files) {
            WebMarkupContainer secondContainer = new WebMarkupContainer(items.newChildId());
            items.add(secondContainer);

            secondContainer.add(file.createSmallThumb("thumb"));

            enrich(secondContainer, file, page);
        }
        page++;
    }

    add(frames);
}

From source file:com.apachecon.memories.Thumbs.java

License:Apache License

public Thumbs(String id, int maxElems, int rowElements, IModel<List<UserFile>> model) {
    super(id, model);

    RepeatingView repeater = new RepeatingView("items");
    int itemCount = 0;
    for (UserFile file : model.getObject()) {
        MarkupContainer container = new WebMarkupContainer(repeater.newChildId());
        Link link = new BookmarkablePageLink("link", Upload.class);
        link.add(file.createSmallThumb("thumb"));
        container.add(link);//from   w  ww .  j  ava  2 s. c o m

        repeater.add(container);

        if (++itemCount % rowElements == 0) {
            container.add(AttributeModifier.append("class", "last"));
        }

        if (itemCount == maxElems) {
            break;
        }
    }

    add(repeater);
}

From source file:com.cubeia.network.shared.web.wicket.navigation.Breadcrumbs.java

License:Open Source License

private void addBreadCrumb(PageNode node, RepeatingView rv) {
    if (node.getParent() != null) {
        addBreadCrumb(node.getParent(), rv);
    }//w ww . j a v a2s . c o  m
    AbstractItem ai = new AbstractItem(rv.newChildId());
    WebMarkupContainer link = null;
    if (node.isLinkable()) {
        link = new BookmarkablePageLink("link", node.getPageClass());
    } else {
        link = new WebMarkupContainer("link");
    }
    ai.add(link);
    link.add(new Label("title", node.getTitle()));
    WebMarkupContainer icon = new WebMarkupContainer("icon");
    if (node.hasIcon()) {
        icon.add(AttributeModifier.replace("class", node.getIcon()));
    } else {
        icon.add(AttributeModifier.replace("class", "hide"));
    }
    link.add(icon);
    rv.add(ai);
}

From source file:com.cubeia.network.shared.web.wicket.navigation.MenuPanel.java

License:Open Source License

private void createMenuItems(List<PageNode> pages, Class<? extends Page> currentPageClass, RepeatingView rv) {
    for (PageNode n : pages) {
        if (!n.isLinkable()) {
            continue;
        }//from w  w  w  .  ja  v  a2  s.  c  o  m
        AbstractItem item = new AbstractItem(rv.newChildId());
        item.add(createMenuItem(n));
        boolean linkableChildren = n.hasLinkableChildren();
        if (n.isRelatedTo(currentPageClass)) {

            if (linkableChildren) {
                item.add(AttributeModifier.append("class", "open"));
            }
            if (n.getPageClass() != null) {
                item.add(AttributeModifier.append("class", "active"));
            }
        }
        if (linkableChildren) {
            item.add(AttributeModifier.append("class", "submenu"));
            item.add(new MenuPanel("children", n.getChildren(), currentPageClass));
        } else {
            item.add(new WebMarkupContainer("children"));
        }
        rv.add(item);
    }
}

From source file:com.evolveum.midpoint.web.component.assignment.MetadataPanel.java

License:Apache License

private void initLayout() {
    WebMarkupContainer metadataBlock = new WebMarkupContainer(ID_METADATA_BLOCK);
    metadataBlock.setOutputMarkupId(true);
    add(metadataBlock);//w w  w.  java 2  s .  c om

    WebMarkupContainer headerContainer = new WebMarkupContainer(ID_HEADER_CONTAINER);
    headerContainer.setOutputMarkupId(true);
    headerContainer.add(new AttributeAppender("class", "prism-header " + additionalHeaderStyle));
    metadataBlock.add(headerContainer);

    Label metadataHeader = new Label(ID_METADATA_LABEL,
            createStringResource("AssignmentEditorPanel.metadataBlock", header != null ? header : ""));
    metadataHeader.setOutputMarkupId(true);
    headerContainer.add(metadataHeader);

    RepeatingView metadataRowRepeater = new RepeatingView(ID_METADATA_ROW);
    metadataBlock.add(metadataRowRepeater);
    for (QName qname : metadataFieldsList) {
        WebMarkupContainer metadataRow = new WebMarkupContainer(metadataRowRepeater.newChildId());
        metadataRow.setOutputMarkupId(true);
        if (metadataFieldsList.indexOf(qname) % 2 != 0) {
            metadataRow.add(new AttributeAppender("class", "stripe"));
        }
        metadataRowRepeater.add(metadataRow);

        metadataRow.add(
                new Label(ID_METADATA_PROPERTY_KEY, createStringResource(DOT_CLASS + qname.getLocalPart())));

        IModel<String> metadataFieldModel = new IModel<String>() {
            @Override
            public String getObject() {
                PropertyModel<Object> tempModel = new PropertyModel<>(getModel(), qname.getLocalPart());
                if (tempModel.getObject() instanceof XMLGregorianCalendar) {
                    return WebComponentUtil.getLocalizedDate((XMLGregorianCalendar) tempModel.getObject(),
                            DateLabelComponent.MEDIUM_MEDIUM_STYLE);
                } else if (tempModel.getObject() instanceof ObjectReferenceType) {
                    ObjectReferenceType ref = (ObjectReferenceType) tempModel.getObject();
                    return WebComponentUtil.getName(ref, getPageBase(), OPERATION_LOAD_USER);
                } else if (tempModel.getObject() instanceof List) {
                    List list = (List) tempModel.getObject();
                    String result = "";
                    for (Object o : list) {
                        if (o instanceof ObjectReferenceType) {
                            if (result.length() > 0) {
                                result += ", ";
                            }
                            result += WebComponentUtil.getName((ObjectReferenceType) o, getPageBase(),
                                    OPERATION_LOAD_USER);
                        }
                    }
                    return result;
                }
                return "";
            }
        };
        metadataRow.add(new Label(ID_METADATA_FILED, metadataFieldModel));
        metadataRow.add(new VisibleEnableBehaviour() {
            @Override
            public boolean isVisible() {
                return StringUtils.isNotEmpty(metadataFieldModel.getObject());
            }
        });

    }

}

From source file:com.evolveum.midpoint.web.component.data.column.ColumnUtils.java

License:Apache License

private static <T> PropertyColumn<T, String> createPropertyColumn(String name, String sortableProperty,
        final String expression, final boolean multivalue) {

    return new PropertyColumn<T, String>(createStringResource(name), sortableProperty, expression) {
        private static final long serialVersionUID = 1L;

        @Override/*  ww  w  .  jav a  2s .  c om*/
        public void populateItem(Item item, String componentId, IModel rowModel) {
            if (multivalue) {
                IModel<List> values = new PropertyModel<List>(rowModel, expression);
                RepeatingView repeater = new RepeatingView(componentId);
                for (final Object task : values.getObject()) {
                    repeater.add(new Label(repeater.newChildId(), task.toString()));
                }
                item.add(repeater);
                return;
            }

            super.populateItem(item, componentId, rowModel);
        }
    };

}

From source file:com.evolveum.midpoint.web.component.data.MultiButtonPanel2.java

License:Apache License

private void initLayout() {
    RepeatingView buttons = new RepeatingView(ID_BUTTONS);
    add(buttons);//from  ww  w . ja  v a  2  s.  c  o m

    for (int id = 0; id < numberOfButtons; id++) {
        AjaxIconButton button = createButton(id, buttons.newChildId(), getModel());
        if (button != null) {
            buttons.add(button);
        }
    }
}

From source file:com.evolveum.midpoint.web.component.input.MultiStateHorizontalButton.java

License:Apache License

private void initLayout() {
    WebMarkupContainer buttonsPanel = new WebMarkupContainer(ID_BUTTONS_CONTAINER);
    buttonsPanel.setOutputMarkupId(true);
    add(buttonsPanel);// w  ww .  ja  v a  2 s .c  o m

    RepeatingView buttons = new RepeatingView(ID_BUTTON);
    buttons.setOutputMarkupId(true);
    buttonsPanel.add(buttons);

    for (String propertyKey : propertyKeysList) {
        AjaxSubmitButton button = new AjaxSubmitButton(buttons.newChildId(),
                pageBase.createStringResource(propertyKey)) {
            @Override
            public void onSubmit(AjaxRequestTarget ajaxRequestTarget) {
                MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey),
                        ajaxRequestTarget);
            }

            @Override
            public void onError(AjaxRequestTarget ajaxRequestTarget) {
                MultiStateHorizontalButton.this.onStateChanged(propertyKeysList.indexOf(propertyKey),
                        ajaxRequestTarget);
            }
        };
        button.add(getActiveButtonClassAppender(propertyKeysList.indexOf(propertyKey)));
        button.setOutputMarkupId(true);
        buttons.add(button);
    }

}

From source file:com.evolveum.midpoint.web.component.objectdetails.FocusPersonasTabPanel.java

License:Apache License

private void initLayout(ModelServiceLocator serviceLocator) {
    WebMarkupContainer container = new WebMarkupContainer(ID_PERSONAS_CONTAINER);
    container.setOutputMarkupId(true);/*from   w w  w  .  j a va  2 s . co m*/
    add(container);

    RepeatingView view = new RepeatingView(ID_PERSONAS_TABLE);
    view.setOutputMarkupId(true);
    container.add(view);

    LoadableModel<List<PrismObject<FocusType>>> personasListModel = loadModel();
    if (personasListModel.getObject() == null || personasListModel.getObject().size() == 0) {
        WebMarkupContainer viewChild = new WebMarkupContainer(view.newChildId());
        viewChild.setOutputMarkupId(true);
        view.add(viewChild);

        WebMarkupContainer emptyContainer = new WebMarkupContainer(ID_PERSONAS_SUMMARY);
        emptyContainer.setOutputMarkupId(true);
        viewChild.add(emptyContainer);
        return;
    }
    Task task = pageBase.createSimpleTask(OPERATION_LOAD_PERSONAS);
    for (PrismObject<FocusType> personaObject : personasListModel.getObject()) {
        ObjectWrapper<FocusType> personaWrapper = ObjectWrapperUtil.createObjectWrapper(
                WebComponentUtil.getEffectiveName(personaObject, RoleType.F_DISPLAY_NAME), "", personaObject,
                ContainerStatus.MODIFYING, task, getPageBase());

        WebMarkupContainer personaPanel = new WebMarkupContainer(view.newChildId());
        personaPanel.setOutputMarkupId(true);
        view.add(personaPanel);

        FocusSummaryPanel.addSummaryPanel(personaPanel, personaObject, personaWrapper, ID_PERSONAS_SUMMARY,
                serviceLocator);
    }

}