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

The following examples show how to use org.apache.wicket.markup.html.basic.Label. 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 File: ServerLogPage.java    From onedev with 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 File: SignInPage.java    From ontopia with Apache License 2.0 7 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 #3
Source File: AlarmImagePanel.java    From nextreports-server with 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 #4
Source File: RegisterPanel.java    From yes-cart with 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 #5
Source File: OClusterMetaPanel.java    From Orienteer with 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 #6
Source File: ServerSideJs.java    From yes-cart with 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 #7
Source File: AddressForm.java    From yes-cart with 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 #8
Source File: ConnObjectAttrColumn.java    From syncope with 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 #9
Source File: SecurityQuestionsITCase.java    From syncope with 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 #10
Source File: PaymentPage.java    From yes-cart with 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 #11
Source File: CurrentProjectDashlet.java    From inception with Apache License 2.0 5 votes vote down vote up
public CurrentProjectDashlet(String aId, IModel<Project> aCurrentProject)
{
    super(aId);
    projectModel = aCurrentProject;
    add(new Label("name", LoadableDetachableModel.of(this::getProjectName)));
    
    add(new Label("description", LoadableDetachableModel.of(this::getProjectDescription))
            .setEscapeModelStrings(false));
}
 
Example #12
Source File: EditablePanelDropdownText.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public EditablePanelDropdownText(String id, IModel inputModel, final NodeModel nodeModel, final TreeNode node, final Map<String, String> realmMap, final int type)
{
	super(id);
	
	//show the inherited role if the user hasn't selected this node
	IModel<String> labelModel = new AbstractReadOnlyModel<String>() {
		@Override
		public String getObject() {
			String[] inheritedAccess = nodeModel.getNodeAccessRealmRole();
			
			if("".equals(inheritedAccess[0])){
				return "";
			}else{
				String realmRole = inheritedAccess[0] + ":" + inheritedAccess[1];
				if(realmMap.containsKey(realmRole)){
					return realmMap.get(realmRole);
				}else{
					return realmRole;
				}
			}
		}
	};
	Label label = new Label("realmRole", labelModel){
		public boolean isVisible() {
			if(DelegatedAccessConstants.TYPE_ACCESS_SHOPPING_PERIOD_USER == type){
				return !nodeModel.isDirectAccess() || !nodeModel.getNodeShoppingPeriodAdmin();
			}else{
				return !nodeModel.isDirectAccess();
			}
		};
	};
	add(label);
}
 
Example #13
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void onInitialize() {

    super.onInitialize();

    final String currentSiteId = this.toolManager.getCurrentPlacement().getContext();

    try {
        Site site = siteService.getSite(currentSiteId);
        add(new Label("siteinfo", Model.of(site.getDescription())).setEscapeModelStrings(false));
    } catch (IdUnusedException e) {
        log.error(e.getMessage(), e);
    }
}
 
Example #14
Source File: MarkDownVisualizer.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel,
                                     IModel<OProperty> propertyModel, IModel<V> valueModel) {
    switch (mode) {
        case VIEW:
            return new Label(id, new MarkDownModel((IModel<String>) valueModel)).setEscapeModelStrings(false);
        case EDIT:
            return new TextArea<String>(id, (IModel<String>) valueModel).setType(String.class);
        default:
            return null;
    }
}
 
Example #15
Source File: WidgetPage.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void onInitialize() {
    super.onInitialize();

    // setup the data for the page
    final Label data = new Label("data");
    data.add(new AttributeAppender("data-siteid", getCurrentSiteId()));
    data.add(new AttributeAppender("data-tz", getUserTimeZone().getID()));
    data.add(new AttributeAppender("data-namespace", getNamespace()));

    add(data);
}
 
Example #16
Source File: ScriptingPage.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
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()));
  // }
}
 
Example #17
Source File: PropertyListPanel.java    From inception with Apache License 2.0 5 votes vote down vote up
public PropertyListPanel(String aId, IModel<KnowledgeBase> aKbModel, IModel<KBProperty> aModel)
{
    super(aId, aModel);

    setOutputMarkupId(true);

    selectedProperty = aModel;
    kbModel = aKbModel;
    preferences = Model.of(new Preferences());

    OverviewListChoice<KBProperty> overviewList = new OverviewListChoice<>("properties");
    overviewList.setChoiceRenderer(new ChoiceRenderer<>("uiLabel"));
    overviewList.setModel(selectedProperty);
    overviewList.setChoices(LambdaModel.of(this::getProperties));
    overviewList.add(new LambdaAjaxFormComponentUpdatingBehavior("change",
            this::actionSelectionChanged));
    
    add(overviewList);

    add(new Label("count", LambdaModel.of(() -> overviewList.getChoices().size())));

    LambdaAjaxLink addLink = new LambdaAjaxLink("add",
        target -> send(getPage(), Broadcast.BREADTH, new AjaxNewPropertyEvent(target)));
    addLink.add(new Label("label", new ResourceModel("property.list.add")));
    addLink.add(new WriteProtectionBehavior(kbModel));
    add(addLink);

    Form<Preferences> form = new Form<>("form", CompoundPropertyModel.of(preferences));
    form.add(new CheckBox("showAllProperties").add(
            new LambdaAjaxFormSubmittingBehavior("change", this::actionPreferenceChanged)));
    add(form);
}
 
Example #18
Source File: ConfirmEmailHtmlNotificationPanel.java    From artifact-listener with Apache License 2.0 5 votes vote down vote up
public ConfirmEmailHtmlNotificationPanel(String id, IModel<EmailAddress> emailModel) {
	super(id, emailModel);
	
	add(new CustomWebMarkupContainer("titleContainer", STYLE_TITLE));
	
	WebMarkupContainer contentContainer = new CustomWebMarkupContainer("contentContainer", STYLE_CONTENT);
	add(contentContainer);
	
	contentContainer.add(new Label("intro", new StringResourceModel("notification.panel.confirmEmail.text", getModel())));
	
	ExternalLink confirmLink = new ExternalLink("confirmLink", getConfirmUrl());
	confirmLink.add(new StyleAttributeAppender(STYLE_LINK));
	contentContainer.add(confirmLink);
}
 
Example #19
Source File: PropertyFeatureEditor.java    From inception with 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 #20
Source File: ProjectPortfolioPanel.java    From artifact-listener with 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 #21
Source File: ShippingView.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Add shipping price view to given form if shipping method is selected.
 *
 * @param form given form.
 */
private void addPriceView(final Form form) {

    final ShoppingCart cart = getCurrentCart();
    final Total total = cart.getTotal();
    final Long slaId = cart.getCarrierSlaId().get(this.supplier);

    if (slaId == null) {
        form.addOrReplace(new Label(PRICE_LABEL));
        form.addOrReplace(new Label(PRICE_VIEW));
    } else {
        final PriceModel model = shippingServiceFacade.getCartShippingSupplierTotal(cart, this.supplier);

        form.addOrReplace(new Label(PRICE_LABEL, new StringResourceModel(PRICE_LABEL, this)));
        form.addOrReplace(
                new PriceView(
                        PRICE_VIEW,
                        model,
                        total.getAppliedDeliveryPromo(), true, true,
                        model.isTaxInfoEnabled(), model.isTaxInfoShowAmount(),
                        true
                )
        );

    }

}
 
Example #22
Source File: ViewFriends.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public ViewFriends(final String userUuid) {

        log.debug("ViewFriends()");

        //get user viewing this page
        final String currentUserUuid = sakaiProxy.getCurrentUserId();

        //check person viewing this page (currentuserId) is allowed to view userId's friends - unless admin
        boolean isFriendsListVisible = sakaiProxy.isSuperUser()
                    || privacyLogic.isActionAllowed(userUuid, currentUserUuid, PrivacyType.PRIVACY_OPTION_MYFRIENDS);

        if (isFriendsListVisible) {
            //show confirmed friends panel for the given user
            Panel confirmedFriends = new ConfirmedFriends("confirmedFriends", userUuid);
            confirmedFriends.setOutputMarkupId(true);
            add(confirmedFriends);

            //post view event
            sakaiProxy.postEvent(ProfileConstants.EVENT_FRIENDS_VIEW_OTHER, "/profile/"+userUuid, false);
        } else {
            log.debug("User: {} is not allowed to view the friends list for: {} ", currentUserUuid, userUuid);
            String displayName = sakaiProxy.getUserDisplayName(userUuid);
            Label notPermitted = new Label("confirmedFriends"
                        , new StringResourceModel("error.friend.view.disallowed", null, new Object[] {displayName}));
            add(notPermitted);
        }
	}
 
Example #23
Source File: MenuConfigContent.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
public MenuConfigContent(final String id, final Menu menu)
{
  super(id);
  final RepeatingView mainMenuRepeater = new RepeatingView("mainMenuItem");
  add(mainMenuRepeater);
  if (menu == null) {
    mainMenuRepeater.setVisible(false);
    log.error("Oups, menu is null. Configuration of favorite menu not possible.");
    return;
  }
  int counter = 0;
  if (menu.getMenuEntries() == null) {
    // Should only occur in maintenance mode!
    return;
  }
  for (final MenuEntry mainMenuEntry : menu.getMenuEntries()) {
    if (mainMenuEntry.hasSubMenuEntries() == false) {
      continue;
    }
    final WebMarkupContainer mainMenuContainer = new WebMarkupContainer(mainMenuRepeater.newChildId());
    mainMenuRepeater.add(mainMenuContainer);
    if (counter++ % 5 == 0) {
      mainMenuContainer.add(AttributeModifier.append("class", "mm_clear"));
    }
    mainMenuContainer.add(new Label("label", new ResourceModel(mainMenuEntry.getI18nKey())));
    final RepeatingView subMenuRepeater = new RepeatingView("menuItem");
    mainMenuContainer.add(subMenuRepeater);
    for (final MenuEntry subMenuEntry : mainMenuEntry.getSubMenuEntries()) {
      final WebMarkupContainer subMenuContainer = new WebMarkupContainer(subMenuRepeater.newChildId());
      subMenuRepeater.add(subMenuContainer);
      final AbstractLink link = NavAbstractPanel.getMenuEntryLink(subMenuEntry, false);
      if (link != null) {
        subMenuContainer.add(link);
      } else {
        subMenuContainer.setVisible(false);
      }
    }
  }
}
 
Example #24
Source File: LocalizationVisualizer.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
public <V> Component createComponent(String id, DisplayMode mode, IModel<ODocument> documentModel, IModel<OProperty> propertyModel, IModel<V> valueModel) {
    switch (mode)
    {
        case VIEW:
        	return new Label(id, new FunctionModel<>(new DynamicPropertyValueModel<>(documentModel, propertyModel), LocalizeFunction.getInstance()));
        case EDIT:
            return new OLocalizationEditPanel<V>(id, documentModel, propertyModel).setType(String.class);
        default:
            return null;
    }
}
 
Example #25
Source File: SecurityPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public void populateItem(Item<ICellPopulator<AclEntry>> item, String componentId, IModel<AclEntry> rowModel) {
    if (rowModel.getObject().getType() == AclEntry.USER_TYPE) {
        item.add(new Label(componentId, getString("AclEntryPanel.user")));
    } else if (rowModel.getObject().getType() == AclEntry.GROUP_TYPE) {
        item.add(new Label(componentId, getString("AclEntryPanel.group")));
    }
}
 
Example #26
Source File: AbstractProductSearchResultList.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Extension hook for list item data population.
 *
 * @param listItem list item
 * @param selectedLocale locale
 * @param thumbWidthHeight thumb dimensions
 */
protected void onBeforeRenderPopulateListItem(final ListItem<ProductSearchResultDTO> listItem,
                                              final String selectedLocale,
                                              final Pair<String, String> thumbWidthHeight)
{
    final ProductSearchResultDTO prod = listItem.getModelObject();

    final String width = thumbWidthHeight.getFirst();
    final String height = thumbWidthHeight.getSecond();

    final LinksSupport links = getWicketSupportFacade().links();

    final String prodName = prod.getName(selectedLocale);

    listItem.add(
            links.newProductLink(PRODUCT_LINK_IMAGE, prod.getFulfilmentCentreCode(), prod.getId(), getPage().getPageParameters())
                    .add(
                            new ContextImage(PRODUCT_IMAGE, getDefaultImage(prod, width, height, selectedLocale))
                                    .add(new AttributeModifier(HTML_TITLE, prodName))
                                    .add(new AttributeModifier(HTML_ALT, prodName))
                    )
    );
    listItem.add(
            links.newProductLink(PRODUCT_NAME_LINK, prod.getFulfilmentCentreCode(), prod.getId(), getPage().getPageParameters())
                    .add(new Label(NAME, prodName).setEscapeModelStrings(false))
                    .setVisible(nameLinkVisible)
    );
}
 
Example #27
Source File: JQueryButtonPanel.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
@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 #28
Source File: AnnotatorWorkflowActionBarItemGroup.java    From webanno with Apache License 2.0 5 votes vote down vote up
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 #29
Source File: AddAnyButton.java    From yes-cart with 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 #30
Source File: PaginatePanel.java    From nextreports-server with 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);		 		 		
}