Java Code Examples for org.apache.wicket.Page

The following are top voted examples for showing how to use org.apache.wicket.Page. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: vlo-curation   File: PermalinkServiceImpl.java   View source code 7 votes vote down vote up
@Override
public String getUrlString(Class<? extends Page> pageClass, QueryFacetsSelection selection, SolrDocument document) {
    final PageParameters params = new PageParameters();
    if (selection != null) {
        params.mergeWith(paramsConverter.toParameters(selection));
    }

    if (document != null) {
        params.add(VloWebAppParameters.DOCUMENT_ID, document.getFirstValue(FacetConstants.FIELD_ID));
    }

    final String style = Session.get().getStyle();
    if (style != null) {
        params.add(VloWebAppParameters.THEME, style);
    }

    final CharSequence url = RequestCycle.get().urlFor(pageClass, params);
    final String absoluteUrl = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(url));
    return absoluteUrl;
}
 
Example 2
Project: gitplex-mit   File: GitPlexWebApplication.java   View source code 6 votes vote down vote up
@Override
public final IProvider<IExceptionMapper> getExceptionMapperProvider() {
	return new IProvider<IExceptionMapper>() {

		@Override
		public IExceptionMapper get() {
			return new DefaultExceptionMapper() {

				@Override
				protected IRequestHandler mapExpectedExceptions(Exception e, Application application) {
					Page errorPage = mapExceptions(e);
					if (errorPage != null) {
						return createPageRequestHandler(new PageProvider(errorPage));
					} else {
						return super.mapExpectedExceptions(e, application);
					}
				}
				
			};
		}
		
	};
}
 
Example 3
Project: openNaEF   File: InventoryRequestCycle.java   View source code 6 votes vote down vote up
private List<ErrorItem> getMessage(Throwable cause, Page page, String errorCode) {
    List<ErrorItem> items = new ArrayList<ErrorItem>();
    ErrorItem item1 = new ErrorItem("Symptom", "Your operation is failed with error.");
    items.add(item1);
    ErrorItem item2 = new ErrorItem("Cause", cause.getMessage());
    items.add(item2);
    if (cause instanceof InventoryException) {
        Throwable root = ExceptionUtils.getRootCause(cause);
        if (root != null || root != cause) {
            ErrorItem item3 = new ErrorItem("Root Cause", root.getMessage());
            items.add(item3);
        }
    }
    ErrorItem item4 = new ErrorItem("Action", "Please contact system administrator with additional information below.");
    item4.addLine(errorCode);
    items.add(item4);
    return items;
}
 
Example 4
Project: MBaaS   File: Application.java   View source code 6 votes vote down vote up
@Override
public Class<? extends Page> getHomePage() {
    Sql2o sql2o = Spring.getBean(Sql2o.class);
    try (Connection connection = sql2o.open()) {
        Query query = connection.createQuery("SELECT groovy.java_class FROM setting INNER JOIN page on setting.value = page.page_id INNER JOIN groovy on page.groovy_id = groovy.groovy_id where setting.name = 'home_page'");
        String javaClass = query.executeAndFetchFirst(String.class);
        if (Strings.isNullOrEmpty(javaClass)) {
            return DashboardPage.class;
        } else {
            GroovyClassLoader classLoader = Spring.getBean(GroovyClassLoader.class);
            try {
                return (Class<? extends Page>) classLoader.loadClass(javaClass);
            } catch (ClassNotFoundException | ClassCastException e) {
                return DashboardPage.class;
            }
        }
    }
}
 
Example 5
Project: Unicorn   File: DependenciesPanelTest.java   View source code 6 votes vote down vote up
public void setUp() throws Exception{
    super.setUp();
    Persistor.useTestEnvironment();
    attributes.add(baseAttribute);
    attributes.add(depAttribute);
    AttributeTypeTree attributeTree = new AttributeTypeTree(attributes);
    eventType = new EapEventType("TestType", attributeTree);
    ArrayList<EapEventType> eventTypes = new ArrayList<>();
    eventTypes.add(eventType);
    EapEventType.save(eventTypes);
    tester = new WicketTester(new UNICORNApplication());
    tester.startPage(GeneratorPage.class);
    tester.startComponentInPage(new DependenciesPanel("dependenciesPanel" , new GeneratorPage()));
    // get form
    List<Form> list = new ArrayList<>();
    Page x = tester.getLastRenderedPage();
    for (Component form : x.visitChildren(Form.class)) {
        list.add((Form) form);
    }
    formPath = list.get(0).getPageRelativePath();
    listViewPath = formPath + ":dependenciesContainer:dependenciesListview";
}
 
Example 6
Project: wicket-spring-boot   File: WicketBootSecuredWebApplication.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected Class<? extends WebPage> getSignInPageClass() {
	if(classCandidates.getSignInPageCandidates().size() <= 0){
		throw new IllegalStateException("Couln't find sign in page - please annotated the sign in page with @" + WicketSignInPage.class.getName());
	}
	if(classCandidates.getSignInPageCandidates().size() > 1 ){
		String message = "Multiple sign in pages found - please annotated exactly one class with @" + WicketSignInPage.class.getName();
		message += "\n";
		for(WicketClassCandidate<Page> classCandidate : classCandidates.getHomePageCandidates()) {
			message += "\t" + classCandidate.getCandidate() + "\n";
		}
		throw new IllegalStateException(message);
	}
	
	Class<WebPage> candidateClass = classCandidates.getSignInPageCandidates().iterator().next().getCandidate();
	return candidateClass;
}
 
Example 7
Project: superfly   File: EditRolePage.java   View source code 6 votes vote down vote up
public EditRolePage(PageParameters parameters) {
    super(ListRolesPage.class, parameters);
     long roleId = parameters.get("id").toLong(-1L);
     final UIRole role  = roleService.getRole(roleId);
     setDefaultModel(new CompoundPropertyModel<UIRole>(role));
     Form form = new Form("form"){

        @Override
        protected void onSubmit() {
        roleService.updateRole(role);
        setResponsePage(ListRolesPage.class);
        }

     };
     add(form);
     form.add(new LabelValueRow<String>("role-name", new Model<String>(role.getRoleName()), "role.create.name"));
     form.add(new LabelTextFieldRow<String>(role, "principalName", "role.create.principal-name", true));
     form.add(new Button("form-submit"));
     form.add(new BookmarkablePageLink<Page>("form-cancel", ListRolesPage.class));
}
 
Example 8
Project: superfly   File: CloneGroupPage.java   View source code 6 votes vote down vote up
@SuppressWarnings("serial")
public CloneGroupPage(PageParameters param) {
    super(ListGroupsPage.class, param);

    final Long sourceId = param.get("sid").toLong();

    final UIGroup sourceGroup = groupService.getGroupById(sourceId);
    GroupModel groupModel = new GroupModel();

    Form<GroupModel> form = new Form<GroupModel>("form", new Model<GroupModel>(groupModel)) {
        @Override
        protected void onSubmit() {
            UICloneGroupRequest request = new UICloneGroupRequest();
            request.setNewGroupName(getModelObject().getName());
            request.setSourceGroupId(sourceGroup.getId());
            groupService.cloneGroup(request);
            setResponsePage(ListGroupsPage.class);
        }

    };
    add(form);

    form.add(new LabelValueRow<String>("source", new Model(sourceGroup.getLabel()), "group.clone.source"));
    form.add(new LabelTextFieldRow<String>(groupModel, "name", "group.clone.name", true));
    form.add(new BookmarkablePageLink<Page>("cancel", ListGroupsPage.class));
}
 
Example 9
Project: owsi-core-parent   File: LinksTemplate.java   View source code 6 votes vote down vote up
public LinksTemplate(PageParameters parameters) {
	super(parameters);
	
	IModel<User> userModel = new GenericEntityModel<Long, User>(null);
	try {
		linkDescriptor(new Model<Class<Page>>(null), userModel).extract(parameters);
	} catch (LinkParameterValidationException ignored) {
		// Get around the parameter validation for the purpose of this test
	}
	
	add(new Label("title", getTitleModel()));
	
	Component linkToPage1 = LinkDescriptorBuilder.toPageInstance(this).validate(LinksPage1.class).build()
			.link("linkToThisPageInstanceOnlyIfPage1").hideIfInvalid();
	add(linkToPage1);
	
	add(LinkDescriptorBuilder.toPageInstance(this).validate(LinksTemplate.class).build().link("linkToThisPageInstance")
			.add(Condition.componentVisible(linkToPage1).thenHide()));
	
	add(new DynamicLinkTestPanel("linkTestPanel", userModel));
	
	add(new DynamicImageTestPanel("imageTestPanel"));
}
 
Example 10
Project: ontopia   File: EnterTopicPage.java   View source code 6 votes vote down vote up
public EnterTopicPage(PageParameters parameters) {
	super(parameters);
	
    Topic topic = new TopicModel<Topic>(parameters.getString("topicMapId"), parameters.getString("topicId")).getTopic();
    
    Class<? extends Page> pageClass;
    if (topic.isTopicType())
      pageClass = InstancesPage.class;
//    else if (topic.isAssociationType())
//      pageClass = InstancePage.class;
//    else if (topic.isOccurrenceType())
//      pageClass = InstancePage.class;
//    else if (topic.isNameType())
//      pageClass = InstancePage.class;
//    else if (topic.isRoleType())
//      pageClass = InstancePage.class;
    else
      pageClass = InstancePage.class;
    
    // redirect page
    PageParameters params = new PageParameters();
    params.add("topicMapId", topic.getTopicMap().getId());
    params.add("topicId", topic.getId());
    setResponsePage(pageClass, params);
    setRedirect(true);
  }
 
Example 11
Project: owsi-core-parent   File: CorePageInstanceLinkGenerator.java   View source code 6 votes vote down vote up
protected Page getValidPageInstance() throws LinkInvalidTargetRuntimeException {
	Page pageInstance = pageInstanceModel.getObject();
	if (pageInstance == null) {
		throw new LinkInvalidTargetRuntimeException("The target page instance was null");
	}
	
	Class<? extends Page> validPageClass = getValidExpectedPageClass(pageInstance);
	
	if (validPageClass == null) {
		throw new LinkInvalidTargetRuntimeException("The target page instance '" + pageInstance + "' had unexpected type :"
				+ " got " + pageInstance.getClass().getName() + ", "
				+ "expected one of " + Joiner.on(", ").join(Collections2.transform(expectedPageClassModels, GET_NAME_FROM_CLASS_MODEL_FUNCTION)));
	}
	
	if (! bypassPermissions) {
		if (!Session.get().getAuthorizationStrategy().isActionAuthorized(pageInstance, Page.RENDER)) {
			throw new LinkInvalidTargetRuntimeException("The rendering of the target page instance '" + pageInstance
					+ "' was not authorized.");
		}
	}
	
	return pageInstance;
}
 
Example 12
Project: invesdwin-nowicket   File: AWebPage.java   View source code 6 votes vote down vote up
protected Navbar newNavbar(final String id) {
    final Navbar navbar = new Navbar(id) {

        @Override
        protected TransparentWebMarkupContainer newContainer(final String componentId) {
            final TransparentWebMarkupContainer container = super.newCollapseContainer(componentId);
            container.add(AttributeModifier.replace("class", getContainerClass()));
            return container;
        }

        @Override
        protected Class<? extends Page> getHomePage() {
            return getNavbarHomePage();
        }

    };
    navbar.setBrandName(Model.of("invesdwin-NoWicket"));
    navbar.setBrandImage(DEFAULT_LOGO, Model.of("logo"));

    addSignInOrSignOutPageToNavbar(navbar);

    return navbar;
}
 
Example 13
Project: owsi-core-parent   File: BuilderTargetFactories.java   View source code 6 votes vote down vote up
private BuilderTargetFactories(
		IBuilderLinkDescriptorFactory<TEarlyTarget, TEarlyTargetDefinitionLinkDescriptor>
				earlyTargetDefinitionLinkDescriptorFactory,
		IModel<? extends TEarlyTarget> earlyTargetDefinitionTargetModel,
		IBuilderLinkDescriptorFactory<
				Class<? extends Page>, TLateTargetDefinitionPageLinkDescriptor
				> lateTargetDefinitionPageLinkDescriptorFactory,
		IBuilderLinkDescriptorFactory<
				ResourceReference, TLateTargetDefinitionResourceLinkDescriptor
				> lateTargetDefinitionResourceLinkDescriptorFactory,
		IBuilderLinkDescriptorFactory<
				ResourceReference, TLateTargetDefinitionImageResourceLinkDescriptor
				> lateTargetDefinitionImageResourceLinkDescriptorFactory) {
	super();
	this.earlyTargetDefinitionLinkDescriptorFactory = earlyTargetDefinitionLinkDescriptorFactory;
	this.earlyTargetDefinitionTargetModel = earlyTargetDefinitionTargetModel;
	this.lateTargetDefinitionPageLinkDescriptorFactory = lateTargetDefinitionPageLinkDescriptorFactory;
	this.lateTargetDefinitionResourceLinkDescriptorFactory = lateTargetDefinitionResourceLinkDescriptorFactory;
	this.lateTargetDefinitionImageResourceLinkDescriptorFactory = lateTargetDefinitionImageResourceLinkDescriptorFactory;
}
 
Example 14
Project: ontopia   File: SignOutPage.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked") 
public SignOutPage(final PageParameters parameters) {
  add(new HeaderPanel("header"));    
  add(new FooterPanel("footer"));
  
  String page = parameters.getString(REDIRECTPAGE_PARAM); 
  Class<? extends Page> pageClass; 
  if (page != null) { 
    try { 
      pageClass = (Class<? extends Page>) Class.forName(page); 
    } catch (ClassNotFoundException e) { 
      throw new RuntimeException(e); 
    } 
  } else { 
    pageClass = getApplication().getHomePage(); 
  } 
  getSession().invalidate();    
  setResponsePage(pageClass);
  setRedirect(true);
}
 
Example 15
Project: hippo   File: BlankAttachmentFieldValidatorTest.java   View source code 5 votes vote down vote up
private void initialiseWicketApplication() {

        // This initialises various statically stored values that Wicket uses,
        // most notably, Session and Application whose absence was causing NullPointerException during call to
        // org.hippoecm.frontend.editor.validator.plugins.AbstractCmsValidator.getTranslation(java.lang.String).
        new WicketTester(new WebApplication() {
            public Class<? extends Page> getHomePage() {
                return null;
            }
        });
    }
 
Example 16
Project: hippo   File: BlankStaticDropdownSelectionFieldValidatorTest.java   View source code 5 votes vote down vote up
private void initialiseWicketApplication() {

        // This initialises various statically stored values that Wicket uses,
        // most notably, Session and Application whose absence was causing NullPointerException during call to
        // org.hippoecm.frontend.editor.validator.plugins.AbstractCmsValidator.getTranslation(java.lang.String).
        new WicketTester(new WebApplication() {
            public Class<? extends Page> getHomePage() {
                return null;
            }
        });
    }
 
Example 17
Project: hippo   File: CoverageDatesValidatorTest.java   View source code 5 votes vote down vote up
private void initialiseWicketApplication() {
    // This initialises various statically stored values that Wicket uses,
    // most notably, Session and Application whose absence was causing NullPointerException during call to
    // org.hippoecm.frontend.editor.validator.plugins.AbstractCmsValidator.getTranslation(java.lang.String).
    new WicketTester(new WebApplication() {
        public Class<? extends Page> getHomePage() {
            return null;
        }
    });
}
 
Example 18
Project: hippo   File: BlankRelatedLinkFieldValidatorTest.java   View source code 5 votes vote down vote up
private void initialiseWicketApplication() {
    // This initialises various statically stored values that Wicket uses,
    // most notably, Session and Application whose absence was causing NullPointerException during call to
    // org.hippoecm.frontend.editor.validator.plugins.AbstractCmsValidator.getTranslation(java.lang.String).
    new WicketTester(new WebApplication() {
        public Class<? extends Page> getHomePage() {
            return null;
        }
    });
}
 
Example 19
Project: gitplex-mit   File: GitPlexWebApplication.java   View source code 5 votes vote down vote up
protected Page mapExceptions(Exception e) {
	for (ExpectedExceptionContribution contribution: expectedExceptionContributions) {
		for (Class<? extends Exception> expectedExceptionClass: contribution.getExpectedExceptionClasses()) {
			Exception expectedException = ExceptionUtils.find(e, expectedExceptionClass);
			if (expectedException != null)
				return new ExpectedExceptionPage(expectedException);
		}
	}
	
	return new UnexpectedExceptionPage(e);
}
 
Example 20
Project: gitplex-mit   File: WicketUtils.java   View source code 5 votes vote down vote up
@Nullable
public static Page getPage() {
	if (RequestCycle.get() != null && RequestCycle.get().getActiveRequestHandler() instanceof IPageRequestHandler) {
		return (Page) ((IPageRequestHandler) RequestCycle.get().getActiveRequestHandler()).getPage();	
	} else {
		return null;
	}
}
 
Example 21
Project: gitplex-mit   File: WicketUtils.java   View source code 5 votes vote down vote up
@Nullable
public static PageKey getPageKey() {
	Page page = getPage();
	if (page != null) {
		String sessionId = page.getSession().getId();
		if (sessionId != null) {
			return new PageKey(sessionId, new PageIdKey(page.getPageId()));
		}
	}
	return null;
}
 
Example 22
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
public PageTab(IModel<String> titleModel, Class<? extends Page> mainPageClass, 
		Class<? extends Page> additionalPageClass1, 
		Class<? extends Page> additionalPageClass2,
		Class<? extends Page> additionalPageClass3) {
	this(titleModel, mainPageClass, asList(additionalPageClass1, 
			additionalPageClass2, additionalPageClass3));
}
 
Example 23
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
public PageTab(IModel<String> titleModel, Class<? extends Page> mainPageClass, 
		Class<? extends Page> additionalPageClass1, 
		Class<? extends Page> additionalPageClass2,
		Class<? extends Page> additionalPageClass3, 
		Class<? extends Page> additionalPageClass4) {
	this(titleModel, mainPageClass, asList(additionalPageClass1, 
			additionalPageClass2, additionalPageClass3, additionalPageClass4));
}
 
Example 24
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
public PageTab(IModel<String> titleModel, Class<? extends Page> mainPageClass, 
		Class<? extends Page> additionalPageClass1, 
		Class<? extends Page> additionalPageClass2,
		Class<? extends Page> additionalPageClass3, 
		Class<? extends Page> additionalPageClass4, 
		Class<? extends Page> additionalPageClass5) {
	this(titleModel, mainPageClass, asList(additionalPageClass1, 
			additionalPageClass2, additionalPageClass3, additionalPageClass4, additionalPageClass5));
}
 
Example 25
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
private static List<Class<? extends Page>> asList(Class<? extends Page> pageClass1, 
		Class<? extends Page> pageClass2) {
	List<Class<? extends Page>> pageClasses = new ArrayList<Class<? extends Page>>();
	pageClasses.add(pageClass1);
	pageClasses.add(pageClass2);
	return pageClasses;
}
 
Example 26
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
private static List<Class<? extends Page>> asList(Class<? extends Page> pageClass1, 
		Class<? extends Page> pageClass2, Class<? extends Page> pageClass3) {
	List<Class<? extends Page>> pageClasses = new ArrayList<Class<? extends Page>>();
	pageClasses.add(pageClass1);
	pageClasses.add(pageClass2);
	pageClasses.add(pageClass3);
	return pageClasses;
}
 
Example 27
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
private static List<Class<? extends Page>> asList(
		Class<? extends Page> pageClass1, Class<? extends Page> pageClass2, 
		Class<? extends Page> pageClass3, Class<? extends Page> pageClass4) {
	List<Class<? extends Page>> pageClasses = new ArrayList<Class<? extends Page>>();
	pageClasses.add(pageClass1);
	pageClasses.add(pageClass2);
	pageClasses.add(pageClass3);
	pageClasses.add(pageClass4);
	return pageClasses;
}
 
Example 28
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
private static List<Class<? extends Page>> asList(
		Class<? extends Page> pageClass1, Class<? extends Page> pageClass2, 
		Class<? extends Page> pageClass3, Class<? extends Page> pageClass4, 
		Class<? extends Page> pageClass5) {
	List<Class<? extends Page>> pageClasses = new ArrayList<Class<? extends Page>>();
	pageClasses.add(pageClass1);
	pageClasses.add(pageClass2);
	pageClasses.add(pageClass3);
	pageClasses.add(pageClass4);
	pageClasses.add(pageClass5);
	return pageClasses;
}
 
Example 29
Project: gitplex-mit   File: PageTab.java   View source code 5 votes vote down vote up
public boolean isActive(Page currentPage) {
	if (mainPageClass.isAssignableFrom(currentPage.getClass()))
		return true;
	
	for (Class<?> pageClass: additionalPageClasses) {
		if (pageClass.isAssignableFrom(currentPage.getClass())) 
			return true;
	}
	return false;
}
 
Example 30
Project: engerek   File: TestConnectionMessagesPanel.java   View source code 5 votes vote down vote up
public void initResultsPanel(RepeatingView resultView, List<OpResult> opresults, Page parentPage) {
    for (OpResult result : opresults) {
        OperationResultPanel resultPanel = new OperationResultPanel(resultView.newChildId(), new Model<>(result), parentPage);
        resultPanel.setOutputMarkupId(true);
        resultView.add(resultPanel);
    }
}
 
Example 31
Project: engerek   File: AvailableResponses.java   View source code 5 votes vote down vote up
public AvailableResponses(Page page) {
    this.page = page;

    // TODO: use ModelInteractionService.getCertificationConfiguration() instead
    AccessCertificationConfigurationType config = SystemConfigurationHolder.getCertificationConfiguration();

    responseKeys = new ArrayList<>(6);
    responseValues = new ArrayList<>(6);

    addResponse(config, "PageCertDecisions.menu.accept", ACCEPT);
    addResponse(config, "PageCertDecisions.menu.revoke", REVOKE);
    addResponse(config, "PageCertDecisions.menu.notDecided", NOT_DECIDED);
    addResponse(config, "PageCertDecisions.menu.noResponse", NO_RESPONSE);
}
 
Example 32
Project: engerek   File: HeaderMenuAction.java   View source code 5 votes vote down vote up
@Override
public void onError(AjaxRequestTarget target, Form<?> form) {
    Page page = component.getPage();

    if (page instanceof PageBase) {
        target.add(((PageBase) page).getFeedbackPanel());
    }
}
 
Example 33
Project: engerek   File: ObjectSelectionPage.java   View source code 5 votes vote down vote up
@Override
public Page createPage() {
    context.callingPageReference = context.getCallingPage().getPageReference();

    ObjectSelectionPanel selectionPanel = new ObjectSelectionPanel(
            ObjectSelectionPage.ID_OBJECT_SELECTION_PANEL,
            context.getObjectTypeClass(), modalWindow, context);

    return new ObjectSelectionPage(selectionPanel, context.getCallingPage());
}
 
Example 34
Project: engerek   File: WebComponentUtil.java   View source code 5 votes vote down vote up
public static PageBase getPageBase(Component component) {
	Page page = component.getPage();
	if (page instanceof PageBase) {
		return (PageBase) page;
	} else if (page instanceof PageDialog) {
		return ((PageDialog) page).getPageBase();
	} else {
		throw new IllegalStateException("Couldn't determine page base for " + page);
	}
}
 
Example 35
Project: engerek   File: WebComponentUtil.java   View source code 5 votes vote down vote up
public static <T extends Component> T theSameForPage(T object, PageReference containingPageReference) {
	Page containingPage = containingPageReference.getPage();
	if (containingPage == null) {
		return object;
	}
	String path = object.getPageRelativePath();
	T retval = (T) containingPage.get(path);
	if (retval == null) {
		return object;
		// throw new IllegalStateException("There is no component like " +
		// object + " (path '" + path + "') on " + containingPage);
	}
	return retval;
}
 
Example 36
Project: engerek   File: OperationResultPanel.java   View source code 5 votes vote down vote up
public void initLayout(Page parentPage) {

		WebMarkupContainer detailsBox = new WebMarkupContainer(ID_DETAILS_BOX);
		detailsBox.setOutputMarkupId(true);
		detailsBox.add(AttributeModifier.append("class", createHeaderCss()));
		add(detailsBox);

		initHeader(detailsBox);
		initDetails(detailsBox, parentPage);
	}
 
Example 37
Project: engerek   File: OperationResultPanel.java   View source code 5 votes vote down vote up
private void initContexts(WebMarkupContainer operationContent, final IModel<OpResult> model, Page parentPage) {

		Label contextsLabel = new Label("contextsLabel", parentPage.getString("FeedbackAlertMessageDetails.contexts"));
		contextsLabel.setOutputMarkupId(true);
		contextsLabel.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});

		operationContent.add(contextsLabel);

		ListView<Context> contexts = new ListView<Context>("contexts", createContextsModel(model)) {
			private static final long serialVersionUID = 1L;
			
			@Override
			protected void populateItem(ListItem<Context> item) {
				item.add(new Label("contextName", new PropertyModel<Object>(item.getModel(), "name")));
				item.add(new Label("contextValue", new PropertyModel<Object>(item.getModel(), "value")));
			}
		};
		contexts.setOutputMarkupId(true);
		contexts.add(new VisibleEnableBehaviour() {
			private static final long serialVersionUID = 1L;

			@Override
			public boolean isVisible() {
				return CollectionUtils.isNotEmpty(model.getObject().getContexts());
			}
		});
		operationContent.add(contexts);
	}
 
Example 38
Project: singular-server   File: Menu.java   View source code 5 votes vote down vote up
public Class<? extends Page> getBoxPageClass() {
    Class<? extends Page> homePage = WebApplication.get().getHomePage();
    if (homePage != null) {
        return homePage;
    }
    return boxPageClass;
}
 
Example 39
Project: singular-server   File: Page410Test.java   View source code 5 votes vote down vote up
@WithUserDetails("vinicius.nunes")
@Transactional
@Test
public void testPage410Rendering() {
    tester = new SingularWicketTester(singularApplication);
    Page p = new Page410();
    tester.startPage(p);
    tester.assertRenderedPage(Page410.class);
}
 
Example 40
Project: singular-server   File: AccessDeniedPageTest.java   View source code 5 votes vote down vote up
@WithUserDetails("vinicius.nunes")
@Transactional
@Test
public void testAccessDeniedPageRendering() {
    tester = new SingularWicketTester(singularApplication);
    Page p = new AccessDeniedPage();
    tester.startPage(p);
    tester.assertRenderedPage(AccessDeniedPage.class);
}