Java Code Examples for org.apache.wicket.markup.ComponentTag#append()

The following examples show how to use org.apache.wicket.markup.ComponentTag#append() . 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: EmailStatusIcon.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
@Override
public void onComponentTag(final ComponentTag tag) {
	EmailStatus value = getValue();
	
	if (value != null) {
		String iconClass = "";
		String tooltipKey = getString("profile.email.status." + value.toString());
		if (value == EmailStatus.PENDING_CONFIRM) {
			iconClass = BOOTSTRAP_PENDING_CONFIRM_ICON_CLASS;
		} else if (value == EmailStatus.PENDING_DELETE) {
			iconClass = BOOTSTRAP_PENDING_DELETE_ICON_CLASS;
		} else if (value == EmailStatus.VALIDATED) {
			iconClass = BOOTSTRAP_VALIDATED_ICON_CLASS;
		}
		tag.append(CLASS_ATTRIBUTE, iconClass, SEPARATOR);
		tag.append(TOOLTIP_ATTRIBUTE, tooltipKey, SEPARATOR);
	}
	super.onComponentTag(tag);
}
 
Example 2
Source File: CurationPage.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag aTag)
{
    super.onComponentTag(aTag);
    
    final SourceListView curationViewItem = getModelObject();
    
    // Is in focus?
    if (curationViewItem.getSentenceNumber() == CurationPage.this.getModelObject()
            .getFocusUnitIndex()) {
        aTag.append("class", "current", " ");
    }
    
    // Agree or disagree?
    String cC = curationViewItem.getSentenceState().getValue();
    if (cC != null) {
        aTag.append("class", "disagree", " ");
    }
    else {
        aTag.append("class", "agree", " ");
    }
    
    // In range or not?
    if (curationViewItem.getSentenceNumber() >= fSn
            && curationViewItem.getSentenceNumber() <= lSn) {
        aTag.append("class", "in-range", " ");
    }
    else {
        aTag.append("class", "out-range", " ");
    }
}
 
Example 3
Source File: AbstractWidget.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	String widgetStyleClass = getWidgetStyleClass();
	if(widgetStyleClass!=null) {
		tag.append("class", widgetStyleClass, " ");
	}
}
 
Example 4
Source File: FAIcon.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	checkComponentTag(tag, "i");
	String css = getDefaultModelObjectAsString();
	if(css!=null)
	{
		FAIconType faIconType = FAIconType.parseToFAIconType(css);
		if(faIconType!=null) css = faIconType.getCssClass();
		tag.append("class", css, " "); 
	}
	super.onComponentTag(tag);
}
 
Example 5
Source File: AjaxIndicator.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	checkComponentTag(tag, "div");
	tag.append("style", "display: none", "; ");
	tag.append("class", "ajax-indicator", " ");
}
 
Example 6
Source File: InfinitePagingDataTable.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void onComponentTag(final Component component, final ComponentTag tag)
{
	String className = getCssClass();
	if (!Strings.isEmpty(className))
	{
		tag.append("class", className, " ");
	}
}
 
Example 7
Source File: InfinitePagingDataTable.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
@Override
public void onComponentTag(final Component component, final ComponentTag tag)
{
	String className = getCssClass();
	if (!Strings.isEmpty(className))
	{
		tag.append("class", className, " ");
	}
}
 
Example 8
Source File: ProjectAvatar.java    From onedev with MIT License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	
	tag.setName("img");
	tag.append("class", "project-avatar", " ");
	tag.put("src", url);
}
 
Example 9
Source File: LinkedAccountPlainAttrsPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
@Override
protected FormComponent<?> checkboxToggle(
        final Attr attrTO,
        final AbstractFieldPanel<?> panel,
        final boolean isMultivalue) {

    LinkedAccountPlainAttrProperty property = accountPlainAttrProperties.stream().filter(
            existingProperty -> {
                return existingProperty.getSchema().equals(attrTO.getSchema());
            }).findFirst().orElseGet(() -> {
                LinkedAccountPlainAttrProperty newProperty = new LinkedAccountPlainAttrProperty();
                newProperty.setOverridable(linkedAccountTO.getPlainAttr(attrTO.getSchema()).isPresent());
                newProperty.setSchema(attrTO.getSchema());
                newProperty.getValues().addAll(attrTO.getValues());
                accountPlainAttrProperties.add(newProperty);
                return newProperty;
            });

    final BootstrapToggleConfig config = new BootstrapToggleConfig().
            withOnStyle(BootstrapToggleConfig.Style.success).
            withOffStyle(BootstrapToggleConfig.Style.danger).
            withSize(BootstrapToggleConfig.Size.mini);

    return new BootstrapToggle("externalAction", new PropertyModel<Boolean>(property, "overridable"), config) {

        private static final long serialVersionUID = -875219845189261873L;

        @Override
        protected CheckBox newCheckBox(final String id, final IModel<Boolean> model) {
            final CheckBox checkBox = super.newCheckBox(id, model);
            checkBox.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

                private static final long serialVersionUID = -1107858522700306810L;

                @Override
                protected void onUpdate(final AjaxRequestTarget target) {
                    if (isMultivalue) {
                        MultiFieldPanel.class.cast(panel).setFormReadOnly(!model.getObject());
                    } else {
                        FieldPanel.class.cast(panel).setReadOnly(!model.getObject());
                    }

                    updateAccountPlainSchemas(property, model.getObject());
                    target.add(panel);
                }
            });
            return checkBox;
        }

        @Override
        protected IModel<String> getOnLabel() {
            return Model.of("Override");
        }

        @Override
        protected IModel<String> getOffLabel() {
            return Model.of("Override?");
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {
            super.onComponentTag(tag);
            tag.append("class", "overridable", " ");
        }
    };
}
 
Example 10
Source File: LinkedAccountCredentialsPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
private FormComponent<?> checkboxToggle(
        final LinkedAccountPlainAttrProperty property, final FieldPanel<?> panel) {

    final BootstrapToggleConfig config = new BootstrapToggleConfig().
            withOnStyle(BootstrapToggleConfig.Style.success).
            withOffStyle(BootstrapToggleConfig.Style.danger).
            withSize(BootstrapToggleConfig.Size.mini);

    return new BootstrapToggle("externalAction", new PropertyModel<Boolean>(property, "overridable"), config) {

        private static final long serialVersionUID = -875219845189261873L;

        @Override
        protected CheckBox newCheckBox(final String id, final IModel<Boolean> model) {
            final CheckBox checkBox = super.newCheckBox(id, model);
            checkBox.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

                private static final long serialVersionUID = -1107858522700306810L;

                @Override
                protected void onUpdate(final AjaxRequestTarget target) {
                    FieldPanel.class.cast(panel).setReadOnly(!model.getObject());
                    if (model.getObject()) {
                        if (property.getSchema().equals("password")) {
                            linkedAccountTO.setPassword(passwordValue);
                        } else if (property.getSchema().equals("username")) {
                            linkedAccountTO.setUsername(usernameValue);
                        }
                    } else {
                        if (property.getSchema().equals("password")) {
                            passwordValue = linkedAccountTO.getPassword();
                            linkedAccountTO.setPassword(null);
                        } else if (property.getSchema().equals("username")) {
                            usernameValue = linkedAccountTO.getUsername();
                            linkedAccountTO.setUsername(null);
                        }
                    }
                    target.add(panel);
                }
            });
            return checkBox;
        }

        @Override
        protected IModel<String> getOnLabel() {
            return Model.of("Override");
        }

        @Override
        protected IModel<String> getOffLabel() {
            return Model.of("Override?");
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {
            super.onComponentTag(tag);
            tag.append("class", "overridable", " ");
        }
    };
}
 
Example 11
Source File: GridsterAjaxBehavior.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	tag.append("class", "gridster orienteer", " ");
}
 
Example 12
Source File: EditablePanelDate.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public EditablePanelDate(String id, IModel inputModel, final NodeModel nodeModel, final TreeNode node, final boolean startDate)
{
	super(id);

	if (startDate && nodeModel.getNodeShoppingPeriodStartDate() != null) {
		dateTextField = DateFormatterUtil.format(nodeModel.getNodeShoppingPeriodStartDate(), DATEPICKER_FORMAT, getSession().getLocale());
	}
	if (!startDate && nodeModel.getShoppingPeriodEndDate() != null) {
		dateTextField = DateFormatterUtil.format(nodeModel.getNodeShoppingPeriodEndDate(), DATEPICKER_FORMAT, getSession().getLocale());
	}

	final TextField date = new TextField<String>("dateTextField", new PropertyModel<String>(this, "dateTextField")){
		@Override
		public boolean isVisible() {
			return nodeModel.isDirectAccess() && nodeModel.getNodeShoppingPeriodAdmin();
		}
		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			tag.append("size", "8", "");
			tag.append("readonly", "readonly", "");
			tag.append("class", "formInputField", " ");
			tag.append("class", "datePicker", " ");
		}
	};
	String dateInputId = ((startDate) ? "dateTextFieldStart_" : "dateTextFieldEnd_") + nodeModel.getNodeId();
	date.setMarkupId(dateInputId);

	final HiddenField hiddenInput = new HiddenField<String>("hiddenDateTextField", new PropertyModel<String>(this, "hiddenDateTextField"));
	String hiddenInputId = String.format((startDate) ? HIDDEN_START_ISO8601 : HIDDEN_END_ISO8601, nodeModel.getNodeId());
	hiddenInput.setMarkupId(hiddenInputId);
	hiddenInput.add(new AjaxFormComponentUpdatingBehavior("onchange")
	{
		@Override
		protected void onUpdate(AjaxRequestTarget target)
		{
			if (DateFormatterUtil.isValidISODate(hiddenDateTextField) && hiddenDateTextField != null){
				Date hiddenDate = DateFormatterUtil.parseISODate(hiddenDateTextField);
				if(startDate){
					nodeModel.setShoppingPeriodStartDate(hiddenDate);
					dateTextField = DateFormatterUtil.format(hiddenDate, DATEPICKER_FORMAT, getSession().getLocale());
				}else{
					nodeModel.setShoppingPeriodEndDate(hiddenDate);
					dateTextField = DateFormatterUtil.format(hiddenDate, DATEPICKER_FORMAT, getSession().getLocale());
				}

				//In order for the models to refresh, you have to call "expand" or "collapse" then "updateTree",
				//since I don't want to expand or collapse, I just call whichever one the node is already
				//Refreshing the tree will update all the models and information (like role) will be generated onClick
				if(((BaseTreePage)target.getPage()).getTree().getTreeState().isNodeExpanded(node)){
					((BaseTreePage)target.getPage()).getTree().getTreeState().expandNode(node);
				}else{
					((BaseTreePage)target.getPage()).getTree().getTreeState().collapseNode(node);
				}
				((BaseTreePage)target.getPage()).getTree().updateTree(target);
				target.focusComponent(hiddenInput);
			}
		}

	});
	add(date);
	add(hiddenInput);
}
 
Example 13
Source File: BootstrapFeedbackPopover.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	
	if(model.getObject().size() > 0) tag.append("class", "has-error", " ");
}
 
Example 14
Source File: AbstractTauchartsPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	tag.append("style", "height:"+configModel.getObject().getMinHeight()+"px;", " ");
	super.onComponentTag(tag);
}
 
Example 15
Source File: BootstrapControlGroupFeedback.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	
	if(new FeedbackCollector(getPage()).collect(filter).size() > 0) tag.append("class", "has-error", " ");
}
 
Example 16
Source File: OrienteerPagingNavigator.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	if(!iterator().next().isEnabledInHierarchy()) tag.append("class", "disabled", " ");
}
 
Example 17
Source File: DashboardPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	tag.append("class", "dashboard", " ");
}
 
Example 18
Source File: EditablePanelDate.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public EditablePanelDate(String id, IModel inputModel, final NodeModel nodeModel, final TreeNode node, final boolean startDate)
{
	super(id);

	if (startDate && nodeModel.getNodeShoppingPeriodStartDate() != null) {
		dateTextField = DateFormatterUtil.format(nodeModel.getNodeShoppingPeriodStartDate(), DATEPICKER_FORMAT, getSession().getLocale());
	}
	if (!startDate && nodeModel.getShoppingPeriodEndDate() != null) {
		dateTextField = DateFormatterUtil.format(nodeModel.getNodeShoppingPeriodEndDate(), DATEPICKER_FORMAT, getSession().getLocale());
	}

	final TextField date = new TextField<String>("dateTextField", new PropertyModel<String>(this, "dateTextField")){
		@Override
		public boolean isVisible() {
			return nodeModel.isDirectAccess() && nodeModel.getNodeShoppingPeriodAdmin();
		}
		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			tag.append("size", "8", "");
			tag.append("readonly", "readonly", "");
			tag.append("class", "formInputField", " ");
			tag.append("class", "datePicker", " ");
		}
	};
	String dateInputId = ((startDate) ? "dateTextFieldStart_" : "dateTextFieldEnd_") + nodeModel.getNodeId();
	date.setMarkupId(dateInputId);

	final HiddenField hiddenInput = new HiddenField<String>("hiddenDateTextField", new PropertyModel<String>(this, "hiddenDateTextField"));
	String hiddenInputId = String.format((startDate) ? HIDDEN_START_ISO8601 : HIDDEN_END_ISO8601, nodeModel.getNodeId());
	hiddenInput.setMarkupId(hiddenInputId);
	hiddenInput.add(new AjaxFormComponentUpdatingBehavior("onchange")
	{
		@Override
		protected void onUpdate(AjaxRequestTarget target)
		{
			if (DateFormatterUtil.isValidISODate(hiddenDateTextField) && hiddenDateTextField != null){
				Date hiddenDate = DateFormatterUtil.parseISODate(hiddenDateTextField);
				if(startDate){
					nodeModel.setShoppingPeriodStartDate(hiddenDate);
					dateTextField = DateFormatterUtil.format(hiddenDate, DATEPICKER_FORMAT, getSession().getLocale());
				}else{
					nodeModel.setShoppingPeriodEndDate(hiddenDate);
					dateTextField = DateFormatterUtil.format(hiddenDate, DATEPICKER_FORMAT, getSession().getLocale());
				}

				//In order for the models to refresh, you have to call "expand" or "collapse" then "updateTree",
				//since I don't want to expand or collapse, I just call whichever one the node is already
				//Refreshing the tree will update all the models and information (like role) will be generated onClick
				if(((BaseTreePage)target.getPage()).getTree().getTreeState().isNodeExpanded(node)){
					((BaseTreePage)target.getPage()).getTree().getTreeState().expandNode(node);
				}else{
					((BaseTreePage)target.getPage()).getTree().getTreeState().collapseNode(node);
				}
				((BaseTreePage)target.getPage()).getTree().updateTree(target);
				target.focusComponent(hiddenInput);
			}
		}

	});
	add(date);
	add(hiddenInput);
}
 
Example 19
Source File: StructureTable.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	checkComponentTag(tag, "table");
	tag.append("class", "table table-sm structure-table", " ");
	super.onComponentTag(tag);
}
 
Example 20
Source File: OrienteerHeadersToolbar.java    From Orienteer with Apache License 2.0 2 votes vote down vote up
/**
 * Change color for filtered column
 * @param tag html tag of current column
 * @param column {@link IColumn} column for change color
 */
public void changeColorForFilteredColumn(ComponentTag tag, IColumn<T, S> column) {
    if(filteredColumnClass!=null && needChangeColor(column)) tag.append("class", filteredColumnClass, " ");
}