Java Code Examples for org.apache.wicket.markup.ComponentTag

The following are top voted examples for showing how to use org.apache.wicket.markup.ComponentTag. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: singular-server   File: DocumentationTablePage.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 2
Project: owsi-core-parent   File: DynamicImage.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 3
Project: owsi-core-parent   File: BlankLink.java   Source Code and License 6 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag)
{
	super.onComponentTag(tag);

	if (isEnabledInHierarchy())
	{
		if (tag.getName().equalsIgnoreCase("a"))
		{
			tag.put("href", "#");
		}
	}
	else
	{
		disableLink(tag);
	}
}
 
Example 4
Project: u-qasar.platform   File: ButtonBehavior.java   Source Code and License 6 votes vote down vote up
@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);
	}
}
 
Example 5
Project: ontopia   File: VizigatorLinkFunctionBoxPanel.java   Source Code and License 6 votes vote down vote up
@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());
    }
  };
}
 
Example 6
Project: u-qasar.platform   File: UserProfilePictureBackgroundBehaviour.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
			}
		}
	}
}
 
Example 7
Project: artifactory   File: SecureForm.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 8
Project: invesdwin-nowicket   File: ModelButton.java   Source Code and License 6 votes vote down vote up
@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", "#");
        }
    }
}
 
Example 9
Project: u-qasar.platform   File: CubeAnalysisDataManagementPage.java   Source Code and License 6 votes vote down vote up
/**
 * @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;
}
 
Example 10
Project: invesdwin-nowicket   File: AOptions.java   Source Code and License 6 votes vote down vote up
/**
 * {@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();
}
 
Example 11
Project: invesdwin-nowicket   File: CsrfTokenForm.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 12
Project: u-qasar.platform   File: AnalysisDrilldown.java   Source Code and License 6 votes vote down vote up
/**
 * @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;
}
 
Example 13
Project: ontopia   File: UploadIFrame.java   Source Code and License 6 votes vote down vote up
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;
      }
    }            
  });
}
 
Example 14
Project: artifactory   File: PublishedModulesTabPanel.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
}
 
Example 15
Project: artifactory   File: AjaxGroupableHeadersToolbar.java   Source Code and License 6 votes vote down vote up
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();
        }
    };
}
 
Example 16
Project: gitplex-mit   File: TooltipBehavior.java   Source Code and License 5 votes vote down vote up
@Override
public void onComponentTag(Component component, ComponentTag tag) {
	String original = tag.getAttribute("title");
	
	super.onComponentTag(component, tag);
	
	// hack here
	String current = tag.getAttribute("title");
	if (!Strings.isNullOrEmpty(original) && Strings.isNullOrEmpty(current)) {
		tag.put("title", original);
	}
}
 
Example 17
Project: gitplex-mit   File: BranchLink.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	configure();
	if (!isEnabled()) {
		tag.setName("span");
	}
}
 
Example 18
Project: gitplex-mit   File: UserLink.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	
	configure();
	if (!isEnabled())
		tag.setName("span");
}
 
Example 19
Project: gitplex-mit   File: VerificationStatusPanel.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new DropdownLink("status") {

		@Override
		protected Component newContent(String id, FloatingPanel floating) {
			return new VerificationDetailPanel(id, VerificationStatusPanel.this.getModel());
		}

		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);

			Collection<Verification> verifications = VerificationStatusPanel.this.getModelObject().values();
			if (hasStatus(verifications, Status.ERROR)) {
				tag.put("class", "verification-status error fa fa-warning");
				tag.put("title", "Some verifications are in error, click for details");
			} else if (hasStatus(verifications, Status.FAILURE)) {
				tag.put("class", "verification-status failure fa fa-times");
				tag.put("title", "Some verifications are failed, click for details");
			} else if (hasStatus(verifications, Status.RUNNING)) {
				tag.put("class", "verification-status running fa fa-circle");
				tag.put("title", "Some verifications are running, click for details");
			} else if (hasStatus(verifications, Status.SUCCESS)) {
				tag.put("class", "verification-status success fa fa-check");
				tag.put("title", "Verifications are successful, click for details");
			}
		}
		
	});
	
	setOutputMarkupPlaceholderTag(true);
}
 
Example 20
Project: gitplex-mit   File: AvatarLink.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	configure();
	if (!isEnabled())
		tag.setName("span");
}
 
Example 21
Project: gitplex-mit   File: Avatar.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
	super.onComponentTag(tag);
	
	tag.setName("img");
	tag.append("class", "avatar", " ");
	tag.put("src", url);
}
 
Example 22
Project: gitplex-mit   File: UserPage.java   Source Code and License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	ViewStateAwarePageLink<Void> avatarLink = new ViewStateAwarePageLink<Void>("avatar", 
			AvatarEditPage.class, AvatarEditPage.paramsOf(getUser())) {

		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			if (!isEnabled())
				tag.setName("span");
		}
		
	};
	if (!SecurityUtils.canManage(getUser())) {
		avatarLink.setEnabled(false);
	}
	add(avatarLink);
	avatarLink.add(new Avatar("avatar", userModel.getObject()));
	
	List<PageTab> tabs = new ArrayList<>();
	
	tabs.add(new UserTab("Profile", "fa fa-fw fa-list-alt", UserProfilePage.class));
	if (SecurityUtils.canManage(getUser())) {
		tabs.add(new UserTab("Edit Avatar", "fa fa-fw fa-picture-o", AvatarEditPage.class));
		
		if (StringUtils.isNotBlank(getUser().getPassword()))
			tabs.add(new UserTab("Change Password", "fa fa-fw fa-key", PasswordEditPage.class));
		tabs.add(new UserTab("Access Token", "fa fa-fw fa-key", TokenGeneratePage.class));
	}
	tabs.add(new UserTab("Groups", "fa fa-fw fa-group", UserMembershipsPage.class));
	if (SecurityUtils.isAdministrator()) 
		tabs.add(new UserTab("Authorizations", "fa fa-fw fa-lock", UserAuthorizationsPage.class));
	if (SecurityUtils.canManage(getUser()))
		tabs.add(new UserTab("Tasks", "fa fa-fw fa-bell-o", TaskListPage.class));
	
	add(new Tabbable("userTabs", tabs));
}
 
Example 23
Project: engerek   File: Form.java   Source Code and License 5 votes vote down vote up
@Override
public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
    super.onComponentTagBody(markupStream, openTag);

    if (addFakeInputFields) {
    	final Response response = getResponse();
    	response.write("<input style=\"display:none\">\n" +
            "<input type=\"password\" style=\"display:none\">");
    }
}
 
Example 24
Project: engerek   File: SimpleRoleSelector.java   Source Code and License 5 votes vote down vote up
private Component createRoleLink(String id, IModel<PrismObject<R>> model) {
    AjaxLink<PrismObject<R>> button = new AjaxLink<PrismObject<R>>(id, model) {

        @Override
        public IModel<?> getBody() {
            return new Model<String>(getModel().getObject().asObjectable().getName().getOrig());
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            LOGGER.trace("{} CLICK: {}", this, getModel().getObject());
            toggleRole(getModel().getObject());
            target.add(this);
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            PrismObject<R> role = getModel().getObject();
            if (isSelected(role)) {
                tag.put("class", "list-group-item active");
            } else {
                tag.put("class", "list-group-item");
            }
            String description = role.asObjectable().getDescription();
            if (description != null) {
                tag.put("title", description);
            }
        }
    };
    button.setOutputMarkupId(true);
    return button;
}
 
Example 25
Project: engerek   File: SimpleParametricRoleSelector.java   Source Code and License 5 votes vote down vote up
private Component createParamLink(String id, IModel<String> itemModel) {
    AjaxLink<String> button = new AjaxLink<String>(id, itemModel) {

        @Override
        public IModel<?> getBody() {
            return new Model<String>(getModel().getObject());
        }

        @Override
        public void onClick(AjaxRequestTarget target) {
            LOGGER.trace("{} CLICK param: {}", this, getModel().getObject());
            toggleParam(getModel().getObject());
            target.add(SimpleParametricRoleSelector.this);
        }

        @Override
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            String param = getModel().getObject();
            if (param.equals(selectedParam)) {
                tag.put("class", "list-group-item active");
            } else {
                tag.put("class", "list-group-item");
            }
        }
    };
    button.setOutputMarkupId(true);
    return button;
}
 
Example 26
Project: engerek   File: AjaxIconButton.java   Source Code and License 5 votes vote down vote up
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    String icon = getModelObject();
    if (StringUtils.isNotEmpty(icon)) {
        replaceComponentTagBody(markupStream, openTag, "<i class=\"" + icon + "\"></i>");
        return;
    }

    super.onComponentTagBody(markupStream, openTag);
}
 
Example 27
Project: engerek   File: AjaxIconButton.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    if (tag.isOpenClose()) {
        tag.setType(XmlTag.TagType.OPEN);
    }
}
 
Example 28
Project: engerek   File: TableHeadersToolbar.java   Source Code and License 5 votes vote down vote up
@Override
protected WebMarkupContainer newSortableHeader(String headerId, final String property, final ISortStateLocator locator) {
    return new AjaxFallbackOrderByBorder(headerId, property, locator) {

        @Override
        protected void onSortChanged() {
            getTable().setCurrentPage(0);
        }
        
        @Override
        protected void onAjaxClick(AjaxRequestTarget target) {
        	target.add(getTable());
        }

        @Override
        public void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            ISortState sortState = locator.getSortState();
            SortOrder dir = sortState.getPropertySortOrder(property);
            String cssClass;
            if (dir == SortOrder.ASCENDING) {
                cssClass = "sortable asc";
            } else if (dir == SortOrder.DESCENDING) {
                cssClass = "sortable desc";
            } else {
                cssClass = "sortable";
            }

            if (!Strings.isEmpty(cssClass)) {
                tag.append("class", cssClass, " ");
            }
        }
    };
}
 
Example 29
Project: engerek   File: NavigatorPageLink.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    if (tag.isOpenClose()) {
        tag.setType(XmlTag.TagType.OPEN);
    }
}
 
Example 30
Project: engerek   File: TabbedPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Generates a loop item used to represent a specific tab's <code>li</code> element.
 *
 * @param tabIndex
 * @return new loop item
 */
protected LoopItem newTabContainer(final int tabIndex) {
    return new LoopItem(tabIndex) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void onConfigure() {
            super.onConfigure();

            setVisible(getVisiblityCache().isVisible(tabIndex));
        }

        @Override
        protected void onComponentTag(final ComponentTag tag) {
            super.onComponentTag(tag);

            String cssClass = tag.getAttribute("class");
            if (cssClass == null) {
                cssClass = " ";
            }
            cssClass += " tab" + getIndex();

            if (getIndex() == getSelectedTab()) {
                cssClass += ' ' + getSelectedTabCssClass();
            }
            if (getVisiblityCache().getLastVisible() == getIndex()) {
                cssClass += ' ' + getLastTabCssClass();
            }
            tag.put("class", cssClass.trim());
        }
    };
}
 
Example 31
Project: engerek   File: AjaxButton.java   Source Code and License 5 votes vote down vote up
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    String text = getModelObject();
    if (StringUtils.isNotEmpty(text)) {
        replaceComponentTagBody(markupStream, openTag, text);
        return;
    }

    super.onComponentTagBody(markupStream, openTag);
}
 
Example 32
Project: engerek   File: AjaxButton.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    if (tag.isOpenClose()) {
        tag.setType(XmlTag.TagType.OPEN);
    }
}
 
Example 33
Project: engerek   File: AjaxSubmitButton.java   Source Code and License 5 votes vote down vote up
@Override
public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
    if (label != null) {
        String text = label.getObject();
        replaceComponentTagBody(markupStream, openTag, text);
        return;
    }

    super.onComponentTagBody(markupStream, openTag);
}
 
Example 34
Project: engerek   File: AjaxSubmitButton.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    if (!isEnabled()) {
        tag.put("disabled", "disabled");
    }

    if (tag.isOpenClose()) {
        tag.setType(XmlTag.TagType.OPEN);
    }
}
 
Example 35
Project: engerek   File: CaptchaPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor.
 *
 * @param id
 *            The component id
 */
public CaptchaPanel(String id) {
	super(id);

	FeedbackPanel feedback = new FeedbackPanel("feedback",
			new ContainerFeedbackMessageFilter(CaptchaPanel.this));
	add(feedback);

	captchaImageResource = createCaptchImageResource();
	final Image captchaImage = new Image("image", captchaImageResource);
	captchaImage.setOutputMarkupId(true);
	add(captchaImage);

	AjaxLink<Void> changeCaptchaLink = new AjaxLink<Void>("changeLink") {
				private static final long serialVersionUID = 1L;

		@Override
		public void onClick(AjaxRequestTarget target) {
			captchaImageResource.invalidate();
			target.add(captchaImage);
		}
	};
	add(changeCaptchaLink);

	add(new RequiredTextField<String>("text",
			new PropertyModel<String>(CaptchaPanel.this, "captchaText"), String.class) {
							private static final long serialVersionUID = 1L;

		@Override
		protected final void onComponentTag(final ComponentTag tag) {
			super.onComponentTag(tag);
			// clear the field after each render
			tag.put("value", "");
		}
	});
}
 
Example 36
Project: singular-server   File: Header.java   Source Code and License 5 votes vote down vote up
private void addBaseurlAnchor() {
    WebMarkupContainer anchor = new WebMarkupContainer("baseurlAnchor");
    anchor.add(new Behavior() {
        @Override
        public void onComponentTag(Component component, ComponentTag tag) {
            super.onComponentTag(component, tag);
            String path = WebApplication.get().getServletContext().getContextPath();
            if (StringUtils.isBlank(path)) {
                path = "/";
            }
            tag.put("href", path);
        }
    });
    add(anchor);
}
 
Example 37
Project: Unicorn   File: ExternalPage.java   Source Code and License 5 votes vote down vote up
/**
 * Handles this frame's tag.
 *
 * @param tag the component tag
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
@Override
protected final void onComponentTag(final ComponentTag tag) {
	this.checkComponentTag(tag, "iframe");

	// generate the src attribute
	tag.put("src", this.URL);

	super.onComponentTag(tag);
}
 
Example 38
Project: Unicorn   File: BootStrapLabel.java   Source Code and License 5 votes vote down vote up
@Override
protected final void onComponentTag(final ComponentTag tag) {
	this.checkComponentTag(tag, "span");

	// generate the class attribute
	tag.put("class", this.textEmphasisClass.getClassValue());

	super.onComponentTag(tag);
}
 
Example 39
Project: Intercloud   File: ExtendedFrame.java   Source Code and License 5 votes vote down vote up
/**
 * Handles this frame's tag.
 * 
 * @param tag
 *            the component tag
 * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
 */
@Override
protected final void onComponentTag(final ComponentTag tag)
{
	checkComponentTag(tag, "frame");

	tag.put("src", getUrl());

	super.onComponentTag(tag);
}
 
Example 40
Project: ontopia   File: FieldInstanceDateField.java   Source Code and License 5 votes vote down vote up
@Override
protected void onComponentTag(ComponentTag tag) {
  tag.setName("input");
  tag.put("type", "text");
  tag.put("size", cols);
  super.onComponentTag(tag);
}