Refine search
@Override public CharSequence getBeforeSendHandler(Component component) { IRequestHandler handler = new ResourceReferenceRequestHandler( AbstractPostAjaxBehavior.INDICATOR); CharSequence url = RequestCycle.get().urlFor(handler); return String.format("" + "$('#%s-working-indicator').remove(); " + "$('#%s').after('<img id=\"%s-working-indicator\" src=\"%s\" class=\"working-indicator\"></img>');", component.getMarkupId(), component.getMarkupId(), component.getMarkupId(), url); }
public InfiniteScrollingBehavior setNextSelector(Component component) { component.setOutputMarkupId(true); nextSelector = component.getMarkupId(); return this; }
@Override public void bind(Component component) { this.component = component; for (Map.Entry<String, ExtEventAjaxBehavior> entry : eventHandlers.entrySet()) { ExtEventAjaxBehavior behavior = entry.getValue(); if (!component.getBehaviors().contains(behavior)) { component.add(behavior); } } }
public void uninstallPush(final Component component) { for (final IBehavior behavior : component.getBehaviors()) { if (behavior instanceof TimerChannelBehavior) { component.remove(behavior); } } }
@Override public Object component(Component c) { if (!(c instanceof AbstractLink && "cancel".equals(c.getId()))) { c.setEnabled(false); } return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } });
public void addToastrMessage(ToastrType toastrType, String message) { ToastrSettings settings = getDefaultSettings(); settings.getToastrType().setValue(toastrType); settings.getNotificationTitle().setValue(message); if (!((WebRequest) RequestCycle.get().getRequest()).isAjax()) { component.add($b.onReadyScript((ISupplier<CharSequence>) () -> generateJs(settings, false))); } else { AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); target.appendJavaScript(generateJs(settings, true)); } }
@Override protected void onClosed() { super.onClosed(); AjaxRequestTarget target = RequestCycle.get().find(AjaxRequestTarget.class); if (target != null) { String script = String.format("onedev.server.dropdownHover.closed('%s', '%s');", getComponent().getMarkupId(true), getMarkupId(true)); target.appendJavaScript(script); } dropdown = null; }
@Override public final void onRequest() { WebApplication app = (WebApplication)getComponent().getApplication(); AjaxRequestTarget target = app.newAjaxRequestTarget(getComponent().getPage()); RequestCycle requestCycle = RequestCycle.get(); requestCycle.scheduleRequestHandlerAfterCurrent(target); respond(target); }
/** * Register a component as draggable/moveable item. * (add the css class and markupId to be find on clientside). * * @param v the component to register. * @return this */ protected DnDSortableBehavior registerItem(Component v) { v.add(new AttributeAppender("class", new Model<String>(String.valueOf(options_.get("accept"))), " ")); v.setOutputMarkupId(true); return this; }
@Override protected void respond(AjaxRequestTarget target) { getComponent().getPage().visitChildren((component, visit) -> { if (SINGULAR_JS_BEAHAVIOR_UPDATE_REGION.equals(component.getId())) { target.add(component); visit.stop(); } }); }
public <C extends Component> C newTag(String tag, boolean closeTag, String attrs, C component) { TemplatePanel container = newComponent(id -> new TemplatePanel(id, () -> "<" + tag + " wicket:id='" + component.getId() + "' " + defaultString(attrs) + ">" + (closeTag ? "</" + tag + ">\n" : "\n"))); container .add(component) .setRenderBodyOnly(true).setOutputMarkupId(false).setOutputMarkupPlaceholderTag(false); return component; }
@Override public final void focusComponent(Component component) { if (component != null && component.getOutputMarkupId() == false) { throw new IllegalArgumentException( "cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString()); } final String id = component != null ? ("'" + component.getMarkupId() + "'") : "null"; appendJavaScript("Wicket.Focus.setFocusOnId(" + id + ");"); }
public static void setAsResponsePageWithMessage(Component c, String message, String identity) { PageParameters params = new PageParameters(); if (identity != null) { params.add(IDENTITY_PARAM, identity); } if (StringUtils.isNotBlank(message)) { params.add(MESSAGE, message); } RequestCycle.get().setResponsePage(c.getPage().getClass(), params, RenderPageRequestHandler.RedirectPolicy.NEVER_REDIRECT); } }
@Override protected void populateItem(final LoopItem loopItem) { final String parentMarkupId = Collapsible.this.getMarkupId(true); final ITab tab = Collapsible.this.tabs.get(loopItem.getIndex()); final Component container = newContainer("body", tab, activeTab.getObject().equals(loopItem.getIndex())); final Component title = newTitle("title", tab); title.add(new AttributeModifier("data-parent", "#" + parentMarkupId)); title.add(new AttributeModifier("href", "#" + container.getMarkupId(true))); loopItem.add(title); loopItem.add(container); } };
private void afterParse(Component tableComponent) { tableComponent.getPage().endComponentRender(tableComponent); Application.get() .getComponentPreOnBeforeRenderListeners() .remove(PathSetupListener.INSTANCE); RequestCycle.get().setResponse(originalResponse); originalResponse = null; cellExporter = null; }
public Object component(Component component) { if (component.getMarkupId().equals(id)) { this.found = component; return IVisitor.STOP_TRAVERSAL; } if (component instanceof MarkupContainer) { return ((MarkupContainer)component).visitChildren(this); } return IVisitor.CONTINUE_TRAVERSAL; }
/** * @see org.apache.wicket.Component#onBeforeRender() */ @Override protected void onBeforeRender() { shown = makeContentVisible(); getContent().setOutputMarkupId(true); getContent().setVisible(shown); super.onBeforeRender(); }
/** * Returns the markup id attribute of the outer most span of this indicator. This is the id of * the span that should be hidden or show to hide or show the indicator. * * @return markup id of outer most span */ public String getMarkupId() { return component.getMarkupId() + "--ajax-indicator"; }
/** * Adds {@link HTML5Attributes} to all {@link FormComponent}s. */ @Override public void onInstantiation(Component component) { if (component instanceof FormComponent) { component.add(new HTML5Attributes()); } } }
@Override protected String propertyExpression() { return CompoundPropertyModel.this.propertyExpression(owner); }