javax.faces.model.SelectItem Java Examples

The following examples show how to use javax.faces.model.SelectItem. 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: ManageServiceInstanceCtrl.java    From development with Apache License 2.0 6 votes vote down vote up
private List<ServiceInstanceRow> initServiceInstanceRows()
        throws ServiceInstanceException {
    List<ServiceInstance> serviceInstances = getServiceInstanceService()
            .getInstancesForController(getControllerId());
    List<ServiceInstanceRow> result = new ArrayList<>();
    if (serviceInstances == null) {
        return result;
    }
    for (ServiceInstance serviceInstance : serviceInstances) {
        List<SelectItem> selectableOperations = initSelectableOperaions(
                serviceInstance);
        ServiceInstanceRow row = new ServiceInstanceRow(serviceInstance,
                selectableOperations);
        result.add(row);
    }
    return result;

}
 
Example #2
Source File: AuthorBean.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public List<SelectItem> getPendingSelectActionList2()
{
 if (pendingActionList2 != null) {
  return pendingActionList2;
 }

 pendingActionList2 = new ArrayList<SelectItem>();
 ResourceLoader com = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.CommonMessages");
 AuthorizationBean authorizationBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");

 boolean isEditAnyAssessment = authorizationBean.getEditAnyAssessment();
 boolean isEditOwnAssessment = authorizationBean.getEditOwnAssessment();

 if (isEditAnyAssessment || isEditOwnAssessment) {
  pendingActionList2.add(new SelectItem("edit_pending", com.getString("edit_action")));
  pendingActionList2.add(new SelectItem("preview_pending", com.getString("action_preview")));
  if (ServerConfigurationService.getBoolean("samigo.printAssessment", true)) {
	  pendingActionList2.add(new SelectItem("print_pending", com.getString("action_print")));
  }
  pendingActionList2.add(new SelectItem("settings_pending", com.getString("settings_action")));
  pendingActionList2.add(new SelectItem("duplicate", com.getString("action_duplicate")));
  pendingActionList2.add(new SelectItem("export", com.getString("export_action")));
 }
 return pendingActionList2;
}
 
Example #3
Source File: AuthorBean.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public List<SelectItem> getPublishedSelectActionList()
{
 if (publishedActionList != null) {
  return publishedActionList;
 }

 ResourceLoader com = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.CommonMessages");
 AuthorizationBean authorizationBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");

 publishedActionList = new ArrayList<SelectItem>();
 boolean isEditAnyAssessment = authorizationBean.getEditAnyAssessment();
 boolean isEditOwnAssessment = authorizationBean.getEditOwnAssessment();

 if (isEditAnyAssessment || isEditOwnAssessment) {
  publishedActionList.add(new SelectItem("preview_published", com.getString("action_preview")));
  if (ServerConfigurationService.getBoolean("samigo.printAssessment", true)) {
	  publishedActionList.add(new SelectItem("print_published", com.getString("action_print")));
  }
  publishedActionList.add(new SelectItem("settings_published", com.getString("settings_action")));
 }

 return publishedActionList;
}
 
Example #4
Source File: MySubscriptionsCtrlTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test
public void operationChanged_ParameterRequest() throws Exception {
    POSubscription sub = initSubscription(model);
    OperationModel om = initOperation(sub);
    initOperationParameter(om, OperationParameterType.REQUEST_SELECT);
    List<String> list = initValues(subSvc, sub, om);
    ctrl.operationChanged();

    assertFalse(sub.isExecuteDisabled());
    assertSame(om.getOperation(),
            sub.getSelectedOperation().getOperation());
    verify(subSvc).getServiceOperationParameterValues(
            eq(sub.getVOSubscription()), eq(om.getOperation()));
    List<SelectItem> values = model.getMySubscriptions().get(0)
            .getSelectedOperation().getParameters().get(0).getValues();
    assertEquals(list.size(), values.size());
    for (int i = 0; i < list.size(); i++) {
        assertEquals(list.get(i), values.get(i).getValue());
        assertEquals(list.get(i), values.get(i).getLabel());
    }
}
 
Example #5
Source File: CustomizeLandingpageCtrlTest.java    From development with Apache License 2.0 6 votes vote down vote up
@Test
public void switchToEnterpriseLandingpage() {

    // given some model for the public landing page
    model.setLandingpageConfig(new POPublicLandingpageConfig());
    model.setAvailableServices(new ArrayList<POService>());
    model.setFillinItems(new ArrayList<SelectItem>());

    // when switching
    ctrl.switchToEnterpriseLandingpage();

    // than public landing page model is reset
    assertNull(model.getLandingpageConfig());
    assertNull(model.getAvailableServices());
    assertNull(model.getFillinItems());
}
 
Example #6
Source File: Utilities.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * It provides a list of meeting type choices for user.
 * 
 * @param mSelectedType
 *            a String value, which indicates that the passed-in meeting
 *            type will not disabled.
 * @param disableNotSelectedOnes
 *            a boolean value which indicate whether to disable other
 *            meeting types except this one.
 * @return a list of SelectItem objects.
 */
public static List<SelectItem> getMeetingTypeSelectItems(
		String mSelectedType, boolean disableNotSelectedOnes) {
	List<SelectItem> meetingTypeItems = new ArrayList<SelectItem>();
	SelectItem announ = new SelectItem(ANNOUNCEMENT, Utilities.rb
			.getString("label_announcement"), "anouncment");
	SelectItem multiple = new SelectItem(INDIVIDUAL, Utilities.rb
			.getString("label_individaul"), "individaul");
	SelectItem group = new SelectItem(GROUP, Utilities.rb
			.getString("label_group"), "group");

	if (disableNotSelectedOnes) {
		if (!ANNOUNCEMENT.equals(mSelectedType))
			announ.setDisabled(true);
		if (!GROUP.equals(mSelectedType))
			group.setDisabled(true);
		if (!INDIVIDUAL.equals(mSelectedType))
			multiple.setDisabled(true);
	}
	meetingTypeItems.add(announ);
	meetingTypeItems.add(group);
	meetingTypeItems.add(multiple);

	return meetingTypeItems;
}
 
Example #7
Source File: EcrfStatusEntryBeanBase.java    From ctsms with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void setSelectedProbandListEntry(IDVO probandListEntry) {
	DataTable.clearFilters(getEcrfDataTableId());
	if (probandListEntry != null) {
		this.probandListEntry = (ProbandListEntryOutVO) probandListEntry.getVo();
	} else {
		this.probandListEntry = null;
	}
	ecrf = null;
	if (this.probandListEntry != null) {
		ecrfModel.setProbandListEntryId(probandListEntry.getId());
		filterVisits = WebUtil.getVisits(this.probandListEntry.getTrial().getId());
		filterVisits.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
	} else {
		ecrfModel.setProbandListEntryId(null);
		filterVisits.clear();
	}
	ecrfModel.updateRowCount();
	ecrfFieldValueBean.setFieldQuery(null);
	initSets(false);
}
 
Example #8
Source File: AuthorBean.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public List<SelectItem> getPendingSelectActionList1()
{
 if (pendingActionList1 != null) {
  return pendingActionList1;
 }

 pendingActionList1 = new ArrayList<SelectItem>();
 ResourceLoader com = new ResourceLoader("org.sakaiproject.tool.assessment.bundle.CommonMessages");
 AuthorizationBean authorizationBean = (AuthorizationBean) ContextUtil.lookupBean("authorization");

 boolean isEditAnyAssessment = authorizationBean.getEditAnyAssessment();
 boolean isEditOwnAssessment = authorizationBean.getEditOwnAssessment();

 if (isEditAnyAssessment || isEditOwnAssessment) {
  pendingActionList1.add(new SelectItem("edit_pending", com.getString("edit_action")));
  pendingActionList1.add(new SelectItem("preview_pending", com.getString("action_preview")));
  if (ServerConfigurationService.getBoolean("samigo.printAssessment", true)) {
	  pendingActionList1.add(new SelectItem("print_pending", com.getString("action_print")));
  }
  pendingActionList1.add(new SelectItem("settings_pending", com.getString("settings_action")));
  pendingActionList1.add(new SelectItem("publish", com.getString("publish_action")));
  pendingActionList1.add(new SelectItem("duplicate", com.getString("action_duplicate")));
  pendingActionList1.add(new SelectItem("export", com.getString("export_action")));
 }
 return pendingActionList1;
}
 
Example #9
Source File: UserPrefsTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * @return Returns the prefTimeZones.
 */
public List<SelectItem> getPrefTimeZones()
{
	if (prefTimeZones.size() == 0)
	{
		String[] timeZoneArray = TimeZone.getAvailableIDs();
		Arrays.sort(timeZoneArray);
		for (int i = 0; i < timeZoneArray.length; i++) {
			String tzt = timeZoneArray[i];
			if (StringUtils.contains(tzt, '/') && !StringUtils.startsWith(tzt, "SystemV") && !StringUtils.startsWith(tzt, "Etc/GMT")) {
				String id = tzt;
				String name = tzt;
				if (StringUtils.contains(tzt, '_')) {
					name = StringUtils.replace(tzt, "_", " ");
				}
				prefTimeZones.add(new SelectItem(id, name));
			}
		}
	}

	return prefTimeZones;
}
 
Example #10
Source File: ItemAuthorBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public int compare(Object o1, Object o2) {
	SelectItem i1 = (SelectItem) o1;
	SelectItem i2 = (SelectItem) o2;
	RuleBasedCollator collator_ini = (RuleBasedCollator)Collator.getInstance();
	try {
		RuleBasedCollator collator= new RuleBasedCollator(collator_ini.getRules().replaceAll("<'\u005f'", "<' '<'\u005f'"));
		return collator.compare(i1.getLabel(), i2.getLabel());
	} catch (ParseException e) {}
	return Collator.getInstance().compare(i1.getLabel(), i2.getLabel());
}
 
Example #11
Source File: DegreeManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public List<SelectItem> getAcademicAdminOffices() {

        List<SelectItem> result = new ArrayList<SelectItem>();
        result.add(new SelectItem(this.NO_SELECTION, BundleUtil.getString(Bundle.SCIENTIFIC, "choose")));

        for (AdministrativeOffice administrativeOffice : rootDomainObject.getAdministrativeOfficesSet()) {
            result.add(new SelectItem(administrativeOffice.getExternalId(), administrativeOffice.getName().getContent()));
        }

        return result;
    }
 
Example #12
Source File: UserListBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public List getUserAuthorities() {
	userAuthorities = new ArrayList();
	userAuthorities.add(new SelectItem(USER_AUTH_ALL, msgs.getString("user_auth_all")));
	userAuthorities.add(new SelectItem(USER_AUTH_INTERNAL, msgs.getString("user_auth_internal")));
	userAuthorities.add(new SelectItem(USER_AUTH_EXTERNAL, msgs.getString("user_auth_external")));
	return userAuthorities;
}
 
Example #13
Source File: AcademicAdministrationCurricularCourseManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void readBolonhaExecutionYears(final List<SelectItem> result) {
    for (final ExecutionYear executionYear : ExecutionYear.readNotClosedExecutionYears()) {
        result.add(new SelectItem(executionYear.getExternalId(), executionYear.getYear()));
    }
    if (getExecutionYearID() == null) {
        final ExecutionDegree mostRecentExecutionDegree = getDegreeCurricularPlan().getMostRecentExecutionDegree();
        setExecutionYearID(mostRecentExecutionDegree != null ? mostRecentExecutionDegree.getExecutionYear().getExternalId() : ExecutionYear
                .readCurrentExecutionYear().getExternalId());
    }
}
 
Example #14
Source File: SchedulerTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public List<SelectItem> getScheduledJobs() throws SchedulerException
{
    ArrayList<SelectItem> scheduledJobs = new ArrayList<SelectItem> ();
    Set<JobKey> jobKeys = schedulerManager.getScheduler().getJobKeys(GroupMatcher.groupEquals(Scheduler.DEFAULT_GROUP));

    for (JobKey key : jobKeys) {
        scheduledJobs.add(new SelectItem(key.getName()));
    }

    return scheduledJobs;
}
 
Example #15
Source File: SessionScopeBean.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
public synchronized ArrayList<SelectItem> getFilterVisitScheduleDurations() {
	if (filterVisitScheduleDurations == null) {
		filterVisitScheduleDurations = WebUtil.getVisitScheduleDurations();
		filterVisitScheduleDurations.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
	}
	return filterVisitScheduleDurations;
}
 
Example #16
Source File: DeleteCustomerPriceModelCtrl.java    From development with Apache License 2.0 5 votes vote down vote up
String getOrgName() {

        DeleteCustomerPriceModelModel m = getModel();
        String orgId = m.getSelectedOrgId();
        String result = orgId;
        List<SelectItem> customers = m.getCustomers();
        for (SelectItem si : customers) {
            if (si.getValue().equals(orgId)) {
                result = si.getLabel();
                break;
            }
        }

        return result;
    }
 
Example #17
Source File: SelectItemsIterator.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public SelectItem next() {
	Object item = iterator.next();
	if (item instanceof SelectItem) {
		return (SelectItem) item;
	} else {
		return getSelectItemFor(ctx, item);
	}
}
 
Example #18
Source File: SessionScopeBean.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
public synchronized ArrayList<SelectItem> getFilterInventoryCategories() {
	if (filterInventoryCategories == null) {
		filterInventoryCategories = WebUtil.getAllInventoryCategories();
		filterInventoryCategories.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
	}
	return filterInventoryCategories;
}
 
Example #19
Source File: CollidingVisitScheduleItemEagerModel.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void initSets() {
	ProbandStatusEntryOutVO probandStatusEntryVO = WebUtil.getProbandStatusEntry(probandStatusEntryId);
	if (probandStatusEntryVO != null) {
		filterTrials = WebUtil.getParticipationTrials(probandStatusEntryVO.getProband().getId());
	} else {
		filterTrials = new ArrayList<SelectItem>();
	}
	filterTrials.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
}
 
Example #20
Source File: CustomizeLandingpageCtrlTest.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * Test the building of fillin itmes for the UI
 */
@Test
public void buildFillinItems() {
    // given
    List<FillinCriterion> fillinOptions = new ArrayList<FillinCriterion>();
    fillinOptions.add(FillinCriterion.ACTIVATION_DESCENDING);

    // when
    List<SelectItem> result = ctrl.buildFillinItems(fillinOptions);

    // than
    assertNotNull(result);
    assertEquals(1, result.size());
}
 
Example #21
Source File: ManageOperatorRevenueShareCtrl.java    From development with Apache License 2.0 5 votes vote down vote up
void initTemplateServiceSelector() {
    List<SelectItem> uiTemplateServices = new ArrayList<SelectItem>();
    Response response = sl.findService(ServiceSelector.class)
            .getTemplateServices();
    List<POService> templates = response.getResultList(POService.class);
    for (POService templateService : templates) {
        uiTemplateServices.add(new SelectItem(Long.valueOf(templateService
                .getKey()), templateService.getServiceId() + "("
                + templateService.getVendorOrganizationId() + ")"));
    }
    model.setTemplates(uiTemplateServices);
}
 
Example #22
Source File: AssessmentSettingsBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public SelectItem[] getSecureDeliverModuleSelections() {
 
 SecureDeliveryServiceAPI secureDeliveryService = SamigoApiFactory.getInstance().getSecureDeliveryServiceAPI(); 
 Set<RegisteredSecureDeliveryModuleIfc> modules = secureDeliveryService.getSecureDeliveryModules( new ResourceLoader().getLocale() );
 
 SelectItem[] selections = new SelectItem[ modules.size() ];
 int index = 0;
 for ( RegisteredSecureDeliveryModuleIfc module : modules ) {
  
  selections[index] = new SelectItem( module.getId(), module.getName() );
  ++index;
 }
 
 return selections;
}
 
Example #23
Source File: EvaluationManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public List<SelectItem> getEnrolmentTypeFilterOptions() {
    List<SelectItem> options = new ArrayList<>();

    options.add(new SelectItem(FILTER_ALL, BundleUtil.getString(Bundle.ENUMERATION, "filter.all")));
    for (EvaluationSeason season : EvaluationConfiguration.getInstance().getEvaluationSeasonSet()) {
        options.add(new SelectItem(season.getExternalId(), season.getName().getContent()));
    }
    options.add(new SelectItem(ENROLMENT_TYPE_FILTER_NOT_ENROLLED, BundleUtil.getString(Bundle.ENUMERATION,
            "filter.not.enrolled")));

    return options;
}
 
Example #24
Source File: SessionScopeBean.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
public synchronized ArrayList<SelectItem> getFilterMassMailTypes() {
	if (filterMassMailTypes == null) {
		filterMassMailTypes = WebUtil.getAllMassMailTypes();
		filterMassMailTypes.add(0, new SelectItem(CommonUtil.NO_SELECTION_VALUE, ""));
	}
	return filterMassMailTypes;
}
 
Example #25
Source File: AssessmentSettingsBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public SelectItem[] getSecureDeliverModuleSelections() {
 
 SecureDeliveryServiceAPI secureDeliveryService = SamigoApiFactory.getInstance().getSecureDeliveryServiceAPI(); 
 Set<RegisteredSecureDeliveryModuleIfc> modules = secureDeliveryService.getSecureDeliveryModules( new ResourceLoader().getLocale() );
 
 SelectItem[] selections = new SelectItem[ modules.size() ];
 int index = 0;
 for ( RegisteredSecureDeliveryModuleIfc module : modules ) {
  
  selections[index] = new SelectItem( module.getId(), module.getName() );
  ++index;
 }
 
 return selections;
}
 
Example #26
Source File: CreateExecutionDegreesForExecutionYearBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public List getExecutionYears() {
    final List<SelectItem> result = new ArrayList<SelectItem>();
    for (final ExecutionYear executionYear : ExecutionYear.readNotClosedExecutionYears()) {
        result.add(new SelectItem(executionYear.getExternalId(), executionYear.getYear()));
    }
    if (getChoosenExecutionYearID() == null && result.size() > 0) {
        setChoosenExecutionYearID(ExecutionYear.readCurrentExecutionYear().getExternalId());
    }
    return result;
}
 
Example #27
Source File: Paginator.java    From ctsms with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void updatePageSizes() {
	ArrayList<String> sizeStrings = getPageSizeStrings();
	pageSizes.clear();
	Iterator<String> it = sizeStrings.iterator();
	while (it.hasNext()) {
		String sizeString = it.next();
		pageSizes.add(new SelectItem(sizeString, sizeString));
	}
}
 
Example #28
Source File: SOPEvaluationManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public List<SelectItem> getSeasonLabels() {
    final List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem("noSelection", this.chooseMessage));
    result.add(new SelectItem(Season.SEASON1_STRING, messages.getMessage(I18N.getLocale(), "property.exam.1stExam")));
    result.add(new SelectItem(Season.SEASON2_STRING, messages.getMessage(I18N.getLocale(), "property.exam.2stExam")));
    result.add(new SelectItem(Season.SPECIAL_SEASON_STRING, messages.getMessage(I18N.getLocale(),
            "property.exam.specialSeasonExam")));
    return result;
}
 
Example #29
Source File: MessageForumStatisticsBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public List<SelectItem> getGroupsForStatisticsByTopic()
{
	// Set up the topic statistics, cache things like m_displayAnonIds
	if (m_displayAnonIds)
	{
		// Prevent single-user group exploit of anonymity
		m_groupsForStatisticsByTopic = Collections.emptyList();
	}
	else
	{
		m_groupsForStatisticsByTopic = getGroups();
	}
	return m_groupsForStatisticsByTopic;
}
 
Example #30
Source File: OperationParameterModel.java    From development with Apache License 2.0 5 votes vote down vote up
public void setValues(List<SelectItem> values) {
    this.values = values;
    if (this.parameter == null) {
    	return;
    }
    if (getValue() != null && !getValue().equals("")) {
    	return;
    }
    if (values != null && !values.isEmpty()) {
    	setValue(values.get(0).getValue().toString());
    }
}