org.apache.struts.util.LabelValueBean Java Examples
The following examples show how to use
org.apache.struts.util.LabelValueBean.
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: RankChannelsAction.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * Sets up the rangling widget. * @param context the request context of the current request * @param form the dynaform related to the current request. * @param set the set holding the channel ids. */ private void setupWidget(RequestContext context, DynaActionForm form, Set<String> set) { LinkedHashSet labelValues = new LinkedHashSet(); populateWidgetLabels(labelValues, context); for (String id : set) { Long ccid = Long.valueOf(id); ConfigChannel channel = ConfigurationFactory.lookupConfigChannelById(ccid); labelValues.add(lv(channel.getName(), channel.getId().toString())); } //set the form variables for the widget to read. form.set(POSSIBLE_CHANNELS, labelValues); if (!labelValues.isEmpty()) { if (form.get(SELECTED_CHANNEL) == null) { String selected = ((LabelValueBean)labelValues.iterator().next()) .getValue(); form.set(SELECTED_CHANNEL, selected); } } }
Example #2
Source File: KickstartSoftwareEditActionTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
public void testSetupExecute() throws Exception { Channel child = ChannelTestUtils.createChildChannel(user, ksdata.getTree().getChannel()); actionPerform(); KickstartableTree tree = ksdata.getKickstartDefaults().getKstree(); verifyFormValue(KickstartSoftwareEditAction.URL, tree.getDefaultDownloadLocation()); verifyFormValue(KickstartSoftwareEditAction.CHANNEL, tree.getChannel().getId()); Collection c = (Collection) getRequest().getAttribute(KickstartSoftwareEditAction.CHANNELS); assertNotNull(c); assertTrue(c.iterator().next() instanceof LabelValueBean); // For some reason this assertion fails, even thou i swear its in the request //assertNotNull(getRequest(). // getAttribute(KickstartSoftwareEditAction.CHILD_CHANNELS)); assertNotNull(getRequest(). getAttribute(KickstartSoftwareEditAction.CHANNELS)); }
Example #3
Source File: UserActionHelper.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * @return List of possible user prefixes * get the list of prefixes to populate the prefixes drop-down box. * package protected, because nothing outside of actions should need this.*/ public static List getPrefixes() { // SETUP Prefix list List preselct = new LinkedList(); Iterator i = LocalizationService.getInstance(). availablePrefixes().iterator(); while (i.hasNext()) { String keyval = (String) i.next(); StringBuilder msgKey = new StringBuilder("user prefix "); msgKey.append(keyval); String display = LocalizationService.getInstance(). getMessage(msgKey.toString()); preselct.add(new LabelValueBean(display, keyval)); } return preselct; }
Example #4
Source File: ManageShiftsDA.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
public ActionForward listExecutionCourseCourseLoads(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { readAndSetInfoToManageShifts(request); DynaActionForm createShiftForm = (DynaActionForm) form; InfoExecutionCourse infoExecutionCourse = RequestUtils.getExecutionCourseBySigla(request, (String) createShiftForm.get("courseInitials")); if (infoExecutionCourse != null) { final List<LabelValueBean> tiposAula = new ArrayList<LabelValueBean>(); for (final ShiftType shiftType : infoExecutionCourse.getExecutionCourse().getShiftTypes()) { tiposAula .add(new LabelValueBean(BundleUtil.getString(Bundle.ENUMERATION, shiftType.getName()), shiftType.name())); } request.setAttribute("tiposAula", tiposAula); } return mapping.findForward("ShowShiftList"); }
Example #5
Source File: WrittenEvaluationsSearchByDegreeAndYear.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
@EntryPoint public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { VariantBean bean = getRenderedObject(); if (bean == null) { bean = new VariantBean(); bean.setObject(AcademicInterval.readDefaultAcademicInterval(AcademicPeriod.SEMESTER)); } RenderUtils.invalidateViewState(); AcademicInterval academicInterval = (AcademicInterval) bean.getObject(); request.setAttribute("bean", bean); final List<LabelValueBean> executionDegreeLabelValueBeans = new ArrayList<LabelValueBean>(); for (final ExecutionDegree executionDegree : ExecutionDegree.filterByAcademicInterval(academicInterval)) { String part = addAnotherInfoToLabel(executionDegree, academicInterval) ? " - " + executionDegree.getDegreeCurricularPlan().getName() : ""; executionDegreeLabelValueBeans.add(new LabelValueBean(executionDegree.getDegree().getPresentationName() + part, executionDegree.getExternalId().toString())); } Collections.sort(executionDegreeLabelValueBeans, Comparator.comparing(LabelValueBean::getLabel)); request.setAttribute("executionDegreeLabelValueBeans", executionDegreeLabelValueBeans); return mapping.findForward("showForm"); }
Example #6
Source File: BaseRankChannels.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * Sets up the rangling widget. * @param context the request context of the current request * @param form the dynaform related to the current request. * @param set the rhnset holding the channel ids. */ protected void setupWidget(RequestContext context, DynaActionForm form, RhnSet set) { User user = context.getCurrentUser(); LinkedHashSet labelValues = new LinkedHashSet(); populateWidgetLabels(labelValues, context); for (Iterator itr = set.getElements().iterator(); itr.hasNext();) { Long ccid = ((RhnSetElement) itr.next()).getElement(); ConfigChannel channel = ConfigurationManager.getInstance() .lookupConfigChannel(user, ccid); String optionstr = channel.getName() + " (" + channel.getLabel() + ")"; labelValues.add(lv(optionstr, channel.getId().toString())); } //set the form variables for the widget to read. form.set(POSSIBLE_CHANNELS, labelValues); if (!labelValues.isEmpty()) { if (form.get(SELECTED_CHANNEL) == null) { String selected = ((LabelValueBean)labelValues.iterator().next()) .getValue(); form.set(SELECTED_CHANNEL, selected); } } }
Example #7
Source File: MarkSheetSearchDispatchAction.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
private void buildDegreeCurricularPlans(HttpServletRequest request, ExecutionSemester semester) { final List<DegreeCurricularPlan> dcps = new ArrayList<DegreeCurricularPlan>(semester.getExecutionYear().getDegreeCurricularPlans()); Collections.sort(dcps, DegreeCurricularPlan.COMPARATOR_BY_PRESENTATION_NAME); final List<LabelValueBean> result = new ArrayList<LabelValueBean>(); Set<Degree> degreesForMarksheets = AcademicAccessRule .getDegreesAccessibleToFunction(AcademicOperationType.MANAGE_MARKSHEETS, Authenticate.getUser()).collect( Collectors.toSet()); for (final DegreeCurricularPlan dcp : dcps) { if (degreesForMarksheets.contains(dcp.getDegree())) { result.add(new LabelValueBean(dcp.getPresentationName(semester.getExecutionYear()), dcp.getExternalId() .toString())); } } request.setAttribute("degreeCurricularPlans", result); }
Example #8
Source File: CurriculumDispatchAction.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
private List<LabelValueBean> getSCPsLabelValueBeanList(Collection<StudentCurricularPlan> studentCurricularPlans) { final List<LabelValueBean> result = new ArrayList<LabelValueBean>(); result.add(new LabelValueBean(StudentCurricularPlanIDDomainType.NEWEST_STRING, StudentCurricularPlanIDDomainType.NEWEST .toString())); result.add(new LabelValueBean(StudentCurricularPlanIDDomainType.ALL_STRING, StudentCurricularPlanIDDomainType.ALL .toString())); for (final StudentCurricularPlan studentCurricularPlan : studentCurricularPlans) { final StringBuilder label = new StringBuilder(); label.append(studentCurricularPlan.getRegistration().getDegreeNameWithDescription()); label.append(", ").append(studentCurricularPlan.getDegreeCurricularPlan().getName()); if (studentCurricularPlan.getSpecialization() != null) { label.append(" - ").append( BundleUtil.getString(Bundle.ENUMERATION, studentCurricularPlan.getSpecialization().name())); } label.append(" - ").append(studentCurricularPlan.getStartDateYearMonthDay()); result.add(new LabelValueBean(label.toString(), String.valueOf(studentCurricularPlan.getExternalId()))); } return result; }
Example #9
Source File: BaseTreeAction.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * Return the selected base channel, either the existing value for a * channel being edited, the previous selection on the form after an * error, or the first value in the list. * @param rctx Request context to examine. * @return Channel selected previously or by default, null if neither exist. */ protected Channel getSelectedBaseChannel(RequestContext rctx) { String previousChannelIdSelection = rctx.getParam(CHANNEL_ID, false); if (previousChannelIdSelection != null) { return ChannelFactory.lookupById(Long.valueOf(previousChannelIdSelection)); } KickstartableTree tree = (KickstartableTree)rctx.getRequest().getAttribute( RequestContext.KSTREE); if (tree != null) { // Looks like we're editing an existing tree: return tree.getChannel(); } List channelLabels = (List)rctx.getRequest().getAttribute(CHANNELS); if (channelLabels != null) { String channelId = ((LabelValueBean)channelLabels.get(0)).getValue(); return ChannelFactory.lookupById(Long.valueOf(channelId)); } return null; }
Example #10
Source File: RankChannelsAction.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * Sets up the rangling widget. * @param context the request context of the current request * @param form the dynaform related to the current request. * @param set the set holding the channel ids. */ private void setupWidget(RequestContext context, DynaActionForm form, Set<String> set) { LinkedHashSet labelValues = new LinkedHashSet(); populateWidgetLabels(labelValues, context); for (String id : set) { Long ccid = Long.valueOf(id); ConfigChannel channel = ConfigurationFactory.lookupConfigChannelById(ccid); String optionstr = channel.getName() + " (" + channel.getLabel() + ")"; labelValues.add(lv(optionstr, channel.getId().toString())); } //set the form variables for the widget to read. form.set(POSSIBLE_CHANNELS, labelValues); if (!labelValues.isEmpty()) { if (form.get(SELECTED_CHANNEL) == null) { String selected = ((LabelValueBean)labelValues.iterator().next()) .getValue(); form.set(SELECTED_CHANNEL, selected); } } }
Example #11
Source File: BaseRankChannels.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * Sets up the rangling widget. * @param context the request context of the current request * @param form the dynaform related to the current request. * @param set the rhnset holding the channel ids. */ protected void setupWidget(RequestContext context, DynaActionForm form, RhnSet set) { User user = context.getCurrentUser(); LinkedHashSet labelValues = new LinkedHashSet(); populateWidgetLabels(labelValues, context); for (Iterator itr = set.getElements().iterator(); itr.hasNext();) { Long ccid = ((RhnSetElement) itr.next()).getElement(); ConfigChannel channel = ConfigurationManager.getInstance() .lookupConfigChannel(user, ccid); labelValues.add(lv(channel.getName(), channel.getId().toString())); } //set the form variables for the widget to read. form.set(POSSIBLE_CHANNELS, labelValues); if (!labelValues.isEmpty()) { if (form.get(SELECTED_CHANNEL) == null) { String selected = ((LabelValueBean)labelValues.iterator().next()) .getValue(); form.set(SELECTED_CHANNEL, selected); } } }
Example #12
Source File: UserActionHelper.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * @return List of possible user prefixes * get the list of prefixes to populate the prefixes drop-down box. * package protected, because nothing outside of actions should need this.*/ public static List getPrefixes() { // SETUP Prefix list List preselct = new LinkedList(); Iterator i = LocalizationService.getInstance(). availablePrefixes().iterator(); while (i.hasNext()) { String keyval = (String) i.next(); StringBuilder msgKey = new StringBuilder("user prefix "); msgKey.append(keyval); String display = LocalizationService.getInstance(). getMessage(msgKey.toString()); preselct.add(new LabelValueBean(display, keyval)); } return preselct; }
Example #13
Source File: KickstartSoftwareEditActionTest.java From spacewalk with GNU General Public License v2.0 | 6 votes |
public void testSetupExecute() throws Exception { Channel child = ChannelTestUtils.createChildChannel(user, ksdata.getTree().getChannel()); actionPerform(); KickstartableTree tree = ksdata.getKickstartDefaults().getKstree(); verifyFormValue(KickstartSoftwareEditAction.URL, tree.getDefaultDownloadLocation()); verifyFormValue(KickstartSoftwareEditAction.CHANNEL, tree.getChannel().getId()); Collection c = (Collection) getRequest().getAttribute(KickstartSoftwareEditAction.CHANNELS); assertNotNull(c); assertTrue(c.iterator().next() instanceof LabelValueBean); // For some reason this assertion fails, even thou i swear its in the request //assertNotNull(getRequest(). // getAttribute(KickstartSoftwareEditAction.CHILD_CHANNELS)); assertNotNull(getRequest(). getAttribute(KickstartSoftwareEditAction.CHANNELS)); }
Example #14
Source File: EditExecutionCourseManageCurricularCoursesDispatchAction.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
protected void buildExecutionDegreeLabelValueBean(List<InfoExecutionDegree> executionDegreeList, List<LabelValueBean> courses) { for (InfoExecutionDegree infoExecutionDegree : executionDegreeList) { String name = infoExecutionDegree.getInfoDegreeCurricularPlan().getDegreeCurricularPlan() .getPresentationName(infoExecutionDegree.getInfoExecutionYear().getExecutionYear()); /* TODO: DUPLICATE check really needed? name = infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getDegreeType().getLocalizedName() + " em " + name; name += duplicateInfoDegree(executionDegreeList, infoExecutionDegree) ? "-" + infoExecutionDegree.getInfoDegreeCurricularPlan().getName() : ""; */ // courses.add(new LabelValueBean(name, name + "~" + infoExecutionDegree.getInfoDegreeCurricularPlan().getExternalId().toString())); courses.add(new LabelValueBean(name, infoExecutionDegree.getInfoDegreeCurricularPlan().getExternalId())); } }
Example #15
Source File: BaseTreeAction.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * Return the selected base channel, either the existing value for a * channel being edited, the previous selection on the form after an * error, or the first value in the list. * @param rctx Request context to examine. * @return Channel selected previously or by default, null if neither exist. */ protected Channel getSelectedBaseChannel(RequestContext rctx) { String previousChannelIdSelection = rctx.getParam(CHANNEL_ID, false); if (previousChannelIdSelection != null) { return ChannelFactory.lookupById(new Long(previousChannelIdSelection)); } KickstartableTree tree = (KickstartableTree)rctx.getRequest().getAttribute( RequestContext.KSTREE); if (tree != null) { // Looks like we're editing an existing tree: return tree.getChannel(); } List channelLabels = (List)rctx.getRequest().getAttribute(CHANNELS); if (channelLabels != null) { String channelId = ((LabelValueBean)channelLabels.get(0)).getValue(); return ChannelFactory.lookupById(new Long(channelId)); } return null; }
Example #16
Source File: CloneErrataAction.java From uyuni with GNU General Public License v2.0 | 6 votes |
private void populateChannelDropDown(RequestContext rctx) { LocalizationService ls = LocalizationService.getInstance(); List<LabelValueBean> displayList = new ArrayList<LabelValueBean>(); displayList.add(new LabelValueBean(ls.getMessage("cloneerrata.anychannel"), ANY_CHANNEL)); List<ClonedChannel> channels = ChannelManager .getChannelsWithClonableErrata(rctx.getCurrentUser().getOrg()); if (channels != null) { for (Iterator<ClonedChannel> i = channels.iterator(); i.hasNext();) { Channel c = i.next(); // /me wonders if this shouldn't be part of the query. if ("rpm".equals(c.getChannelArch().getArchType().getLabel())) { displayList.add(new LabelValueBean(c.getName(), "channel_" + c.getId())); } } } rctx.getRequest().setAttribute("clonablechannels", displayList); }
Example #17
Source File: SystemDetailsEditActionTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
public void testBaseEntitlementListForEntitledSystem() throws Exception { actionPerform(); verifyForward(RhnHelper.DEFAULT_FORWARD); List options = (List) request .getAttribute(SystemDetailsEditAction .BASE_ENTITLEMENT_OPTIONS); boolean unentitledValueFound = false; Iterator i = options.iterator(); while (i.hasNext()) { LabelValueBean bean = (LabelValueBean) i.next(); if (bean.getValue().equals("unentitle")) { unentitledValueFound = true; } } assertTrue(unentitledValueFound); }
Example #18
Source File: SystemDetailsEditActionTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
public void testBaseEntitlementListForUnetitledSystem() throws Exception { systemEntitlementManager.removeAllServerEntitlements(s); TestUtils.saveAndFlush(s); actionPerform(); verifyForward(RhnHelper.DEFAULT_FORWARD); List options = (List) request .getAttribute(SystemDetailsEditAction .BASE_ENTITLEMENT_OPTIONS); boolean unentitledValueFound = false; Iterator i = options.iterator(); while (i.hasNext()) { LabelValueBean bean = (LabelValueBean) i.next(); if (bean.getValue().equals("none")) { unentitledValueFound = true; } } assertTrue(unentitledValueFound); }
Example #19
Source File: CloneErrataAction.java From spacewalk with GNU General Public License v2.0 | 6 votes |
private void populateChannelDropDown(RequestContext rctx) { LocalizationService ls = LocalizationService.getInstance(); List<LabelValueBean> displayList = new ArrayList<LabelValueBean>(); displayList.add(new LabelValueBean(ls.getMessage("cloneerrata.anychannel"), ANY_CHANNEL)); List<ClonedChannel> channels = ChannelManager .getChannelsWithClonableErrata(rctx.getCurrentUser().getOrg()); if (channels != null) { for (Iterator<ClonedChannel> i = channels.iterator(); i.hasNext();) { Channel c = i.next(); // /me wonders if this shouldn't be part of the query. if ("rpm".equals(c.getChannelArch().getArchType().getLabel())) { displayList.add(new LabelValueBean(c.getName(), "channel_" + c.getId())); } } } rctx.getRequest().setAttribute("clonablechannels", displayList); }
Example #20
Source File: ExecutionDegreesFormat.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
public static List<LabelValueBean> buildLabelValueBeansForExecutionDegree(List<ExecutionDegree> executionDegrees) { final List<LabelValueBean> result = new ArrayList<LabelValueBean>(); for (final ExecutionDegree executionDegree : executionDegrees) { final ExecutionYear executionYear = executionDegree.getExecutionYear(); final String degreeName = executionDegree.getDegree().getNameFor(executionYear).getContent(); final String degreeType = executionDegree.getDegreeCurricularPlan().getDegreeType().getName().getContent(); String name = degreeType + " em " + degreeName; name += (addDegreeCurricularPlanName(executionDegree, executionDegrees)) ? " - " + executionDegree.getDegreeCurricularPlan().getName() : ""; result.add(new LabelValueBean(name, executionDegree.getExternalId().toString())); } return result; }
Example #21
Source File: Data.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
public static final List<LabelValueBean> getMonths() { List<LabelValueBean> result = new ArrayList<LabelValueBean>(); result.add(new LabelValueBean(Data.OPTION_STRING, Data.OPTION_DEFAULT)); result.add(new LabelValueBean(Data.JANUARY_STRING, Data.JANUARY.toString())); result.add(new LabelValueBean(Data.FEBRUARY_STRING, Data.FEBRUARY.toString())); result.add(new LabelValueBean(Data.MARCH_STRING, Data.MARCH.toString())); result.add(new LabelValueBean(Data.APRIL_STRING, Data.APRIL.toString())); result.add(new LabelValueBean(Data.MAY_STRING, Data.MAY.toString())); result.add(new LabelValueBean(Data.JUNE_STRING, Data.JUNE.toString())); result.add(new LabelValueBean(Data.JULY_STRING, Data.JULY.toString())); result.add(new LabelValueBean(Data.AUGUST_STRING, Data.AUGUST.toString())); result.add(new LabelValueBean(Data.SETEMBER_STRING, Data.SETEMBER.toString())); result.add(new LabelValueBean(Data.OCTOBER_STRING, Data.OCTOBER.toString())); result.add(new LabelValueBean(Data.NOVEMBER_STRING, Data.NOVEMBER.toString())); result.add(new LabelValueBean(Data.DECEMBER_STRING, Data.DECEMBER.toString())); return result; }
Example #22
Source File: SystemDetailsEditActionTest.java From spacewalk with GNU General Public License v2.0 | 6 votes |
public void testBaseEntitlementListForEntitledSystem() throws Exception { actionPerform(); verifyForward(RhnHelper.DEFAULT_FORWARD); List options = (List) request .getAttribute(SystemDetailsEditAction .BASE_ENTITLEMENT_OPTIONS); boolean unentitledValueFound = false; Iterator i = options.iterator(); while (i.hasNext()) { LabelValueBean bean = (LabelValueBean) i.next(); if (bean.getValue().equals("unentitle")) { unentitledValueFound = true; } } assertTrue(unentitledValueFound); }
Example #23
Source File: LookupTables.java From unitime with Apache License 2.0 | 6 votes |
public static void setupDepartments(HttpServletRequest request, SessionContext context, boolean includeExternal) throws Exception { TreeSet<Department> departments = Department.getUserDepartments(context.getUser()); if (includeExternal) departments.addAll(Department.findAllExternal(context.getUser().getCurrentAcademicSessionId())); List<LabelValueBean> deptList = new ArrayList<LabelValueBean>(); for (Department d: departments) { String code = d.getDeptCode().trim(); String abbv = d.getName().trim(); if (d.isExternalManager()) deptList.add(new LabelValueBean(code + " - " + abbv + " (" + d.getExternalMgrLabel() + ")", code)); else deptList.add(new LabelValueBean(code + " - " + abbv, code)); } request.setAttribute(Department.DEPT_ATTR_NAME, deptList); }
Example #24
Source File: EditRoomDeptAction.java From unitime with Apache License 2.0 | 6 votes |
public void setupDepartments(EditRoomDeptForm editRoomDeptForm, HttpServletRequest request, Location location) throws Exception { Collection availableDepts = new Vector(); Collection currentDepts = new HashSet(); Set<Department> departments = Department.getUserDepartments(sessionContext.getUser()); boolean hasControl = false; for (RoomDept rd: location.getRoomDepts()) { currentDepts.add(rd.getDepartment()); if (departments.contains(rd.getDepartment()) && rd.isControl()) hasControl = true; } Set<Department> set = Department.findAllBeingUsed(location.getSession().getUniqueId()); for (Department d: set) { if (hasControl || departments.contains(d) || !currentDepts.contains(d)) availableDepts.add(new LabelValueBean(d.getDeptCode() + " - " + d.getName(), d.getUniqueId().toString())); } request.setAttribute(Department.DEPT_ATTR_NAME, availableDepts); }
Example #25
Source File: InstructorSearchAction.java From unitime with Apache License 2.0 | 6 votes |
/** * @return */ private Set<Department> setupManagerDepartments(HttpServletRequest request) throws Exception{ Set<Department> departments = Department.getUserDepartments(sessionContext.getUser()); if (departments.isEmpty()) throw new Exception(MSG.exceptionNoDepartmentToManage()); List<LabelValueBean> labelValueDepts = new ArrayList<LabelValueBean>(); for (Department d: departments) labelValueDepts.add(new LabelValueBean(d.getDeptCode() + "-" + d.getName(), d.getUniqueId().toString())); if (labelValueDepts.size() == 1) request.setAttribute("deptId", labelValueDepts.get(0).getValue()); request.setAttribute(Department.DEPT_ATTR_NAME,labelValueDepts); return departments; }
Example #26
Source File: InstructorListAction.java From unitime with Apache License 2.0 | 6 votes |
/** * @return */ private void setupManagerDepartments(HttpServletRequest request) throws Exception{ Vector<LabelValueBean> labelValueDepts = new Vector<LabelValueBean>(); for (Department d: Department.getUserDepartments(sessionContext.getUser())) { labelValueDepts.add( new LabelValueBean( d.getDeptCode() + "-" + d.getName(), d.getUniqueId().toString() ) ); } if (labelValueDepts.size() == 1) request.setAttribute("deptId", labelValueDepts.get(0).getValue()); request.setAttribute(Department.DEPT_ATTR_NAME,labelValueDepts); }
Example #27
Source File: SystemDetailsEditActionTest.java From spacewalk with GNU General Public License v2.0 | 6 votes |
public void testBaseEntitlementListForUnetitledSystem() throws Exception { SystemManager.removeAllServerEntitlements(s.getId()); TestUtils.saveAndFlush(s); actionPerform(); verifyForward(RhnHelper.DEFAULT_FORWARD); List options = (List) request .getAttribute(SystemDetailsEditAction .BASE_ENTITLEMENT_OPTIONS); boolean unentitledValueFound = false; Iterator i = options.iterator(); while (i.hasNext()) { LabelValueBean bean = (LabelValueBean) i.next(); if (bean.getValue().equals("none")) { unentitledValueFound = true; } } assertTrue(unentitledValueFound); }
Example #28
Source File: RegisteredSetupAction.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public ActionForward execute(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { ActionForward forward = super.execute(mapping, formIn, request, response); LocalizationService ls = LocalizationService.getInstance(); List<LabelValueBean> optionsLabelValueBeans = new ArrayList<LabelValueBean>(); for (int j = 0; j < OPTIONS.length; ++j) { optionsLabelValueBeans.add(new LabelValueBean(ls.getMessage(OPTIONS[j]), OPTIONS[j])); } request.setAttribute("options", optionsLabelValueBeans); return forward; }
Example #29
Source File: AddSpecialUseRoomAction.java From unitime with Apache License 2.0 | 6 votes |
/** * * @param request * @throws Exception */ private void setup(HttpServletRequest request, Set<Department> departments, List<Building> buildings) throws Exception { List<LabelValueBean> deptList = new ArrayList<LabelValueBean>(); for (Department d: departments) { String code = d.getDeptCode().trim(); String abbv = d.getName().trim(); deptList.add(new LabelValueBean(code + " - " + abbv, code)); } request.setAttribute(Department.DEPT_ATTR_NAME, deptList); List<LabelValueBean> bldgList = new ArrayList<LabelValueBean>(); for (Building b: buildings) { bldgList.add(new LabelValueBean( b.getAbbreviation() + "-" + b.getName(), b.getUniqueId() + "-" + b.getAbbreviation())); } request.setAttribute(Building.BLDG_LIST_ATTR_NAME, bldgList); }
Example #30
Source File: Data.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
public static final List<LabelValueBean> getMonthsStartingInOne() { List<LabelValueBean> result = new ArrayList<LabelValueBean>(); result.add(new LabelValueBean(Data.OPTION_STRING, Data.OPTION_DEFAULT)); result.add(new LabelValueBean(Data.JANUARY_STRING, String.valueOf(Data.JANUARY + 1))); result.add(new LabelValueBean(Data.FEBRUARY_STRING, String.valueOf(Data.FEBRUARY + 1))); result.add(new LabelValueBean(Data.MARCH_STRING, String.valueOf(Data.MARCH + 1))); result.add(new LabelValueBean(Data.APRIL_STRING, String.valueOf(Data.APRIL + 1))); result.add(new LabelValueBean(Data.MAY_STRING, String.valueOf(Data.MAY + 1))); result.add(new LabelValueBean(Data.JUNE_STRING, String.valueOf(Data.JUNE + 1))); result.add(new LabelValueBean(Data.JULY_STRING, String.valueOf(Data.JULY + 1))); result.add(new LabelValueBean(Data.AUGUST_STRING, String.valueOf(Data.AUGUST + 1))); result.add(new LabelValueBean(Data.SETEMBER_STRING, String.valueOf(Data.SETEMBER + 1))); result.add(new LabelValueBean(Data.OCTOBER_STRING, String.valueOf(Data.OCTOBER + 1))); result.add(new LabelValueBean(Data.NOVEMBER_STRING, String.valueOf(Data.NOVEMBER + 1))); result.add(new LabelValueBean(Data.DECEMBER_STRING, String.valueOf(Data.DECEMBER + 1))); return result; }