List of usage examples for org.apache.wicket.extensions.breadcrumb.panel IBreadCrumbPanelFactory IBreadCrumbPanelFactory
IBreadCrumbPanelFactory
From source file:com.ttdev.wicketpagetest.sample.guice.ProductIDPanel.java
License:Open Source License
public ProductIDPanel(String id, IBreadCrumbModel breadCrumbModel) { super(id, breadCrumbModel); Form<ProductIDPanel> form = new Form<ProductIDPanel>("form", new CompoundPropertyModel<ProductIDPanel>(this)) { private static final long serialVersionUID = 1L; protected void onSubmit() { crumbNavigator.activate(ProductIDPanel.this, new IBreadCrumbPanelFactory() { private static final long serialVersionUID = 1L; public BreadCrumbPanel create(String componentId, IBreadCrumbModel breadCrumbModel) { return new ProductDetailsPanel(componentId, breadCrumbModel, productID); }/*w w w. jav a2s.co m*/ }); } }; add(form); form.add(new TextField<String>("productID")); }
From source file:gr.abiss.calipso.wicket.asset.AssetCustomAttributeFormPagePanel.java
License:Open Source License
private void deleteLink() { //hide link if: admin, user==null, try to delete self or new user if (canBeDeleted == false || assetTypeCustomAttribute == null || assetTypeCustomAttribute.getId() == null || !Boolean.parseBoolean(((CalipsoApplication) Application.get()) .getCalipsoPropertyValue("allow.delete.assetTypeCustomAttribute"))) { add(new WebMarkupContainer("delete").setVisible(false)); } else {//if edit add(new Link("delete") { @Override//from w ww . j av a2s . co m public void onClick() { final String line1 = localize("asset.customAttributes.deleteConfirmMessage"); final String line2 = new String( "\"" + localize(assetTypeCustomAttribute.getNameTranslationResourceKey()) + "\""); final String heading = new String(localize("asset.customAttributes.deleteConfirmHeading")); final String warning = new String(""); activate(new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String componentId, IBreadCrumbModel breadCrumbModel) { ConfirmPanel confirm = new ConfirmPanel(componentId, breadCrumbModel, heading, warning, new String[] { line1 }) { @Override public void onConfirm() { //Delete Custom Attribute getCalipso().removeCustomAttribute(assetTypeCustomAttribute); BreadCrumbUtils.removePreviousBreadCrumbPanel(getBreadCrumbModel()); activate(new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String componentId, IBreadCrumbModel breadCrumbModel) { return (BreadCrumbPanel) breadCrumbModel.getActive(); } }); } }; return confirm; } }); }//onclick });//add, new Link } }
From source file:gr.abiss.calipso.wicket.asset.AssetCustomAttributeLookupValuesFormPanel.java
License:Open Source License
/** * Renders User Interface components/*from w w w. j a v a 2 s . c om*/ * */ private void addComponents() { if (this.assetTypeCustomAttribute.getAllowedLookupValues() == null) { lookupValues = new ArrayList<CustomAttributeLookupValue>(); } //if else { lookupValues = new ArrayList<CustomAttributeLookupValue>( this.assetTypeCustomAttribute.getAllowedLookupValues()); } //else add(new ValuesForm("valuesForm", lookupValues)); WebMarkupContainer editArea = new WebMarkupContainer("editArea"); if (this.lookupValue == null) { editArea.add(new EditForm("editForm", new CustomAttributeLookupValue())); editArea.setVisible(false); } //if else { isNewEntry = (lookupValue.getAttribute() == null); editArea.add(new Label("editLabel", localize("asset.customAttributes." + String.valueOf(isNewEntry ? "add" : "edit") + "Value"))); editArea.add(new EditForm("editForm", this.lookupValue)); } //else add(editArea); Link add = new Link("add") { public void onClick() { activate(new IBreadCrumbPanelFactory() { public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { //Remove last breadcrumb participant if (breadCrumbModel.allBreadCrumbParticipants().size() > 0) { breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); } //if return new AssetCustomAttributeFormPagePanel( breadCrumbModel.getActive().getComponent().getId(), breadCrumbModel, AssetCustomAttributeLookupValuesFormPanel.this.assetTypeCustomAttribute, new CustomAttributeLookupValue()).setReferenceAssetType(referenceAssetType); } }); }//onClick }; add(add); }
From source file:gr.abiss.calipso.wicket.asset.AssetCustomAttributesPanel.java
License:Open Source License
/** * Renders link that drives to page for new attribute creation. * *///from w w w .j a va 2 s . co m private void createNewCustomAttributes() { Link newCustomAttribute = new Link("new") { @Override public void onClick() { activate(new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { AssetCustomAttributeFormPagePanel assetCustomAttributeFormPagePanel = new AssetCustomAttributeFormPagePanel( id, breadCrumbModel); if (referenceAssetType != null) { assetCustomAttributeFormPagePanel.setReferenceAssetType(referenceAssetType); } return assetCustomAttributeFormPagePanel; } }); }//onClick }; add(newCustomAttribute); }
From source file:gr.abiss.calipso.wicket.asset.AssetCustomAttributesPanel.java
License:Open Source License
/** * Renders custom attribute list/* w w w.j a v a2s . c o m*/ * */ private void listAttributes() { LoadableDetachableModel attributesListModel = new LoadableDetachableModel() { @Override protected Object load() { return getCalipso().findCustomAttributesMatching( AssetCustomAttributesPanel.this.assetTypeCustomAttributeSearch); }//load }; attributesListModel.getObject(); //////////////// // Pagination // //////////////// PaginationPanel paginationPanel = new PaginationPanel("paginationPanel", getBreadCrumbModel(), this.assetTypeCustomAttributeSearch) { IBreadCrumbPanelFactory breadCrumbPanelFactory = new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { //Remove last breadcrumb participant if (breadCrumbModel.allBreadCrumbParticipants().size() > 0) { breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); } //if return new AssetCustomAttributesPanel(breadCrumbModel.getActive().getComponent().getId(), breadCrumbModel, AssetCustomAttributesPanel.this.referenceAssetType, AssetCustomAttributesPanel.this.assetTypeCustomAttributeSearch, AssetCustomAttributesPanel.this.isSearchOpen); } }; @Override public void onNextPageClick() { activate(breadCrumbPanelFactory); } @Override public void onPreviousPageClick() { activate(breadCrumbPanelFactory); } @Override public void onPageNumberClick() { activate(breadCrumbPanelFactory); } }; add(paginationPanel); ///////////////// // List header // ///////////////// List<String> columnHeaders = AssetCustomAttributesPanel.this.assetTypeCustomAttributeSearch .getColumnHeaders(); ListView headings = new ListView("headings", columnHeaders) { @Override protected void populateItem(ListItem listItem) { final String header = (String) listItem.getModelObject(); Link headingLink = new Link("heading") { @Override public void onClick() { AssetCustomAttributesPanel.this.assetTypeCustomAttributeSearch.doSort(header); } }; listItem.add(headingLink); String label = localize("asset.customAttributes." + header); headingLink.add(new Label("heading", label)); if (header.equals( AssetCustomAttributesPanel.this.assetTypeCustomAttributeSearch.getSortFieldName())) { String order = AssetCustomAttributesPanel.this.assetTypeCustomAttributeSearch.isSortDescending() ? "order-down" : "order-up"; listItem.add(new SimpleAttributeModifier("class", order)); } } }; add(headings); ///////////////////// // Attributes List // ///////////////////// final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt"); if (this.referenceAssetType != null) { add(new Label("add", localize("asset.assetTypes.addCustomAttributeToType", localize(this.referenceAssetType.getNameTranslationResourceKey())))); } //if else { add(new WebMarkupContainer("add").setVisible(false)); } //else ListView listView = new ListView("attributesList", attributesListModel) { AssetType referenceAssetType = AssetCustomAttributesPanel.this.referenceAssetType; @Override protected void populateItem(ListItem listItem) { final AssetTypeCustomAttribute attribute = (AssetTypeCustomAttribute) listItem.getModelObject(); if (attribute.getId().equals(selectedAttributeId)) { listItem.add(new SimpleAttributeModifier("class", "selected")); } else if (listItem.getIndex() % 2 != 0) { listItem.add(sam); } //if // listItem.add(new Label("name", new PropertyModel(attribute, "name"))); listItem.add(new Label("name", localize(attribute.getNameTranslationResourceKey()))); listItem.add(new Label("formType", new Model(localize("asset.attributeType_" + attribute.getFormType())))); listItem.add(new Label("mandatory", new Model(attribute.isMandatory() ? localize("yes") : localize("no")))); listItem.add( new Label("active", new Model(attribute.isActive() ? localize("yes") : localize("no")))); Link edit = new Link("edit") { @Override public void onClick() { activate(new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { AssetCustomAttributeFormPagePanel assetCustomAttributeFormPagePanel = new AssetCustomAttributeFormPagePanel( id, breadCrumbModel, attribute); if (referenceAssetType != null) { assetCustomAttributeFormPagePanel.setReferenceAssetType(referenceAssetType); } //if return assetCustomAttributeFormPagePanel; } }); }//onClick }; listItem.add(edit); if (referenceAssetType == null) { listItem.add(new WebMarkupContainer("add").setVisible(false)); } //if else { WebMarkupContainer add; if (referenceAssetType.getAllowedCustomAttributes().contains(attribute)) {//if this customAttribute is used add = new Fragment("add", "removeLink", this); if (logger.isDebugEnabled()) { logger.debug("Allowed custom attributes : " + referenceAssetType.getAllowedCustomAttributes()); } add.add(new Link("link") { //remove a custom attribute to the Asset Type in question @Override public void onClick() { if (logger.isDebugEnabled()) { logger.debug("Allowed custom attributes : " + referenceAssetType.getAllowedCustomAttributes()); logger.debug("Removing attribute : " + attribute.getName()); } AssetCustomAttributesPanel.this.referenceAssetType.getAllowedCustomAttributes() .remove(attribute); if (logger.isDebugEnabled()) { logger.debug("new Allowed custom attributes : " + referenceAssetType.getAllowedCustomAttributes()); } //Remove last 2 breadcrumb participants if (breadCrumbModel.allBreadCrumbParticipants().size() > 2) { breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); } //if activate(new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { return new AssetTypeFormPagePanel( getBreadCrumbModel().getActive().getComponent().getId(), getBreadCrumbModel(), AssetCustomAttributesPanel.this.referenceAssetType); } }); }//onClick }); } else {//if this customAttribute is not used, can add it add = new Fragment("add", "addLink", this); add.add(new Link("link") { //Adds a custom attribute to the Asset Type in question @Override public void onClick() { if (logger.isDebugEnabled()) { logger.debug("Allowed custom attributes : " + referenceAssetType.getAllowedCustomAttributes()); logger.debug("Added custom attribute : " + attribute.getName()); } AssetCustomAttributesPanel.this.referenceAssetType.getAllowedCustomAttributes() .add(attribute); if (logger.isDebugEnabled()) { logger.debug("New Allowed custom attributes : " + referenceAssetType.getAllowedCustomAttributes()); } //Remove last 2 breadcrumb participants if (breadCrumbModel.allBreadCrumbParticipants().size() > 2) { breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); } //if activate(new IBreadCrumbPanelFactory() { @Override public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { return new AssetTypeFormPagePanel( getBreadCrumbModel().getActive().getComponent().getId(), getBreadCrumbModel(), AssetCustomAttributesPanel.this.referenceAssetType); } }); }//onClick }); } listItem.add(add); } //else } }; add(listView); add(new WebMarkupContainer("noData").setVisible(this.assetTypeCustomAttributeSearch.getResultCount() == 0)); }
From source file:gr.abiss.calipso.wicket.asset.AssetsListPanel.java
License:Open Source License
private void addComponents(List<Asset> assets) { // Pagination PaginationPanel paginationPanel = new PaginationPanel("paginationPanel", getBreadCrumbModel(), this.assetSearch) { IBreadCrumbPanelFactory breadCrumbPanelFactory = new IBreadCrumbPanelFactory() { public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { //Remove last breadcrumb participant if (breadCrumbModel != null && breadCrumbModel.allBreadCrumbParticipants().size() > 0) { breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); } //if return new AssetSpacePanel(getBreadCrumbModel().getActive().getComponent().getId(), getBreadCrumbModel(), AssetsListPanel.this.assetSearch); }//from w w w. java 2 s. co m }; public void onNextPageClick() { activate(breadCrumbPanelFactory); } public void onPreviousPageClick() { activate(breadCrumbPanelFactory); } public void onPageNumberClick() { activate(breadCrumbPanelFactory); } }; add(paginationPanel); // List view headers List<String> columnHeaders = this.assetSearch.getColumnHeaders(); ListView headings = new ListView("headings", columnHeaders) { protected void populateItem(ListItem listItem) { final String header = (String) listItem.getModelObject(); Link headingLink = new Link("heading") { public void onClick() { AssetsListPanel.this.assetSearch.doSort(header); } }; listItem.add(headingLink); String label = localize("asset.assetsList." + header); headingLink.add(new Label("heading", label)); if (header.equals(AssetsListPanel.this.assetSearch.getSortFieldName())) { String order = AssetsListPanel.this.assetSearch.isSortDescending() ? "order-down" : "order-up"; listItem.add(new SimpleAttributeModifier("class", order)); } } }; add(headings); //Header message Label hAction = new Label("hAction"); hAction.setDefaultModel(new Model(localize("edit"))); add(hAction); ///////////////// // Asset List // ///////////////// final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt"); ListView listView = new ListView("assetsList", assets) { protected void populateItem(ListItem listItem) { /* final Asset asset; if (listItem.getModelObject().getClass().equals(AssetCustomAttributeValue.class)){ AssetCustomAttributeValue assetCustomAttributeValue = (AssetCustomAttributeValue)listItem.getModelObject(); asset = assetCustomAttributeValue.getAsset(); } else{ asset = (Asset)listItem.getModelObject(); }*/ final Asset asset = (Asset) listItem.getModelObject(); if (selectedAssetId != null && selectedAssetId.equals(asset.getId())) { listItem.add(new SimpleAttributeModifier("class", "selected")); } else if (listItem.getIndex() % 2 != 0) { listItem.add(sam); } //if Label assetType = new Label("assetType", localize(asset.getAssetType().getNameTranslationResourceKey())); listItem.add(assetType); final WebMarkupContainer customAttributesContainer = new WebMarkupContainer( "customAttributesContainer"); customAttributesContainer.setOutputMarkupId(true); listItem.add(customAttributesContainer); final WebMarkupContainer customAttributesPanelContainer = new WebMarkupContainer( "customAttributesPanel"); customAttributesPanelContainer.setOutputMarkupId(true); customAttributesContainer.add(customAttributesPanelContainer); ExpandCustomAttributesLink customAttributesLink = new ExpandCustomAttributesLink( "showCustomAttributesLink", getBreadCrumbModel(), asset); customAttributesLink.setComponentWhenCollapsed(customAttributesPanelContainer); customAttributesLink.setTargetComponent(customAttributesContainer); customAttributesLink.setImageWhenCollapsed(new CollapsedPanel("imagePanel")); customAttributesLink.setImageWhenExpanded(new ExpandedPanel("imagePanel")); CollapsedPanel imagePanel = new CollapsedPanel("imagePanel"); customAttributesLink.add(imagePanel); listItem.add(customAttributesLink); //listItem.add(new Label("inventoryCode", asset.getInventoryCode())); listItem.add(new AssetViewLink("inventoryCode", getBreadCrumbModel(), asset)); // display space listItem.add(new Label("space", localize(asset.getSpace().getNameTranslationResourceKey()))); //format and display dates SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); // start date if (asset.getSupportStartDate() != null) { listItem.add(new Label("supportStartDate", dateFormat.format(asset.getSupportStartDate()))); } else { listItem.add(new Label("supportStartDate", "")); } // end date if (asset.getSupportEndDate() != null) { listItem.add(new Label("supportEndDate", dateFormat.format(asset.getSupportEndDate())) .add(AssetsUtils.getSupportEndDateStyle(asset.getSupportEndDate()))); } else { listItem.add(new Label("supportEndDate", "")); } //edit or other action button/link AbstractLink link = getAssetActionLink("actionLink", asset); listItem.add(link); //For future use WebMarkupContainer add = new WebMarkupContainer("add"); add.setVisible(false); listItem.add(add); }//populateItem };//ListView add(listView); add(new WebMarkupContainer("noData").setVisible(this.assetSearch.getResultCount() == 0)); }
From source file:gr.abiss.calipso.wicket.asset.AssetsListPanel.java
License:Open Source License
/** * Others may want to override this to provide other functionality. The * markup ID should be "actionLink"/*from w w w . j a v a 2s .com*/ * @param asset * @return */ public AbstractLink getAssetActionLink(String markupId, final Asset asset) { Link link = new Link(markupId) { public void onClick() { activate(new IBreadCrumbPanelFactory() { public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { return new AssetFormPagePanel(getBreadCrumbModel().getActive().getComponent().getId(), breadCrumbModel, asset); } }); } }; link.add(new StaticImage("actionLinkImg", new Model("../resources/edit.gif"))); return link; }
From source file:gr.abiss.calipso.wicket.asset.AssetSpacePanel.java
License:Open Source License
/** * Link to Asset Creation//from w ww .ja va 2 s . com * */ private void createAsset() { Link newAsset = new Link("new") { private static final long serialVersionUID = 1L; public void onClick() { activate(new IBreadCrumbPanelFactory() { private static final long serialVersionUID = 1L; public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { return new AssetFormPagePanel(id, breadCrumbModel); } }); }//onClick }; add(newAsset); }
From source file:gr.abiss.calipso.wicket.asset.AssetTypeFormPanel.java
License:Open Source License
/** * Renders UI Components/* w w w . ja v a 2 s .c o m*/ * */ private void addComponents(final List<AssetTypeCustomAttribute> assetTypeCustomAttributes, final CompoundPropertyModel model) { //Mandatory mark. red asterisk (*) add(new MandatoryPanel("mandatoryPanel")); //name /* TextField name = new TextField("name"); name.setRequired(true); name.add(new ErrorHighlighter()); add(name); model.bind(name); //form label for name name.setLabel(new ResourceModel("asset.assetTypes.description")); add(new SimpleFormComponentLabel("textLabel", name)); */ if (MapUtils.isEmpty(this.assetType.getNameTranslations())) { this.assetType.setNameTranslations(getCalipso().getNameTranslations(this.assetType)); } // TODO: switch to space or spacegroup languages when we move asset type creation context there add(new ListView("nameTranslations", getCalipso().getSupportedLanguages()) { protected void populateItem(ListItem listItem) { Language language = (Language) listItem.getModelObject(); TextField description = new TextField("name"); // name translations are required. description.setRequired(true); description.add(new ErrorHighlighter()); listItem.add(description); description.setModel(new PropertyModel(assetType, "nameTranslations[" + language.getId() + "]")); //model.bind(description, "nameTranslations["+language.getId()+"]"); // form label for name description.setLabel(new ResourceModel("language." + language.getId())); listItem.add(new SimpleFormComponentLabel("languageLabel", description)); } }); WebMarkupContainer customAttributes = new WebMarkupContainer("customAttributes"); //Add new attribute Link addNewAttribute = new Link("add") { public void onClick() { activate(new IBreadCrumbPanelFactory() { public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { return new AssetCustomAttributesPanel( getBreadCrumbModel().getActive().getComponent().getId(), getBreadCrumbModel(), AssetTypeFormPanel.this.assetType); } }); }//onClick }; customAttributes.add(addNewAttribute); final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt"); //customAttributes ListView listView = new ListView("customAttributesList", assetTypeCustomAttributes) { protected void populateItem(ListItem listItem) { if (listItem.getIndex() % 2 != 0) { listItem.add(sam); } //if final AssetTypeCustomAttribute assetTypeCustomAttribute = (AssetTypeCustomAttribute) listItem .getModelObject(); boolean canDeleteCustomAttribute = false;//getJtrac().loadCountForAssetTypeAndCustomAttribute(assetType, assetTypeCustomAttribute); //Name Label name = new Label("name", localize(assetTypeCustomAttribute.getNameTranslationResourceKey())); listItem.add(name); //Type Label type = new Label("type", localize("asset.attributeType_" + assetTypeCustomAttribute.getFormType())); listItem.add(type); //Active Label active = new Label("active", assetTypeCustomAttribute.isActive() ? localize("yes") : localize("no")); listItem.add(active); //Mandatory Label mandatory = new Label("mandatory", assetTypeCustomAttribute.isMandatory() ? localize("yes") : localize("no")); listItem.add(mandatory); //Remove Link remove = new Link("remove") { public void onClick() { assetTypeCustomAttributes.remove(assetTypeCustomAttribute); assetType.remove(assetTypeCustomAttribute); BreadCrumbUtils.removeActiveBreadCrumbPanel(getBreadCrumbModel()); activate(new IBreadCrumbPanelFactory() { public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { return new AssetTypeFormPagePanel( getBreadCrumbModel().getActive().getComponent().getId(), getBreadCrumbModel(), assetType); }//create }); }//onClick }; listItem.add(remove); remove.setVisible(canDeleteCustomAttribute); }//populateItem };//ListView add(customAttributes.add(listView).setVisible(isEdit)); }
From source file:gr.abiss.calipso.wicket.asset.AssetTypesListPanel.java
License:Open Source License
private void addComponents(IModel assetTypes) { //////////////// // Pagination // //////////////// PaginationPanel paginationPanel = new PaginationPanel("paginationPanel", getBreadCrumbModel(), this.assetTypeSearch) { IBreadCrumbPanelFactory breadCrumbPanelFactory = new IBreadCrumbPanelFactory() { public BreadCrumbPanel create(String id, IBreadCrumbModel breadCrumbModel) { //Remove last breadcrumb participant if (breadCrumbModel.allBreadCrumbParticipants().size() > 0) { breadCrumbModel.allBreadCrumbParticipants() .remove(breadCrumbModel.allBreadCrumbParticipants().size() - 1); } //if return new AssetTypesPanel(getBreadCrumbModel().getActive().getComponent().getId(), getBreadCrumbModel(), AssetTypesListPanel.this.assetTypeSearch); }/*from w ww . j ava2s. c o m*/ }; public void onNextPageClick() { activate(breadCrumbPanelFactory); } public void onPreviousPageClick() { activate(breadCrumbPanelFactory); } public void onPageNumberClick() { activate(breadCrumbPanelFactory); } }; add(paginationPanel); ///////////////// // List header // ///////////////// List<String> columnHeaders = this.assetTypeSearch.getColumnHeaders(); ListView headings = new ListView("headings", columnHeaders) { protected void populateItem(ListItem listItem) { final String header = (String) listItem.getModelObject(); Link headingLink = new Link("heading") { public void onClick() { AssetTypesListPanel.this.assetTypeSearch.doSort(header); } }; listItem.add(headingLink); String label = localize("asset.assetTypes." + header); headingLink.add(new Label("heading", label)); if (header.equals(AssetTypesListPanel.this.assetTypeSearch.getSortFieldName())) { String order = AssetTypesListPanel.this.assetTypeSearch.isSortDescending() ? "order-down" : "order-up"; listItem.add(new SimpleAttributeModifier("class", order)); } } }; add(headings); ///////////////////// // Asset Type List // ///////////////////// final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt"); ListView listView = new ListView("assetTypeList", assetTypes) { protected void populateItem(ListItem listItem) { final AssetType assetType = (AssetType) listItem.getModelObject(); if (selectedAssetTypeId != null && assetType.getId() == selectedAssetTypeId.longValue()) { listItem.add(new SimpleAttributeModifier("class", "selected")); } else if (listItem.getIndex() % 2 != 0) { listItem.add(sam); } //if // TODO: remove the getName part after ele finishes listItem.add(new Label("description", localize(assetType.getNameTranslationResourceKey()))); listItem.add(new BreadCrumbLink("edit", getBreadCrumbModel()) { @Override protected IBreadCrumbParticipant getParticipant(String id) { return new AssetTypeFormPagePanel(id, getBreadCrumbModel(), getCalipso().loadAssetType(assetType.getId())); } }); }//populateItem };//ListView add(listView); add(new WebMarkupContainer("noData").setVisible(this.assetTypeSearch.getResultCount() == 0)); }