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

The following examples show how to use org.apache.wicket.markup.html.panel.Panel. 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: ConnObjectPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
/**
 * Get panel for attribute value (not remote status).
 *
 * @param id component id to be replaced with the fragment content.
 * @param attrTO remote attribute.
 * @return fragment.
 */
private static Panel getValuePanel(final String id, final String schemaName, final Attr attrTO) {
    Panel field;
    if (attrTO == null) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>());
    } else if (CollectionUtils.isEmpty(attrTO.getValues())) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>());
    } else if (ConnIdSpecialName.PASSWORD.equals(schemaName)) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>("********"));
    } else if (attrTO.getValues().size() == 1) {
        field = new AjaxTextFieldPanel(id, schemaName, new Model<>(attrTO.getValues().get(0)));
    } else {
        field = new MultiFieldPanel.Builder<>(new ListModel<>(attrTO.getValues())).build(
                id,
                schemaName,
                new AjaxTextFieldPanel("panel", schemaName, new Model<>()));
    }

    field.setEnabled(false);
    return field;
}
 
Example #2
Source File: StackPanel.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public void forwardWorkspace(Panel panel, AjaxRequestTarget target) {
    if (stack.size() > STACK_MAX_SIZE) {
        // clear all
        stack.pop();
        while (stack.size() > 1) {
            stack.pop();
        }
    }

    panel.setOutputMarkupId(true);
    workContainer.replace(panel);
    stack.push(panel);

    if (target != null) {
        target.add(workContainer);
    }
}
 
Example #3
Source File: AnyDirectoryPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected Panel customResultBody(final String panelId, final AnyWrapper<A> item, final Serializable result) {
    if (!(result instanceof ProvisioningResult)) {
        throw new IllegalStateException("Unsupported result type");
    }

    return new StatusPanel(
            panelId,
            ((ProvisioningResult<A>) result).getEntity(),
            new ListModel<>(new ArrayList<>()),
            ((ProvisioningResult<A>) result).getPropagationStatuses().stream().map(status -> {
                ConnObjectTO before = status.getBeforeObj();
                ConnObjectWrapper afterObjWrapper = new ConnObjectWrapper(
                        ((ProvisioningResult<A>) result).getEntity(),
                        status.getResource(),
                        status.getAfterObj());
                return Triple.of(before, afterObjWrapper, status.getFailureReason());
            }).collect(Collectors.toList()),
            pageRef);
}
 
Example #4
Source File: UpdateActionLink.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
public void executeAction(AjaxRequestTarget target) {
    Entity entity = getActionContext().getEntity();
    try {
        Report report = (Report) entity;
        Panel workPanel;
        if (ReportConstants.NEXT.equals(report.getType())) {
            workPanel = new UploadNextReportPanel("work", report);
            //setResponsePage(new UploadNextReportPage(report));
        } else {
            workPanel = new UploadJasperReportPanel("work", report);
            //setResponsePage(new UploadJasperReportPage(report));
        }

        EntityBrowserPanel panel = findParent(EntityBrowserPanel.class);
        panel.forwardWorkspace(workPanel, target);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #5
Source File: HomePage.java    From nextreports-server with Apache License 2.0 6 votes vote down vote up
private void onSlidebarClick(AjaxRequestTarget target, String sectionId) {
    String oldSectionId = sectionManager.getSelectedSectionId();
    Section section = sectionManager.getSection(sectionId);
    sectionManager.setSelectedSectionId(sectionId);
    Panel newPanel = section.createView("sectionPanel");
    newPanel.setOutputMarkupId(true);
    sectionPanel.replaceWith(newPanel);
    target.add(newPanel);
    sectionPanel = newPanel;

    // close slidebar
    target.appendJavaScript("closeSlidebar();");

    // refresh active class
    ListView<String> view = (ListView<String>) get("section");
    Iterator<Component> it= view.iterator();
    while (it.hasNext()) {
        ListItem<String> item = (ListItem<String>) it.next();
        String itemId = item.getModelObject();
        if (itemId.equals(sectionId) || itemId.equals(oldSectionId)) {
            target.add(item);
        }
    }
}
 
Example #6
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 #7
Source File: BlobDiffPanel.java    From onedev with MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	if (change.getType() == ChangeType.ADD || change.getType() == ChangeType.COPY) {
		showBlob(change.getNewBlob());
	} else if (change.getType() == ChangeType.DELETE) {
		showBlob(change.getOldBlob());
	} else {
		if (change.getOldText() != null && change.getNewText() != null) {
			if (change.getOldText().getLines().size() + change.getNewText().getLines().size() > DiffUtils.MAX_DIFF_SIZE) {
				add(newFragment("Unable to diff as the file is too large.", true));
			} else if (change.getAdditions() + change.getDeletions() > WebConstants.MAX_SINGLE_DIFF_LINES) {
				add(newFragment("Diff is too large to be displayed.", true));
			} else if (change.getAdditions() + change.getDeletions() == 0 
					&& (commentSupport == null || commentSupport.getComments().isEmpty())) {
				add(newFragment("Content is identical", false));
			} else {
				add(new TextDiffPanel(CONTENT_ID, projectModel, requestModel, change, diffMode, blameModel, commentSupport));
			}
		} else if (change.getOldBlob().isPartial() || change.getNewBlob().isPartial()) {
			add(newFragment("File is too large to be loaded.", true));
		} else if (change.getOldBlob().getMediaType().equals(change.getNewBlob().getMediaType())) {
			Panel diffPanel = null;
			for (DiffRenderer renderer: OneDev.getExtensions(DiffRenderer.class)) {
				diffPanel = renderer.render(CONTENT_ID, change.getNewBlob().getMediaType(), change, diffMode);
				if (diffPanel != null)
					break;
			}
			if (diffPanel != null)
				add(diffPanel);
			else
				add(newFragment("Binary file.", false));
		} else {
			add(newFragment("Binary file.", false));
		}
	}
}
 
Example #8
Source File: Login.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Override
protected List<Panel> getSSOLoginFormPanels() {
    List<Panel> ssoLoginFormPanels = new ArrayList<>();
    lookup.getSSOLoginFormPanels().forEach(ssoLoginFormPanel -> {
        try {
            ssoLoginFormPanels.add(ssoLoginFormPanel.getConstructor(String.class, BaseSession.class).
                    newInstance("ssoLogin", SyncopeEnduserSession.get()));
        } catch (Exception e) {
            LOG.error("Could not initialize the provided SSO login form panel", e);
        }
    });
    return ssoLoginFormPanels;
}
 
Example #9
Source File: ImageDiffRenderer.java    From onedev with MIT License 5 votes vote down vote up
@Override
public Panel render(String panelId, MediaType mediaType, BlobChange change, DiffViewMode viewMode) {
	if (mediaType.getType().equalsIgnoreCase("image"))
		return new ImageDiffPanel(panelId, change);
	else
		return null;
}
 
Example #10
Source File: AbstractUnitizingAgreementMeasureSupport.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public Panel createResultsPanel(String aId,
        IModel<PairwiseAnnotationResult<UnitizingAgreementResult>> aResults,
        SerializableSupplier<Map<String, List<CAS>>> aCasMapSupplier)
{
    return new PairwiseUnitizingAgreementTable(aId, aResults);
}
 
Example #11
Source File: IssueOpenedActivity.java    From onedev with MIT License 5 votes vote down vote up
@Override
public Panel render(String panelId, DeleteCallback deleteCallback) {
	return new IssueOpenedPanel(panelId, new LoadableDetachableModel<Issue>() {

		@Override
		protected Issue load() {
			return getIssue();
		}
		
	});
}
 
Example #12
Source File: AnyPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
protected Panel createDirectoryPanel(
        final AnyTypeTO anyTypeTO,
        final RealmTO realmTO,
        final AnyLayout anyLayout,
        final boolean enableSearch,
        final DirectoryPanelSupplier directoryPanelSupplier) {

    return directoryPanelSupplier.supply(DIRECTORY_PANEL_ID, anyTypeTO, realmTO, anyLayout, pageRef);
}
 
Example #13
Source File: PushTaskFilters.java    From syncope with Apache License 2.0 5 votes vote down vote up
public PushTaskFilters(final PushTaskWrapper pushTaskWrapper) {
    super();

    final LoadableDetachableModel<List<AnyTypeTO>> types = new LoadableDetachableModel<List<AnyTypeTO>>() {

        private static final long serialVersionUID = 5275935387613157437L;

        @Override
        protected List<AnyTypeTO> load() {
            return AnyTypeRestClient.listAnyTypes();
        }
    };

    add(new ListView<AnyTypeTO>("filters", types) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<AnyTypeTO> item) {
            final String key = item.getModelObject().getKey();
            item.add(new Accordion("filters", Collections.<ITab>singletonList(
                    new AbstractTab(new StringResourceModel(
                            "filters", this, new Model<>(item.getModelObject()))) {

                private static final long serialVersionUID = 1037272333056449378L;

                @Override
                public Panel getPanel(final String panelId) {
                    return new AnyObjectSearchPanel.Builder(
                            key, new MapOfListModel<>(pushTaskWrapper, "filterClauses", key)).
                            required(false).build(panelId);
                }
            }), Model.of(StringUtils.isBlank(pushTaskWrapper.getFilters().get(key)) ? -1 : 0))
                    .setOutputMarkupId(true));
        }
    });
}
 
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 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 #15
Source File: SchemaTypeWizardBuilder.java    From syncope with Apache License 2.0 5 votes vote down vote up
public Details(final SchemaTO modelObject) {
    AjaxDropDownChoicePanel<SchemaType> kind =
            new AjaxDropDownChoicePanel<>("kind", getString("kind"), new Model<>());
    kind.setChoices(List.of(SchemaType.values()));
    kind.setOutputMarkupId(true);
    kind.setModelObject(schemaType);
    kind.setEnabled(false);
    add(kind);

    Panel detailsPanel;
    switch (schemaType) {
        case DERIVED:
            detailsPanel = new DerSchemaDetails("details", (DerSchemaTO) modelObject);
            break;

        case VIRTUAL:
            detailsPanel = SyncopeWebApplication.get().getVirSchemaDetailsPanelProvider().
                    get("details", (VirSchemaTO) modelObject);
            break;

        case PLAIN:
        default:
            detailsPanel = new PlainSchemaDetails("details", (PlainSchemaTO) modelObject);
    }
    detailsPanel.setOutputMarkupId(true);
    add(detailsPanel);
}
 
Example #16
Source File: ViewFriends.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public ViewFriends(final String userUuid) {

        log.debug("ViewFriends()");

        //get user viewing this page
        final String currentUserUuid = sakaiProxy.getCurrentUserId();

        //check person viewing this page (currentuserId) is allowed to view userId's friends - unless admin
        boolean isFriendsListVisible = sakaiProxy.isSuperUser()
                    || privacyLogic.isActionAllowed(userUuid, currentUserUuid, PrivacyType.PRIVACY_OPTION_MYFRIENDS);

        if (isFriendsListVisible) {
            //show confirmed friends panel for the given user
            Panel confirmedFriends = new ConfirmedFriends("confirmedFriends", userUuid);
            confirmedFriends.setOutputMarkupId(true);
            add(confirmedFriends);

            //post view event
            sakaiProxy.postEvent(ProfileConstants.EVENT_FRIENDS_VIEW_OTHER, "/profile/"+userUuid, false);
        } else {
            log.debug("User: {} is not allowed to view the friends list for: {} ", currentUserUuid, userUuid);
            String displayName = sakaiProxy.getUserDisplayName(userUuid);
            Label notPermitted = new Label("confirmedFriends"
                        , new StringResourceModel("error.friend.view.disallowed", null, new Object[] {displayName}));
            add(notPermitted);
        }
	}
 
Example #17
Source File: IssueChangeActivity.java    From onedev with MIT License 5 votes vote down vote up
@Override
public Panel render(String panelId, DeleteCallback callback) {
	return new IssueChangePanel(panelId, new LoadableDetachableModel<IssueChange>() {

		@Override
		protected IssueChange load() {
			return getChange();
		}
		
	});
}
 
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: MarkupProvider.java    From Orienteer with Apache License 2.0 5 votes vote down vote up
public MarkupProvider()
{
	registerMarkupContent(DropDownChoice.class, "<select wicket:id=\"component\" class=\"custom-select\"></select>");
	registerMarkupContent(ListMultipleChoice.class, "<select wicket:id=\"component\" class=\"form-control\"></select>");
	registerMarkupContent(CheckBox.class, "<input type=\"checkbox\" wicket:id=\"component\"/>");
	registerMarkupContent(TextField.class, "<input type=\"text\" wicket:id=\"component\" class=\"form-control\"/>");
	registerMarkupContent(NumberTextField.class, "<input type=\"number\" wicket:id=\"component\" class=\"form-control\"/>");
	registerMarkupContent(TextArea.class, "<textarea wicket:id=\"component\" class=\"form-control\"></textarea>");
	registerMarkupContent(FormComponentPanel.class, "<div wicket:id=\"component\"></div>");
	registerMarkupContent(Panel.class, "<div wicket:id=\"component\"></div>");
	registerMarkupContent(AbstractLink.class, "<a wicket:id=\"component\"></a>");
	registerMarkupContent(StructureTable.class, "<table wicket:id=\"component\"></table>");
	registerMarkupContent(Select2MultiChoice.class, "<select wicket:id=\"component\" class=\"form-control\"/>");
	registerMarkupContent(Select2Choice.class, "<select wicket:id=\"component\" class=\"form-control\"/>");
}
 
Example #20
Source File: KrippendorffAlphaUnitizingAgreementMeasureSupport.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public Panel createResultsPanel(String aId,
        IModel<PairwiseAnnotationResult<UnitizingAgreementResult>> aResults,
        SerializableSupplier<Map<String, List<CAS>>> aCasMapSupplier)
{
    return new PairwiseUnitizingAgreementTable(aId, aResults);
}
 
Example #21
Source File: BaseModal.java    From syncope with Apache License 2.0 5 votes vote down vote up
private BaseModal<T> setInternalContent(final Panel component) {
    if (!component.getId().equals(getContentId())) {
        throw new WicketRuntimeException("Modal content id is wrong. "
                + "Component ID: " + component.getId() + "; content ID: " + getContentId());
    }

    content.replaceWith(component);
    content = component;

    return this;
}
 
Example #22
Source File: StackPanel.java    From nextreports-server with Apache License 2.0 5 votes vote down vote up
public StackPanel(String id) {
    super(id);

    stack = new Stack<Panel>();
    workContainer = new WebMarkupContainer("workContainer");
    workContainer.setOutputMarkupId(true);

    add(workContainer);
}
 
Example #23
Source File: StringFeatureSupport.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public Panel createTraitsEditor(String aId,  IModel<AnnotationFeature> aFeatureModel)
{
    AnnotationFeature feature = aFeatureModel.getObject();
    
    if (!accepts(feature)) {
        throw unsupportedFeatureTypeException(feature);
    }
    
    return new StringFeatureTraitsEditor(aId, this, aFeatureModel);
}
 
Example #24
Source File: SpanLayerSupport.java    From webanno with Apache License 2.0 5 votes vote down vote up
@Override
public Panel createTraitsEditor(String aId,  IModel<AnnotationLayer> aLayerModel)
{
    AnnotationLayer layer = aLayerModel.getObject();
    
    if (!accepts(layer)) {
        throw unsupportedLayerTypeException(layer);
    }
    
    return new SpanLayerTraitsEditor(aId, this, aLayerModel);
}
 
Example #25
Source File: MyMessages.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private void switchContentPanel(Panel replacement, AjaxRequestTarget target) {
	
	replacement.setOutputMarkupId(true);
	tabPanel.replaceWith(replacement);
	if(target != null) {
		target.add(replacement);
		//resize iframe
		target.appendJavaScript("setMainFrameHeight(window.name);");
	}
	
	//must keep reference up to date
	tabPanel=replacement;
	
}
 
Example #26
Source File: ViewFriends.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public ViewFriends(final String userUuid) {

        log.debug("ViewFriends()");

        //get user viewing this page
        final String currentUserUuid = sakaiProxy.getCurrentUserId();

        //check person viewing this page (currentuserId) is allowed to view userId's friends - unless admin
        boolean isFriendsListVisible = sakaiProxy.isSuperUser()
                    || privacyLogic.isActionAllowed(userUuid, currentUserUuid, PrivacyType.PRIVACY_OPTION_MYFRIENDS);

        if (isFriendsListVisible) {
            //show confirmed friends panel for the given user
            Panel confirmedFriends = new ConfirmedFriends("confirmedFriends", userUuid);
            confirmedFriends.setOutputMarkupId(true);
            add(confirmedFriends);

            //post view event
            sakaiProxy.postEvent(ProfileConstants.EVENT_FRIENDS_VIEW_OTHER, "/profile/"+userUuid, false);
        } else {
            log.debug("User: {} is not allowed to view the friends list for: {} ", currentUserUuid, userUuid);
            String displayName = sakaiProxy.getUserDisplayName(userUuid);
            Label notPermitted = new Label("confirmedFriends"
                        , new StringResourceModel("error.friend.view.disallowed", null, new Object[] {displayName}));
            add(notPermitted);
        }
	}
 
Example #27
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 #28
Source File: UsersProjectSettingsPanelFactory.java    From webanno with Apache License 2.0 4 votes vote down vote up
@Override
public Panel createSettingsPanel(String aID, final IModel<Project> aProjectModel)
{
    return new ProjectUsersPanel(aID, aProjectModel);
}
 
Example #29
Source File: DefaultWorkflowActionBarExtension.java    From webanno with Apache License 2.0 4 votes vote down vote up
@Override
public Panel createActionBarItem(String aId, AnnotationPageBase aPage)
{
    return new AnnotatorWorkflowActionBarItemGroup(aId, aPage);
}
 
Example #30
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;
}