/** * 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"; }
/** * Gets the id of the component that the calendar widget will get attached to. * * @return The DOM id of the component */ protected final String getComponentMarkupId() { return component.getMarkupId(); }
/** * Checks whether or not this component has a markup id value generated, whether it is automatic * or user defined * * @return true if this component has a markup id value generated */ final boolean hasMarkupIdMetaData() { return getMarkupId() != null; }
/** * Generate the proper enable/disable JavaScript code for the given component. * By default component is enabled/disabled using DOM attribute 'disabled'. * */ protected String generateHandlerJavaScript(Component component, boolean disabled) { return String.format(DISABLE_ENABLE_JS, component.getMarkupId(), disabled); } }
/** * Gets the escaped DOM id that the calendar widget will get attached to. All non word * characters (\W) will be removed from the string. * * @return The DOM id of the calendar widget - same as the component's markup id + 'Dp'} */ protected final String getEscapedComponentMarkupId() { return component.getMarkupId().replaceAll("\\W", ""); }
/** * Returns the markup id of the component. * * @return component id */ private String getContentMarkupId() { return getContent().getMarkupId(); }
public InfiniteScrollingBehavior setItemSelector(Component component, String selector) { component.setOutputMarkupId(true); jsonData.put("itemSelector", "#" + component.getMarkupId() + " " + selector); return this; }
@Override protected Map<String, Object> getVariables() { Map<String, Object> vars = super.getVariables(); vars.put("id", component.getMarkupId()); return vars; } };
/** * Helper method that returns the component's html selector (ie: '#myId'). * * @param component the {@link Component} * @return the html selector */ public static String getSelector(Component component) { return "#" + component.setOutputMarkupId(true).getMarkupId(); }
/** * Generates javascript to show a toggle over a tag * * @param component * component that will be covered by veil * @return javascript */ public static String toggle(final Component component) { return Generic.toggle(component.getMarkupId()); }
@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 + ");"); }
/** * Identifying name of this behavior. */ private String getName() { return String.format("wicket-ajaxdownload-%s-%s", getComponent().getMarkupId(), getComponent().getBehaviorId(this)); }
@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 + ");"); }
@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 + ");"); }
@Override public void renderHead(Component component, IHeaderResponse response) { final PackageResourceReference customJS = new PackageResourceReference(getClass(), getClass().getSimpleName() + ".js"); response.render(JavaScriptReferenceHeaderItem.forReference(customJS)); response.render(OnDomReadyHeaderItem.forScript("Singular.applyTelefoneNacionalMask('" + component.getMarkupId(true) + "')")); }
@Override protected CharSequence getPreconditionScript() { return "return Wicket.$$('" + getComponent().getMarkupId() + "') && Wicket.$$('" + getForm().getMarkupId() + "')"; } }
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(OnDomReadyHeaderItem.forScript("$('#" + Strings2.escapeMarkupId(component.getMarkupId()) + "').affix({ offset : " + offset.getObject() + " });")); } }
@Override public void onComponentTag(Component component, ComponentTag tag) { tag.put("id", component.getMarkupId()); tag.put("onfocus", getFocusTrackingHandler(component)); super.onComponentTag(component, tag); } });
public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem.forReference(SELECT2_KEYBOARD_JS)); String enabler = "enableSelect2Keyboard('" + component.getMarkupId() + "');"; response.render(OnLoadHeaderItem.forScript(enabler)); } }
protected void onComponentRendered() { if (getComponent() instanceof AbstractTextComponent) { Response response = getComponent().getResponse(); final String id = getComponent().getMarkupId(); response.write(JavascriptUtils.SCRIPT_OPEN_TAG); response.write("new Wicket.ChangeHandler('" + id + "');"); response.write(JavascriptUtils.SCRIPT_CLOSE_TAG); } } }