当前位置: 首页>>代码示例>>Java>>正文


Java IChoiceRenderer类代码示例

本文整理汇总了Java中org.apache.wicket.markup.html.form.IChoiceRenderer的典型用法代码示例。如果您正苦于以下问题:Java IChoiceRenderer类的具体用法?Java IChoiceRenderer怎么用?Java IChoiceRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IChoiceRenderer类属于org.apache.wicket.markup.html.form包,在下文中一共展示了IChoiceRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createChoiceModel

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
private IModel<List<ObjectTypes>> createChoiceModel(final IChoiceRenderer<ObjectTypes> renderer) {
	return new LoadableModel<List<ObjectTypes>>(false) {

		@Override
		protected List<ObjectTypes> load() {
			List<ObjectTypes> choices = new ArrayList<>();

			Collections.addAll(choices, ObjectTypes.values());
			choices.remove(ObjectTypes.OBJECT);

			Collections.sort(choices, new Comparator<ObjectTypes>() {

				@Override
				public int compare(ObjectTypes o1, ObjectTypes o2) {
					String str1 = (String) renderer.getDisplayValue(o1);
					String str2 = (String) renderer.getDisplayValue(o2);
					return String.CASE_INSENSITIVE_ORDER.compare(str1, str2);
				}
			});

			return choices;
		}
	};
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:25,代码来源:PageDebugList.java

示例2: initLayout

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
private void initLayout(final Component component){

        TextFormGroup name = new TextFormGroup(ID_NAME, new PropertyModel<String>(getModel(), UserReportDto.F_NAME),
                createStringResource("ObjectType.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
        add(name);

        TextFormGroup description = new TextFormGroup(ID_DESCRIPTION, new PropertyModel<String>(getModel(), UserReportDto.F_DESCRIPTION),
                createStringResource("ObjectType.description"), ID_LABEL_SIZE, ID_INPUT_SIZE, true);
        add(description);

        IModel choices = WebComponentUtil.createReadonlyModelFromEnum(ExportType.class);
        IChoiceRenderer renderer = new EnumChoiceRenderer();
        DropDownFormGroup exportType = new DropDownFormGroup(ID_EXPORT_TYPE, new
                PropertyModel<ExportType>(getModel(), UserReportDto.F_EXPORT_TYPE), choices, renderer,
                createStringResource("UserReportConfigPanel.exportFileType"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
        add(exportType);

        DateFormGroup dateFrom = new DateFormGroup(ID_DATE_FROM, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_FROM_GREG),
                createStringResource("UserReportConfigPanel.dateFrom"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
        add(dateFrom);

        DateFormGroup dateTo = new DateFormGroup(ID_DATE_TO, new PropertyModel<XMLGregorianCalendar>(getModel(), UserReportDto.F_TO_GREG),
                createStringResource("UserReportConfigPanel.dateTo"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
        add(dateTo);
    }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:26,代码来源:UserReportConfigPanel.java

示例3: createDropDown

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
private <V> DropDownChoice<V> createDropDown(String id, IModel<V> defaultModel, final List<V> values,
		IChoiceRenderer<V> renderer) {
	DropDownChoice<V> listSelect = new DropDownChoice<V>(id, defaultModel,
			new AbstractReadOnlyModel<List<V>>() {
				private static final long serialVersionUID = 1L;

				@Override
				public List<V> getObject() {
					return values;
				}
			}, renderer);

	listSelect.add(new OnChangeAjaxBehavior() {
		private static final long serialVersionUID = 1L;

		@Override
		protected void onUpdate(AjaxRequestTarget target) {
			refreshTable(target);
		}
	});

	return listSelect;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:24,代码来源:RoleMemberPanel.java

示例4: GenericSelect2DropDownMultipleChoice

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
/**
 * @param id The wicket ID.
 * @param collectionModel The model containing the selected elements.
 * @param collectionSupplier A factory for new, empty collections to be put in <code>collectionModel</code>
 * @param choicesModel The model containing the selectable elements.
 * @param renderer The choice renderer.
 */
protected <C extends Collection<T>> GenericSelect2DropDownMultipleChoice(
		String id, IModel<C> collectionModel, Supplier<? extends C> collectionSupplier,
		IModel<? extends Collection<? extends T>> choicesModel, IChoiceRenderer<? super T> renderer) {
	super(id);
	
	setModel(new ConcreteCollectionToCollectionWrapperModel<T, C>(collectionModel, collectionSupplier));
	
	choicesWrapperModel = new MultipleChoicesWrapperModel<T>(collectionModel, choicesModel);
	setChoices(choicesWrapperModel);
	setSelectedObjectForcedInChoices(true);
	setChoiceRenderer(renderer);
	
	select2Behavior = Select2Behavior.forChoice(this);
	fillSelect2Settings(select2Behavior.getSettings());
	add(select2Behavior);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:24,代码来源:GenericSelect2DropDownMultipleChoice.java

示例5: AbstractOptGroupDropDownChoice

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
protected AbstractOptGroupDropDownChoice(String id, IModel<E> model, final IModel<? extends List<? extends E>> choicesModel,
			IChoiceRenderer<? super E> renderer, final Comparator<E> sorter) {
	super(id, model, choicesModel, renderer);
	setChoices(new LoadableDetachableModel<List<? extends E>>() {
		private static final long serialVersionUID = 1L;
		@Override
		protected List<? extends E> load() {
			List<? extends E> result = choicesModel.getObject();
			Collections.sort(result, sorter);
			return result;
		};
		@Override
		public void detach() {
			super.detach();
			choicesModel.detach();
		}
	});
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:19,代码来源:AbstractOptGroupDropDownChoice.java

示例6: createPalette

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
private Palette<T> createPalette(
        final String id,
        final IModel<List<T>> model,
        final ListModel<T> choices,
        final IChoiceRenderer renderer) {

    final Palette<T> palette = new Palette(
            "paletteField",
            model,
            choices,
            renderer,
            8,
            false);

    return palette;
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:17,代码来源:AjaxPalettePanel.java

示例7: initIds

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
/**
 * Synchronize ids collection from the palette's model
 */
private void initIds() {
    // construct the model string based on selection collection
    final IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
    final StringBuilder modelStringBuffer = new StringBuilder();
    final Collection<T> modelCollection = getPalette().getModelCollection();
    if (modelCollection == null) {
        throw new WicketRuntimeException("Expected getPalette().getModelCollection() to return a non-null value."
                + " Please make sure you have model object assigned to the palette");
    }
    final Iterator<T> selection = modelCollection.iterator();

    int i = 0;
    while (selection.hasNext()) {
        modelStringBuffer.append(renderer.getIdValue(selection.next(), i++));
        if (selection.hasNext()) {
            modelStringBuffer.append(',');
        }
    }

    // set model and update ids array
    final String modelString = modelStringBuffer.toString();
    setDefaultModel(new Model<String>(modelString));
    updateIds(modelString);
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:28,代码来源:Recorder.java

示例8: getUnselectedList

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
/**
 * @return list over unselected choices
 */
protected List<T> getUnselectedList() {
    final Collection<? extends T> choices = getPalette().getChoices();

    if (choices.size() - getSelectedIds().size() == 0) {
        return Collections.<T> emptyList();
    }

    final IChoiceRenderer<T> renderer = getPalette().getChoiceRenderer();
    final List<T> unselected = new ArrayList<T>(Math.max(1, choices.size() - getSelectedIds().size()));

    for (final T choice : choices) {
        final String choiceId = renderer.getIdValue(choice, 0);

        if (!getSelectedIds().contains(choiceId)) {
            unselected.add(choice);
        }
    }
    return unselected;
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:23,代码来源:Recorder.java

示例9: makeUserChoiceRenderer

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
private IChoiceRenderer<User> makeUserChoiceRenderer()
{
    return new ChoiceRenderer<User>()
    {
        private static final long serialVersionUID = 4607720784161484145L;

        @Override
        public Object getDisplayValue(User aObject)
        {
            List<ProjectPermission> projectPermissions = projectRepository
                    .listProjectPermissionLevel(aObject, projectModel.getObject());
            List<String> permissionLevels = new ArrayList<>();
            for (ProjectPermission projectPermission : projectPermissions) {
                permissionLevels.add(projectPermission.getLevel().getName());
            }
            return aObject.getUsername() + " " + permissionLevels
                    + (aObject.isEnabled() ? "" : " (login disabled)");
        }
    };
}
 
开发者ID:webanno,项目名称:webanno,代码行数:21,代码来源:UserSelectionPanel.java

示例10: profile_renderer_render_default_label_only_on_default_profile

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
@Test
public void profile_renderer_render_default_label_only_on_default_profile() throws Exception {
	IChoiceRenderer<MiddlewareProfileStatus> statusRenderer = mock(IChoiceRenderer.class);
	when(statusRenderer.getDisplayValue(any(MiddlewareProfileStatus.class))).thenReturn("mockedstatus");
	
	ProfileChoiceRenderer renderer = spy(new ReleaseOverrideProfilePanel.ProfileChoiceRenderer(null, statusRenderer));
	doReturn("default, ").when(renderer).getDefaultLabel();
	
	for (MiddlewareProfile profile : MiddlewareProfile.values()) {
		if(MiddlewareProfile.getDefault() == profile){
			assertThat(renderer.getDisplayValue(profile)).contains("default, ");
		}else{

			assertThat(renderer.getDisplayValue(profile)).doesNotContain("default, ");
		}
	}
}
 
开发者ID:orange-cloudfoundry,项目名称:elpaaso-core,代码行数:18,代码来源:ReleaseOverrideProfilePanelTest.java

示例11: DeletableLabelGroup

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
public DeletableLabelGroup(String id, IModel<Collection<T>> collectionModel, IChoiceRenderer<T> renderer) {
    super(id, collectionModel);
    setRenderer(renderer);
    setOutputMarkupId(true);

    dataView = new DataView<T>("item", new LabelsDataProvider()) {
        @Override
        protected void populateItem(Item<T> item) {
            final T value = item.getModelObject();
            String itemText = getDisplayValue(value);
            item.add(newLabel(value, itemText));
        }
    };
    add(dataView);
    add(new MoreIndicator("more"));
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:17,代码来源:DeletableLabelGroup.java

示例12: GroupSizeCache

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
public GroupSizeCache(Collection<T> collection, IChoiceRenderer<T> renderer) {
    indicesList = new ArrayList<>();
    int index = 0;
    int beginIndex = 0;
    String prevId = null;
    for (T element : collection) {
        String id = renderer.getIdValue(element, index);
        if (prevId != null && !prevId.equals(id)) {
            indicesList.add(new GroupMetaData(beginIndex, index));
            beginIndex = index;
        }

        prevId = id;
        index++;
    }
    indicesList.add(new GroupMetaData(beginIndex, index));
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:18,代码来源:GroupSizeCache.java

示例13: DropDownChoicePanel

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
public DropDownChoicePanel(String id, IModel<T> model, IModel<? extends List<? extends T>> choices, IChoiceRenderer<T> renderer,
                            boolean allowNull) {
     super(id);

     DropDownChoice<T> input = new DropDownChoice<T>(ID_INPUT, model, choices, renderer) {

     	private static final long serialVersionUID = 1L;

@Override
         protected String getNullValidDisplayValue() {
             return getString("DropDownChoicePanel.notDefined");
         }
     };
     input.setNullValid(allowNull);
     add(input);
 }
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:17,代码来源:DropDownChoicePanel.java

示例14: createChoiceModel

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
private IModel<List<ObjectTypes>> createChoiceModel(final IChoiceRenderer<ObjectTypes> renderer) {
	return new LoadableModel<List<ObjectTypes>>(false) {

		@Override
		protected List<ObjectTypes> load() {
			List<ObjectTypes> choices = new ArrayList<>();

			Collections.addAll(choices, ObjectTypes.values());
			choices.remove(ObjectTypes.OBJECT);

			choices.sort((o1, o2) -> {
				String str1 = (String) renderer.getDisplayValue(o1);
				String str2 = (String) renderer.getDisplayValue(o2);
				return String.CASE_INSENSITIVE_ORDER.compare(str1, str2);
			});

			return choices;
		}
	};
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:21,代码来源:PageDebugList.java

示例15: initIds

import org.apache.wicket.markup.html.form.IChoiceRenderer; //导入依赖的package包/类
/**
 * Synchronize ids collection from the palette's model
 */
private void initIds() {
    // construct the model string based on selection collection
    IChoiceRenderer<? super T> renderer = getPalette().getChoiceRenderer();
    StringBuilder modelStringBuffer = new StringBuilder();
    Collection<T> modelCollection = getPalette().getModelCollection();
    if (modelCollection == null) {
        throw new WicketRuntimeException("Expected getPalette().getModelCollection() to return a non-null value."
                + " Please make sure you have model object assigned to the palette");
    }
    Iterator<T> selection = modelCollection.iterator();

    int i = 0;
    while (selection.hasNext()) {
        modelStringBuffer.append(renderer.getIdValue(selection.next(), i++));
        if (selection.hasNext()) {
            modelStringBuffer.append(",");
        }
    }

    // set model and update ids array
    String modelString = modelStringBuffer.toString();
    setDefaultModel(new Model<>(modelString));
    updateIds(modelString);
}
 
开发者ID:apache,项目名称:syncope,代码行数:28,代码来源:SelectableRecorder.java


注:本文中的org.apache.wicket.markup.html.form.IChoiceRenderer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。