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

The following examples show how to use org.apache.wicket.markup.html.panel.Panel. These examples are extracted from open source projects. 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 Project: nextreports-server   Source File: StackPanel.java    License: 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 2
Source Project: inception   Source File: InstancePanel.java    License: 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 3
Source Project: syncope   Source File: ConnObjectPanel.java    License: 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 4
Source Project: syncope   Source File: AnyDirectoryPanel.java    License: 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 5
Source Project: nextreports-server   Source File: UpdateActionLink.java    License: 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 6
Source Project: nextreports-server   Source File: HomePage.java    License: 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 7
Source Project: syncope   Source File: AnyPanel.java    License: 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 8
/**
 * 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 9
Source Project: onedev   Source File: BlobDiffPanel.java    License: 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 10
Source Project: onedev   Source File: ImageDiffRenderer.java    License: 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 11
Source Project: onedev   Source File: IssueChangeActivity.java    License: 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 12
Source Project: onedev   Source File: IssueOpenedActivity.java    License: 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 13
Source Project: syncope   Source File: SchemaTypeWizardBuilder.java    License: 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 14
Source Project: Orienteer   Source File: MarkupProvider.java    License: 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 15
Source Project: syncope   Source File: BaseModal.java    License: 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 16
Source Project: webanno   Source File: StringFeatureSupport.java    License: 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 17
Source Project: webanno   Source File: SpanLayerSupport.java    License: 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 18
Source Project: sakai   Source File: ViewFriends.java    License: 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 19
@Override
public Panel createResultsPanel(String aId,
        IModel<PairwiseAnnotationResult<UnitizingAgreementResult>> aResults,
        SerializableSupplier<Map<String, List<CAS>>> aCasMapSupplier)
{
    return new PairwiseUnitizingAgreementTable(aId, aResults);
}
 
Example 20
Source Project: nextreports-server   Source File: StackPanel.java    License: 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 21
Source Project: sakai   Source File: MyMessages.java    License: 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 22
@Override
public Panel createResultsPanel(String aId,
        IModel<PairwiseAnnotationResult<UnitizingAgreementResult>> aResults,
        SerializableSupplier<Map<String, List<CAS>>> aCasMapSupplier)
{
    return new PairwiseUnitizingAgreementTable(aId, aResults);
}
 
Example 23
Source Project: sakai   Source File: ViewFriends.java    License: 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 24
public void removeItem(AjaxRequestTarget target){
	Panel panel = new EmptyPanel("container");
	addOrReplace(panel);
	panel.setOutputMarkupId(true);
	panel.setVisible(false);
	target.add(panel);
}
 
Example 25
Source Project: Orienteer   Source File: DefaultRegistrationPanel.java    License: 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 26
Source Project: syncope   Source File: Login.java    License: 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 27
Source Project: syncope   Source File: PushTaskFilters.java    License: 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 28
@Override
public Panel createSettingsPanel(String aID, final IModel<Project> aProjectModel)
{
    return new ProjectKnowledgeBasePanel(aID, aProjectModel);
}
 
Example 29
Source Project: inception   Source File: ConceptFeatureSupport.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Panel createTraitsEditor(String aId, IModel<AnnotationFeature> aFeatureModel)
{
    return new ConceptFeatureTraitsEditor(aId, this, aFeatureModel);
}
 
Example 30
@Override
public Panel createSettingsPanel(String aID, final IModel<Project> aProjectModel)
{
    return new ProjectRecommendersPanel(aID, aProjectModel);
}