Java Code Examples for org.apache.wicket.markup.html.WebMarkupContainer#setRenderBodyOnly()

The following examples show how to use org.apache.wicket.markup.html.WebMarkupContainer#setRenderBodyOnly() . 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: JiraIssuesPanel.java    From projectforge-webapp with GNU General Public License v3.0 6 votes vote down vote up
public JiraIssuesPanel(final String id, final IModel<String> model)
{
  super(id);
  setRenderBodyOnly(true);
  if (WicketUtils.isJIRAConfigured() == false) {
    final WebMarkupContainer dummy = new WebMarkupContainer("issues");
    setVisible(false);
    dummy.add(new ExternalLink("jiraLink", "dummy"));
    add(dummy);
    return;
  }
  final RepeatingView jiraIssuesRepeater = new RepeatingView("issues");
  add(jiraIssuesRepeater);
  final String[] jiraIssues = JiraUtils.checkForJiraIssues(model.getObject());
  if (jiraIssues == null) {
    jiraIssuesRepeater.setVisible(false);
  } else {
    for (final String issue : jiraIssues) {
      final WebMarkupContainer item = new WebMarkupContainer(jiraIssuesRepeater.newChildId());
      item.setRenderBodyOnly(true);
      jiraIssuesRepeater.add(item);
      item.add(new ExternalLink("jiraLink", JiraUtils.buildJiraIssueBrowseLinkUrl(issue), issue));
    }
  }
}
 
Example 2
Source File: StylableSelectOptions.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#onBeforeRender()
 */
protected final void onPopulate() {
	if(size() == 0 || recreateChoices){
		// populate this repeating view with SelectOption components
		removeAll();

		Object modelObject = getDefaultModelObject();

		if(modelObject != null){
			if(!(modelObject instanceof Collection)){
				throw new WicketRuntimeException("Model object " + modelObject + " not a collection");
			}

			// iterator over model objects for SelectOption components
			Iterator it = ((Collection) modelObject).iterator();

			while (it.hasNext()){
				// we need a container to represent a row in repeater
				WebMarkupContainer row = new WebMarkupContainer(newChildId());
				row.setRenderBodyOnly(true);
				add(row);

				// we add our actual SelectOption component to the row
				Object value = it.next();
				String text = renderer.getDisplayValue(value);
				IModel model = renderer.getModel(value);
				String style = renderer.getStyle(value);
				row.add(newOption(text, model, style));
			}
		}
	}
}
 
Example 3
Source File: StylableSelectOptions.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * @see org.apache.wicket.Component#onBeforeRender()
 */
protected final void onPopulate() {
	if(size() == 0 || recreateChoices){
		// populate this repeating view with SelectOption components
		removeAll();

		Object modelObject = getDefaultModelObject();

		if(modelObject != null){
			if(!(modelObject instanceof Collection)){
				throw new WicketRuntimeException("Model object " + modelObject + " not a collection");
			}

			// iterator over model objects for SelectOption components
			Iterator it = ((Collection) modelObject).iterator();

			while (it.hasNext()){
				// we need a container to represent a row in repeater
				WebMarkupContainer row = new WebMarkupContainer(newChildId());
				row.setRenderBodyOnly(true);
				add(row);

				// we add our actual SelectOption component to the row
				Object value = it.next();
				String text = renderer.getDisplayValue(value);
				IModel model = renderer.getModel(value);
				String style = renderer.getStyle(value);
				row.add(newOption(text, model, style));
			}
		}
	}
}
 
Example 4
Source File: ResourceSecurityPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
public ResourceSecurityPanel(final ResourceTO resourceTO) {
    super();
    setOutputMarkupId(true);

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

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

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

    // -------------------------------
    // Pull policy selection
    // -------------------------------
    AjaxDropDownChoicePanel<String> pullPolicy = new AjaxDropDownChoicePanel<>(
            "pullPolicy",
            new ResourceModel("pullPolicy", "pullPolicy").getObject(),
            new PropertyModel<>(resourceTO, "pullPolicy"),
            false);
    pullPolicy.setChoiceRenderer(new PolicyRenderer(pullPolicies));
    pullPolicy.setChoices(new ArrayList<>(pullPolicies.getObject().keySet()));
    ((DropDownChoice<?>) pullPolicy.getField()).setNullValid(true);
    container.add(pullPolicy);
    // -------------------------------

    // -------------------------------
    // Push policy selection
    // -------------------------------
    AjaxDropDownChoicePanel<String> pushPolicy = new AjaxDropDownChoicePanel<>(
            "pushPolicy",
            new ResourceModel("pushPolicy", "pushPolicy").getObject(),
            new PropertyModel<>(resourceTO, "pushPolicy"),
            false);
    pushPolicy.setChoiceRenderer(new PolicyRenderer(pushPolicies));
    pushPolicy.setChoices(new ArrayList<>(pushPolicies.getObject().keySet()));
    ((DropDownChoice<?>) pushPolicy.getField()).setNullValid(true);
    container.add(pushPolicy);
    // -------------------------------
}
 
Example 5
Source File: ResourceDetailsPanel.java    From syncope with Apache License 2.0 4 votes vote down vote up
public ResourceDetailsPanel(final ResourceTO resourceTO, final boolean createFlag) {
    super();
    setOutputMarkupId(true);

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

    container.add(new AjaxTextFieldPanel(
            Constants.KEY_FIELD_NAME,
            new ResourceModel(Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME).getObject(),
            new PropertyModel<>(resourceTO, Constants.KEY_FIELD_NAME),
            false).addRequiredLabel().setEnabled(createFlag));

    container.add(new AjaxCheckBoxPanel(
            "enforceMandatoryCondition",
            new ResourceModel("enforceMandatoryCondition", "enforceMandatoryCondition").getObject(),
            new PropertyModel<>(resourceTO, "enforceMandatoryCondition"),
            false));

    container.add(new AjaxSpinnerFieldPanel.Builder<Integer>().build(
            "propagationPriority",
            "propagationPriority",
            Integer.class,
            new PropertyModel<>(resourceTO, "propagationPriority")));

    container.add(new AjaxCheckBoxPanel("randomPwdIfNotProvided",
            new ResourceModel("randomPwdIfNotProvided", "randomPwdIfNotProvided").getObject(),
            new PropertyModel<>(resourceTO, "randomPwdIfNotProvided"),
            false));

    container.add(new AjaxPalettePanel.Builder<String>().
            setAllowMoveAll(true).setAllowOrder(true).
            build("propagationActions",
                    new PropertyModel<>(resourceTO, "propagationActions"),
                    new ListModel<>(propagationActions.getObject())).
            setOutputMarkupId(true));

    container.add(new AjaxDropDownChoicePanel<>(
            "createTraceLevel",
            new ResourceModel("createTraceLevel", "createTraceLevel").getObject(),
            new PropertyModel<>(resourceTO, "createTraceLevel"),
            false).
            setChoices(Arrays.stream(TraceLevel.values()).collect(Collectors.toList())).setNullValid(false));

    container.add(new AjaxDropDownChoicePanel<>(
            "provisionSorter", "provisionSorter",
            new PropertyModel<>(resourceTO, "provisionSorter"), false).
            setChoices(provisionSorters));

    container.add(new AjaxDropDownChoicePanel<>(
            "updateTraceLevel",
            new ResourceModel("updateTraceLevel", "updateTraceLevel").getObject(),
            new PropertyModel<>(resourceTO, "updateTraceLevel"),
            false).
            setChoices(Arrays.stream(TraceLevel.values()).collect(Collectors.toList())).setNullValid(false));

    container.add(new AjaxDropDownChoicePanel<>(
            "deleteTraceLevel",
            new ResourceModel("deleteTraceLevel", "deleteTraceLevel").getObject(),
            new PropertyModel<>(resourceTO, "deleteTraceLevel"),
            false).
            setChoices(Arrays.stream(TraceLevel.values()).collect(Collectors.toList())).setNullValid(false));

    container.add(new AjaxDropDownChoicePanel<>(
            "provisioningTraceLevel",
            new ResourceModel("provisioningTraceLevel", "provisioningTraceLevel").getObject(),
            new PropertyModel<>(resourceTO, "provisioningTraceLevel"),
            false).
            setChoices(Arrays.stream(TraceLevel.values()).collect(Collectors.toList())).setNullValid(false));

    container.add(new AjaxTextFieldPanel(
            "connector",
            new ResourceModel("connector", "connector").getObject(),
            new Model<>(resourceTO.getConnectorDisplayName()),
            false).addRequiredLabel().setEnabled(false));
}
 
Example 6
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));
    }
}