@Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); if (!isEnabledInHierarchy()) { onDisabled(tag); } } };
public class HomePage extends WebPage { public HomePage() { add(new Label("label", "<ul><li>test</li><li>test</li><li>test</li><li>test</li><li>test</li></ul>") .setEscapeModelStrings(false)); add(new WebComponent("html") { @Override protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) { Response response = getRequestCycle().getResponse(); response.write("<ul>"); for (int i = 0; i < 5; i++) response.write("<li>test</li>"); response.write("</ul>"); } }); } }
private static void initAnnotatorJs(IHeaderResponse aResponse, WebComponent aContainer, StoreAdapter aAdapter) { String callbackUrl = aAdapter.getCallbackUrl().toString(); StringBuilder script = new StringBuilder(); script.append( "var ann = $('#" + aContainer.getMarkupId() + "').annotator({readOnly: true});"); script.append("ann.annotator('addPlugin', 'Store', {"); script.append(" prefix: null,"); script.append(" emulateJSON: true,"); script.append(" emulateHTTP: true,"); script.append(" urls: {"); script.append(" read: '" + callbackUrl + "',"); script.append(" create: '" + callbackUrl + "',"); script.append(" update: '" + callbackUrl + "',"); script.append(" destroy: '" + callbackUrl + "',"); script.append(" search: '" + callbackUrl + "'"); script.append(" }"); script.append("});"); // script.append("Wicket.$('" + vis.getMarkupId() + "').annotator = ann;"); aResponse.render(OnDomReadyHeaderItem.forScript(script.toString())); }
/** * Constructor * * @param id * @param model * @param max * max number of files a user can upload * */ public MultiFileUploadField(String id, IModel model, int max) { super(id, model); this.max = max; upload = new WebComponent("upload"); upload.setOutputMarkupId(true); add(upload); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); container.add(new Label("caption", new CaptionModel())); }
public TopPlugin(final IPluginContext context, final IPluginConfig config) { super(context, config); final WebMarkupContainer logo = new WebMarkupContainer("logo"); logo.add(TitleAttribute.set("Hippo Release Version: " + SYSTEM_INFO.getReleaseVersion())); add(logo); final WebComponent toolbar = new WebComponent(BAR_STYLES); final String style = obtainBreadcrumbStyle(config); if (StringUtils.isNotBlank(style)) { toolbar.add(AttributeModifier.replace("style", style)); } add(toolbar); }
private void addImageHistoryFLow() { WebComponent imageHistFlow; if (requirementPK != null) { String classCss = " col-md-12 "; FlowInstance flowInstance = requirementService.getRequirement(requirementPK).getFlowInstance(); flowInstance.getTasksOlderFirst(); if (flowInstance.getFlowDefinition().getFlowMap().getAllTasks().size() <= QUANTIDADE_MAX_TAKS_TO_MIDDLE_SIZE) { classCss = " col-md-6 col-md-offset-3 "; } byte[] bytes = generateHistImage(flowInstance); DynamicImageResource imageResource = new DynamicImageResource() { @Override protected byte[] getImageData(IResource.Attributes attributes) { return bytes; } }; imageHistFlow = new Image("imageHist", imageResource); imageHistFlow.setVisible(bytes.length != 0); imageHistFlow.add(new AttributeAppender("class", classCss)); } else { imageHistFlow = new WebComponent("imageHist"); imageHistFlow.setVisible(false); } add(imageHistFlow); }
Component linkImage = new WebComponent("searchLinkImage").setVisible(false); if (pBuilder.imageResource != null || pBuilder.imageResourceReference != null)
public LearningCurveChartPanel(String aId, IModel<AnnotatorState> aModel) { super(aId); model = aModel; chartContainer = new Label(CHART_CONTAINER); chartContainer.setOutputMarkupId(true); add(chartContainer); }
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(new JavaScriptPackageHeaderItem(DataTable.class)); // DataTable.js }
/** * Constructor * * @param id * @param model * @param max * max number of files a user can upload * */ @SuppressWarnings("unchecked") public MultiFileUploadField(String id, IModel<? extends Collection<FileUpload>> model, int max) { super(id, (IModel<Collection<FileUpload>>)model); this.max = max; upload = new WebComponent("upload"); upload.setOutputMarkupId(true); add(upload); container = new WebMarkupContainer("container"); container.setOutputMarkupId(true); add(container); container.add(new Label("caption", new CaptionModel())); }
/** * Adds components. */ private final void initComps() { WebComponent meta = new WebComponent("meta"); PageParameters parameters = new PageParameters(); parameters.put("cto", continueTo); CharSequence url = urlFor(new BookmarkablePageRequestTarget(BrowserInfoPage.class, parameters)); meta.add(new AttributeModifier("content", true, new Model<String>("0; url=" + url))); add(meta); WebMarkupContainer link = new WebMarkupContainer("link"); link.add(new AttributeModifier("href", true, new Model<Serializable>((Serializable)url))); add(link); add(new BrowserInfoForm("postback") { private static final long serialVersionUID = 1L; /** * @see org.apache.wicket.markup.html.pages.BrowserInfoForm#afterSubmit() */ @Override protected void afterSubmit() { continueToPrevious(); } }); }
upload.setOutputMarkupId(true); add(upload);
@Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(new JavaScriptPackageHeaderItem(DataTable.class)); // DataTable.js }
/** * @see org.apache.wicket.Component#onComponentTag(ComponentTag) */ @Override protected void onComponentTag(final ComponentTag tag) { checkComponentTag(tag, "img"); super.onComponentTag(tag); } }
@Override protected void onInitialize() { super.onInitialize(); add(dataField = new TextField<String>("data", Model.of(getModelObject()))); WebComponent fileInput = new WebComponent("fileInput"); fileInput.setOutputMarkupId(true); add(fileInput); add(new WebMarkupContainer("fileLabel") { @Override protected void onComponentTag(ComponentTag tag) { super.onComponentTag(tag); tag.put("for", fileInput.getMarkupId()); } }); add(behavior = new AbstractPostAjaxBehavior() { @Override protected void respond(AjaxRequestTarget target) { send(AvatarUploadField.this, Broadcast.BUBBLE, new AvatarFileSelected(target)); } }); }
WebComponent base = new WebComponent("base"); add(base); base.add(new AttributeModifier("href", "<the url>"));
/** * Adds components. */ private final void initComps() { WebComponent meta = new WebComponent("meta"); PageParameters parameters = new PageParameters(); parameters.put("cto", continueTo); CharSequence url = urlFor(new BookmarkablePageRequestTarget(BrowserInfoPage.class, parameters)); meta.add(new AttributeModifier("content", true, new Model("0; url=" + url))); add(meta); WebMarkupContainer link = new WebMarkupContainer("link"); link.add(new AttributeModifier("href", true, new Model((Serializable)url))); add(link); add(new BrowserInfoForm("postback") { private static final long serialVersionUID = 1L; /** * @see org.apache.wicket.markup.html.pages.BrowserInfoForm#afterSubmit() */ protected void afterSubmit() { continueToPrevious(); } }); }
private static void initAnnotatorJs(IHeaderResponse aResponse, WebComponent aContainer, StoreAdapter aAdapter) { String callbackUrl = aAdapter.getCallbackUrl().toString(); StringBuilder script = new StringBuilder(); script.append( "var ann = $('#" + aContainer.getMarkupId() + "').annotator({readOnly: true});"); script.append("ann.annotator('addPlugin', 'Store', {"); script.append(" prefix: null,"); script.append(" emulateJSON: true,"); script.append(" emulateHTTP: true,"); script.append(" urls: {"); script.append(" read: '" + callbackUrl + "',"); script.append(" create: '" + callbackUrl + "',"); script.append(" update: '" + callbackUrl + "',"); script.append(" destroy: '" + callbackUrl + "',"); script.append(" search: '" + callbackUrl + "'"); script.append(" }"); script.append("});"); // script.append("Wicket.$('" + vis.getMarkupId() + "').annotator = ann;"); aResponse.render(OnDomReadyHeaderItem.forScript(script.toString())); }
upload.setOutputMarkupId(true); add(upload);
/** * Renders links to the needed javascript and the CSS in the head of response. * * @param response * The header response to contribute to. */ @Override public void renderHead(IHeaderResponse response) { response.renderJavaScriptReference(JS); response.renderCSSReference(CSS); super.renderHead(response); }