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

The following examples show how to use org.apache.wicket.markup.html.panel.Fragment. 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: EventRefDetailsPanel.java    From sakai with Educational Community License v2.0 7 votes vote down vote up
@Override
protected void onInitialize()
{
	super.onInitialize();
	List<EventDetail> detailsList = getDetails();
	add(new ListView<EventDetail>("detailsList", detailsList)
	{
		@Override
		protected void populateItem(ListItem<EventDetail> item)
		{
			EventDetail ref = item.getModelObject();
			item.add(new Label("key", Model.of(ref.getKey())).setRenderBodyOnly(true));
			Fragment frag = buildDetailsFragment(ref);
			item.add(frag);
		}
	});
}
 
Example #2
Source File: SourceViewPanel.java    From onedev with MIT License 7 votes vote down vote up
@Override
public WebMarkupContainer newAdditionalActions(String id) {
	WebMarkupContainer actions = new Fragment(id, "actionsFrag", this);
	if (hasOutline()) {
		actions.add(new CheckBox("outline", Model.of(isOutlineVisibleInitially())).add(new OnChangeAjaxBehavior() {

			@Override
			protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
				super.updateAjaxAttributes(attributes);
				attributes.setMethod(Method.POST);
			}

			@Override
			protected void onUpdate(AjaxRequestTarget target) {
				toggleOutline(target);
			}
			
		}));
	} else {
		actions.add(new WebMarkupContainer("outline").setVisible(false));
	}
	return actions;
}
 
Example #3
Source File: CodeCommentPanel.java    From onedev with MIT License 6 votes vote down vote up
private WebMarkupContainer newAddReplyContainer() {
	WebMarkupContainer addReplyContainer = new Fragment("addReply", "addReplyFrag", this) {

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(SecurityUtils.getUser() != null);
		}
		
	};
	addReplyContainer.setOutputMarkupId(true);
	addReplyContainer.add(new AjaxLink<Void>("reply") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			onAddReply(target);
		}
		
	});
	return addReplyContainer;
}
 
Example #4
Source File: ArtifactPomSearchResultsPanel.java    From artifact-listener with Apache License 2.0 6 votes vote down vote up
private void addDataView(String id, final String className, IDataProvider<ArtifactBean> dataProvider) {
	// Data view
	final DataView<ArtifactBean> artifactDataView = new ArtifactBeanDataView("dataView", dataProvider);
	dataViews.add(artifactDataView);
	
	// Fragment
	Fragment fragment = new Fragment(id, "dataViewFragment", this) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onConfigure() {
			super.onConfigure();
			setVisible(artifactDataView.getDataProvider().size() != 0);
		}
	};
	fragment.add(new Label("title", new ResourceModel("artifact.follow.pom." + id)),
				artifactDataView);
	add(fragment);
}
 
Example #5
Source File: EventRefDetailsPanel.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
@Override
protected void onInitialize()
{
	super.onInitialize();
	List<EventDetail> detailsList = getDetails();
	add(new ListView<EventDetail>("detailsList", detailsList)
	{
		@Override
		protected void populateItem(ListItem<EventDetail> item)
		{
			EventDetail ref = item.getModelObject();
			item.add(new Label("key", Model.of(ref.getKey())).setRenderBodyOnly(true));
			Fragment frag = buildDetailsFragment(ref);
			item.add(frag);
		}
	});
}
 
Example #6
Source File: StudentVisitsWidget.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private Fragment getLazyLoadedMiniStats(String markupId) {
    Fragment ministatFragment = new Fragment(markupId, "ministatFragment", this);
    int miniStatsCount = widgetMiniStats != null ? widgetMiniStats.size() : 0;
    Loop miniStatsLoop = new Loop("widgetRow", miniStatsCount) {
        private static final long serialVersionUID = 1L;
        @Override
        protected void populateItem(LoopItem item) {
            int index = item.getIndex();
            WidgetMiniStat ms = widgetMiniStats.get(index);

            Label widgetValue = new Label("widgetValue", Model.of(ms.getValue()));
            Label widgetLabel = new Label("widgetLabel", Model.of(ms.getLabel()));
            WebMarkupContainer widgetIcon = new WebMarkupContainer("widgetIcon");
            widgetIcon.add(new AttributeAppender("class", " " + ms.getSecondValue()));

            item.add(widgetValue);
            item.add(widgetLabel);
            item.add(widgetIcon);
        }
    };
    ministatFragment.add(miniStatsLoop);
    return ministatFragment;
}
 
Example #7
Source File: MergeLinkedAccountsSearchPanel.java    From syncope with Apache License 2.0 6 votes vote down vote up
public MergeLinkedAccountsSearchPanel(final MergeLinkedAccountsWizardModel model, final PageReference pageRef) {
    super();
    setOutputMarkupId(true);

    this.wizardModel = model;
    setTitleModel(new StringResourceModel("mergeLinkedAccounts.searchUser", Model.of(model.getBaseUser())));
    ownerContainer = new WebMarkupContainer("ownerContainer");
    ownerContainer.setOutputMarkupId(true);
    add(ownerContainer);

    userSearchFragment = new Fragment("search", "userSearchFragment", this);
    userSearchPanel = UserSearchPanel.class.cast(new UserSearchPanel.Builder(
        new ListModel<>(new ArrayList<>())).required(false).enableSearch(MergeLinkedAccountsSearchPanel.this).
        build("usersearch"));
    userSearchFragment.add(userSearchPanel);

    AnyTypeTO anyTypeTO = anyTypeRestClient.read(AnyTypeKind.USER.name());
    userDirectoryPanel = UserSelectionDirectoryPanel.class.cast(new UserSelectionDirectoryPanel.Builder(
        anyTypeClassRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
        build("searchResult"));

    userSearchFragment.add(userDirectoryPanel);
    ownerContainer.add(userSearchFragment);
}
 
Example #8
Source File: StudentVisitsWidget.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
private Fragment getLazyLoadedMiniStats(String markupId) {
    Fragment ministatFragment = new Fragment(markupId, "ministatFragment", this);
    int miniStatsCount = widgetMiniStats != null ? widgetMiniStats.size() : 0;
    Loop miniStatsLoop = new Loop("widgetRow", miniStatsCount) {
        private static final long serialVersionUID = 1L;
        @Override
        protected void populateItem(LoopItem item) {
            int index = item.getIndex();
            WidgetMiniStat ms = widgetMiniStats.get(index);

            Label widgetValue = new Label("widgetValue", Model.of(ms.getValue()));
            Label widgetLabel = new Label("widgetLabel", Model.of(ms.getLabel()));
            WebMarkupContainer widgetIcon = new WebMarkupContainer("widgetIcon");
            widgetIcon.add(new AttributeAppender("class", " " + ms.getSecondValue()));

            item.add(widgetValue);
            item.add(widgetLabel);
            item.add(widgetIcon);
        }
    };
    ministatFragment.add(miniStatsLoop);
    return ministatFragment;
}
 
Example #9
Source File: PaymentPage.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Get the negative result fragment.
 * @return negative result fragment
 */
private MarkupContainer createNegativePaymentResultFragment() {

    error(getLocalizer().getString(NEGATIVE_PAYMENT_NOTES, this));

    final List<CustomerOrderPayment> payments = checkoutServiceFacade.findPaymentRecordsByOrderNumber(getOrderNumber());


    return new Fragment(RESULT_CONTAINER, NEGATIVE_RESULT_FRAGMENT, this)
            .add(
                    new ListView<CustomerOrderPayment>(PAYMENT_DETAIL_LIST, payments) {
                        @Override
                        protected void populateItem(final ListItem<CustomerOrderPayment> item) {
                            final CustomerOrderPayment payment = item.getModelObject();
                            item.add(new Label(PAYMENT_ID_LABEL, String.valueOf(payment.getCustomerOrderPaymentId())));
                            item.add(new Label(PAYMENT_TRANS_ID, StringUtils.defaultIfEmpty(payment.getTransactionReferenceId(), StringUtils.EMPTY)));
                            item.add(new Label(PAYMENT_AUTH_CODE, StringUtils.defaultIfEmpty(payment.getTransactionAuthorizationCode(), StringUtils.EMPTY)));
                            item.add(new Label(PAYMENT_ERROR_CODE, StringUtils.defaultIfEmpty(payment.getTransactionOperationResultCode(), StringUtils.EMPTY)));
                            item.add(new Label(PAYMENT_ERROR_DESCR, StringUtils.defaultIfEmpty(payment.getTransactionOperationResultMessage(), StringUtils.EMPTY)));
                        }
                    }

            );
}
 
Example #10
Source File: PaymentPage.java    From yes-cart with Apache License 2.0 6 votes vote down vote up
/**
 * Get the negative result fragment, which responsible
 * to show item allocation error.
 *
 * @param sku the {@link ProductSku} which quantity can not be allocated.
 *
 * @return negative result fragment
 */
private MarkupContainer createNegativeItemAllocationResultFragment(final String sku) {

    final ProductSku productSku = productServiceFacade.getProductSkuBySkuCode(sku);

    final Map<String, Object> param = new HashMap<>();
    param.put("product", getI18NSupport().getFailoverModel(productSku.getDisplayName(), productSku.getName()).getValue(getLocale().getLanguage()));
    param.put("sku", sku);
    final String errorMessage =
            WicketUtil.createStringResourceModel(this, ALLOCATION_DETAIL, param).getString();

    error(errorMessage);

    return new Fragment(RESULT_CONTAINER, NEGATIVE_ALLOCATION_RESULT_FRAGMENT, this)
            .add(
                    new Label(
                            ALLOCATION_DETAIL,
                            errorMessage )
            ) ;

}
 
Example #11
Source File: GeneralErrorPage.java    From onedev with MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	WebMarkupContainer container = new WebMarkupContainer("error");
	container.setOutputMarkupId(true);
	add(container);
	
	container.add(new Label("title", StringUtils.abbreviate(title, MAX_TITLE_LEN)));
	
	container.add(new ViewStateAwarePageLink<Void>("home", ProjectListPage.class));
	
	container.add(new AjaxLink<Void>("showDetail") {

		@Override
		public void onClick(AjaxRequestTarget target) {
			Fragment fragment = new Fragment("detail", "detailFrag", GeneralErrorPage.this);
			fragment.add(new MultilineLabel("body", detailMessage));				
			container.replace(fragment);
			target.add(container);
			setVisible(false);
		}

	});
	container.add(new WebMarkupContainer("detail"));
}
 
Example #12
Source File: UserPage.java    From onedev with MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(new SideBar("userSidebar", null) {

		@Override
		protected Component newHead(String componentId) {
			Fragment fragment = new Fragment(componentId, "sidebarHeadFrag", UserPage.this);
			User user = userModel.getObject();
			fragment.add(new UserAvatar("avatar", user)
					.add(AttributeAppender.append("title", user.getDisplayName())));
			fragment.add(new Label("name", user.getDisplayName()));
			return fragment;
		}
		
		@Override
		protected List<? extends Tab> newTabs() {
			return UserPage.this.newTabs();
		}
		
	});
}
 
Example #13
Source File: NewPullRequestPage.java    From onedev with MIT License 6 votes vote down vote up
private Fragment newAcceptedFrag() {
	Fragment fragment = new Fragment("status", "mergedFrag", this);
	fragment.add(new BranchLink("sourceBranch", getPullRequest().getSource()));
	fragment.add(new BranchLink("targetBranch", getPullRequest().getTarget()));
	fragment.add(new Link<Void>("swapBranches") {

		@Override
		public void onClick() {
			setResponsePage(
					NewPullRequestPage.class, 
					paramsOf(getProject(), getPullRequest().getSource(), getPullRequest().getTarget()));
		}
		
	});
	return fragment;
}
 
Example #14
Source File: CheckoutPage.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * Create shipment method selection fragment.
 *
 * @return shipment method fragment
 */

private MarkupContainer createShipmentFragment() {
    return new Fragment(CONTENT_VIEW, SHIPMENT_FRAGMENT, this)
            .add(
                    new ShippingDeliveriesView(SHIPMENT_VIEW, false)
            );
}
 
Example #15
Source File: NewPullRequestPage.java    From onedev with MIT License 5 votes vote down vote up
private Fragment newEffectiveFrag() {
	Fragment fragment = new Fragment("status", "effectiveFrag", this);

	fragment.add(new Label("description", new AbstractReadOnlyModel<String>() {

		@Override
		public String getObject() {
			if (requestModel.getObject().isOpen())
				return "This change is already opened for merge by pull request";
			else 
				return "This change is squashed/rebased onto base branch via pull request";
		}
		
	}).setEscapeModelStrings(false));
	
	fragment.add(new Link<Void>("link") {

		@Override
		protected void onInitialize() {
			super.onInitialize();
			add(new Label("label", new AbstractReadOnlyModel<String>() {

				@Override
				public String getObject() {
					return "#" + getPullRequest().getNumber();
				}
				
			}));
		}

		@Override
		public void onClick() {
			PageParameters params = PullRequestDetailPage.paramsOf(getPullRequest());
			setResponsePage(PullRequestActivitiesPage.class, params);
		}
		
	});
	
	return fragment;
}
 
Example #16
Source File: TopologyTogglePanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
private Fragment getLocationFragment(final TopologyNode node, final PageReference pageRef) {
    Fragment fragment = new Fragment("actions", "locationActions", this);

    AjaxLink<String> create = new IndicatingAjaxLink<String>("create") {

        private static final long serialVersionUID = 3776750333491622263L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            final ConnInstanceTO modelObject = new ConnInstanceTO();
            modelObject.setLocation(node.getKey());

            final IModel<ConnInstanceTO> model = new CompoundPropertyModel<>(modelObject);
            modal.setFormModel(model);

            target.add(modal.setContent(new ConnectorWizardBuilder(modelObject, pageRef).
                    build(BaseModal.CONTENT_ID, AjaxWizard.Mode.CREATE)));

            modal.header(new Model<>(MessageFormat.format(getString("connector.new"), node.getKey())));
            modal.show(true);
        }

        @Override
        public String getAjaxIndicatorMarkupId() {
            return Constants.VEIL_INDICATOR_MARKUP_ID;
        }

    };
    fragment.add(create);
    MetaDataRoleAuthorizationStrategy.authorize(create, RENDER, IdMEntitlement.CONNECTOR_CREATE);

    return fragment;
}
 
Example #17
Source File: TwitterPrefsPane.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Helper to switch content fragments for us
 * 
 * @param replacement	replacement Fragment
 * @param target		AjaxRequestTarget
 */
private void switchContentFragments(Fragment replacement, AjaxRequestTarget target) {
	
	replacement.setOutputMarkupId(true);
	currentFragment.replaceWith(replacement);
	if(target != null) {
		target.add(replacement);
		//resize iframe
		target.appendJavaScript("setMainFrameHeight(window.name);");
	}
	
	//must keep reference up to date
	currentFragment=replacement;
}
 
Example #18
Source File: AbstractFieldPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public AbstractFieldPanel(final String id, final String name, final IModel<T> model) {
    super(id, model);
    this.name = name;

    add(new Fragment("required", "emptyFragment", AbstractFieldPanel.this));
    add(new Fragment("externalAction", "emptyFragment", AbstractFieldPanel.this));

    addLabel();
    setOutputMarkupId(true);
}
 
Example #19
Source File: AppointmentTemplate.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
Fragment getSubjectFragment() {
	Fragment f = new Fragment(COMP_ID, "subject", this);
	f.add(new OmTextLabel("prefix", getPrefix())
			, new OmTextLabel("title", a.getTitle())
			, new OmTextLabel("start", format(a.getStart(), SHORT))
			, new DashOmTextLabel("dash")
			, new OmTextLabel("end", format(a.getEnd(), SHORT))
			);
	return f;
}
 
Example #20
Source File: RecordingExpiringTemplate.java    From openmeetings with Apache License 2.0 5 votes vote down vote up
@Override
Fragment getSubjectFragment() {
	Fragment f = new Fragment(COMP_ID, "subject", this);
	Room room = roomDao.get(rec.getRoomId());
	f.add(new OmTextLabel("prefix", getString("template.recording.expiring.subj.prefix", locale))
			, new OmTextLabel("room", room == null ? null : getString("template.recording.expiring.subj.room", locale, room.getName())).setVisible(room != null)
			);
	return f;
}
 
Example #21
Source File: AbstractFieldPanel.java    From syncope with Apache License 2.0 5 votes vote down vote up
public AbstractFieldPanel<T> addRequiredLabel() {
    if (!isRequired()) {
        setRequired(true);
    }

    final Fragment fragment = new Fragment("required", "requiredFragment", this);
    fragment.add(new Label("requiredLabel", "*"));
    replace(fragment);

    this.isRequiredLabelAdded = true;

    return this;
}
 
Example #22
Source File: CheckoutPage.java    From yes-cart with Apache License 2.0 5 votes vote down vote up
/**
 * The default fragment is login/register page.
 *
 * @return login fragment
 */
private MarkupContainer createLoginFragment() {
    return new Fragment(CONTENT_VIEW, LOGIN_FRAGMENT, this)
            .add(new LoginPanel(PART_LOGIN_VIEW, true))
            .add(new RegisterPanel(PART_REGISTER_VIEW, true))
            .add(new GuestPanel(PART_GUEST_VIEW));
}
 
Example #23
Source File: PullRequestActivitiesPage.java    From onedev with MIT License 5 votes vote down vote up
private Component newSinceChangesRow(String id, Date sinceDate) {
	WebMarkupContainer row = new WebMarkupContainer(id);
	row.setOutputMarkupId(true);
	
	row.add(new WebMarkupContainer("avatar"));
	WebMarkupContainer contentColumn = new Fragment("content", "sinceChangesRowContentFrag", this);
	contentColumn.add(AttributeAppender.append("colspan", "2"));
	contentColumn.add(new SinceChangesLink("sinceChanges", requestModel, sinceDate));
	row.add(contentColumn);
	
	row.add(AttributeAppender.append("class", "since-changes"));
	
	return row;
}
 
Example #24
Source File: TwitterPrefsPane.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * Helper to switch content fragments for us
 * 
 * @param replacement	replacement Fragment
 * @param target		AjaxRequestTarget
 */
private void switchContentFragments(Fragment replacement, AjaxRequestTarget target) {
	
	replacement.setOutputMarkupId(true);
	currentFragment.replaceWith(replacement);
	if(target != null) {
		target.add(replacement);
		//resize iframe
		target.appendJavaScript("setMainFrameHeight(window.name);");
	}
	
	//must keep reference up to date
	currentFragment=replacement;
}
 
Example #25
Source File: BlobDiffPanel.java    From onedev with MIT License 5 votes vote down vote up
private Fragment newFragment(String message, boolean warning) {
	Fragment fragment = new Fragment(CONTENT_ID, "noDiffFrag", this);
	fragment.add(new BlobDiffTitle("title", change));
	if (warning)
		fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-warning")));
	else
		fragment.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", "fa fa-info-circle")));
	fragment.add(new Label("message", message));
	return fragment;
}
 
Example #26
Source File: WizardMgtPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
protected WizardMgtPanel(final String id, final boolean wizardInModal) {
    super(id);
    setOutputMarkupId(true);

    this.actualId = wizardInModal ? BaseModal.CONTENT_ID : WIZARD_ID;
    this.wizardInModal = wizardInModal;

    outerObjects.add(modal);

    container = new WebMarkupContainer("container");
    container.setOutputMarkupPlaceholderTag(true).setOutputMarkupId(true);
    add(container);

    initialFragment = new Fragment("content", "default", this);
    container.addOrReplace(initialFragment);

    addAjaxLink = new AjaxLink<T>("add") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            send(WizardMgtPanel.this, Broadcast.BREADTH,
                    new ActionLinksTogglePanel.ActionLinkToggleCloseEventPayload(target));
            send(WizardMgtPanel.this, Broadcast.EXACT,
                    new AjaxWizard.NewItemActionEvent<>(null, target));
        }
    };

    addAjaxLink.setEnabled(false);
    addAjaxLink.setVisible(false);
    initialFragment.addOrReplace(addAjaxLink);

    utilityAjaxLink = new AjaxLink<T>("utility") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            send(WizardMgtPanel.this, Broadcast.EXACT, new ExitEvent(target));
        }
    };

    utilityAjaxLink.setEnabled(false);
    utilityAjaxLink.setVisible(false);
    initialFragment.addOrReplace(utilityAjaxLink);

    utilityIcon = new Label("utilityIcon");
    utilityAjaxLink.add(utilityIcon);

    add(new ListView<Component>("outerObjectsRepeater", outerObjects) {

        private static final long serialVersionUID = -9180479401817023838L;

        @Override
        protected void populateItem(final ListItem<Component> item) {
            item.add(item.getModelObject());
        }

    });
}
 
Example #27
Source File: ActionLinksTogglePanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
private Fragment getEmptyFragment() {
    return new Fragment("actions", "emptyFragment", this);
}
 
Example #28
Source File: BuildSpecBlobViewPanel.java    From onedev with MIT License 4 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	try {
		Blob blob = context.getProject().getBlob(context.getBlobIdent(), true);
		BuildSpec buildSpec = BuildSpec.parse(blob.getBytes());
		
		if (buildSpec != null) {
			Fragment validFrag = new Fragment("content", "validFrag", this);			
			if (!buildSpec.getJobs().isEmpty()) {
				Fragment hasJobsFrag = new Fragment("jobs", "hasJobsFrag", this);
				
				RepeatingView navsView = new RepeatingView("navs");
				RepeatingView jobsView = new RepeatingView("contents");
				for (Job job: buildSpec.getJobs()) {
					WebMarkupContainer nav = new WebMarkupContainer(navsView.newChildId());
					nav.add(new Label("jobName", job.getName()));
					nav.add(AttributeAppender.append("data-name", job.getName()));
					nav.add(new RunJobLink("run", context.getCommit().copy(), job.getName()) {

						@Override
						protected Project getProject() {
							return context.getProject();
						}

					});
					navsView.add(nav);
					jobsView.add(BeanContext.view(jobsView.newChildId(), job));
				}
				hasJobsFrag.add(navsView);
				hasJobsFrag.add(jobsView);
				
				validFrag.add(hasJobsFrag);
			} else {
				validFrag.add(new Label("jobs", "No jobs defined").add(AttributeAppender.append("class", "not-defined")));
			}
			
			if (!buildSpec.getProperties().isEmpty())
				validFrag.add(PropertyContext.view("properties", buildSpec, "properties"));
			else
				validFrag.add(new Label("properties", "No properties defined").add(AttributeAppender.append("class", "not-defined")));
				
			add(validFrag);
		} else {
			add(new Label("content", "Build spec not defined").add(AttributeAppender.append("class", "not-defined")));
		}
	} catch (Exception e) {
		Fragment invalidFrag = new Fragment("content", "invalidFrag", this);
		invalidFrag.add(new MultilineLabel("errorMessage", Throwables.getStackTraceAsString(e)));
		add(invalidFrag);
	}
	
	add(selectBehavior = new AbstractPostAjaxBehavior() {
		
		@Override
		protected void respond(AjaxRequestTarget target) {
			IRequestParameters params = RequestCycle.get().getRequest().getPostParameters();
			String selection = params.getParameterValue("selection").toString();
			String position = BuildSpecRendererProvider.getPosition(selection);
			context.pushState(target, context.getBlobIdent(), position);
		}
		
	});
}
 
Example #29
Source File: RealmDetails.java    From syncope with Apache License 2.0 4 votes vote down vote up
public RealmDetails(
        final String id,
        final RealmTO realmTO,
        final ActionsPanel<?> actionsPanel,
        final boolean unwrapped) {

    super(id);

    container = new WebMarkupContainer("container");
    container.setOutputMarkupId(true);
    container.setRenderBodyOnly(unwrapped);
    add(container);

    final WebMarkupContainer generics = new WebMarkupContainer("generics");
    container.add(generics.setVisible(unwrapped));

    FieldPanel<String> name = new AjaxTextFieldPanel(
            "name", "name", new PropertyModel<>(realmTO, "name"), false);
    name.addRequiredLabel();
    generics.add(name);

    FieldPanel<String> fullPath = new AjaxTextFieldPanel(
            "fullPath", "fullPath", new PropertyModel<>(realmTO, "fullPath"), false);
    fullPath.setEnabled(false);
    generics.add(fullPath);

    AjaxDropDownChoicePanel<String> accountPolicy = new AjaxDropDownChoicePanel<>(
            "accountPolicy",
            new ResourceModel("accountPolicy", "accountPolicy").getObject(),
            new PropertyModel<>(realmTO, "accountPolicy"),
            false);
    accountPolicy.setChoiceRenderer(new PolicyRenderer(accountPolicies));
    accountPolicy.setChoices(new ArrayList<>(accountPolicies.getObject().keySet()));
    ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
    container.add(accountPolicy);

    AjaxDropDownChoicePanel<String> passwordPolicy = new AjaxDropDownChoicePanel<>(
            "passwordPolicy",
            new ResourceModel("passwordPolicy", "passwordPolicy").getObject(),
            new PropertyModel<>(realmTO, "passwordPolicy"),
            false);
    passwordPolicy.setChoiceRenderer(new PolicyRenderer(passwordPolicies));
    passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
    ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
    container.add(passwordPolicy);

    AjaxPalettePanel<String> actions = new AjaxPalettePanel.Builder<String>().
            setAllowMoveAll(true).setAllowOrder(true).
            build("actions",
                    new PropertyModel<>(realmTO, "actions"),
                    new ListModel<>(logicActions.getObject()));
    actions.setOutputMarkupId(true);
    container.add(actions);

    container.add(new AjaxPalettePanel.Builder<String>().build("resources",
            new PropertyModel<>(realmTO, "resources"),
            new ListModel<>(resources.getObject())).
            setOutputMarkupId(true).
            setEnabled(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())).
            setVisible(!SyncopeConstants.ROOT_REALM.equals(realmTO.getName())));

    if (actionsPanel == null) {
        add(new Fragment("actions", "emptyFragment", this).setRenderBodyOnly(true));
    } else {
        Fragment fragment = new Fragment("actions", "actionsFragment", this);
        fragment.add(actionsPanel);
        add(fragment.setRenderBodyOnly(true));
    }
}
 
Example #30
Source File: BinaryFieldPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
private void changePreviewer(final Component panelPreview) {
    final Fragment fragment = new Fragment("panelPreview", "previewFragment", container);
    fragment.add(panelPreview);
    container.addOrReplace(fragment);
    uploadForm.addOrReplace(container);
}