Java Code Examples for org.apache.wicket.markup.html.WebMarkupContainer

The following examples show how to use org.apache.wicket.markup.html.WebMarkupContainer. 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
@Override
public void onInitialize()
{
	super.onInitialize();
	WebMarkupContainer span = new WebMarkupContainer("span");
	add(span);
	span.add(AttributeModifier.replace("colspan", new AbstractReadOnlyModel<String>()
	{
		@Override
		public String getObject()
		{
			return String.valueOf(table.getColumns().size());
		}
	}));
	final Form<?> form = new Form<>("navForm");
	form.add(newPagingNavigator("navigator", table, form).setRenderBodyOnly(true));
	form.add(newNavigatorLabel("navigatorLabel", table).setRenderBodyOnly(true));
	span.add(form);
}
 
Example 2
Source Project: openmeetings   Source File: StartWidgetView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onInitialize() {
	add(new WebMarkupContainer("step1").add(new PublicRoomsEventBehavior()));
	add(new WebMarkupContainer("step2").add(new PublicRoomsEventBehavior()));
	add(new WebMarkupContainer("step3").add(new WebMarkupContainer("avTest").add(AttributeModifier.append("href"
			, RequestCycle.get().urlFor(HashPage.class, new PageParameters().add(APP, APP_TYPE_SETTINGS)).toString()))));

	add(new WebMarkupContainer("step4").add(new PublicRoomsEventBehavior()));
	add(new Label("123msg", Application.getString("widget.start.desc")) //Application here is used to substitute {0}
			.setEscapeModelStrings(false));
	add(new BootstrapButton("start", new ResourceModel("788"), Buttons.Type.Outline_Primary).add(new PublicRoomsEventBehavior()));
	add(new BootstrapButton("calendar", new ResourceModel("291"), Buttons.Type.Outline_Primary).add(new AjaxEventBehavior(EVT_CLICK) {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onEvent(AjaxRequestTarget target) {
			((MainPage)getPage()).updateContents(CALENDAR, target);
		}
	}));
	super.onInitialize();
}
 
Example 3
Source Project: onedev   Source File: GeneralErrorPage.java    License: 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 4
Source Project: openmeetings   Source File: MessagesContactsPanel.java    License: Apache License 2.0 6 votes vote down vote up
private void selectFolder(WebMarkupContainer folder, Long id, AjaxRequestTarget target) {
	selectedFolder = folder;
	selectedFolderModel.setObject(id);
	setDefaultFolderClass();
	selectFolder(folder);
	emptySelection(target);
	selectDropDown.setModelObject(SELECT_CHOOSE);
	moveDropDown.setModelObject(NOT_MOVE_FOLDER);
	deleteBtn.add(AttributeModifier.replace("value", Application.getString(TRASH_FOLDER_ID.equals(id) ? "1256" : "80")));
	readBtn.setEnabled(false);
	unreadBtn.setEnabled(false);
	if (target != null) {
		updateTable(target);
		target.add(folders, unread, selectDropDown, moveDropDown);
		target.add(dataContainer.getContainer(), dataContainer.getNavigator());
		target.add(dataContainer.getLinks());
	}
}
 
Example 5
/**
 * @see org.apache.wicket.Component#onInitialize()
 */
@Override
protected void onInitialize()
{
  super.onInitialize();
  newEntryValue = new ContactEntryDO().setStreet(DEFAULT_ENTRY_VALUE).setCity(DEFAULT_CITY_VALUE) //
      .setZipCode(DEFAULT_ZIPCODE_VALUE).setCountry(DEFAULT_COUNTRY_VALUE).setState(DEFAULT_STATE_VALUE).setContactType(ContactType.PRIVATE) //
      .setContact(model.getObject());
  formChoiceRenderer = new LabelValueChoiceRenderer<ContactType>(this, ContactType.values());
  mainContainer = new WebMarkupContainer("main");
  add(mainContainer.setOutputMarkupId(true));
  entrysRepeater = new RepeatingView("liRepeater");
  mainContainer.add(entrysRepeater);

  rebuildEntrys();
  addNewEntryContainer = new WebMarkupContainer("liAddNewEntry");
  mainContainer.add(addNewEntryContainer);

  init(addNewEntryContainer);
  entrysRepeater.setVisible(true);
}
 
Example 6
Source Project: AppStash   Source File: ProductItemPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Component productDetailImageLink() {
    Link<Void> detailPageLink = new Link<Void>("productDetailLink") {
        @Override
        public void onClick() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.set("urlname", productUrlModel.getObject());
            setResponsePage(new ProductDetailPage(pageParameters));
        }
    };
    WebMarkupContainer image = new WebMarkupContainer("image");
    image.add(new AttributeModifier("src", new ImageLinkModel(productInfoModel, this)));
    image.add(new AttributeModifier("title", new PropertyModel<String>(productInfoModel, "description")));
    image.add(new AttributeModifier("alt", new PropertyModel<String>(productInfoModel, "name")));
    image.setOutputMarkupId(true);

    detailPageLink.add(image);
    return detailPageLink;
}
 
Example 7
Source Project: the-app   Source File: ProductItemPanel.java    License: Apache License 2.0 6 votes vote down vote up
private Component productDetailImageLink() {
    Link<Void> detailPageLink = new Link<Void>("productDetailLink") {
        @Override
        public void onClick() {
            PageParameters pageParameters = new PageParameters();
            pageParameters.set("urlname", productUrlModel.getObject());
            setResponsePage(new ProductDetailPage(pageParameters));
        }
    };
    WebMarkupContainer image = new WebMarkupContainer("image");
    image.add(new AttributeModifier("src", new ImageLinkModel(productInfoModel, this)));
    image.add(new AttributeModifier("title", new PropertyModel<String>(productInfoModel, "description")));
    image.add(new AttributeModifier("alt", new PropertyModel<String>(productInfoModel, "name")));
    image.setOutputMarkupId(true);

    detailPageLink.add(image);
    return detailPageLink;
}
 
Example 8
Source Project: sakai   Source File: BasePage.java    License: Educational Community License v2.0 6 votes vote down vote up
/**
 * Helper to build a notification flag with a Bootstrap popover
 */
public WebMarkupContainer buildFlagWithPopover(final String componentId, final String message) {
	final WebMarkupContainer flagWithPopover = new WebMarkupContainer(componentId);

	flagWithPopover.add(new AttributeModifier("title", message));
	flagWithPopover.add(new AttributeModifier("aria-label", message));
	flagWithPopover.add(new AttributeModifier("data-toggle", "popover"));
	flagWithPopover.add(new AttributeModifier("data-trigger", "manual"));
	flagWithPopover.add(new AttributeModifier("data-placement", "bottom"));
	flagWithPopover.add(new AttributeModifier("data-html", "true"));
	flagWithPopover.add(new AttributeModifier("data-container", "#gradebookGrades"));
	flagWithPopover.add(new AttributeModifier("data-template",
			"<div class=\"gb-popover popover\" role=\"tooltip\"><div class=\"arrow\"></div><div class=\"popover-content\"></div></div>"));
	flagWithPopover.add(new AttributeModifier("data-content", generatePopoverContent(message)));
	flagWithPopover.add(new AttributeModifier("tabindex", "0"));

	return flagWithPopover;
}
 
Example 9
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 10
Source Project: syncope   Source File: LogsITCase.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void updateConsoleLogs() {
    TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:1:link");
    TESTER.assertComponent(CONTAINER_PATH, WebMarkupContainer.class);

    Component result = searchLog(KEY, CONTAINER_PATH, "org.apache.wicket");
    assertNotNull(result);

    TESTER.getRequest().setMethod(Form.METHOD_GET);
    TESTER.getRequest().addParameter(
            result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", "6");
    TESTER.assertComponent(
            result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", DropDownChoice.class);
    TESTER.executeAjaxEvent(
            result.getPageRelativePath() + ":fields:1:field:dropDownChoiceField", Constants.ON_CHANGE);

    assertSuccessMessage();
}
 
Example 11
private void addNameRecord() {
    WebMarkupContainer nameRecordingContainer = new WebMarkupContainer("nameRecordingContainer");

    nameRecordingContainer.add(new Label("nameRecordingLabel", new ResourceModel("profile.name.recording")));
    WebMarkupContainer audioPlayer = new WebMarkupContainer("audioPlayer");

    final String slash = Entity.SEPARATOR;
    final StringBuilder path = new StringBuilder();
    path.append(slash);
    path.append("direct");
    path.append(slash);
    path.append("profile");
    path.append(slash);
    path.append(userProfile.getUserUuid());
    path.append(slash);
    path.append("pronunciation");
    path.append("?v=");
    path.append(RandomStringUtils.random(8, true, true));

    audioPlayer.add(new AttributeModifier("src", path.toString()));
    nameRecordingContainer.add(audioPlayer);
    add(nameRecordingContainer);

    if (profileLogic.getUserNamePronunciation(userProfile.getUserUuid()) == null) nameRecordingContainer.setVisible(false);
    else visibleFieldCount++;
}
 
Example 12
Source Project: onedev   Source File: SideBar.java    License: MIT License 6 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	add(newHead("head"));
	add(new Tabbable("tabs", newTabs()));
	add(new WebMarkupContainer("miniToggle").setVisible(miniCookieKey!=null));

	add(AttributeAppender.append("class", "sidebar"));
	
	if (miniCookieKey != null) {
		add(AttributeAppender.append("class", "minimizable"));
		WebRequest request = (WebRequest) RequestCycle.get().getRequest();
		Cookie miniCookie = request.getCookie(miniCookieKey);
		if (miniCookie != null) {
			if ("yes".equals(miniCookie.getValue()))
				add(AttributeAppender.append("class", "minimized"));
		} else if (WicketUtils.isDevice()) {
			add(AttributeAppender.append("class", "minimized"));
		}
	} 
}
 
Example 13
Source Project: onedev   Source File: ModalPanel.java    License: MIT License 6 votes vote down vote up
@Override
protected void onBeforeRender() {
	if (!inited) {
		WebMarkupContainer dialog = new WebMarkupContainer("dialog");
		add(dialog);
		
		dialog.add(newContent(CONTENT_ID));

		String cssClass = getCssClass();
		if (cssClass != null)
			dialog.add(AttributeAppender.append("class", cssClass));
		
		inited = true;
	}
	super.onBeforeRender();
}
 
Example 14
Source Project: sakai   Source File: CSSFeedbackPanel.java    License: Educational Community License v2.0 6 votes vote down vote up
public CSSFeedbackPanel(String id) {
	super(id);
	WebMarkupContainer feedbackul = (WebMarkupContainer) get("feedbackul");
	if(feedbackul != null){
		feedbackul.add(new AttributeModifier("class", true, new Model() {
			private static final long	serialVersionUID	= 1L;
			public Serializable getObject() {
				if(anyErrorMessage()){
					return "alertMessage";
				}else if(anyMessage()){
					return "success";
				}else{
					return "";
				}
			}
		}));
		feedbackul.add(new AttributeModifier("style", true, new Model("list-style-type:none")));
	}
}
 
Example 15
Source Project: sakai   Source File: ImportExportPage.java    License: Educational Community License v2.0 6 votes vote down vote up
public ImportExportPage() {

		defaultRoleChecksForInstructorOnlyPage();

		disableLink(this.importExportPageLink);

		container = new WebMarkupContainer("gradebookImportExportContainer");
		container.setOutputMarkupId(true);
		container.add(new GradeImportUploadStep("wizard"));
		add(container);

		// hide BasePage's feedback panel and use the error/nonError filtered feedback panels
		feedbackPanel.setVisibilityAllowed(false);
		add(nonErrorFeedbackPanel);
		add(errorFeedbackPanel);
	}
 
Example 16
private WebMarkupContainer createTreeRow(final T node)
{
  final WebMarkupContainer row = new WebMarkupContainer(rowRepeater.newChildId(), new Model<TreeTableNode>(node));
  row.setOutputMarkupId(true);
  row.add(AttributeModifier.replace("class", "even"));
  if (clickRows == true) {
    WicketUtils.addRowClick(row);
  }
  rowRepeater.add(row);
  final RepeatingView colBodyRepeater = new RepeatingView("cols");
  row.add(colBodyRepeater);
  final String cssStyle = getCssStyle(node);

  // Column: browse icons
  final TreeIconsActionPanel< ? extends TreeTableNode> treeIconsActionPanel = createTreeIconsActionPanel(node);
  addColumn(row, treeIconsActionPanel, cssStyle);
  treeIconsActionPanel.init(this, node);
  treeIconsActionPanel.add(AttributeModifier.append("style", new Model<String>("white-space: nowrap;")));

  addColumns(colBodyRepeater, cssStyle, node);
  return row;
}
 
Example 17
@Override
@SuppressWarnings("serial")
protected void init()
{
  add(createFeedbackPanel());
  gridBuilder = newGridBuilder(this, "flowform");
  gridBuilder.newGridPanel();
  {
    final FieldsetPanel fs = gridBuilder.newFieldset("Show all");
    fs.add(new CheckBoxPanel(fs.newChildId(), new PropertyModel<Boolean>(this, "showOldUpdateScripts"), null, true) {
      /**
       * @see org.projectforge.web.wicket.flowlayout.CheckBoxPanel#onSelectionChanged(java.lang.Boolean)
       */
      @Override
      protected void onSelectionChanged(final Boolean newSelection)
      {
        parentPage.refresh();
      }
    });
  }
  scripts = new WebMarkupContainer("scripts");
  add(scripts);
  updateEntryRows();

  actionButtons = new MyComponentsRepeater<SingleButtonPanel>("buttons");
  add(actionButtons.getRepeatingView());
  {
    final Button refreshButton = new Button(SingleButtonPanel.WICKET_ID, new Model<String>("refresh")) {
      @Override
      public final void onSubmit()
      {
        parentPage.refresh();
      }
    };
    final SingleButtonPanel refreshButtonPanel = new SingleButtonPanel(actionButtons.newChildId(), refreshButton, "refresh",
        SingleButtonPanel.DEFAULT_SUBMIT);
    actionButtons.add(refreshButtonPanel);
    setDefaultButton(refreshButton);
  }
}
 
Example 18
/**
 * @param id
 */
@SuppressWarnings("serial")
public RechnungCostTablePanel(final String id, final AbstractRechnungsPositionDO position)
{
  super(id);
  this.position = position;
  table = new WebMarkupContainer("costtable");
  add(table.setOutputMarkupId(true));
  this.model = new ArrayList<KostZuweisungDO>();
  listView = new ListView<KostZuweisungDO>("listview", model) {

    @Override
    protected void populateItem(final ListItem<KostZuweisungDO> item)
    {
      final KostZuweisungDO zuweisung = item.getModelObject();
      // row.add(new Kost1FormComponent("kost1", new PropertyModel<Kost1DO>(zuweisung, "kost1"), true)
      // .setVisible(isShowEditableKostZuweisungen()));
      final Component kost1 = new Label("kost1", KostFormatter.format(zuweisung.getKost1()));
      WicketUtils.addTooltip(kost1, KostFormatter.formatToolTip(zuweisung.getKost1()));
      item.add(kost1);
      // subItem.add(new Kost2FormComponent("kost2", new PropertyModel<Kost2DO>(zuweisung, "kost2"), true)
      // .setVisible(isShowEditableKostZuweisungen()));
      final Component kost2 = new Label("kost2", KostFormatter.format(zuweisung.getKost2()));
      WicketUtils.addTooltip(kost2, KostFormatter.formatToolTip(zuweisung.getKost2()));
      item.add(kost2);
      item.add(new Label("netto", CurrencyFormatter.format(zuweisung.getNetto())));
      final BigDecimal percentage;
      if (NumberHelper.isZeroOrNull(position.getNetSum()) == true || NumberHelper.isZeroOrNull(zuweisung.getNetto()) == true) {
        percentage = BigDecimal.ZERO;
      } else {
        percentage = zuweisung.getNetto().divide(position.getNetSum(), RoundingMode.HALF_UP);
      }
      final boolean percentageVisible = NumberHelper.isNotZero(percentage);
      item.add(new Label("percentage", NumberFormatter.formatPercent(percentage)).setVisible(percentageVisible));
      onRenderCostRow(position, zuweisung, kost1, kost2);
    }
  };
  table.add(listView);
  refresh();
}
 
Example 19
protected void addActionLink(final RepeatingView actionLinkRepeater, final AbstractLink link, final String labelText, final String tooltip)
{
  final WebMarkupContainer actionLinkContainer = new WebMarkupContainer(actionLinkRepeater.newChildId());
  actionLinkRepeater.add(actionLinkContainer);
  final Label label = new Label("label", labelText);
  if (tooltip != null) {
    WicketUtils.addTooltip(label, tooltip);
  }
  actionLinkContainer.add(link.add(label));
}
 
Example 20
Source Project: onedev   Source File: AdministrationTabLink.java    License: MIT License 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	
	Link<Void> link = new ViewStateAwarePageLink<Void>("link", tab.getMainPageClass());
	link.add(new WebMarkupContainer("icon").add(AttributeAppender.append("class", tab.getIconClass())));
	link.add(new Label("label", tab.getTitleModel()));
	add(link);
}
 
Example 21
Source Project: openmeetings   Source File: RoomsTabbedPanel.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onInitialize() {
	super.onInitialize();
	User u = userDao.get(getUserId());
	add(new AjaxBootstrapTabbedPanel<>("orgTabs", u.getGroupUsers().stream().map(gu -> new AbstractTab(Model.of(gu.getGroup().getName())) {
		private static final long serialVersionUID = 1L;

		@Override
		public WebMarkupContainer getPanel(String panelId) {
			return new RoomsPanel(panelId, roomDao.getGroupRooms(gu.getGroup().getId()));
		}
	}).collect(Collectors.toList())));
}
 
Example 22
Source Project: Orienteer   Source File: DefaultRegistrationPage.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates container which will be used for Ajax update when user will be registered
 * @param id {@link String} component id
 * @return {@link WebMarkupContainer}
 */
private WebMarkupContainer createContainer(String id) {
    return new WebMarkupContainer(id) {
        @Override
        protected void onInitialize() {
            super.onInitialize();
            add(createRegistrationPanel("registrationPanel"));
            add(createRegistrationSuccessLabel("registrationSuccessLabel"));
            setOutputMarkupPlaceholderTag(true);
        }
    };
}
 
Example 23
Source Project: onedev   Source File: SourceEditPanel.java    License: MIT License 5 votes vote down vote up
@Override
protected WebMarkupContainer newEditOptions(String componentId) {
	sourceFormat = new SourceFormatPanel(componentId, new OptionChangeCallback() {

		@Override
		public void onOptioneChange(AjaxRequestTarget target) {
			String script = String.format("onedev.server.sourceEdit.onIndentTypeChange('%s', '%s');", 
					getEditor().getMarkupId(), sourceFormat.getIndentType());
			target.appendJavaScript(script);
		}
		
	}, new OptionChangeCallback() {

		@Override
		public void onOptioneChange(AjaxRequestTarget target) {
			String script = String.format("onedev.server.sourceEdit.onTabSizeChange('%s', %s);", 
					getEditor().getMarkupId(), sourceFormat.getTabSize());
			target.appendJavaScript(script);
		}
		
	}, new OptionChangeCallback() {
		
		@Override
		public void onOptioneChange(AjaxRequestTarget target) {
			String script = String.format("onedev.server.sourceEdit.onLineWrapModeChange('%s', '%s');", 
					getEditor().getMarkupId(), sourceFormat.getLineWrapMode());
			target.appendJavaScript(script);
		}
		
	});	
	return sourceFormat;
}
 
Example 24
Source Project: inception   Source File: SearchPage.java    License: Apache License 2.0 5 votes vote down vote up
public SearchPage()
{
    project = Session.get().getMetaData(SessionMetaData.CURRENT_PROJECT);
    if (project == null) {
        abort();
    }

    add(new SearchForm("searchForm"));

    List<IColumn<ExternalSearchResult, String>> columns = new ArrayList<>();

    columns.add(new AbstractColumn<ExternalSearchResult, String>(new Model<>("Results"))
    {
        private static final long serialVersionUID = 3795885786416467291L;

        @Override
        public void populateItem(Item<ICellPopulator<ExternalSearchResult>> cellItem,
                String componentId, IModel<ExternalSearchResult> model)
        {
            @SuppressWarnings("rawtypes")
            Item rowItem = cellItem.findParent( Item.class );
            int rowIndex = rowItem.getIndex();
            ResultRowView rowView = new ResultRowView(componentId, rowIndex + 1, model);
            cellItem.add(rowView);
        }
    });

    dataProvider = new ExternalResultDataProvider(externalSearchService,
            userRepository.getCurrentUser());

    dataTableContainer = new WebMarkupContainer("dataTableContainer");
    dataTableContainer.setOutputMarkupId(true);
    add(dataTableContainer);

    dataTableContainer.add(new DefaultDataTable<>("resultsTable", columns, dataProvider, 10));
}
 
Example 25
Source Project: syncope   Source File: LogsITCase.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void readConsoleLogs() {
    TESTER.assertComponent("body:content:tabbedPanel:tabs-container:tabs:1:link", AjaxFallbackLink.class);
    TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:1:link");
    TESTER.assertComponent(CONTAINER_PATH, WebMarkupContainer.class);

    assertNotNull(searchLog(KEY, CONTAINER_PATH, "org.apache.wicket"));
}
 
Example 26
Source Project: syncope   Source File: SCIMConfPage.java    License: Apache License 2.0 5 votes vote down vote up
private WebMarkupContainer updateSCIMGeneralConfContent(final SCIMConf scimConf) {
    if (scimConf == null) {
        return content;
    }
    content.addOrReplace(new SCIMConfPanel("body", scimConf, SCIMConfPage.this.getPageReference()) {

        private static final long serialVersionUID = 8221398624379357183L;

        @Override
        protected void setWindowClosedReloadCallback(final BaseModal<?> modal) {
            modal.setWindowClosedCallback(target -> {
                if (modal.getContent() instanceof ResultPage) {
                    Serializable result = ResultPage.class.cast(modal.getContent()).getResult();
                    try {
                        SCIMConfRestClient.set(MAPPER.readValue(result.toString(), SCIMConf.class));

                        SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
                        modal.show(false);
                        target.add(content);
                    } catch (Exception e) {
                        LOG.error("While setting SCIM configuration", e);
                        SyncopeConsoleSession.get().onException(e);
                    }
                    ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
                }
            });
        }
    });

    return content;
}
 
Example 27
/**
 * Constructor
 * 
 * @param table
 *            data table this toolbar will be attached to
 */
public SakaiNavigationToolBar(final DataTable table)
{
	super(table);

	WebMarkupContainer span = (WebMarkupContainer) get("span");
	span.add(new AttributeModifier("colspan", new Model(String.valueOf(table.getColumns().size()))));

	span.get("navigator").replaceWith(newPagingNavigator("navigator", table));
	span.get("navigatorLabel").replaceWith(newNavigatorLabel("navigatorLabel", table));
}
 
Example 28
Source Project: onedev   Source File: FieldListEditPanel.java    License: MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected List<Serializable> convertInputToValue() throws ConversionException {
	List<Serializable> value = new ArrayList<>();
	for (Component container: (WebMarkupContainer)get("fields")) {
		Label label = (Label) container.get("name");
		FieldSupply field = new FieldSupply();
		field.setName((String) label.getDefaultModelObject());
		FieldSpec fieldSpec = Preconditions.checkNotNull(getFieldSpecs().get(field.getName()));
		field.setSecret(fieldSpec instanceof SecretField);
		if (container.get("value") instanceof PropertyEditor) {
			PropertyEditor<Serializable> propertyEditor = (PropertyEditor<Serializable>) container.get("value");
			Class<?> valueProviderClass = (Class<?>) container.getDefaultModelObject();
			if (valueProviderClass == SpecifiedValue.class) {
				SpecifiedValue specifiedValue = new SpecifiedValue();
				Object propertyValue = propertyEditor.getConvertedInput();
				specifiedValue.setValue(fieldSpec.convertToStrings(propertyValue));
				field.setValueProvider(specifiedValue);
			} else {
				ScriptingValue scriptingValue = new ScriptingValue();
				scriptingValue.setScriptName((String) propertyEditor.getConvertedInput()); 
				field.setValueProvider(scriptingValue);
			} 
		} else {
			field.setValueProvider(new Ignore());
		}
		value.add(field);
	}
	return value;
}
 
Example 29
public DivTextPanel(final String id, final IModel<String> text, final Behavior... behaviors)
{
  super(id);
  add(div = new WebMarkupContainer("div"));
  label = new Label(WICKET_ID, text);
  init(behaviors);
}
 
Example 30
Source Project: onedev   Source File: WicketUtils.java    License: MIT License 5 votes vote down vote up
public static int getChildIndex(WebMarkupContainer parent, Component child) {
	int index = 0;
	for (Component each: parent) {
		if (each == child)
			return index;
		index++;
	}
	return -1;
}