Java Code Examples for org.apache.wicket.markup.html.list.ListView

The following are top voted examples for showing how to use org.apache.wicket.markup.html.list.ListView. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: geoserver-documentor   File: DocumentationIndexPage.java   View source code 6 votes vote down vote up
public DocumentationIndexPage() {
	Harvester harvester = new Harvester();
	
	@SuppressWarnings({ "unchecked", "rawtypes" })
	ListView listview = new ListView("listview", harvester.getWorkspaces()) {
	    /**
		 * 
		 */
		private static final long serialVersionUID = 2974513833506276491L;

		protected void populateItem(ListItem item) {
	    	WorkspaceDoc wi = (WorkspaceDoc) item.getModelObject();
			BookmarkablePageLink link = new BookmarkablePageLink("link", WorkspacePage.class);
			link.setParameter("workspaceName", wi.getName());
			link.add(new Label("workspaceName", wi.getName()));
	        item.add(link);
	    }
	};
	add(listview);

	ExtensionInfo info = new ExtensionInfo();
	add(new Label("documentorVersion", info.getVersion()));
	add(new Label("documentorGitVersion", info.getGitVersion()));
	add(new Label("readme", info.getReadme()));
}
 
Example 2
Project: gitplex-mit   File: ReflectionBeanViewer.java   View source code 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new ListView<PropertyContext<Serializable>>("properties", propertyContexts) {

		@Override
		protected void populateItem(ListItem<PropertyContext<Serializable>> item) {
			PropertyContext<Serializable> propertyContext = item.getModelObject();
			Method propertyGetter = propertyContext.getPropertyGetter();
			Label nameLabel = new Label("name", EditableUtils.getName(propertyGetter));
			item.add(nameLabel);
			OmitName omitName = propertyGetter.getAnnotation(OmitName.class);

			if (omitName != null && omitName.value() != OmitName.Place.EDITOR) {
				nameLabel.setVisible(false);
				item.add(AttributeAppender.append("class", "name-omitted"));
			}

			Serializable bean = (Serializable) ReflectionBeanViewer.this.getDefaultModelObject();
			Serializable propertyValue = (Serializable) propertyContext.getPropertyValue(bean);
			item.add(propertyContext.renderForView("value", Model.of(propertyValue)));
		}

	});
}
 
Example 3
Project: openNaEF   File: LocationViewPage.java   View source code 6 votes vote down vote up
public LocationViewPage(PageParameters params) {
    Logger log = getLogger();
    try {
        AAAWebUtil.checkAAA(this, OPERATION_NAME);
        this.current = LocationUtil.getLocation(params);
        this.model = new LocationNodeModel(this.current);
        this.model.renew();
        log.debug("current location: " + current.getName());
        log.debug("param=" + params);
        ListView<BreadCrumbLink> breadcrumbList = LocationUtil.createBreadCrumbList(current);
        add(breadcrumbList);
        createHeader();
        populateLocation();
        populateNode();
        createAddLocationLink();
        createEditLocationLink();
        createDeleteLocationLink();
        createAddNodeLink();
        log.debug("end");
    } catch (Exception e) {
        throw ExceptionUtils.throwAsRuntime(e);
    }
}
 
Example 4
Project: openNaEF   File: LocationViewPage.java   View source code 6 votes vote down vote up
private void populateNode() throws ExternalServiceException, IOException, RemoteException {
    ListView<NodeDto> list = new ListView<NodeDto>("nodeList", this.model) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<NodeDto> item) {
            NodeDto node = item.getModelObject();
            BookmarkablePageLink<Void> link = NodePageUtil.createNodeLink("nodeLink", node);
            item.add(link);
        }
    };
    add(list);
    WebMarkupContainer container = new WebMarkupContainer("nodeBlock");
    add(container);
    container.setVisible(this.model.isVisible());
}
 
Example 5
Project: MasterStats   File: BasePage.java   View source code 6 votes vote down vote up
/**
 * generates the navbar and mark the active page
 *
 * @param activePage page to be marked active (null for no active page)
 */
private void loadNavbar(final PageType activePage) {
    // add an entry for each page type
    add(new ListView<PageType>("navbar_left_elements", Arrays.asList(PageType.values())) {
        @Override
        protected void populateItem(final ListItem<PageType> item) {
            final PageType type = item.getModelObject();
            // create a link for the page type
            BookmarkablePageLink<String> link = new BookmarkablePageLink<>("navbar_left_element_link", type.getPageClass());
            link.add(new Label("navbar_left_element_text", type.getLinkText()));
            // if the type is same as active page, mark it as active
            if (type.equals(activePage)) link.add(new AttributeAppender("class", "active", " "));
            item.add(link);
        }
    });

    // create the summoner search region drop down menu
    // get all valid entries
    List<String> endpoints = Arrays.asList(RiotEndpoint.PLAYABLE_ENDPOINTS)
            .stream().map(RiotEndpoint::name).collect(Collectors.toList());
    // add the options to the drop down menu
    DropDownChoice<String> dropDownChoice = new DropDownChoice<>("navbar_form_regions_select",
            new PropertyModel<>(this, "selectedRegion"), endpoints, new StringChoiceRenderer());
    dropDownChoice.add(new AttributeModifier("name", "region"));
    add(dropDownChoice);
}
 
Example 6
Project: engerek   File: SimpleRoleSelector.java   View source code 6 votes vote down vote up
private void initLayout() {
    setOutputMarkupId(true);
    ListView<PrismObject<R>> list = new ListView<PrismObject<R>>(ID_LIST, availableRoles) {
        @Override
        protected void populateItem(ListItem<PrismObject<R>> item) {
            item.add(createRoleLink(ID_ITEM, item.getModel()));
        }
    };
    list.setOutputMarkupId(true);
    add(list);

    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            reset();
            target.add(SimpleRoleSelector.this);
        }
    };
    buttonReset.setBody(createStringResource("SimpleRoleSelector.reset"));
    add(buttonReset);
}
 
Example 7
Project: engerek   File: DelegationEditorPanel.java   View source code 6 votes vote down vote up
private void addPrivilegesPanel(WebMarkupContainer body){
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames){
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item) {
            Label privilageNameLabel = new Label(ID_PRIVILEGE, item.getModel());
            item.add(privilageNameLabel);
        }
    };
    privilegesListComponent.setOutputMarkupId(true);
    privilegesListComponent.add(new VisibleEnableBehaviour(){
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible(){
            if (!UserDtoStatus.ADD.equals(getModelObject().getStatus())){
                return true;
            }
           return false;
        }
    });
    body.addOrReplace(privilegesListComponent);
}
 
Example 8
Project: engerek   File: ApprovalProcessesPreviewPanel.java   View source code 6 votes vote down vote up
private void initLayout() {
	ListView<ApprovalProcessExecutionInformationDto> list = new ListView<ApprovalProcessExecutionInformationDto>(ID_PROCESSES, getModel()) {
		@Override
		protected void populateItem(ListItem<ApprovalProcessExecutionInformationDto> item) {
			item.add(new Label(ID_NAME, LoadableModel.create(() -> {
				String targetName = item.getModelObject().getTargetName();
				if (targetName != null) {
					return ApprovalProcessesPreviewPanel.this.getString("ApprovalProcessesPreviewPanel.processRelatedTo", targetName);
				} else {
					return getString("ApprovalProcessesPreviewPanel.process");
				}
			}, false)));
			item.add(new ApprovalProcessExecutionInformationPanel(ID_PREVIEW, item.getModel()));
		}
	};
	add(list);
}
 
Example 9
Project: engerek   File: PrismObjectPanel.java   View source code 6 votes vote down vote up
private void addOrReplaceContainers(IModel<ObjectWrapper<O>> model, final Form form, boolean isToBeReplaced){
    ListView<ContainerWrapper> containers = new ListView<ContainerWrapper>(ID_CONTAINERS,
            createContainerModel(model)) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ContainerWrapper> item) {
            PrismContainerPanel containerPanel = createContainerPanel(item, form);
            createMetadataPanel(model, item, containerPanel);
        }
    };
    containers.setReuseItems(true);

    if (isToBeReplaced) {
        replace(containers);
    } else {
        add(containers);
    }
}
 
Example 10
Project: engerek   File: PrismContainerPanel.java   View source code 6 votes vote down vote up
private void addOrReplaceProperties(IModel<ContainerWrapper> model, final Form form, boolean isToBeReplaced){
     ListView<ItemWrapper> properties = new ListView<ItemWrapper>("properties",
             new PropertyModel(model, "properties")) {
private static final long serialVersionUID = 1L;

@Override
         protected void populateItem(final ListItem<ItemWrapper> item) {
             item.add(new PrismPropertyPanel("property", item.getModel(), form, pageBase));
             item.add(new VisibleEnableBehaviour() {
             	private static final long serialVersionUID = 1L;
             	
             	@Override
             	public boolean isVisible() {
             		return item.getModel().getObject().isVisible();
             	}
             });
             item.add(AttributeModifier.append("class", createStyleClassModel(item.getModel())));
         }
     };
     properties.setReuseItems(true);
     if (isToBeReplaced) {
         replace(properties);
     } else {
         add(properties);
     }
 }
 
Example 11
Project: engerek   File: InformationPanel.java   View source code 6 votes vote down vote up
private void initLayout() {
	Label titleLabel = new Label(ID_TITLE, new PropertyModel<>(getModel(), InformationType.F_TITLE.getLocalPart()));
	titleLabel.add(new VisibleBehaviour(() -> getModelObject().getTitle() != null));
	add(titleLabel);

	ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS,
			new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {
		@Override
		protected void populateItem(ListItem<InformationPartType> item) {
			InformationPartType part = item.getModelObject();
			Label label = new Label(ID_PART, part.getText());
			if (Boolean.TRUE.equals(part.isHasMarkup())) {
				label.setEscapeModelStrings(false);
			}
			item.add(label);
		}
	};
	add(list);
}
 
Example 12
Project: engerek   File: PageInternals.java   View source code 6 votes vote down vote up
private void initCounters() {
   	
   	ListView<InternalCounters> countersTable = new ListView<InternalCounters>(ID_COUNTERS_TABLE, Arrays.asList(InternalCounters.values())) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void populateItem(ListItem<InternalCounters> item) {
			InternalCounters counter = item.getModelObject();
			Label label = new Label(ID_COUNTER_LABEL, createStringResource("InternalCounters."+counter.getKey()));
			item.add(label);
	    	
	    	Label valueLabel = new Label(ID_COUNTER_VALUE, new AbstractReadOnlyModel<String>() {
				private static final long serialVersionUID = 1L;

				@Override
				public String getObject() {
					long val = InternalMonitor.getCount(counter);
					return Long.toString(val);
				}
			});
	    	item.add(valueLabel);
		}
   		
   	};
   	add(countersTable);
}
 
Example 13
Project: vlo-curation   File: BootstrapDropdown.java   View source code 6 votes vote down vote up
protected Component createMenu(String id) {
    final WebMarkupContainer menu = new WebMarkupContainer(id);
    menu.add(new ListView<DropdownMenuItem>("menuItem", getModel()) {
        @Override
        protected void populateItem(ListItem<DropdownMenuItem> item) {
            final DropdownMenuItem itemObject = item.getModelObject();
            //link that forms the menu item's action
            item.add(itemObject.getLink("link")
                    //link label defined by the menu item object
                    .add(new Label("label", itemObject.getLabel()))
                    //icon with icon class defined by the menu item object
                    .add(new WebMarkupContainer("icon")
                            .add(new AttributeModifier("class", itemObject.getIconClass())))
            );
        }
    });
    return menu;
}
 
Example 14
Project: singular-server   File: ExtensionButtonsPanel.java   View source code 6 votes vote down vote up
private void addButtons() {
    add(new ListView<RequirementButtonExtension>("buttons", extensions) {
        @Override
        protected void populateItem(ListItem<RequirementButtonExtension> item) {
            final RequirementButtonExtension itemModel = item.getModelObject();
            SingularSaveButton button = new SingularSaveButton("button", formModel, itemModel.shouldValidateForm()) {
                @Override
                protected void onValidationSuccess(AjaxRequestTarget target, Form<?> form, IModel<? extends SInstance> instanceModel) {
                    itemModel.onAction(new RequirementButtonExtension
                            .ActionContext(target, form, petInstanceModel.getObject(), instanceModel.getObject()));
                }
            };
            RequirementButtonExtension.ButtonView buttonView = itemModel.getButtonView();
            WebMarkupContainer                    icon       = new WebMarkupContainer("icon");
            if (buttonView.getIcon() != null) {
                icon.add($b.classAppender(buttonView.getIcon().getCssClass()));
            }
            else {
                icon.setVisible(false);
            }
            button.add(icon);
            button.add(new Label("label", buttonView.getLabel()).setRenderBodyOnly(true));
            item.add(button);
        }
    }.setRenderBodyOnly(true));
}
 
Example 15
Project: Intercloud   File: CategoryResponsePanel.java   View source code 6 votes vote down vote up
public CategoryResponsePanel(String id, IModel<? extends CategoryModel> categoryModel) {
    super(id);

    CategoryModel category = categoryModel.getObject();
    this.add(new Label("type", getType()));
    this.add(new Label("term", category.getTerm()));
    this.add(new Label("schema", category.getSchema()));
    this.add(new WebMarkupContainer("titleRow") {
        @Override
        public boolean isVisible() {
            return null != category.getTitle();
        }
    }.add(new Label("title", category.getTitle())));

    this.add(new ListView<AttributeModel>("attributeContainer", new ListModel<>(new ArrayList<>(category.getAttributes()))) {
        @Override
        protected void populateItem(ListItem<AttributeModel> listItem) {
            AttributeModel attribute = listItem.getModelObject();
            listItem.add(new Label("name", attribute.getName()));
            listItem.add(new Label("value", attribute.getValue().toString()));
            listItem.add(new Label("description", attribute.getDescription()));
        }
    });
}
 
Example 16
Project: Intercloud   File: UriResponsePanel.java   View source code 6 votes vote down vote up
public UriResponsePanel(String id, IModel<UriListRepresentationModel> representationModel) {
    super(id);

    this.add(new ListView<String>("uriList", new ListModel<>(representationModel.getObject().getUriList())) {
        @Override
        protected void populateItem(ListItem<String> listItem) {
            AjaxLink link = new AjaxLink("uri") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    try {
                        XmppURI uri = new XmppURI(listItem.getModelObject());
                        setResponsePage(new BrowserPage(Model.of(uri)));
                    } catch (URISyntaxException e) {
                        logger.error("Could not parse Xmpp Uri. {}", listItem.getModelObject(), e);
                        target.appendJavaScript("alert('Could not parse Xmpp Uri.');");
                    }
                }
            };
            link.setBody(listItem.getModel());
            listItem.add(link);
        }
    });
}
 
Example 17
Project: openmeetings   File: WbPanel.java   View source code 6 votes vote down vote up
public WbPanel(String id, RoomPanel rp) {
	super(id, rp);
	this.roomId = rp.getRoom().getId();
	if (rp.getRoom().isHidden(RoomElement.Whiteboard)) {
		setVisible(false);
	} else {
		add(new ListView<String>("clipart", Arrays.asList(OmFileHelper.getPublicClipartsDir().list())) {
			private static final long serialVersionUID = 1L;

			@Override
			protected void populateItem(ListItem<String> item) {
				String cls = String.format("clipart-%s", item.getIndex());
				item.add(append(ATTR_CLASS, cls), append("data-mode", cls)
						, append("data-image", item.getModelObject()).setSeparator(""));
			}
		}, fileName);
	}
}
 
Example 18
Project: webanno   File: ProjectCasDoctorPanel.java   View source code 6 votes vote down vote up
private ListView<LogMessageSet> createMessageSetsView()
{
    return new ListView<LogMessageSet>("messageSets",
            PropertyModel.of(this, "formModel.messageSets"))
    {
        private static final long serialVersionUID = 8957632000765128508L;

        @Override
        protected void populateItem(ListItem<LogMessageSet> aItem)
        {
            IModel<LogMessageSet> set = aItem.getModel();
            aItem.add(new Label("name", PropertyModel.of(set, "name")));
            aItem.add(createMessagesView(set));
        }
    };
}
 
Example 19
Project: webanno   File: ProjectCasDoctorPanel.java   View source code 6 votes vote down vote up
private ListView<LogMessage> createMessagesView(IModel<LogMessageSet> aModel)
{
    return new ListView<LogMessage>("messages", PropertyModel.of(aModel, "messages"))
    {
        private static final long serialVersionUID = 8957632000765128508L;

        @Override
        protected void populateItem(ListItem<LogMessage> aItem)
        {
            IModel<LogMessage> msg = aItem.getModel();
            aItem.add(new Label("level", PropertyModel.of(msg, "level")));
            aItem.add(new Label("source", PropertyModel.of(msg, "source.simpleName")));
            aItem.add(new Label("message", PropertyModel.of(msg, "message")));
        }
    };
}
 
Example 20
Project: relax-dms   File: SchemaUpdate.java   View source code 6 votes vote down vote up
private void createTemplateList(Map<String, String> templateMap) {  
    List<String> titleList = templateMap.keySet().stream().collect(Collectors.toList());
    ListView listview = new ListView("listView", titleList) {
        @Override
        protected void populateItem(ListItem item) {
            final String title = (String) item.getModelObject();
            final String id = templateMap.get(title);
            
            AjaxLink<Void> templateLink = new AjaxLink("templateLink") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    PageParameters params = new PageParameters();
                    params.add("templateId", id);
                    setResponsePage(SchemaUpdate.class, params);
                }
            };
            item.add(templateLink.add(new Label("label", title)));
        }
    };
    add(listview);
}
 
Example 21
Project: relax-dms   File: User.java   View source code 6 votes vote down vote up
private void createDocumentList(String id, List<DocumentListData> docList) {
    ListView listview = new ListView(id, docList) {
        @Override
        protected void populateItem(ListItem item) {
            DocumentListData doc = (DocumentListData) item.getModelObject();
            
            PageParameters pp = new PageParameters();
            pp.add("id", doc.getId());
            
            BookmarkablePageLink<Void> docLink = new BookmarkablePageLink("docLink", DocumentTabs.class, pp);
            item.add(docLink.add(new Label("id", doc.getId())));
            item.add(new Label("title", doc.getTitle()));
        }
    };
    add(listview);
}
 
Example 22
Project: relax-dms   File: DocumentCreate.java   View source code 6 votes vote down vote up
private void createTemplateList(Map<String, String> templateMap) {  
    List<String> titleList = templateMap.keySet().stream().collect(Collectors.toList());
    ListView listview = new ListView("listView", titleList) {
        @Override
        protected void populateItem(ListItem item) {
            final String title = (String) item.getModelObject();
            final String id = templateMap.get(title);
            
            AjaxLink<Void> templateLink = new AjaxLink("templateLink") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    PageParameters params = new PageParameters();
                    params.add("templateId", id);
                    setResponsePage(DocumentCreate.class, params);
                }
            };
            item.add(templateLink.add(new Label("label", title)));
        }
    };
    add(listview);
}
 
Example 23
Project: relax-dms   File: DocumentList.java   View source code 6 votes vote down vote up
private void createDocumentList(List<DocumentListData> docList) {
    ListView listview = new ListView("listView", docList) {
        @Override
        protected void populateItem(ListItem item) {
            DocumentListData doc = (DocumentListData) item.getModelObject();
            
            PageParameters pp = new PageParameters();
            pp.add("id", doc.getId());
            
            BookmarkablePageLink<Void> docLink = new BookmarkablePageLink("docLink", DocumentTabs.class, pp);
            item.add(docLink.add(new Label("id", doc.getId())));
            item.add(new Label("title", doc.getTitle()));
            item.add(new Label("author", doc.getAuthor()));
        }
    };
    add(listview);
}
 
Example 24
Project: elpaaso-core   File: DesignerSteppedProcessPanel.java   View source code 6 votes vote down vote up
private void initComponents() {

        WebMarkupContainer container = new WebMarkupContainer("container");
        add(container);

        list = new ListView<String>("repeater", stepItemsModel) {
            private static final long serialVersionUID = -49889646848608542L;

            @Override
            protected void populateItem(ListItem<String> listItem) {
                Label stepNumber = new Label("stepNumber", new Model<String>(String.valueOf(listItem.getIndex()+1)));
                stepNumber.setRenderBodyOnly(true);
                listItem.add(stepNumber);
                listItem.add(new Label("stepName", listItem.getDefaultModelObjectAsString()));

                updateProcessStep(listItem, currentStep);

            }
        };
        container.add(list);

    }
 
Example 25
Project: artifactory   File: VirtualRepoListPanel.java   View source code 6 votes vote down vote up
/**
 * Adds a list of virtual repositories, using a RepoAwareActionableItem for information
 *
 * @param item The selected item from the tree
 */
private void addRepoList(final RepoAwareActionableItem item) {
    RepositoryService repositoryService = ContextHelper.get().getRepositoryService();
    List<VirtualRepoDescriptor> reposToDisplay = repositoryService.getVirtualReposContainingRepo(item.getRepo());

    add(new ListView<VirtualRepoDescriptor>("items", reposToDisplay) {
        @Override
        protected void populateItem(ListItem<VirtualRepoDescriptor> virtualRepo) {
            VirtualRepoDescriptor virtualRepoDescriptor = virtualRepo.getModelObject();
            final String hrefPrefix = RequestUtils.getWicketServletContextUrl();
            String path = getRepoPath(item);
            String href = hrefPrefix + "/" + virtualRepoDescriptor.getKey() + "/" + path;
            if (!href.endsWith("/")) {
                href += "/";
            }
            AbstractLink link = new ExternalLink("link", href, virtualRepoDescriptor.getKey());
            link.add(new CssClass("repository-virtual"));
            virtualRepo.add(link);
        }
    });
}
 
Example 26
Project: sakai   File: SortGradeItemsByGradeItemPanel.java   View source code 6 votes vote down vote up
@Override
public void onInitialize() {
	super.onInitialize();

	final List<Assignment> assignments = this.businessService.getGradebookAssignments(SortType.SORT_BY_SORTING);

	add(new ListView<Assignment>("gradeItemList", assignments) {
		@Override
		protected void populateItem(final ListItem<Assignment> assignmentItem) {
			final Assignment assignment = assignmentItem.getModelObject();
			assignmentItem.add(new Label("name", assignment.getName()));
			assignmentItem.add(new HiddenField<Long>("id",
					Model.of(assignment.getId())).add(
							new AttributeModifier("name",
									String.format("id", assignment.getId()))));
			assignmentItem.add(new HiddenField<Integer>("order",
					Model.of(assignment.getSortOrder())).add(
							new AttributeModifier("name",
									String.format("item_%s[order]", assignment.getId()))));
			assignmentItem.add(new HiddenField<Integer>("current_order",
					Model.of(assignment.getSortOrder())).add(
							new AttributeModifier("name",
									String.format("item_%s[current_order]", assignment.getId()))));
		}
	});
}
 
Example 27
Project: sakai   File: GradeImportConfirmationStep.java   View source code 6 votes vote down vote up
/**
 * Helper to create a listview for what needs to be shown
 * 
 * @param markupId wicket markup id
 * @param itemList ist of stuff
 * @return
 */
private ListView<ProcessedGradeItem> makeListView(final String markupId, final List<ProcessedGradeItem> itemList) {

	final ListView<ProcessedGradeItem> rval = new ListView<ProcessedGradeItem>(markupId, itemList) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void populateItem(final ListItem<ProcessedGradeItem> item) {

			final ProcessedGradeItem gradeItem = item.getModelObject();

			String displayTitle = gradeItem.getItemTitle();
			if (gradeItem.getType() == Type.COMMENT) {
				displayTitle = MessageHelper.getString("importExport.confirmation.commentsdisplay", gradeItem.getItemTitle());
			}

			item.add(new Label("title", displayTitle));
			item.add(new Label("points", gradeItem.getItemPointValue()));
		}
	};

	return rval;
}
 
Example 28
Project: sakai   File: GradeImportConfirmationStep.java   View source code 6 votes vote down vote up
/**
 * Helper to create a listview for what needs to be shown for new assignments
 * @param markupId wicket markup id
 * @param itemList list of Assignments populated by the item creation steps
 */
private ListView<Assignment> makeAssignmentsToCreateListView(final String markupId, final List<Assignment> itemList) {
	final ListView<Assignment> rval = new ListView<Assignment>(markupId, itemList) {
		@Override
		protected void populateItem(final ListItem<Assignment> item) {
			final Assignment assignment = item.getModelObject();

			String extraCredit = assignment.isExtraCredit() ? yes : no;
			String dueDate = FormatHelper.formatDate(assignment.getDueDate(), "");
			String releaseToStudents = assignment.isReleased() ? yes : no;
			String includeInCourseGrades = assignment.isCounted() ? yes : no;

			item.add(new Label("title", assignment.getName()));
			item.add(new Label("points", assignment.getPoints()));
			item.add(new Label("extraCredit", extraCredit));
			item.add(new Label("dueDate", dueDate));
			item.add(new Label("releaseToStudents", releaseToStudents));
			item.add(new Label("includeInCourseGrades", includeInCourseGrades));
		}
	};

	return rval;
}
 
Example 29
Project: ontopia   File: StartPage.java   View source code 6 votes vote down vote up
private void addOtherTopicMapsSection() {
  // Alt. 2 Make a loadabledetachableModel for repository
  IModel<List<TopicMapReference>> eachNonOntopolyTopicMapModel = new LoadableDetachableModel<List<TopicMapReference>>() {
    @Override
    protected List<TopicMapReference> load() {
      OntopolyRepository repository = OntopolyContext.getOntopolyRepository();
      return repository.getNonOntopolyTopicMaps();
    }
  }; 

  ListView<TopicMapReference> eachTopicMap = new ListView<TopicMapReference>("eachNonOntopolyTopicMap", eachNonOntopolyTopicMapModel) {
    @Override
    protected void populateItem(ListItem<TopicMapReference> item) {
      final TopicMapReference ref = item.getModelObject();
      Map<String,String> pageParameterMap = new HashMap<String,String>();
      pageParameterMap.put("topicMapId",ref.getId());
      
      OntopolyBookmarkablePageLink link = new OntopolyBookmarkablePageLink(
          "nonOntTMLink", ConvertPage.class, new PageParameters(pageParameterMap), ref.getName());
      item.add(link);
    }
  };
  add(eachTopicMap);
}
 
Example 30
Project: ontopia   File: FunctionBoxesPanel.java   View source code 6 votes vote down vote up
public FunctionBoxesPanel(String id) {
  super(id);
  
  Form<Object> form = new Form<Object>("functionBoxesForm");
  add(form);
  
  List<Component> list = getFunctionBoxesList("functionBox"); 
  ListView<Component> functionBoxes = new ListView<Component>("functionBoxesList", list) {
    @Override
    protected void populateItem(ListItem<Component> item) {
      item.add(item.getModelObject());
    }
  };
  functionBoxes.setVisible(!list.isEmpty());
  form.add(functionBoxes);
}
 
Example 31
Project: ontopia   File: FieldInstancesPanel.java   View source code 6 votes vote down vote up
public FieldInstancesPanel(String id, 
    List<FieldInstanceModel> fieldInstanceModels, final FieldsViewModel fieldsViewModel,
    final boolean readonly, final boolean traversable) {
  super(id);
  this.readonly = readonly;
  
  listView = new ListView<FieldInstanceModel>("fields", fieldInstanceModels) {
    @Override
    public void populateItem(final ListItem<FieldInstanceModel> item) {
      FieldInstanceModel fieldInstanceModel = item.getModelObject();
      item.setRenderBodyOnly(true);
      Component component;
      try {
        component = createFieldInstanceComponent("field", fieldInstanceModel, fieldsViewModel, traversable);
      } catch (Exception e) {
        log.error("Error occurred while creating field instance component", e);
        component = new FieldInstanceErrorPanel("field", fieldInstanceModel, e);
      }
      component.setRenderBodyOnly(true);
      item.add(component);
    }
  };
  listView.setReuseItems(true);
  add(listView);    
}
 
Example 32
Project: midpoint   File: SimpleRoleSelector.java   View source code 6 votes vote down vote up
private void initLayout() {
    setOutputMarkupId(true);
    ListView<PrismObject<R>> list = new ListView<PrismObject<R>>(ID_LIST, availableRoles) {
        @Override
        protected void populateItem(ListItem<PrismObject<R>> item) {
            item.add(createRoleLink(ID_ITEM, item.getModel()));
        }
    };
    list.setOutputMarkupId(true);
    add(list);

    AjaxLink<String> buttonReset = new AjaxLink<String>(ID_BUTTON_RESET) {
        @Override
        public void onClick(AjaxRequestTarget target) {
            reset();
            target.add(SimpleRoleSelector.this);
        }
    };
    buttonReset.setBody(createStringResource("SimpleRoleSelector.reset"));
    add(buttonReset);
}
 
Example 33
Project: midpoint   File: DelegationEditorPanel.java   View source code 6 votes vote down vote up
private void addPrivilegesPanel(WebMarkupContainer body){
    privilegesNames = getPrivilegesNamesList();
    ListView<String> privilegesListComponent = new ListView<String>(ID_PRIVILEGES_LIST, privilegesNames){
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item) {
            Label privilageNameLabel = new Label(ID_PRIVILEGE, item.getModel());
            item.add(privilageNameLabel);
        }
    };
    privilegesListComponent.setOutputMarkupId(true);
    privilegesListComponent.add(new VisibleEnableBehaviour(){
        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible(){
            if (!UserDtoStatus.ADD.equals(getModelObject().getStatus())){
                return true;
            }
           return false;
        }
    });
    body.addOrReplace(privilegesListComponent);
}
 
Example 34
Project: midpoint   File: ApprovalProcessesPreviewPanel.java   View source code 6 votes vote down vote up
private void initLayout() {
	ListView<ApprovalProcessExecutionInformationDto> list = new ListView<ApprovalProcessExecutionInformationDto>(ID_PROCESSES, getModel()) {
		@Override
		protected void populateItem(ListItem<ApprovalProcessExecutionInformationDto> item) {
			item.add(new Label(ID_NAME, LoadableModel.create(() -> {
				String targetName = item.getModelObject().getTargetName();
				if (targetName != null) {
					return ApprovalProcessesPreviewPanel.this.getString("ApprovalProcessesPreviewPanel.processRelatedTo", targetName);
				} else {
					return getString("ApprovalProcessesPreviewPanel.process");
				}
			}, false)));
			item.add(new ApprovalProcessExecutionInformationPanel(ID_PREVIEW, item.getModel()));
			item.add(new EvaluatedTriggerGroupPanel(ID_TRIGGERS, new PropertyModel<>(item.getModel(), ApprovalProcessExecutionInformationDto.F_TRIGGERS)));
		}
	};
	add(list);
}
 
Example 35
Project: midpoint   File: PrismPanel.java   View source code 6 votes vote down vote up
private void addOrReplaceContainers(final Form form, ItemVisibilityHandler isPanelVisible, boolean isToBeReplaced){
    ListView<ContainerWrapper<C>> containers = new ListView<ContainerWrapper<C>>(ID_CONTAINERS,
            getModel()) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<ContainerWrapper<C>> item) {
            createContainerPanel(item, isPanelVisible, form);
        }
    };
    containers.setReuseItems(true);

    if (isToBeReplaced) {
        replace(containers);
    } else {
        add(containers);
    }
}
 
Example 36
Project: midpoint   File: InformationPanel.java   View source code 6 votes vote down vote up
private void initLayout() {
	Label titleLabel = new Label(ID_TITLE, new LocalizableMessageModel(new AbstractReadOnlyModel<LocalizableMessageType>() {
		@Override
		public LocalizableMessageType getObject() {
			InformationType info = getModelObject();
			return getLocalizableMessageOrDefault(info.getLocalizableTitle(), info.getTitle());
		}
	}, this));
	titleLabel.add(new VisibleBehaviour(() -> getModelObject().getLocalizableTitle() != null && getModelObject().getTitle() != null));
	add(titleLabel);

	ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS,
			new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {
		@Override
		protected void populateItem(ListItem<InformationPartType> item) {
			InformationPartType part = item.getModelObject();
			Label label = new Label(ID_PART, WebComponentUtil.resolveLocalizableMessage(
					getLocalizableMessageOrDefault(part.getLocalizableText(), part.getText()), InformationPanel.this));
			if (Boolean.TRUE.equals(part.isHasMarkup())) {
				label.setEscapeModelStrings(false);
			}
			item.add(label);
		}
	};
	add(list);
}
 
Example 37
Project: AppStash   File: CartPanel.java   View source code 6 votes vote down vote up
private Component cartView() {
    cartView = new ListView<CartItemInfo>("cart", cartListModel()) {
        @Override
        protected void populateItem(ListItem<CartItemInfo> item) {
            WebMarkupContainer cartItem = new WebMarkupContainer("item");
            cartItem.add(new Label("name", new PropertyModel<String>(item.getModel(), "product.name")));
            cartItem.add(new IndicatingAjaxLink<Void>("delete") {
                @Override
                public void onClick(AjaxRequestTarget target) {
                    IModel<CartItemInfo> model = item.getModel();
                    send(CartPanel.this, Broadcast.BREADTH, new RemoveFromCartEvent(model.getObject(), target));
                }
            });
            cartItem.add(new Label("price", new PriceModel(new PropertyModel<>(item.getModel(), "totalSum"))));
            item.add(cartItem);
        }
    };
    cartView.setReuseItems(false);
    cartView.setOutputMarkupId(true);
    return cartView;
}
 
Example 38
Project: AppStash   File: OrderItemListPanel.java   View source code 6 votes vote down vote up
private Component orderItemList() {
    return new ListView<OrderItemInfo>("orderItems", new PropertyModel<List<OrderItemInfo>>(getDefaultModel(), "orderItems")) {

        private int orderItemCounter = 1;
       
        @Override
        protected void populateItem(ListItem<OrderItemInfo> orderItem) {
            orderItem.add(new Label("orderItemCounter", Model.of(orderItemCounter++)));
            orderItem.add(new Label("product", new PropertyModel<String>(orderItem.getModel(), "product.name")));
            orderItem.add(new Label("description", new PropertyModel<String>(orderItem.getModel(), "product.description")));
            orderItem.add(new Label("totalSum", new PriceModel(new PropertyModel<>(orderItem.getModel(), "totalSum"))));
        }

        @Override
        protected void onDetach() {
            orderItemCounter = 1;
            super.onDetach();
        }
    };
}
 
Example 39
Project: syncope   File: ProgressesPanel.java   View source code 6 votes vote down vote up
public ProgressesPanel(final String id, final Date lastUpdate, final List<ProgressBean> progressBeans) {
    super(id);

    add(new Label("lastUpdate", SyncopeConsoleSession.get().getDateFormat().format(lastUpdate)));

    ListView<ProgressBean> progresses = new ListView<ProgressBean>("progresses", progressBeans) {

        private static final long serialVersionUID = -9180479401817023838L;

        @Override
        protected void populateItem(final ListItem<ProgressBean> item) {
            item.add(new ProgressPanel("progress", item.getModelObject()));
        }
    };
    progresses.setOutputMarkupId(true);
    add(progresses);
}
 
Example 40
Project: syncope   File: ActionsPanel.java   View source code 6 votes vote down vote up
public ActionsPanel(final String componentId, final IModel<T> model) {
    super(componentId, model);
    setOutputMarkupId(true);
    this.model = model;

    add(new ListView<Action<T>>("actionRepeater", actions) {

        private static final long serialVersionUID = -9180479401817023838L;

        @Override
        protected void populateItem(final ListItem<Action<T>> item) {
            item.add(new ActionPanel<>(ActionsPanel.this.model, item.getModelObject()));
        }

    }.setRenderBodyOnly(true));
}