List of usage examples for org.apache.wicket Component getMarkupId
public String getMarkupId()
From source file:org.wicketstuff.push.dojo.TargetRefresherManager.java
License:Apache License
private String generateReParseJs() { if (!dojoComponents.isEmpty()) { final Iterator<Component> it = dojoComponents.values().iterator(); String parseJs = "["; while (it.hasNext()) { final Component c = it.next(); parseJs += "'" + c.getMarkupId() + "',"; }//from ww w. j a va 2s. c om parseJs = parseJs.substring(0, parseJs.length() - 1); parseJs += "]"; return "djConfig.searchIds = " + parseJs + ";dojo.hostenv.makeWidgets();"; } else { return null; } }
From source file:org.wicketTutorial.chatExample.ChatRoomPanel.java
License:Apache License
public ChatRoomPanel(String id) { super(id);/* w w w .j ava 2 s. com*/ add(new AbstractWebsocketBehavior(false) { @Override protected Url getSocketCreationURL() { Url url = getContextPathURL(); url.getSegments().add("chat"); return url; } @Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); Map<String, Object> variables = Generics.newHashMap(); variables.put("componentId", component.getMarkupId()); PackageTextTemplate webSocketSetupTemplate = new PackageTextTemplate(ChatRoomPanel.class, "ChatRoomPanel.template.js"); response.render( JavaScriptContentHeaderItem.forScript(webSocketSetupTemplate.asString(variables), null)); } @Override protected CharSequence onMessageJsFunction() { return "onChatMessage(evt)"; } @Override protected CharSequence onOpenJsFunction() { return "joinMessage()"; } @Override protected CharSequence onErrorJsFunction() { return ""; } @Override protected HeaderItem wrapSocketCreationScript(PackageTextTemplate template, Map<String, Object> variables) { return OnEventHeaderItem.forScript("'joinButton'", "click", template.asString(variables)); } }); }
From source file:org.xaloon.wicket.component.uploadify.UploadifyBehaviorItem.java
License:Apache License
@Override public void bind(Component component) { setMarkupId(component.getMarkupId()); if (queryBehavior.isCreatedFromComponent()) { component.add(queryBehavior);//from w w w .j av a 2 s . com } }
From source file:org.yes.cart.web.page.AbstractWebPage.java
License:Apache License
private void determineStatefulComponent() { final List<String> statefulComponentIds = new ArrayList<String>(); this.visitChildren(Component.class, new IVisitor<Component, Object>() { @Override/*from ww w . j a v a 2 s .co m*/ public void component(final Component object, final IVisit<Object> objectIVisit) { if (!object.isStateless()) { statefulComponentIds.add(object.getMarkupId()); } } }); LOG.warn("Page {} is stateful because of the following components: {}", getClass().getCanonicalName(), statefulComponentIds); }
From source file:ro.nextreports.server.web.common.behavior.DefaultFocusBehavior.java
License:Apache License
@Override public void renderHead(Component component, IHeaderResponse response) { super.renderHead(component, response); response.render(//from w ww. j av a2s . c o m OnLoadHeaderItem.forScript("document.getElementById('" + component.getMarkupId() + "').focus();")); }
From source file:sf.wicklet.gwt.server.ajax.impl.GwtAjaxWickletTarget.java
License:Apache License
@Override public void add(final Component... components) { for (final Component component : components) { Args.notNull(component, "component"); if (component.getOutputMarkupId() == false && !(component instanceof Page)) { throw new IllegalArgumentException( "cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString()); }/* ww w . j av a 2s. co m*/ add(component, component.getMarkupId()); } }
From source file:wicket.contrib.tinymce.InPlaceEditBehavior.java
License:Open Source License
/** * Construct in-place-editing behavior to a component. It makes the content * of the component editable with a TinyMce WYSIWYG editor. * @param settings /*from ww w.j av a 2 s. c om*/ * @param inPlaceSaveBehavior * * @param settings * TinyMceSettings for the editor when opened. * @param triggerComponent * Component that will get an onclick event to make the component * that this behavior is added to editable. Can be the editable * component itself, but can also be another component, e.g. a * button. If set to null, you will have to start the editable * state via a call to the javascriptfunction with name: * {@link #getStartEditorScriptName()} * @param savePlugin */ public InPlaceEditBehavior(TinyMCESettings settings, Component triggerComponent, WicketSavePlugin savePlugin) { super(settings); componentMarkupId = triggerComponent.getMarkupId(); settings.add(savePlugin.getSaveButton(), Toolbar.first, Position.before); settings.add(savePlugin.getCancelButton(), Toolbar.first, Position.before); settings.add(Button.separator, Toolbar.first, Position.before); }
From source file:wicket.contrib.tinymce.settings.TinyMCESettings.java
License:Open Source License
private void addElements(Collection<Component> components, StringBuffer buffer) { if (components.size() > 0) { buffer.append(",\n\telements : \""); Iterator<Component> iterator = components.iterator(); while (iterator.hasNext()) { Component component = iterator.next(); buffer.append(component.getMarkupId()); if (iterator.hasNext()) buffer.append(", "); }/*from w w w . j a v a2 s . c om*/ buffer.append("\""); } else LOG.warn("tinymce is set to \"exact\" mode but there are no components attached"); }
From source file:wicket.contrib.tinymce.TinyMceBehavior.java
License:Open Source License
protected String getAddTinyMceSettingsScript(Mode mode, Collection<Component> components) { StringBuffer script = new StringBuffer(); // If this behavior is run a second time, it means we're redrawing this // component via an ajax call. The tinyMCE javascript does not handle // this scenario, so we must remove the old editor before initializing // it again./*from www. ja v a 2 s . com*/ if (rendered) { for (Component c : components) { String tryToRemoveJS = "try{tinyMCE.remove(tinyMCE.get('%s'));}catch(e){}\n"; script.append(String.format(tryToRemoveJS, c.getMarkupId())); } } script.append(settings.getLoadPluginJavaScript()); script.append(" tinyMCE.init({" + settings.toJavaScript(mode, components) + " });\n"); script.append(settings.getAdditionalPluginJavaScript()); rendered = true; return script.toString(); }
From source file:wicket.contrib.tinymce4.TinyMceBehavior.java
License:Open Source License
protected String getAddTinyMceSettingsScript(Mode mode, Collection<Component> components) { StringBuffer script = new StringBuffer(); // If this behavior is run a second time, it means we're redrawing this // component via an ajax call. The tinyMCE javascript does not handle // this scenario, so we must remove the old editor before initializing // it again.// w ww . j a va 2s . c o m if (rendered) { for (Component c : components) { String tryToRemoveJS = "try{tinyMCE.remove(tinyMCE.get('%s'));}catch(e){}\n"; script.append(String.format(tryToRemoveJS, c.getMarkupId())); } } script.append(";tinyMCE.init({" + settings.toJavaScript(mode, components) + " });\n"); rendered = true; return script.toString(); }