本文整理汇总了Java中org.apache.wicket.markup.html.WebComponent类的典型用法代码示例。如果您正苦于以下问题:Java WebComponent类的具体用法?Java WebComponent怎么用?Java WebComponent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebComponent类属于org.apache.wicket.markup.html包,在下文中一共展示了WebComponent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitialize
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
// page title label is added here because it uses an overridable method
add(new Label("title", getTitleModel()));
// same for page description (this populates the <meta name="description" /> element)
add(new WebComponent("pageDescription") {
{
add(new AttributeAppender("content", getPageDescriptionModel()));
}
});
add(new WebComponent("canonicalUrl") {
@Override
protected void onRender() {
final IModel<String> canonicalUrlModel = getCanonicalUrlModel();
if (canonicalUrlModel != null) {
getResponse().write("<link rel=\"canonical\" href=\"" + canonicalUrlModel.getObject() + "\"/>");
}
}
});
}
示例2: LinksColumnPanel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
public LinksColumnPanel(String id) {
super(id);
add(ResourcePackage.forJavaScript(LinksColumnPanel.class));
linksPanel = new LinksPanel("links");
linksPanel.setOutputMarkupId(true);
add(linksPanel);
WebComponent icon = new WebComponent("icon");
icon.setOutputMarkupId(true);
add(icon);
HtmlTemplate initScript = new HtmlTemplate("initScript");
initScript.setParameter("iconId", new PropertyModel(icon, "markupId"));
initScript.setParameter("panelId", new PropertyModel(linksPanel, "markupId"));
add(initScript);
}
示例3: UploadIFrame
import org.apache.wicket.markup.html.WebComponent; //导入依赖的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;
}
}
});
}
示例4: UploadPanel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
public UploadPanel(String id, FieldInstanceImageField parentField) {
super(id);
this.parentField = parentField;
// add onUploaded behavior
final OnUploadedBehavior onUploadBehavior = new OnUploadedBehavior();
add(onUploadBehavior);
add(new WebComponent("onUploaded") {
@Override
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
// calling it through setTimeout we ensure that the callback is called
// in the proper execution context, that is the parent frame
replaceComponentTagBody(markupStream, openTag,
"function onUpload_" + UploadPanel.this.getMarkupId() +
"(uploadedFile, clientFileName) { window.setTimeout(function() { " + // window.location.reload(true); " +
onUploadBehavior.getCallback() + "; }, 0 )}");
}
});
}
示例5: BasePage
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
public BasePage() {
super();
add(new Label("pageTitle", new PropertyModel<Void>(this, "pageTitle")));
WebComponent styleLink = new WebComponent("styleLink");
styleLink.add(new AttributeModifier("href", new Model<String>(getStyleAndJSPath() + "/style.css")));
add(styleLink);
WebComponent scriptLocation = new WebComponent("scriptLocation");
scriptLocation.add(new AttributeModifier("src", new Model<String>(getStyleAndJSPath() + "/script.js")));
add(scriptLocation);
add(new GlobalFeedbackPanel("pageFeedback") {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return !getCurrentMessages().isEmpty();
}
});
}
示例6: newNavigatorLabel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
protected WebComponent newNavigatorLabel(String navigatorId) {
IModel model = new AbstractReadOnlyModel() {
@Override
public Object getObject() {
return getNavigatorText();
}
};
return new Label(navigatorId, model);
}
示例7: createMessageLabel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
/**
* Creates a Label without model string escaping if the text to display is
* introduced by <HTML>. In this case the intro is removed and also a
* potential </HTML> outro. This concept is stolen from Swing. Otherwise,
* the method returns a MultiLineLabel
*
* @param message the message
* @return the web component
*/
protected WebComponent createMessageLabel(String message) {
String strippedMessage = stripHTMLIntroOutro(message);
if (strippedMessage.length() == message.length()) {
return new MultiLineLabel("message.label", new Model<String>(message));
}
Label messageLabel = new Label("message.label", message);
messageLabel.setEscapeModelStrings(false);
return messageLabel;
}
示例8: IFramePanel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
public IFramePanel(String id, IResource resource) {
super(id);
this.resource = resource;
WebComponent iframe = new WebComponent("iframe");
add(iframe);
iframe.add(new AttributeModifier("src", new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
return urlFor(ILinkListener.INTERFACE, new PageParameters()).toString();
}
}));
}
示例9: replaceImage
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
/**
* @param image
* @return this for chaining.
*/
public ImagePanel replaceImage(final WebComponent image)
{
removeImage();
add(this.image = image);
return this;
}
示例10: createGalleryImagesPanel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
private void createGalleryImagesPanel() {
images = new ArrayList<IModel<ImgurImage>>();
imageListView = new RefreshingView<ImgurImage>("galleryAlbumPanel") {
@Override
protected Iterator<IModel<ImgurImage>> getItemModels() {
return images.iterator();
}
@Override
protected void populateItem(Item<ImgurImage> item) {
Label label = new Label("title", new PropertyModel<String>(item.getModelObject(), "title"));
label.setOutputMarkupPlaceholderTag(true);
if (item.getModelObject().getTitle() == null) {
label.setVisible(false);
} else {
label.setVisible(true);
}
item.add(label);
WebComponent image = new ExternalImage("image", item.getModelObject().getLink());
image.setOutputMarkupPlaceholderTag(true);
item.add(image);
}
};
imageListView.setOutputMarkupId(true);
form.add(imageListView);
}
示例11: addDevModeWarning
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
/**
* Adds a component that shows a warning sign next to "About" link in development mode
* @param container The parent component
*/
private void addDevModeWarning(final MarkupContainer container) {
final WebComponent devModeWarning = new WebComponent("devModeWarning");
devModeWarning.setVisible(getApplication().usesDevelopmentConfig());
container.add(devModeWarning);
}
示例12: ImageCarouselPanel
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
public ImageCarouselPanel(String id, String diaporamaId) {
super(id);
this.diaporamaId = diaporamaId;
final MarkupContainer diaporamaContainer = new WebMarkupContainer("container");
diaporamaContainer.setOutputMarkupId(true);
add(diaporamaContainer);
List<DummyImageBean> imageBeans = Lists.newArrayList(
new DummyImageBean("logo_openwide.png", "widgets.carousel.openwide.header", "widgets.carousel.openwide.footer"),
new DummyImageBean("logo_sitra.jpg", "widgets.carousel.sitra.header", "widgets.carousel.sitra.footer"),
new DummyImageBean("logo_sytral.jpg", "widgets.carousel.sytral.header", "widgets.carousel.sytral.footer"),
new DummyImageBean("logo_vuitton.jpg", "widgets.carousel.vuitton.header", "widgets.carousel.vuitton.footer")
);
diaporamaContainer.add(new ListView<DummyImageBean>("imageItem", imageBeans) {
private static final long serialVersionUID = 4148116695921332880L;
@Override
protected void populateItem(ListItem<DummyImageBean> item) {
DummyImageBean imageBean = item.getModelObject();
Component header = new Label("header", new ResourceModel(imageBean.getHeaderLabelKey()));
header.setOutputMarkupId(true);
item.add(header);
WebMarkupContainer footer = new WebMarkupContainer("footer");
footer.add(new Label("footerLabel", new ResourceModel(imageBean.getFooterLabelKey())));
footer.setOutputMarkupId(true);
item.add(footer);
WebComponent image = new ContextImage("image", CONTEXT_RELATIVE_IMAGES_PATH + imageBean.getImagePath());
AbstractLink imageLink = new ResourceLink<Void>("imageLink",
new PackageResourceReference(MainTemplate.class, "images/" + imageBean.getImagePath()));
imageLink.add(new AttributeModifier("rel", ImageCarouselPanel.this.diaporamaId));
imageLink.add(new ModalHeaderFooterBehavior(header, footer));
imageLink.add(image);
item.add(imageLink);
}
});
final Component nextButton = new WebMarkupContainer("nextButton");
nextButton.setOutputMarkupId(true);
add(nextButton);
final Component prevButton = new WebMarkupContainer("prevButton");
prevButton.setOutputMarkupId(true);
add(prevButton);
diaporamaContainer.add(new CarouFredSelBehavior(getCarouFredSel(prevButton, nextButton)));
diaporamaContainer.add(new ModalDiaporamaBehavior("a[rel=" + ImageCarouselPanel.this.diaporamaId +"]", new Modal()));
}
示例13: getZipEntryActions
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
@Override
public Component getZipEntryActions(String wicketId, ActionableItem repoItem) {
return new WebComponent(wicketId);
}
示例14: FieldInstanceHTMLArea
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
public FieldInstanceHTMLArea(String id, FieldValueModel _fieldValueModel) {
super(id);
this.fieldValueModel = _fieldValueModel;
OccurrenceIF occ = (OccurrenceIF)fieldValueModel.getObject();
this.oldValue = (occ == null ? null : occ.getValue());
setDefaultModel(new Model<String>(oldValue));
this.textArea = new TextArea<String>("field", new Model<String>(oldValue)) {
@Override
protected void onComponentTag(ComponentTag tag) {
tag.setName("textarea");
tag.put("cols", cols);
tag.put("rows", rows);
tag.put("class", getMarkupId());
super.onComponentTag(tag);
}
@Override
protected void onModelChanged() {
super.onModelChanged();
String newValue = (String)getModelObject();
if (Objects.equals(newValue, oldValue)) return;
AbstractOntopolyPage page = (AbstractOntopolyPage)getPage();
FieldInstance fieldInstance = fieldValueModel.getFieldInstanceModel().getFieldInstance();
if (fieldValueModel.isExistingValue() && oldValue != null)
fieldInstance.removeValue(oldValue, page.getListener());
if (newValue != null && !newValue.equals("")) {
fieldInstance.addValue(newValue, page.getListener());
fieldValueModel.setExistingValue(newValue);
}
oldValue = newValue;
}
};
textArea.setOutputMarkupId(true);
add(textArea);
add(new WebComponent("fieldScript") {
@Override
protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) {
StringBuilder sb = new StringBuilder();
//sb.append("\ntinyMCE.onLoad();");
sb.append("\ntinyMCE.execCommand('mceAddControl', true, '" + textArea.getMarkupId() + "');");
// the next two lines are a work-around for issue 459
// https://github.com/ontopia/ontopia/issues/459
// motivated by this posting
// http://apache-wicket.1842946.n4.nabble.com/tinymce-textarea-in-a-modal-window-not-letting-to-type-td1886534.html
sb.append("\ntinyMCE.execCommand('mceRemoveControl', false, '" + textArea.getMarkupId() + "');");
sb.append("\ntinyMCE.execCommand('mceAddControl', true, '" + textArea.getMarkupId() + "');");
// end of workaround
replaceComponentTagBody(markupStream, openTag, sb.toString());
}
});
}
示例15: addImage
import org.apache.wicket.markup.html.WebComponent; //导入依赖的package包/类
/**
* @param image
* @return this for chaining.
*/
public ImagePanel addImage(final WebComponent image)
{
add(this.image = image);
return this;
}