本文整理匯總了Java中org.apache.wicket.markup.ComponentTag類的典型用法代碼示例。如果您正苦於以下問題:Java ComponentTag類的具體用法?Java ComponentTag怎麽用?Java ComponentTag使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ComponentTag類屬於org.apache.wicket.markup包,在下文中一共展示了ComponentTag類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onConfigure
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
protected void onConfigure() {
super.onConfigure();
WebMarkupContainer container = new WebMarkupContainer("output") {
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
try {
CharArrayWriter baos = new CharArrayWriter(0);
DocumentationDefinitionResolver.get().renderDocumentationHTML(typeLoader.loadTypeOrException(stypeClass), baos);
replaceComponentTagBody(markupStream, openTag, baos.toString());
} catch (Exception e) {
throw SingularException.rethrow(e.getMessage(), e);
}
}
};
queue(container);
}
示例2: onComponentTag
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
protected void onComponentTag(ComponentTag tag) {
ResourceReference resourceReference = getImageResourceReference();
if (resourceReference == null) {
throw new IllegalStateException("The target ResourceReference of an image of type " + getClass() + " was null when trying to render the url.");
}
PageParameters parameters;
try {
LinkParameterValidators.checkModel(parametersValidator);
parameters = getParameters();
LinkParameterValidators.checkSerialized(parameters, parametersValidator);
} catch(LinkParameterValidationException e) {
throw new LinkParameterValidationRuntimeException(e);
}
setImageResourceReference(resourceReference, parameters);
super.onComponentTag(tag);
}
示例3: onComponentTag
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
if (isEnabledInHierarchy())
{
if (tag.getName().equalsIgnoreCase("a"))
{
tag.put("href", "#");
}
}
else
{
disableLink(tag);
}
}
示例4: onComponentTag
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
public void onComponentTag(Component component, ComponentTag tag) {
super.onComponentTag(component, tag);
// change the order of the two following method calls, otherwise ajax
// links can never be disabled!
// HACK issue #79: wicket changes tag name if component wasn't enabled
Buttons.fixDisabledState(component, tag);
Components.assertTag(component, tag, "a", "button", "input");
// a menu button has no css classes, inherits its styles from the menu
if (!Buttons.Type.Menu.equals(getType())) {
Buttons.onComponentTag(component, tag, buttonSize.getObject(),
buttonType.getObject(), blockProvider);
}
}
示例5: getLink
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
protected Component getLink(String id) {
PageParameters pageParameters = new PageParameters();
pageParameters.put("topicMapId", getTopicMapId());
pageParameters.put("topicId", getTopicId());
return new BookmarkablePageLink<Page>(id, VizigatorPage.class, pageParameters) {
@Override
protected void onComponentTag(ComponentTag tag) {
tag.setName("a");
//tag.put("target", "_blank");
super.onComponentTag(tag);
}
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag, new ResourceModel("vizigator.text2").getObject().toString());
}
};
}
示例6: replaceAttributeValue
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
/**
* Checks the given component tag for an instance of the attribute to modify
* and if all criteria are met then replace the value of this attribute with
* the value of the contained model object.
*
* @param component The component
* @param tag The tag to replace the attribute value for
*/
private void replaceAttributeValue(final Component component, final ComponentTag tag) {
if (isEnabled(component)) {
final IValueMap attributes = tag.getAttributes();
final Object replacementValue = getReplacementOrNull(component);
if (VALUELESS_ATTRIBUTE_ADD == replacementValue) {
attributes.put(attribute, null);
} else if (VALUELESS_ATTRIBUTE_REMOVE == replacementValue) {
attributes.remove(attribute);
} else {
final String value = toStringOrNull(attributes.get(attribute));
final String newValue = newValue(value, toStringOrNull(replacementValue));
if (newValue != null) {
attributes.put(attribute, newValue);
}
}
}
}
示例7: onComponentTagBody
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
// render the hidden field
if (isRootForm()) {
AppendingStringBuffer buffer = new AppendingStringBuffer(
"<div style=\"display:none\"><input type=\"hidden\" name=\"");
buffer.append(TOKEN_NAME)
.append("\" id=\"")
.append(TOKEN_NAME)
.append("\" value=\"")
.append(getToken())
.append("\" /></div>");
getResponse().write(buffer);
}
// do the rest of the processing
super.onComponentTagBody(markupStream, openTag);
}
示例8: onComponentTag
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
protected void onComponentTag(final ComponentTag tag) {
/*
* Anchors don't work with fallback, but we just ignore the exception when still needed by menu etc in
* bootstrap. Thus this workaround.
*/
final boolean anchor = "a".equals(tag.getName());
if (anchor) {
tag.setName("button");
}
super.onComponentTag(tag);
if (anchor) {
tag.setName("a");
//if missing, add href to make cursor display properly
if (Strings.isBlank(tag.getAttribute("href"))) {
tag.put("href", "#");
}
}
}
示例9: linkCubesQuery
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
/**
* @return
*/
private ExternalLink linkCubesQuery(
final CubesMetricMeasurement cubesMetricMeasurement) {
ExternalLink link = new ExternalLink("linkCubesQuery", cubesMetricMeasurement.getSelf()){
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("target","_blank");
}
};
link.add(new Label("cubesMetric", new PropertyModel<String>(
cubesMetricMeasurement, "cubesMetric")));
// tooltip config
TooltipConfig confConfig = new TooltipConfig()
.withPlacement(TooltipConfig.Placement.top);
link.add(new TooltipBehavior(new PropertyModel<String>(cubesMetricMeasurement,
"self"), confConfig));
return link;
}
示例10: onComponentTag
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
protected void onComponentTag(final ComponentTag tag) {
checkComponentTag(tag, "select");
super.onComponentTag(tag);
final IValueMap attrs = tag.getAttributes();
attrs.put("multiple", "multiple");
attrs.put("size", getPalette().getRows());
if (!palette.isPaletteEnabled()) {
attrs.put("disabled", "disabled");
}
avoidAjaxSerialization();
}
示例11: onComponentTagBody
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
// render the hidden field
if (isRootForm()) {
final AppendingStringBuffer buffer = new AppendingStringBuffer("<input type=\"hidden\" name=\"");
buffer.append(TOKEN_NAME)
.append("\" id=\"")
.append(TOKEN_NAME)
.append("\" value=\"")
.append(token)
.append("\" />");
getResponse().write(buffer);
}
// do the rest of the processing
super.onComponentTagBody(markupStream, openTag);
}
示例12: linkToJSON
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
/**
* @return a link to JSON response in order to test the query
*/
private ExternalLink linkToJSON() {
ExternalLink link = new ExternalLink("linkCubesQuery", query) {
private static final long serialVersionUID = 1L;
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("target", "_blank");
}
};
link.add(new Label("query", query));
return link;
}
示例13: UploadIFrame
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
public UploadIFrame(FieldValueModel fieldValueModel) {
this.fieldValueModel = fieldValueModel;
// add header contributor for stylesheet
add(CSSPackageResource.getHeaderContribution(getStylesheet()));
WebMarkupContainer container = new WebMarkupContainer("container");
container.setOutputMarkupId(true);
add(container);
// add form
container.add(new UploadForm("form", container));
// add onUploaded method
container.add(new WebComponent("onUploaded") {
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
if (uploaded) {
replaceComponentTagBody(markupStream, openTag,
"window.parent." + getOnUploadedCallback() + "('', '')");
uploaded = false;
}
}
});
}
示例14: getModuleNameLink
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
/**
* Returns a link that redirects to the module info
*
* @param componentId ID to assign to the link
* @param moduleId ID of module to display
* @return Module redirection link
*/
private AjaxLink getModuleNameLink(String componentId, final String moduleId) {
AjaxLink link = new AjaxLink<String>(componentId, Model.of(moduleId)) {
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
replaceComponentTagBody(markupStream, openTag, moduleId);
}
@Override
public void onClick(AjaxRequestTarget target) {
PageParameters pageParameters = new PageParameters();
pageParameters.set(BUILD_NAME, build.getName());
pageParameters.set(BUILD_NUMBER, build.getNumber());
pageParameters.set(BUILD_STARTED, build.getStarted());
pageParameters.set(MODULE_ID, moduleId);
setResponsePage(BuildBrowserRootPage.class, pageParameters);
}
};
link.add(new CssClass("item-link"));
return link;
}
示例15: newGroupByLink
import org.apache.wicket.markup.ComponentTag; //導入依賴的package包/類
private Component newGroupByLink(String id, final ISortStateLocator stateLocator, final String groupProperty) {
return new AjaxLink(id) {
@Override
public void onClick(AjaxRequestTarget target) {
if (stateLocator instanceof IGroupStateLocator) {
IGroupStateLocator groupStateLocator = (IGroupStateLocator) stateLocator;
switchGroupState(groupStateLocator, groupProperty);
target.add(getTable());
}
}
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("title", "Group By");
}
@Override
protected IAjaxCallDecorator getAjaxCallDecorator() {
return new CancelDefaultDecorator();
}
};
}