List of usage examples for org.apache.wicket.util.visit IVisit dontGoDeeper
void dontGoDeeper();
From source file:at.molindo.wicketutils.migration.IVisitor.java
License:Apache License
@Override public void component(T component, IVisit<Object> visit) { Object o = component(component); if (o == CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER) { visit.dontGoDeeper(); } else if (o != CONTINUE_TRAVERSAL) { visit.stop(STOP_TRAVERSAL);/*from w ww.j a va 2 s . co m*/ } }
From source file:com.axway.ats.testexplorer.TestExplorerApplication.java
License:Apache License
@Override protected void init() { Locale.setDefault(Locale.US); getApplicationSettings().setPageExpiredErrorPage(PageExpiredErrorPage.class); getApplicationSettings().setInternalErrorPage(InternalErrorPage.class); // show internal error page rather than default developer page //TODO: use this line in PRODUCTION mode, by default in development mode is used ExceptionSettings.SHOW_EXCEPTION_PAGE // getExceptionSettings().setUnexpectedExceptionDisplay( ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE ); mountPage("/runs", RunsPage.class); mountPage("/suites", SuitesPage.class); mountPage("/scenarios", ScenariosPage.class); mountPage("/testcases", TestcasesPage.class); mountPage("/testcase", TestcasePage.class); mountPage("/charts", ChartsBasePage.class); mountPage("/compare", ComparePage.class); mountPage("/compareStatistics", CompareTestcaseSystemStatisticsPage.class); mountPage("/runMessages", RunMessagePage.class); mountPage("/suiteMessages", SuiteMessagePage.class); mountPage("/machines", MachinesPage.class); mountPage("/runCopy", RunCopyPage.class); mountPage("/testcasesCopy", TestcasesCopyPage.class); mountPage("/reportSelect", SelectTestcaseReportPage.class); mountPage("/pageExpired", PageExpiredErrorPage.class); mountPage("/error", InternalErrorPage.class); mountPage("/dashboardhome", RunsByTypeDashboardHomePage.class); mountPage("/dashboardrun", RunsByTypeDashboardRunPage.class); mountPage("/dashboardsuite", RunsByTypeDashboardSuitePage.class); mountPage("/groups", TestcasesByGroupsPage.class); try {//from w ww. ja va2s.com configProperties = new Properties(); configProperties.load(this.getClass().getClassLoader().getResourceAsStream("ats.config.properties")); } catch (IOException e) { LOG.error("Can't load config.properties file", e); } getAjaxRequestTargetListeners().add(new AjaxRequestTarget.IListener() { @Override public void onBeforeRespond(Map<String, Component> map, final AjaxRequestTarget target) { // if( !Session.get().getFeedbackMessages().isEmpty() ) { target.getPage().visitChildren(IFeedback.class, new IVisitor<Component, Void>() { public void component(final Component component, final IVisit<Void> visit) { if (component.getOutputMarkupId()) { target.appendJavaScript( "$('#" + component.getMarkupId() + "').effect('bounce', { times:5 }, 200);"); target.add(component); //visit.stop(); } visit.dontGoDeeper(); } }); } @Override public void onAfterRespond(Map<String, Component> map, IJavaScriptResponse response) { // Do nothing. } @Override public void updateAjaxAttributes(AbstractDefaultAjaxBehavior behavior, AjaxRequestAttributes attributes) { // TODO Auto-generated method stub } }); // load any available Test Explorer plugins TestExplorerPluginsRepo.getInstance(); }
From source file:com.chitek.wicket.listeditor.ListEditor.java
License:Apache License
/** * Returns a List with all child components that match the given id and class. * /*from www. j ava 2 s . c om*/ * @param id * ID of child components to return * @param clazz * Ther class of the components to return * @return */ public <K extends Component> List<K> getComponentsById(final String id, Class<K> clazz) { final List<K> list = new ArrayList<K>(this.size()); visitChildren(clazz, new IVisitor<K, Boolean>() { @Override public void component(K component, IVisit<Boolean> visit) { if (component.getId().equals(id)) { list.add(component); visit.dontGoDeeper(); } } }); return list; }
From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationCreatePanel.java
License:Apache License
@Override protected void onInitialize() { parentPage = (ApplicationsPage) getPage(); initComponents();/* ww w . j av a2s .c om*/ appForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() { @Override public void component(Component object, IVisit<Void> visit) { object.add(new FieldFeedbackDecorator()); visit.dontGoDeeper(); } }); super.onInitialize(); }
From source file:com.francetelecom.clara.cloud.presentation.applications.ApplicationInformationPanel.java
License:Apache License
@Override protected void onInitialize() { appForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() { @Override/*from w w w. ja va2s . c om*/ public void component(Component object, IVisit<Void> visit) { object.add(new FieldFeedbackDecorator()); visit.dontGoDeeper(); } }); super.onInitialize(); }
From source file:com.francetelecom.clara.cloud.presentation.designer.EditServiceIT.java
License:Apache License
@Test public void testEditShowsValues() { for (final LogicalService service : logicalDeployment.listLogicalServices()) { DeleteEditObjects.editServiceAtRow(myTester, GetObjectsUtils.getPositionForItem(myTester, service)); myTester.assertVisible(NavigationUtils.designerParamFormPath); Form form = GetObjectsUtils.getParamsForm(myTester); form.visitFormComponents(new IVisitor<FormComponent, Void>() { @Override//from w w w .jav a 2s. com public void component(FormComponent formComponent, IVisit<Void> visit) { if (!(formComponent instanceof Button)) { String name = ((FormComponent) formComponent).getInputName(); // We don't test complex fields, such as maven reference // parameters // Full Validation field don't need to be tested if (!name.contains(".") && !name.equals("fullvalidationContent:fullvalidation")) { try { Field field = GetObjectsUtils.getAnyField(service.getClass(), name); field.setAccessible(true); if (field.get(service) != null) { Assert.assertEquals(field.get(service).toString(), ((FormComponent) formComponent).getDefaultModelObject().toString()); } } catch (NoSuchFieldException e) { Assert.fail("field " + name + " could not be found"); } catch (IllegalAccessException e) { Assert.fail("illegal access on " + name + " field"); } } } visit.dontGoDeeper(); } }); NavigationUtils.submitParamsForm(myTester); } }
From source file:com.francetelecom.clara.cloud.presentation.designer.EditServiceIT.java
License:Apache License
@Test public void testEditReadOnly() { try {//from w w w . j av a 2s . co m ApplicationRelease release = manageApplicationRelease.findApplicationReleaseByUID( myTester.getLastRenderedPage().getPageParameters().get("releaseUid").toString()); release.validate(); release.lock(); manageApplicationRelease.updateApplicationRelease(release); } catch (ObjectNotFoundException e) { Assert.fail("could not find application release with id " + myTester.getLastRenderedPage().getPageParameters().get("releaseUid").toString()); } // go on designer step one page to access internal services NavigationUtils.goOnDesignerPage(myTester, releaseUid); myTester.assertRenderedPage(DesignerPage.class); for (final LogicalService service : logicalDeployment.listLogicalServices()) { // When: I try to edit the service int index = GetObjectsUtils.getPositionForItem(myTester, service); Assert.assertFalse("service not found in architecture matrix", -1 == index); myTester.assertVisible(NavigationUtils.getPathForCell(index, 0) + ":cell-view"); DeleteEditObjects.viewServiceAtRow(myTester, index); myTester.assertVisible(NavigationUtils.modalPath); // Then: all displayed fields are read-only Form form = GetObjectsUtils.getModalParamsForm(myTester); form.visitFormComponents(new IVisitor<FormComponent, Void>() { @Override public void component(FormComponent formComponent, IVisit<Void> visit) { if (!(formComponent instanceof Button)) { TagTester tagTester = myTester.getTagByWicketId(((FormComponent) formComponent).getId()); if (tagTester != null) { Assert.assertNotNull(tagTester.getAttribute("disabled")); } } else { if ("addUpdateButton".equals(((Button) formComponent).getId())) { Assert.assertFalse("add/update button should not be visible", ((Button) formComponent).isVisible()); } else if ("cancelCloseButton".equals(((Button) formComponent).getId())) { Label buttonLabel = (Label) ((FormComponent) formComponent).get("cancelLabel"); Assert.assertTrue("cancel/close button should display \"close\"", "close".equals(buttonLabel.getDefaultModelObjectAsString())); } } visit.dontGoDeeper(); } }); } for (final ProcessingNode node : logicalDeployment.listProcessingNodes()) { // When: I try to edit the node int index = GetObjectsUtils.getPositionForItem(myTester, node); Assert.assertFalse("node not found in architecture matrix", -1 == index); myTester.assertVisible(NavigationUtils.getPathForCell(0, index) + ":cell-view"); DeleteEditObjects.viewNodeAtCol(myTester, index); myTester.assertVisible(NavigationUtils.modalPath); // Then: all displayed fields are read-only Form form = GetObjectsUtils.getModalParamsForm(myTester); form.visitFormComponents(new IVisitor<FormComponent, Void>() { @Override public void component(FormComponent object, IVisit<Void> visit) { if (!(object instanceof Button)) { // Assert.assertFalse(((FormComponent)formComponent).getInputName() // + " should be disabled", // ((FormComponent)formComponent).isEnabled()); } visit.dontGoDeeper(); } }); } }
From source file:com.francetelecom.clara.cloud.presentation.designer.FieldConstraintsTest.java
License:Apache License
@Test public void testPreviewFields() { // go on designer step one page to access internal services NavigationUtils.goOnDesignerPage(myTester, releaseUid); List<LogicalModelItem> externalItems = logicalServicesHelper.getExternalServices(); for (LogicalModelItem item : externalItems) { // When: I ask add to add an external service final Class<? extends LogicalModelItem> serviceClass = item.getClass(); if (!serviceClass.getAnnotation(GuiClassMapping.class).status() .equals(GuiClassMapping.StatusType.PREVIEW)) { CreateObjectsWithGUI.selectService(myTester, serviceClass); // Then: Preview fields have a default value // I'm prevented to change the default value for these fields Form form = GetObjectsUtils.getParamsForm(myTester); form.visitFormComponents(new IVisitor<FormComponent, Void>() { @Override// w w w .j a va2s. c o m public void component(FormComponent formComponent, IVisit<Void> visit) { if (!(formComponent instanceof Button)) { String name = ((FormComponent) formComponent).getInputName(); // We don't test complex fields, such as maven reference parameters if (!name.contains(".") && !name.equals("fullvalidationContent:fullvalidation")) { try { GuiMapping annotation = GetObjectsUtils.getAnyField(serviceClass, name) .getAnnotation(GuiMapping.class); if (annotation.status().equals(GuiMapping.StatusType.READ_ONLY)) { TagTester tagTester = myTester .getTagByWicketId(((FormComponent) formComponent).getId()); if (tagTester != null) { Assert.assertNotNull(tagTester.getAttribute("disabled")); } // Assert.assertFalse("field " + name + " should be disabled", ((FormComponent) formComponent).isEnabled()); Assert.assertTrue("field " + name + " should be have a default value", ((FormComponent) formComponent).getDefaultModelObject() != null); } } catch (NoSuchFieldException e) { Assert.fail("field " + name + " not found for service " + serviceClass); } } } visit.dontGoDeeper(); } }); } } NavigationUtils.goOnNextStep(myTester); List<LogicalModelItem> internalItems = logicalServicesHelper.getInternalServices(); for (LogicalModelItem item : internalItems) { // When: I ask add to add an external service final Class<? extends LogicalModelItem> serviceClass = item.getClass(); if (!serviceClass.getAnnotation(GuiClassMapping.class).status() .equals(GuiClassMapping.StatusType.PREVIEW)) { CreateObjectsWithGUI.selectService(myTester, serviceClass); // Then: Preview fields have a default value // I'm prevented to change the default value for these fields Form form = GetObjectsUtils.getParamsForm(myTester); form.visitFormComponents(new IVisitor<FormComponent, Void>() { @Override public void component(FormComponent formComponent, IVisit<Void> visit) { if (!(formComponent instanceof Button)) { String name = ((FormComponent) formComponent).getInputName(); // We don't test complex fields, such as maven reference parameters if (!name.contains(".") && !name.equals("fullvalidationContent:fullvalidation")) { try { GuiMapping annotation = GetObjectsUtils.getAnyField(serviceClass, name) .getAnnotation(GuiMapping.class); if (annotation.status().equals(GuiMapping.StatusType.READ_ONLY)) { TagTester tagTester = myTester .getTagByWicketId(((FormComponent) formComponent).getId()); if (tagTester != null) { Assert.assertNotNull(tagTester.getAttribute("disabled")); } Assert.assertTrue("field " + name + " should be have a default value", ((FormComponent) formComponent).getDefaultModelObject() != null); } } catch (NoSuchFieldException e) { Assert.fail("field " + name + " not found for service " + serviceClass); } } } visit.dontGoDeeper(); } }); } } }
From source file:com.francetelecom.clara.cloud.presentation.designer.services.LogicalServiceBasePanel.java
License:Apache License
@Override protected void onInitialize() { serviceForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() { @Override/*from ww w .j a va 2 s . c o m*/ public void component(Component component, IVisit<Void> visit) { component.add(new FieldFeedbackDecorator()); if (!component.equals(addUpdateButton) && !component.equals(cancelCloseButton)) { boolean serviceParameterEnable = true; if (parentPage instanceof DesignerPage) { serviceParameterEnable = ((DesignerPage) parentPage) .isServiceParameterEnable(serviceForm.getModelObject(), component.getId()); } if (!serviceParameterEnable) { component.setEnabled(false); } } // To disable all field except close button in readOnly mode if (readOnly) { if (!component.equals(cancelCloseButton)) { component.setEnabled(false); } } // overridable components are re-enabled in subclasses, validation button here if (configOverride) { addUpdateButton.setEnabled(true); } visit.dontGoDeeper(); } }); super.onInitialize(); }
From source file:com.francetelecom.clara.cloud.presentation.environments.EnvironmentCreatePanel.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); initComponents();/*from www.j a va 2 s . co m*/ envForm.visitChildren(FormComponent.class, new IVisitor<Component, Void>() { @Override public void component(Component object, IVisit<Void> visit) { object.add(new FieldFeedbackDecorator()); visit.dontGoDeeper(); } }); }