List of usage examples for org.apache.wicket Component getPageRelativePath
@Override public final String getPageRelativePath()
From source file:org.hippoecm.frontend.PluginTest.java
License:Apache License
protected void printComponents(final PrintStream out) { home.visitChildren(new IVisitor<Component, Void>() { @Override/*from w w w . ja v a 2 s . c o m*/ public void component(Component component, IVisit<Void> visit) { String name = component.getClass().getName(); name = name.substring(name.lastIndexOf('.') + 1); out.println(component.getPageRelativePath() + ": " + name); } }); }
From source file:org.openengsb.ui.admin.testClient.TestClientTest.java
License:Apache License
@Test public void testCreateTextFieldsFor2StringArguments() throws Exception { setupAndStartTestClientPage();/*from w w w . ja v a 2s . c o m*/ RepeatingView argList = (RepeatingView) tester .getComponentFromLastRenderedPage("methodCallForm:argumentListContainer:argumentList"); setServiceInDropDown(2); setMethodInDropDown(0); Assert.assertEquals(2, argList.size()); Iterator<? extends Component> iterator = argList.iterator(); while (iterator.hasNext()) { Component next = iterator.next(); tester.assertComponent(next.getPageRelativePath() + ":valueEditor", InputField.class); } }
From source file:org.wicketstuff.dojo11.WicketTestCase.java
License:Apache License
/** * //from ww w. j a v a2 s. c o m * @param pageClass * @param component * @param filename * @throws Exception */ protected void executedListener(final Class<?> pageClass, final Component component, final String filename) throws Exception { assertNotNull(component); System.out.println("=== " + pageClass.getName() + " : " + component.getPageRelativePath() + " ==="); tester.executeListener(component); tester.assertResultPage(pageClass, filename); }
From source file:org.wicketstuff.extjs.util.ExtConfigResourceLoader.java
License:Apache License
protected void loadStringResource(final Component component, final String key, final Config config) { if (component == null) { return;//www . j a va2 s . c om } Locale locale = component.getLocale(); String style = component.getStyle(); // The key prefix is equal to the component path relative to the // current component on the top of the stack. String prefix = Strings.replaceAll(component.getPageRelativePath(), ":", ".").toString(); // The reason why we need to create that stack is because we need to // walk it downwards starting with Page down to the Component List searchStack = getComponentStack(component); // Walk the component hierarchy down from page to the component for (int i = searchStack.size() - 1; i >= 0; i--) { Class clazz = (Class) searchStack.get(i); // First, try the fully qualified resource name relative to the // component on the path from page down. if ((prefix != null) && (prefix.length() > 0)) { loadStringResource(clazz, prefix + '.' + key, locale, style, config); prefix = Strings.afterFirst(prefix, '.'); } if (i == 0 && component.getClass().equals(clazz)) { /* * Before the last component that is supposed to contains the components default we try in the application configuration file */ loadStringResource(Application.get().getClass(), key, locale, style, config); } loadStringResource(clazz, key, locale, style, config); } }
From source file:org.wicketstuff.security.components.SecureComponentHelper.java
License:Apache License
/** * Builds a 'unique' name for the component. The name is based on the page class alias and the * relative path to the page (if not a page itself). Note that although it is unlikely, it is * not impossible for two components to have the same alias. * /*from www . j a va 2 s. c om*/ * @param component * @return an alias. * @throws SecurityException * if the component is null, or if the page of the component is not available. */ public static String alias(Component component) { // might be useful in wicket core itself if (component == null) throw new SecurityException("Specified component is null"); Page page = null; try { page = component.getPage(); } catch (IllegalStateException e) { throw new SecurityException("Unable to create alias for component: " + component, e); } String alias = alias(page.getClass()); String relative = component.getPageRelativePath(); if (relative == null || "".equals(relative)) return alias; return alias + PATH_SEPARATOR + relative; }
From source file:org.wicketstuff.WicketTestCase.java
License:Apache License
/** * /*from w ww .j a v a 2 s.co m*/ * @param clazz * @param component * @param filename * @throws Exception */ protected void executedListener(final Class clazz, final Component component, final String filename) throws Exception { assertNotNull(component); System.out.println("=== " + clazz.getName() + " : " + component.getPageRelativePath() + " ==="); tester.executeListener(component); tester.assertResultPage(clazz, filename); }
From source file:wicket.contrib.input.events.WicketTestCase.java
License:Apache License
/** * /*from w w w . jav a 2 s.c o m*/ * @param clazz * @param component * @param filename * @throws Exception */ protected void executedListener(final Class<?> clazz, final Component component, final String filename) throws Exception { assertNotNull(component); System.out.println("=== " + clazz.getName() + " : " + component.getPageRelativePath() + " ==="); tester.executeListener(component); tester.assertResultPage(clazz, filename); }
From source file:wicketbox.component.DataBox.java
License:Apache License
public DataBox(String id, List<? extends IColumn<T, S>> columns, IDataProvider<T> dataProvider, long rowsPerPage) { super(id, columns, dataProvider, rowsPerPage); add(new Stretch(Orientation.VERTICAL, ".box-table-top", ".box-table-body", ".box-table-bottom")); add(new ColResize(".box-table-top table", ".box-table-body table", new WidthsModel()) { protected String getPersist(Component component) { return persistToCookie("colresize:" + component.getPageRelativePath(), MAX_AGE); }/*from w w w . ja va 2 s . c om*/ }); add(new Scroll(Orientation.HORIZONTAL, ".box-table-top, .box-table-body") { protected String getPersist(Component component) { return persistToDocument("scroll:" + component.getMarkupId()); } }); }
From source file:wicketbox.component.SplitBox.java
License:Apache License
public SplitBox(String id, Component main, Component remainder, IModel<Integer> size) { super(id);// w w w . ja v a2s. co m add(new Stretch(Orientation.HORIZONTAL, ".box-split-resize", ".box-split-remainder", null)); WebMarkupContainer resize = new WebMarkupContainer("resize"); resize.add(new Resize(Orientation.HORIZONTAL, ".box-split-divider") { @Override protected String getPersist(Component component) { return persistToCookie("resize:" + component.getPageRelativePath(), MAX_AGE); } }); add(resize); Args.isTrue("main".equals(main.getId()), "main"); resize.add(main); resize.add(newDivider("divider")); Args.isTrue("remainder".equals(remainder.getId()), "remainder"); add(remainder); }
From source file:wicketbox.examples.ColResizeExamplePage.java
License:Apache License
public ColResizeExamplePage() { WebMarkupContainer resizable = new WebMarkupContainer("resizable"); resizable.add(new ColResize("table.colresize-header", "table.colresize-body", new WidthsModel()) { protected String getPersist(Component component) { return persistToCookie("colresize:" + component.getPageRelativePath(), Duration.days(1)); }/*from ww w.j a va 2 s .co m*/ }); add(resizable); resizable.add(new ListView<Foo>("row", new FoosModel()) { @Override protected void populateItem(ListItem<Foo> item) { item.add(new Label("cell1", new PropertyModel<String>(item.getModel(), "name"))); item.add(new Label("cell2", new PropertyModel<String>(item.getModel(), "name"))); item.add(new Label("cell3", new PropertyModel<String>(item.getModel(), "name"))); item.add(new Label("cell4", new PropertyModel<String>(item.getModel(), "name"))); } }); }