org.apache.wicket.markup.html.panel.EmptyPanel Java Examples

The following examples show how to use org.apache.wicket.markup.html.panel.EmptyPanel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InstancePanel.java    From inception with Apache License 2.0 6 votes vote down vote up
private List<ITab> makeTabs()
{
    List<ITab> tabs = new ArrayList<>();
            
    tabs.add(new AbstractTab(Model.of("Mentions"))
    {
        private static final long serialVersionUID = 6703144434578403272L;

        @Override
        public Panel getPanel(String panelId)
        {
            if (selectedInstanceHandle.getObject() != null) {
                return new AnnotatedListIdentifiers(panelId, kbModel, selectedConceptHandle,
                        selectedInstanceHandle, true);
            }
            else {
                return new EmptyPanel(panelId);
            }
        }
    });        
    return tabs;
}
 
Example #2
Source File: InnerReportsPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public InnerReportsPanel(String id) {
	super(id);
	
	ListView<InnerReport> listReports = new ListView<InnerReport>("listReports", Arrays.asList(InnerReport.values())) {
		@Override
		protected void populateItem(ListItem<InnerReport> item) {
			item.add(createLink("report", item.getModel()));
			//item.add(new Label("description", getString("Section.Audit.innerReports." + item.getModelObject().getDescription() + ".desc")));
		}			
	};		
	
	add(listReports);	
			
	tablePanel = new EmptyPanel("panel");
	tablePanel.setOutputMarkupPlaceholderTag(true);
	add(tablePanel);
	
	setOutputMarkupId(true);
}
 
Example #3
Source File: AjaxCheckTablePanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void populateItem(final Item<ICellPopulator<T>> item, String componentId, IModel<T> rowModel) {
      	final HighlitableDataItem highlitableDataItem = item.findParent(HighlitableDataItem.class);
      	IModel<Boolean> checkBoxModel = new LoadableDetachableModel<Boolean>() {

		private static final long serialVersionUID = 1L;

		@Override
		protected Boolean load() {
			return highlitableDataItem.isHighlite();
		}
      		
      	};
      	if (isCheckable(rowModel)) {
      		item.add(new CheckBoxColumnPanel(componentId, checkBoxModel));
      		item.add(AttributeModifier.replace("class", "checkboxColumn"));
      	} else {
      		item.add(new EmptyPanel(componentId));
      	}
}
 
Example #4
Source File: DrawerManagerTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testCloseDrawerEvent() {
	Capture<EmptyPanel> p = EasyMock.newCapture();
	DrawerManager m = new DrawerManager("test");
	TestDrawer d = new TestDrawer();
	m.push(d);
	startTest(m);

	getTarget().appendJavaScript("$('#"+d.getParent().getMarkupId()+"').unbind('hide-modal');");
	getTarget().appendJavaScript("$('#"+d.getParent().getMarkupId()+"').data('modal-drawer').isShown=true;");
	getTarget().appendJavaScript("$('#"+d.getParent().getMarkupId()+"').modaldrawer('hide');");
	getTarget().appendJavaScript("$('#"+d.getParent().getMarkupId()+"').removeClass('shown-modal');");
	getTarget().add(capture(p));
	replayAll();

	getTester().executeAjaxEvent(d.getParent(), "hide-modal");
	verifyAll();

	assertNull(m.getLast(AbstractDrawer.class));
	assertNull(m.getLastItemRelativePath());
	assertEquals(m, p.getValue().getParent());
	assertTrue(d.getOnCloseCalled());
}
 
Example #5
Source File: ProjectKnowledgeBasePanel.java    From inception with Apache License 2.0 6 votes vote down vote up
public ProjectKnowledgeBasePanel(String aId, final IModel<Project> aProject)
{
    super(aId, aProject);

    setOutputMarkupId(true);
    projectModel = aProject;

    detailsPanel = new EmptyPanel(DETAILS_PANEL_MARKUP_ID);
    add(detailsPanel);

    selectedKnowledgeBaseModel = Model.of();
    KnowledgeBaseListPanel listPanel = new KnowledgeBaseListPanel("list", projectModel,
        selectedKnowledgeBaseModel);
    listPanel.setChangeAction(t -> {
        addOrReplace(detailsPanel);
        detailsPanel.replaceWith(
            new KnowledgeBaseDetailsPanel(DETAILS_PANEL_MARKUP_ID, selectedKnowledgeBaseModel));
        t.add(this);
    });
    add(listPanel);
}
 
Example #6
Source File: ConceptInstancePanel.java    From inception with Apache License 2.0 6 votes vote down vote up
public ConceptInstancePanel(String aId, IModel<KnowledgeBase> aKbModel,
        IModel<KBObject> aSelectedConceptHandle, IModel<KBConcept> aSelectedConceptModel)
{
    super(aId, aSelectedConceptModel);
    setOutputMarkupId(true);
    kbModel = aKbModel;
    selectedInstanceHandle = Model.of();
    selectedConceptHandle = aSelectedConceptHandle;
    
    add(new BootstrapAjaxTabbedPanel<ITab>("tabPanel", makeTabs()));
    
    add(new ConceptInfoPanel("info", kbModel, aSelectedConceptHandle, aSelectedConceptModel));
            
    instanceInfoPanel = new EmptyPanel(INSTANCE_INFO_MARKUP_ID).setVisibilityAllowed(false);
    add(instanceInfoPanel);
}
 
Example #7
Source File: GenericTablePanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public GenericTablePanel(String id, IModel<String> errorMessage) {
    super(id);
    dataTable = null;
    Form form = new Form("form");
    form.add(new EmptyPanel("table").setVisible(false));
    form.setVisible(false);
    form.add(new AjaxFallbackButton("submit", form) {}.setVisible(false));
    add(new Label("error", errorMessage));
    add(form);
}
 
Example #8
Source File: GenericTablePanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private GenericTablePanel(String id, List<? extends IColumn<K, String>> columns,
                          ISortableDataProvider<K, String> provider, int rowsPerRange, boolean filtered) {
    super(id);
    Args.notNull(columns, "columns");
    Args.notNull(provider, "provider");
    setOutputMarkupPlaceholderTag(true);
    dataTable = new OrienteerDataTable<>("table", columns, provider, rowsPerRange);
    if (filtered) {
        FilterForm<OQueryModel<K>> filterForm = createFilterForm("form", (IFilterStateLocator<OQueryModel<K>>) provider);
        filterForm.setOutputMarkupPlaceholderTag(true);
        dataTable.addFilterForm(filterForm);
        filterForm.add(dataTable);
        AjaxFallbackButton button = new AjaxFallbackButton("submit", filterForm) {};
        filterForm.setDefaultButton(button);
        filterForm.enableFocusTracking(button);
        filterForm.add(button);
        filterForm.add(dataTable);
        add(filterForm);
    } else {
        Form form = new Form("form");
        form.add(dataTable);
        form.add(new AjaxFallbackButton("submit", form) {}.setVisible(false));
        add(form);
    }
    add(new EmptyPanel("error").setVisible(false));
}
 
Example #9
Source File: ExternalPageWidget.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
    super.onInitialize();

    if (!Strings.isNullOrEmpty(externalPageUrl)) {
        String interpolatedUrl = MapVariableInterpolator.interpolate(externalPageUrl, new ODocumentMapWrapper(getModelObject()));
        RedirectPage page = new RedirectPage(interpolatedUrl);
        final InlineFrame frame = new InlineFrame("embeddedPage", page);
        frame.add(new AttributeModifier("style", style));
        add(frame);
    } else {
        add(new EmptyPanel("embeddedPage"));
    }
}
 
Example #10
Source File: ImageViewPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public ImageViewPanel(String id, IModel<V> valueModel) {
	super(id, valueModel);

	byte[] imageBytes = (byte[]) getModelObject();
	if (imageBytes != null) {
		String mimeType = new Tika().detect(imageBytes);
		ByteArrayResource byteArrayResource = new ByteArrayResource(mimeType, imageBytes);
		add(new Image("image", byteArrayResource));
	} else {
		add(new EmptyPanel("image"));
	}
}
 
Example #11
Source File: WicketProtector.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
@Override
	public void onInitialize(Component component) {
		if(component instanceof AbstractMetaPanel) {
			final AtomicInteger deep = new AtomicInteger(0);
			component.visitParents(AbstractMetaPanel.class, (c, v) -> deep.incrementAndGet());
			if(deep.get()>=MAX_INCLUSION) {
				component.replaceWith(new EmptyPanel(component.getId()));
//				LOG.error("Due to very deep inclusion the following component was replaced by empty panel: "+component);
			}
		}
	}
 
Example #12
Source File: DefaultRegistrationPanel.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
private Panel createSocialNetworksPanel(String id) {
    List<OAuth2Service> services = OAuth2Repository.getOAuth2Services(true);
    if (services.isEmpty()) {
        return new EmptyPanel(id);
    }

    return new SocialNetworkPanel(id, "panel.registration.social.networks.title", new ListModel<>(services)) {
        @Override
        protected OAuth2ServiceContext createOAuth2ServiceContext(OAuth2Service service) {
            OAuth2ServiceContext ctx = super.createOAuth2ServiceContext(service);
            ctx.setRegistration(true);
            return ctx;
        }
    };
}
 
Example #13
Source File: AbstractListPage.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Override this method if you need a top panel. The default top panel is empty and not visible.
 */
protected void addTopPanel()
{
  final Panel topPanel = new EmptyPanel("topPanel");
  topPanel.setVisible(false);
  form.add(topPanel);
}
 
Example #14
Source File: AbstractListPage.java    From projectforge-webapp with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Override this method if you need a bottom panel. The default bottom panel is empty and not visible.
 */
protected void addBottomPanel(final String id)
{
  final Panel bottomPanel = new EmptyPanel(id);
  bottomPanel.setVisible(false);
  form.add(bottomPanel);
}
 
Example #15
Source File: DrawerManagerTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testLockedDrawerInHierarchyPreventsCloseOfLowerDrawers() {
	Capture<EmptyPanel> p = EasyMock.newCapture();
	DrawerManager m = new DrawerManager("test");
	TestDrawer d1 = new TestDrawer();
	m.push(d1);
	TestDrawer d2 = new TestDrawer();
	d2.setAllowClose(false);
	m.push(d2);
	TestDrawer d3 = new TestDrawer();
	m.push(d3);
	startTest(m);

	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').unbind('hide-modal');");
	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').data('modal-drawer').isShown=true;");
	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').modaldrawer('hide');");
	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').removeClass('shown-modal');");
	getTarget().add(capture(p));
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').addClass('shown-modal');");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').removeClass('hidden-modal');");
	replayAll();

	getTester().executeAjaxEvent(d1.getParent(), "hide-modal");
	verifyAll();

	assertEquals(d2, m.getLast(AbstractDrawer.class));
	assertEquals(d2.getParent().getParent(), p.getValue().getParent());
	assertTrue(d3.getOnCloseCalled());
	assertTrue(d2.getOnCloseCalled());
	assertFalse(d1.getOnCloseCalled());
}
 
Example #16
Source File: DrawerManagerTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testCloseDrawerEventForMultipleDrawers() {
	Capture<EmptyPanel> p2 = EasyMock.newCapture();
	Capture<EmptyPanel> p3 = EasyMock.newCapture();
	DrawerManager m = new DrawerManager("test");
	TestDrawer d1 = new TestDrawer();
	m.push(d1);
	TestDrawer d2 = new TestDrawer();
	m.push(d2);
	TestDrawer d3 = new TestDrawer();
	m.push(d3);
	startTest(m);

	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').unbind('hide-modal');");
	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').data('modal-drawer').isShown=true;");
	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').modaldrawer('hide');");
	getTarget().appendJavaScript("$('#"+d3.getParent().getMarkupId()+"').removeClass('shown-modal');");
	getTarget().add(capture(p3));
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').unbind('hide-modal');");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').data('modal-drawer').isShown=true;");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').modaldrawer('hide');");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').removeClass('shown-modal');");
	getTarget().add(capture(p2));
	getTarget().appendJavaScript("$('#"+d1.getParent().getMarkupId()+"').addClass('shown-modal');");
	getTarget().appendJavaScript("$('#"+d1.getParent().getMarkupId()+"').removeClass('hidden-modal');");
	replayAll();

	getTester().executeAjaxEvent(d2.getParent(), "hide-modal");
	verifyAll();

	assertEquals(d1, m.getLast(AbstractDrawer.class));
	assertEquals(d2.getParent().getParent(), p3.getValue().getParent());
	assertEquals(d1.getParent().getParent(), p2.getValue().getParent());
	assertTrue(d3.getOnCloseCalled());
	assertTrue(d2.getOnCloseCalled());
	assertFalse(d1.getOnCloseCalled());
}
 
Example #17
Source File: DrawerManagerTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testCloseInnerDrawerEvent() {
	Capture<EmptyPanel> p = EasyMock.newCapture();
	DrawerManager m = new DrawerManager("test");
	TestDrawer d1 = new TestDrawer();
	m.push(d1);
	TestDrawer d2 = new TestDrawer();
	m.push(d2);
	startTest(m);

	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').unbind('hide-modal');");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').data('modal-drawer').isShown=true;");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').modaldrawer('hide');");
	getTarget().appendJavaScript("$('#"+d2.getParent().getMarkupId()+"').removeClass('shown-modal');");
	getTarget().add(capture(p));
	getTarget().appendJavaScript("$('#"+d1.getParent().getMarkupId()+"').addClass('shown-modal');");
	getTarget().appendJavaScript("$('#"+d1.getParent().getMarkupId()+"').removeClass('hidden-modal');");
	replayAll();

	getTester().executeAjaxEvent(d2.getParent(), "hide-modal");
	verifyAll();

	assertEquals(d1, m.getLast(AbstractDrawer.class));
	assertEquals(d1.getParent().getParent(), p.getValue().getParent());
	assertFalse(d1.getOnCloseCalled());
	assertTrue(d2.getOnCloseCalled());
}
 
Example #18
Source File: DynamicListItem.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void removeItem(AjaxRequestTarget target){
	Panel panel = new EmptyPanel("container");
	addOrReplace(panel);
	panel.setOutputMarkupId(true);
	panel.setVisible(false);
	target.add(panel);
}
 
Example #19
Source File: DrawerManager.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ListItem(String id, final AbstractDrawer drawer, DrawerManager drawerManager, String css) {
	super(id);
	setOutputMarkupId(true);

	manager = drawerManager;
	item = new WebMarkupContainer("item");
	if (null != css) {
		item.add(new AttributeAppender("class", Model.of(css), " "));
	}
	add(item);
	this.drawer = drawer;
	item.add(drawer);
	add(new EmptyPanel("next").setOutputMarkupId(true));

	item.add(new AjaxEventBehavior("hide-modal") {
		private static final long serialVersionUID = -6423164614673441582L;

		@Override
		protected void onEvent(AjaxRequestTarget target) {
			manager.eventPop(ListItem.this.drawer, target);
		}
		@Override
		protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
			super.updateAjaxAttributes(attributes);
			attributes.setPreventDefault(true);
		}
	});
}
 
Example #20
Source File: NoPagingStrategy.java    From inception with Apache License 2.0 5 votes vote down vote up
@Override
public Component createPositionLabel(String aId, IModel<AnnotatorState> aModel)
{
    EmptyPanel emptyPanel = new EmptyPanel(aId);
    // Just to avoid errors when re-rendering this is requested in an AJAX request
    emptyPanel.setOutputMarkupId(true);
    return emptyPanel;
}
 
Example #21
Source File: MainPage.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	getHeader().setVisible(false);
	final EmptyPanel temp = new EmptyPanel(MAIN_PANEL_ID);
	add(newDelayedLoad());
	add(mainContainer.add(temp).setOutputMarkupId(true));
}
 
Example #22
Source File: TemplatePage.java    From etcd-viewer with Apache License 2.0 5 votes vote down vote up
private void createPage() {

        add(title = new Label("title", new LoadableDetachableModel<Object>() {
            private static final long serialVersionUID = 1L;
            @Override
            protected Object load() {
                return getPageTitleModel().getObject();
            }
        }));

        title.setOutputMarkupId(true);

        if (getApplication().getDebugSettings().isDevelopmentUtilitiesEnabled()) {
            add(new DebugBar("debug"));
        } else {
            add(new EmptyPanel("debug").setVisible(false));
        }

        add(createMenuItem("homeMenuItem", "home", HomePage.class));
        add(createMenuItem("aboutMenuItem", "about", AboutPage.class));

        add(selectRegistryPanel = new SelectRegistryPanel("selectRegistry"));
        selectRegistryPanel.setOutputMarkupId(true);

        add(new SignInPanel("authPanel"));
        add(new SignOutPanel("signOut"));
    }
 
Example #23
Source File: AnalysisPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private Panel createTablePanel(AnalysisDataProvider dataProvider ) {  
	if (dataProvider.isEmpty()) {
		return new EmptyPanel("tablePanel");
	} else {
		return new AnalysisTablePanel("tablePanel", dataProvider);
	}
}
 
Example #24
Source File: AgreementPage.java    From webanno with Apache License 2.0 5 votes vote down vote up
private void commonInit()
{
    add(projectSelectionForm = new ProjectSelectionForm("projectSelectionForm"));
    
    add(agreementForm = new AgreementForm("agreementForm", Model.of(new AgreementFormModel())));
    
    add(resultsContainer = new WebMarkupContainer("resultsContainer"));
    resultsContainer.setOutputMarkupPlaceholderTag(true);
    resultsContainer.add(new EmptyPanel(MID_RESULTS));
}
 
Example #25
Source File: DestinationsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private void init() {
    container = new WebMarkupContainer("container");
    container.setOutputMarkupId(true);
    add(container);

    addTable();
    addDestinationType();

    container.add(new EmptyPanel("destinationPanel"));
}
 
Example #26
Source File: DestinationsPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
private void editDestination(AjaxRequestTarget target) {
    typeChoice.setModelObject(null);
    container.replace(new EmptyPanel("destinationPanel"));
    target.add(typeChoice);
    target.add(table);
    target.add(container);
}
 
Example #27
Source File: OUsersLoginPage.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
protected WebMarkupContainer createRestorePasswordPanel(String id) {
    if (!OrienteerUserModuleRepository.isRestorePassword()) {
        return new EmptyPanel(id);
    }
    return new RestorePasswordPanel(id, restoreModel);
}
 
Example #28
Source File: KnowledgeBasePanel.java    From inception with Apache License 2.0 4 votes vote down vote up
public KnowledgeBasePanel(String id, IModel<Project> aProjectModel,
        IModel<KnowledgeBase> aKbModel)
{
    super(id, aKbModel);

    setOutputMarkupId(true);

    kbModel = aKbModel;
    
    // add the selector for the knowledge bases
    DropDownChoice<KnowledgeBase> ddc = new BootstrapSelect<KnowledgeBase>("knowledgebases",
            LoadableDetachableModel
                    .of(() -> kbService.getEnabledKnowledgeBases(aProjectModel.getObject())));
    
    ddc.add(new LambdaAjaxFormComponentUpdatingBehavior("change", t -> {
        long projectId = aProjectModel.getObject().getId();
        String kbName = aKbModel.getObject().getName();

        PageParameters params = new PageParameters()
            .set(PAGE_PARAM_PROJECT_ID, projectId)
            .set(PAGE_PARAM_KB_NAME, kbName);

        setResponsePage(KnowledgeBasePage.class, params);
    }));

    ddc.setModel(aKbModel);
    ddc.setChoiceRenderer(new ChoiceRenderer<>("name"));
    add(ddc);

    add(createSearchField("searchBar", searchHandleModel, aProjectModel));

    add(conceptTreePanel = new ConceptTreePanel("concepts", kbModel, selectedConceptHandle));
    add(propertyListPanel = new PropertyListPanel("properties", kbModel,
            selectedPropertyHandle));
    
    detailContainer = new WebMarkupContainer(DETAIL_CONTAINER_MARKUP_ID);
    detailContainer.setOutputMarkupId(true);
    add(detailContainer);
    
    details = new EmptyPanel(DETAILS_MARKUP_ID);
    detailContainer.add(details);
}
 
Example #29
Source File: AbstractWidget.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
protected Panel createFooterPanel(String id) {
	Panel panel = new EmptyPanel(id);
	panel.setVisible(false);
	return panel;
}
 
Example #30
Source File: DestinationsPanel.java    From nextreports-server with Apache License 2.0 4 votes vote down vote up
private void clearContainer(AjaxRequestTarget target) {
    typeChoice.setModelObject(null);
    container.replace(new EmptyPanel("destinationPanel"));
    target.add(typeChoice);
    target.add(container);
}