Java Code Examples for org.apache.wicket.markup.html.basic.Label

The following examples show how to use org.apache.wicket.markup.html.basic.Label. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: onedev   Source File: ServerLogPage.java    License: MIT License 7 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();

	add(new ResourceLink<Void>("download", new ServerLogDownloadResourceReference()));
	
	List<String> lines = ServerLogDownloadResource.readServerLog();		
	String content;
	if (lines.size() > MAX_DISPLAY_LINES) {
		add(new Label("warning", "Too many log entries, displaying recent " + MAX_DISPLAY_LINES));
		content = Joiner.on("\n").join(lines.subList(lines.size()-MAX_DISPLAY_LINES, lines.size()));
	} else {
		add(new WebMarkupContainer("warning").setVisible(false));
		content = Joiner.on("\n").join(lines);
	}
	
	add(new Label("logContent", content));
}
 
Example 2
Source Project: yes-cart   Source File: ServerSideJs.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onBeforeRender() {

    final boolean deploymentMode = Application.get().getConfigurationType() == RuntimeConfigurationType.DEPLOYMENT;

    addOrReplace(new Label("jsInclude", new StringBuilder()
        .append("<script type=\"text/javascript\">")
        .append("var ctx = {").append("\n")
        .append("  url: document.URL,\n")
        .append("  live: ").append(deploymentMode).append(",\n")
        .append("  page: '").append(getPage().getClass().getSimpleName()).append("',\n")
        .append("  root: '").append(getWicketUtil().getHttpServletRequest().getContextPath()).append("',\n")
        .append("  resources: {\n")
        .append("     areYouSure: '").append(getLocalizer().getString("areYouSure", this)).append("',\n")
        .append("     yes: '").append(getLocalizer().getString("yes", this)).append("',\n")
        .append("     no: '").append(getLocalizer().getString("no", this)).append("',\n")
        .append("     wishlistTagsInfo: '").append(getLocalizer().getString("wishlistTagsInfo", this)).append("',\n")
        .append("     wishlistTagLinkOffInfo: '").append(getLocalizer().getString("wishlistTagLinkOffInfo", this)).append("',\n")
        .append("     wishlistTagLinkOnInfo: '").append(getLocalizer().getString("wishlistTagLinkOnInfo", this)).append("'\n")
        .append("  }\n")
        .append("}\n")
        .append("</script>").toString()).setEscapeModelStrings(false));

    super.onBeforeRender();
}
 
Example 3
Source Project: syncope   Source File: ConnObjectAttrColumn.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void populateItem(
        final Item<ICellPopulator<ConnObjectTO>> cellItem,
        final String componentId,
        final IModel<ConnObjectTO> rowModel) {

    Optional<Attr> attr = rowModel.getObject().getAttr(name);
    List<String> values = attr.map(Attr::getValues).orElse(null);

    if (values == null || values.isEmpty()) {
        cellItem.add(new Label(componentId, ""));
    } else if (values.size() == 1) {
        cellItem.add(new Label(componentId, values.get(0)));
    } else {
        cellItem.add(new Label(componentId, values.toString()));
    }
}
 
Example 4
Source Project: yes-cart   Source File: PaymentPage.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the negative result fragment, which responsible
 * to show item allocation error.
 *
 * @param sku the {@link ProductSku} which quantity can not be allocated.
 *
 * @return negative result fragment
 */
private MarkupContainer createNegativeItemAllocationResultFragment(final String sku) {

    final ProductSku productSku = productServiceFacade.getProductSkuBySkuCode(sku);

    final Map<String, Object> param = new HashMap<>();
    param.put("product", getI18NSupport().getFailoverModel(productSku.getDisplayName(), productSku.getName()).getValue(getLocale().getLanguage()));
    param.put("sku", sku);
    final String errorMessage =
            WicketUtil.createStringResourceModel(this, ALLOCATION_DETAIL, param).getString();

    error(errorMessage);

    return new Fragment(RESULT_CONTAINER, NEGATIVE_ALLOCATION_RESULT_FRAGMENT, this)
            .add(
                    new Label(
                            ALLOCATION_DETAIL,
                            errorMessage )
            ) ;

}
 
Example 5
Source Project: yes-cart   Source File: AddressForm.java    License: Apache License 2.0 6 votes vote down vote up
private Label getLabel(final AttrValueWithAttribute attrValue, final String lang) {

        final I18NModel model = i18NWebSupport.getFailoverModel(
                attrValue.getAttribute().getDisplayName(),
                attrValue.getAttribute().getName());
        final String prop = attrValue.getAttribute().getVal();

        return new Label(NAME, new IModel<String>() {

            private final I18NModel m = model;

            @Override
            public String getObject() {
                final String lang1 = getLocale().getLanguage();
                final String name = m.getValue(lang1);
                if (StringUtils.isNotBlank(name)) {
                    return name;
                }
                return getLocalizer().getString(prop, AddressForm.this);
            }
        });
    }
 
Example 6
Source Project: ontopia   Source File: SignInPage.java    License: Apache License 2.0 6 votes vote down vote up
public SignInPage(PageParameters params) {
super(params);
    
add(new StartPageHeaderPanel("header"));
add(new FooterPanel("footer"));

   add(new Label("title", new ResourceModel("page.title.signin")));

   add(new Label("message", new AbstractReadOnlyModel<String>() {
       @Override
       public String getObject() {
         OntopolySession session = (OntopolySession)Session.findOrCreate();
         return session.getSignInMessage();
       }
     }));
   add(new SignInForm("form"));
 }
 
Example 7
Source Project: yes-cart   Source File: RegisterPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Label getLabel(final AttrValueWithAttribute attrValue, final String lang) {

        final I18NModel model = getI18NSupport().getFailoverModel(
                attrValue.getAttribute().getDisplayName(),
                attrValue.getAttribute().getName());

        return new Label(NAME, new IModel<String>() {

            private final I18NModel m = model;

            @Override
            public String getObject() {
                final String lang1 = getLocale().getLanguage();
                return m.getValue(lang1);
            }
        });
    }
 
Example 8
Source Project: nextreports-server   Source File: AlarmImagePanel.java    License: Apache License 2.0 6 votes vote down vote up
public AlarmImagePanel(String id, String width, String height, final IModel<AlarmData> model) {
	super(id, model);
	this.width = width;
	this.height = height;
	
	NonCachingImage image = new NonCachingImage("image", new PropertyModel(this, "imageResource")){
           private static final long serialVersionUID = 1L;
           
           @Override
           protected void onBeforeRender() {            	
           	imageResource =  new AlarmDynamicImageResource(80, model.getObject().getColor());       
               super.onBeforeRender();
           }           
       }; 	                
	add(image);
	
	add(new Label("status", model));
	
}
 
Example 9
Source Project: Orienteer   Source File: OClusterMetaPanel.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected Component resolveComponent(String id, DisplayMode mode, String critery) {

    if(DisplayMode.EDIT.equals(mode) && !OSecurityHelper.isAllowed(ORule.ResourceGeneric.SCHEMA, null, OrientPermission.UPDATE))
    {
        mode = DisplayMode.VIEW;
    }
    if(DisplayMode.VIEW.equals(mode))
    {
        return new Label(id, getModel());
    }
    else if(DisplayMode.EDIT.equals(mode)) {
        if (OClustersWidget.COMPRESSION.equals(critery)) {
            return new DropDownChoice<String>(id, (IModel<String>)getModel(), COMPRESSIONS);
        }
        else if(OClustersWidget.COUNT.equals(critery) || OClustersWidget.ID.equals(critery)){
            return resolveComponent(id, DisplayMode.VIEW, critery);
        } else {
            return new TextField<V>(id, getModel()).setType(String.class);
        }
    }
    return null;
}
 
Example 10
Source Project: syncope   Source File: SecurityQuestionsITCase.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void read() {
    Label label = (Label) TESTER.getComponentFromLastRenderedPage(
            "body:content:tabbedPanel:panel:container:content:searchContainer:resultTable:"
            + "tablePanel:groupForm:checkgroup:dataTable:body:rows:1:cells:2:cell");
    assertTrue(label.getDefaultModelObjectAsString().startsWith("What&#039;s your "));

    TESTER.executeAjaxEvent(
            "body:content:tabbedPanel:panel:container:content:searchContainer:resultTable:"
            + "tablePanel:groupForm:checkgroup:dataTable:body:rows:1", Constants.ON_CLICK);

    TESTER.assertComponent(
            "body:content:tabbedPanel:panel:outerObjectsRepeater:1:outer:container:content:"
            + "togglePanelContainer:container:actions:actions:actionRepeater:0:action:action",
            IndicatingAjaxLink.class);
}
 
Example 11
/**
 * Render method
 */
private void renderStatus() {

	log.debug("ProfileStatusRenderer has been added.");
	setOutputMarkupPlaceholderTag(true);
	
	//get status
	ProfileStatus status = statusLogic.getUserStatus(userUuid, privacy);

	//get status
	if(status == null) {
		log.debug("ProfileStatus null");
		setVisible(false);
		setupBlankFields();
		return;
	}
	
	//check message
	if(StringUtils.isBlank(status.getMessage())) {
		log.debug("ProfileStatus message blank");
		setVisible(false);
		setupBlankFields();
		return;
	}
	
	this.hasStatusSet = true;
	
	//output
	add(new Label("message", status.getMessage())
		.add(new AttributeModifier("class", true, new Model<String>(msgClass)))
	);
	add(new Label("date", status.getDateFormatted())
		.add(new AttributeModifier("class", true, new Model<String>(dateClass)))
	);

}
 
Example 12
Source Project: yes-cart   Source File: GuestPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onBeforeRender() {

    final String lang = getLocale().getLanguage();

    // Refresh content
    String regformInfo = getContentInclude(getCurrentShopId(), "registration_guestform_content_include", lang);
    get(GUEST_FORM).get(CONTENT).replaceWith(new Label(CONTENT, regformInfo).setEscapeModelStrings(false));

    super.onBeforeRender();
}
 
Example 13
Source Project: onedev   Source File: PullRequestChangePanel.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	PullRequestChange change = getModelObject();

	if (change.getUser() != null) 
		add(new Label("user", change.getUser().getDisplayName()));
	else if (change.getUserName() != null) 
		add(new Label("user", change.getUserName()));
	else
		add(new WebMarkupContainer("user").setVisible(false));
	
	add(new Label("description", change.getData().getActivity(null)));
	add(new Label("age", DateUtils.formatAge(change.getDate())));
	add(new SinceChangesLink("changes", new AbstractReadOnlyModel<PullRequest>() {

		@Override
		public PullRequest getObject() {
			return getChange().getRequest();
		}

	}, getChange().getDate()));
	
	Component body = change.getData().render("body", change);
	if (body != null) {
		add(body);
	} else {
		add(new WebMarkupContainer("body").setVisible(false));
		add(AttributeAppender.append("class", "no-body"));
	}
}
 
Example 14
Source Project: wicket-spring-boot   Source File: LabeledFormBorder.java    License: Apache License 2.0 5 votes vote down vote up
public LabeledFormBorder(String labelText, FormComponent<T> container) {
	super(container.getId() + "Border");
	this.formComponent = container;
	FormComponentLabel label = new FormComponentLabel("label", container);
	label.add(new AttributeModifier("class", "control-label"));
	Label somethingLabelSpan = new Label("labelText", labelText);
	somethingLabelSpan.setRenderBodyOnly(true);
	label.add(somethingLabelSpan);

	addToBorder(label);
	add(container);
}
 
Example 15
@Override
public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel)
{
  final Date value = (Date) BeanHelper.getNestedProperty(rowModel.getObject(), getPropertyExpression());
  final Label label = new Label(componentId, dateTimeFormatter.getFormattedDate(value, datePattern));
  item.add(label);
  if (cellItemListener != null) {
    cellItemListener.populateItem(item, componentId, rowModel);
  }
}
 
Example 16
Source Project: ontopia   Source File: LinkFunctionBoxPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected List<List<Component>> getFunctionBoxComponentList(String id) {
  List<Component> heading = Arrays.asList(new Component[] { getLabel(id) }); 
  List<Component> box = Arrays.asList(new Component[] {
      new Label(id, new ResourceModel("arrow.right")), getLink(id) });
  
  List<List<Component>> result = new ArrayList<List<Component>>(2);
  result.add(heading);
  result.add(box);
  return result;
}
 
Example 17
Source Project: inception   Source File: ActiveLearningSidebar.java    License: Apache License 2.0 5 votes vote down vote up
private Label createNoRecommendersMessage()
{
    if (!alStateModel.getObject().isSessionActive()) {
        // Use the currently selected layer from the annotation detail editor panel as the
        // default choice in the active learning mode.
        List<AnnotationLayer> layersWithRecommenders = listLayersWithRecommenders();
        if (layersWithRecommenders.contains(getModelObject().getDefaultAnnotationLayer())) {
            alStateModel.getObject()
                .setLayer(getModelObject().getDefaultAnnotationLayer());
        }
        // If the currently selected layer has no recommenders, use the first one which has
        else if (!layersWithRecommenders.isEmpty()) {
            alStateModel.getObject().setLayer(layersWithRecommenders.get(0));
        }
        // If there are no layers with recommenders, then choose nothing and show no
        // recommenders message.
        else {
            alStateModel.getObject().setLayer(null);
            alStateModel.getObject().setDoExistRecommenders(false);
        }
    }
    Label noRecommendersMessage = new Label(CID_NO_RECOMMENDERS, "None of the layers have any "
        + "recommenders configured. Please set the recommenders first in the Project "
        + "Settings.");
    noRecommendersMessage.add(LambdaBehavior.onConfigure(component -> component.setVisible
        (!alStateModel.getObject().isDoExistRecommenders())));
    return noRecommendersMessage;
}
 
Example 18
Source Project: sakai   Source File: AjaxLazyLoadImage.java    License: Educational Community License v2.0 5 votes vote down vote up
/**
 * @param markupId
 *            The components markupid.
 * @return The component to show while the real component is being created.
 */
public Component getLoadingComponent(String markupId) {
	Label indicator = new Label(markupId, "<img src=\"" + RequestCycle.get().urlFor(AbstractDefaultAjaxBehavior.INDICATOR, null) + "\"/>");
	indicator.setEscapeModelStrings(false);
	indicator.add(new AttributeModifier("title", new Model("...")));
	return indicator;
}
 
Example 19
Source Project: syncope   Source File: ReportletDirectoryPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected List<IColumn<ReportletWrapper, String>> getColumns() {
    final List<IColumn<ReportletWrapper, String>> columns = new ArrayList<>();

    columns.add(new PropertyColumn<>(
            new StringResourceModel("reportlet", this), "implementationKey", "implementationKey"));

    columns.add(new AbstractColumn<ReportletWrapper, String>(
            new StringResourceModel("configuration", this)) {

        private static final long serialVersionUID = -4008579357070833846L;

        @Override
        public void populateItem(
                final Item<ICellPopulator<ReportletWrapper>> cellItem,
                final String componentId,
                final IModel<ReportletWrapper> rowModel) {

            if (rowModel.getObject().getConf() == null) {
                cellItem.add(new Label(componentId, ""));
            } else {
                cellItem.add(new Label(componentId, rowModel.getObject().getConf().getClass().getName()));
            }
        }
    });

    return columns;
}
 
Example 20
Source Project: etcd-viewer   Source File: TemplatePage.java    License: Apache License 2.0 5 votes vote down vote up
private void createPage() {

        add(title = new Label("title", new LoadableDetachableModel<Object>() {
            private static final long serialVersionUID = 1L;
            @Override
            protected Object load() {
                return getPageTitleModel().getObject();
            }
        }));

        title.setOutputMarkupId(true);

        if (getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled()) {
            add(new DebugBar("debug"));
        } else {
            add(new EmptyPanel("debug").setVisible(false));
        }

        add(createMenuItem("homeMenuItem", "home", HomePage.class));
        add(createMenuItem("aboutMenuItem", "about", AboutPage.class));

        add(selectRegistryPanel = new SelectRegistryPanel("selectRegistry"));
        selectRegistryPanel.setOutputMarkupId(true);

        add(new SignInPanel("authPanel"));
        add(new SignOutPanel("signOut"));
    }
 
Example 21
Source Project: syncope   Source File: StatusUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static Label getLabel(final String componentId, final String alt, final String title, final String clazz) {
    return new Label(componentId, StringUtils.EMPTY) {

        private static final long serialVersionUID = 4755868673082976208L;

        @Override
        protected void onComponentTag(final ComponentTag tag) {
            super.onComponentTag(tag);
            tag.put("alt", alt);
            tag.put("title", title);
            tag.put("class", clazz);
        }
    };
}
 
Example 22
Source Project: openmeetings   Source File: VoteDialog.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	add(feedback.setOutputMarkupId(true));
	add(new Label("user", user));
	add(new Label("roomPoll.question"));
	add(typeBool.add(new RadioGroup<Boolean>("answer").setRequired(true)
				.add(new Radio<>("true", Model.of(Boolean.TRUE))).add(new Radio<>("false", Model.of(Boolean.FALSE)))
		).setOutputMarkupPlaceholderTag(true).setVisible(false));
	add(typeInt.add(new DropDownChoice<>("pointList", answers).setRequired(true))
			.setOutputMarkupPlaceholderTag(true).setVisible(false));
}
 
Example 23
Source Project: onedev   Source File: BlobDiffPanel.java    License: MIT License 5 votes vote down vote up
private Fragment newFragment(String message, boolean warning) {
	Fragment fragment = new Fragment(CONTENT_ID, "noDiffFrag", this);
	fragment.add(new BlobDiffTitle("title", change));
	if (warning)
		fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-warning")));
	else
		fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-info-circle")));
	fragment.add(new Label("message", message));
	return fragment;
}
 
Example 24
Source Project: inception   Source File: PropertyFeatureEditor.java    License: Apache License 2.0 5 votes vote down vote up
private Label createNoStatementLabel()
{
    Label statementDoesNotExist = new Label("statementDoesNotExist",
        "There is no statement " + "in the KB which matches this SPO.");
    statementDoesNotExist
        .add(LambdaBehavior.onConfigure(component -> component.setVisible(!existStatements)));
    return statementDoesNotExist;
}
 
Example 25
Source Project: nextreports-server   Source File: PaginatePanel.java    License: Apache License 2.0 5 votes vote down vote up
public PaginatePanel(IModel<Analysis> model) {		
	super(FormPanel.CONTENT_ID);
	
	add(new Label("info", new StringResourceModel("PaginatePanel.info", null, null)));
	
	add(new Label("rows",  new StringResourceModel("PaginatePanel.rows", this, null)));
	TextField<Integer> rowsText = new TextField<Integer>("rowsText", new PropertyModel<Integer>(model.getObject(), "rowsPerPage"));
	rowsText.add(RangeValidator.range(1, 500));
	rowsText.setLabel(new StringResourceModel("PaginatePanel.rows", this, null));
		add(rowsText);		 		 		
}
 
Example 26
Source Project: yes-cart   Source File: AddAnyButton.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onBeforeRender() {

    final BookmarkablePageLink link = (BookmarkablePageLink) getWicketSupportFacade().links().newProductLink("link", supplier, product.getProductId());

    final String lang = getLocale().getLanguage();

    final CharSequence uri = link.urlFor(link.getPageClass(), link.getPageParameters());
    final HttpServletRequest req = (HttpServletRequest)((WebRequest) RequestCycle.get().getRequest()).getContainerRequest();
    final String absUri = RequestUtils.toAbsolutePath(req.getRequestURL().toString(), uri.toString());

    final String name = getI18NSupport().getFailoverModel(product.getDisplayName(), product.getName()).getValue(lang);

    final StringBuilder anchor = new StringBuilder()
            .append("<a class=\"a2a_dd\" href=\"http://www.addtoany.com/share_save?linkurl=")
            .append(absUri)
            .append("&amp;linkname=")
            .append(name)
            .append("\">Share</a>");

    final StringBuilder js = new StringBuilder()
            .append("<script type=\"text/javascript\">\n")
            .append("            var a2a_config = a2a_config || {};\n")
            .append("            a2a_config.linkname = \"").append(name).append("\";\n")
            .append("            a2a_config.linkurl = \"").append(absUri).append("\";\n")
            .append("            a2a_config.locale = \"").append(lang).append("\";")
            .append("            a2a_config.color_main = \"D7E5ED\";")
            .append("            a2a_config.color_border = \"AECADB\";")
            .append("            a2a_config.color_link_text = \"333333\";")
            .append("            a2a_config.color_link_text_hover = \"333333\";")
            .append("</script>");

    addOrReplace(new Label("anchor", anchor.toString()).setEscapeModelStrings(false));
    addOrReplace(new Label("js", js.toString()).setEscapeModelStrings(false));

    super.onBeforeRender();
}
 
Example 27
public AnnotatorWorkflowActionBarItemGroup(String aId, AnnotationPageBase aPage)
{
    super(aId);

    page = aPage;

    add(finishDocumentDialog = new ConfirmationDialog("finishDocumentDialog",
            new StringResourceModel("FinishDocumentDialog.title", this, null),
            new StringResourceModel("FinishDocumentDialog.text", this, null)));
    
    add(finishDocumentLink = new LambdaAjaxLink("showFinishDocumentDialog",
            this::actionFinishDocument));
    finishDocumentLink.setOutputMarkupId(true);
    finishDocumentLink.add(enabledWhen(() -> page.isEditable()));
    finishDocumentLink.add(new Label("state")
            .add(new CssClassNameModifier(LambdaModel.of(this::getStateClass))));

    IModel<String> documentNameModel = PropertyModel.of(page.getModel(), "document.name");
    add(resetDocumentDialog = new ChallengeResponseDialog("resetDocumentDialog",
            new StringResourceModel("ResetDocumentDialog.title", this),
            new StringResourceModel("ResetDocumentDialog.text", this)
                    .setModel(page.getModel()).setParameters(documentNameModel),
            documentNameModel));
    resetDocumentDialog.setConfirmAction(this::actionResetDocument);

    add(resetDocumentLink = new LambdaAjaxLink("showResetDocumentDialog",
            resetDocumentDialog::show));
    resetDocumentLink.add(enabledWhen(() -> page.isEditable()));
}
 
Example 28
@Override
protected void onBeforeRender()
{
  if (initialized == false) {
    initialized = true;
    final BookmarkablePageLink<String> link;
    if (params == null) {
      link = new BookmarkablePageLink<String>("button", pageClass);
    } else {
      link = new BookmarkablePageLink<String>("button", pageClass, params);
    }
    if (type != null) {
      link.add(AttributeModifier.replace("data-icon", type.getCssId()));
    }
    add(link);
    if (label != null) {
      link.add(new Label("label", label));
    } else {
      link.add(WicketUtils.getInvisibleComponent("label"));
    }
    if (this.relExternal == true) {
      link.add(AttributeModifier.replace("rel", "external"));
    }
    if (this.relDialog == true) {
      link.add(AttributeModifier.replace("data-rel", "dialog"));
    }
    if (this.noText == true) {
      link.add(AttributeModifier.replace("data-iconpos", "notext"));
    }
    //      if (alignment == Alignment.LEFT) {
    //        link.add(AttributeModifier.add("class", "ui-btn-left"));
    //      }
  }
  super.onBeforeRender();
}
 
Example 29
Source Project: artifact-listener   Source File: ProjectPortfolioPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void addItemColumns(Item<Project> item, IModel<? extends Project> projectModel) {
	Link<Void> projectLink = ProjectDescriptionPage.linkDescriptor(ReadOnlyModel.of(projectModel)).link("projectLink");
	projectLink.add(new Label("name", BindingModel.of(projectModel, Binding.project().name())));
	item.add(projectLink);
	
	item.add(new Label("nbVersions", BindingModel.of(projectModel, Binding.project().versions().size())));
	
	item.add(new Label("nbArtifacts", BindingModel.of(projectModel, Binding.project().artifacts().size())));
}
 
Example 30
private void initScriptVariables()
{
  if (scriptVariables != null) {
    // Already initialized.
    return;
  }
  scriptVariables = new HashMap<String, Object>();
  scriptVariables.put("reportStorage", null);
  scriptVariables.put("reportScriptingStorage", null);
  scriptDao.addScriptVariables(scriptVariables);
  final SortedSet<String> set = new TreeSet<String>();
  set.addAll(scriptVariables.keySet());
  final StringBuffer buf = new StringBuffer();
  buf.append("scriptResult"); // first available variable.
  for (final String key : set) {
    buf.append(", ").append(key);
  }
  if (availableScriptVariablesLabel == null) {
    body.add(availableScriptVariablesLabel = new Label("availableScriptVariables", buf.toString()));
  }
  scriptDao.addAliasForDeprecatedScriptVariables(scriptVariables);
  // buf = new StringBuffer();
  // boolean first = true;
  // for (final BusinessAssessmentRowConfig rowConfig : AccountingConfig.getInstance().getBusinessAssessmentConfig().getRows()) {
  // if (rowConfig.getId() == null) {
  // continue;
  // }
  // if (first == true) {
  // first = false;
  // } else {
  // buf.append(", ");
  // }
  // buf.append('r').append(rowConfig.getNo()).append(", ").append(rowConfig.getId());
  // }
  // if (businessAssessmentRowsVariablesLabel == null) {
  // body.add(businessAssessmentRowsVariablesLabel = new Label("businessAssessmentRowsVariables", buf.toString()));
  // }
}