List of usage examples for com.google.gwt.user.client.ui CheckBox getValue
@Override
public Boolean getValue()
From source file:org.unitime.timetable.gwt.client.hql.SavedHQLPage.java
License:Apache License
public void openDialog(SavedHQLInterface.Query q) { iDialogQuery = q;/*from w w w . j av a2 s. c om*/ if (iDialog == null) { iDialog = new UniTimeDialogBox(true, false); iDialogForm = new SimpleForm(); iDialogName = new UniTimeTextBox(100, 680); iDialogForm.addRow(MESSAGES.propName(), iDialogName); iDialogDescription = new TextArea(); iDialogDescription.setStyleName("unitime-TextArea"); iDialogDescription.setVisibleLines(5); iDialogDescription.setCharacterWidth(120); iDialogForm.addRow(MESSAGES.propDescription(), iDialogDescription); iDialogForm.getCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP); iDialogQueryArea = new TextArea(); iDialogQueryArea.setStyleName("unitime-TextArea"); iDialogQueryArea.setVisibleLines(10); iDialogQueryArea.setCharacterWidth(120); iDialogForm.addRow(MESSAGES.propQuery(), iDialogQueryArea); iDialogForm.getCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP); for (int i = 0; i < iFlags.size(); i++) { SavedHQLInterface.Flag f = iFlags.get(i); CheckBox ch = new CheckBox(f.getText()); iDialogForm.addRow(i == 0 ? MESSAGES.propFlags() : "", ch); } iDialogHeader = new UniTimeHeaderPanel(); iDialogForm.addBottomRow(iDialogHeader); iDialogHeader.addButton("save", MESSAGES.opQuerySave(), 75, new ClickHandler() { @Override public void onClick(ClickEvent event) { iDialogQuery.setName(iDialogName.getText()); if (iDialogName.getText().isEmpty()) { iDialogHeader.setErrorMessage(MESSAGES.errorNameIsRequired()); return; } iDialogQuery.setDescription(iDialogDescription.getText()); iDialogQuery.setQuery(iDialogQueryArea.getText()); if (iDialogQueryArea.getText().isEmpty()) { iDialogHeader.setErrorMessage(MESSAGES.errorQueryIsRequired()); return; } int flags = 0; boolean hasAppearance = false; for (int i = 0; i < iFlags.size(); i++) { SavedHQLInterface.Flag f = iFlags.get(i); CheckBox ch = (CheckBox) iDialogForm.getWidget(3 + i, 1); if (ch.getValue()) { flags += f.getValue(); if (f.isAppearance()) hasAppearance = true; } } if (!hasAppearance) { iDialogHeader.setErrorMessage(MESSAGES.errorNoAppearanceSelected()); return; } iDialogQuery.setFlags(flags); RPC.execute(new HQLStoreRpcRequest(iDialogQuery), new AsyncCallback<GwtRpcResponseLong>() { @Override public void onFailure(Throwable caught) { iDialogHeader.setErrorMessage(caught.getMessage()); } @Override public void onSuccess(GwtRpcResponseLong result) { iDialog.hide(); loadQueries(result.getValue(), false); } }); } }); iDialogHeader.addButton("test", MESSAGES.opQueryTest(), 75, new ClickHandler() { @Override public void onClick(ClickEvent event) { if (iDialogQueryArea.getText().isEmpty()) { iDialogHeader.setErrorMessage(MESSAGES.errorQueryIsRequired()); return; } iDialogQuery.setQuery(iDialogQueryArea.getText()); LoadingWidget.getInstance().show(MESSAGES.waitTestingQuery()); HQLExecuteRpcRequest request = new HQLExecuteRpcRequest(); request.setQuery(iDialogQuery); request.setFromRow(0); request.setMaxRows(101); RPC.execute(request, new AsyncCallback<Table>() { @Override public void onFailure(Throwable caught) { iDialogHeader.setErrorMessage(MESSAGES.failedTestNoReason()); LoadingWidget.getInstance().hide(); UniTimeNotifications.error(MESSAGES.failedTest(caught.getMessage()), caught); } @Override public void onSuccess(Table result) { iDialogHeader.setMessage(result.size() <= 1 ? MESSAGES.infoTestSucceededNoResults() : result.size() > 101 ? MESSAGES.infoTestSucceededWith100OrMoreRows() : MESSAGES.infoTestSucceededWithRows(result.size() - 1)); LoadingWidget.getInstance().hide(); } }); } }); iDialogHeader.addButton("export", MESSAGES.opScriptExport(), new ClickHandler() { @Override public void onClick(ClickEvent event) { RPC.execute(EncodeQueryRpcRequest.encode("output=hql.xml&id=" + iDialogQuery.getId()), new AsyncCallback<EncodeQueryRpcResponse>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(EncodeQueryRpcResponse result) { ToolBox.open(GWT.getHostPageBaseURL() + "export?q=" + result.getQuery()); } }); } }); iDialogHeader.addButton("delete", MESSAGES.opQueryDelete(), 75, new ClickHandler() { @Override public void onClick(ClickEvent event) { RPC.execute(new HQLDeleteRpcRequest(iDialogQuery.getId()), new AsyncCallback<GwtRpcResponseBoolean>() { @Override public void onFailure(Throwable caught) { iDialogHeader.setErrorMessage(caught.getMessage()); } @Override public void onSuccess(GwtRpcResponseBoolean result) { iDialog.hide(); loadQueries(null, false); } }); } }); iDialogHeader.addButton("back", MESSAGES.opQueryBack(), 75, new ClickHandler() { @Override public void onClick(ClickEvent event) { iDialog.hide(); } }); iDialog.setWidget(iDialogForm); } iDialog.setText(q == null ? MESSAGES.dialogNewReport() : MESSAGES.dialogEditReport(q.getName())); iDialogHeader.setEnabled("export", q != null); iDialogHeader.setEnabled("delete", q != null); iDialogHeader.clearMessage(); iDialogName.setText(q == null ? "" : q.getName()); iDialogDescription.setText(q == null ? "" : q.getDescription()); iDialogQueryArea.setText(q == null ? "" : q.getQuery()); for (int i = 0; i < iFlags.size(); i++) { SavedHQLInterface.Flag f = iFlags.get(i); CheckBox ch = (CheckBox) iDialogForm.getWidget(3 + i, 1); ch.setValue(q == null ? iAppearance.equals(f.getAppearance()) : (q.getFlags() & f.getValue()) != 0); } if (iDialogQuery == null) iDialogQuery = new SavedHQLInterface.Query(); iDialog.center(); }
From source file:org.unitime.timetable.gwt.client.instructor.InstructorsTable.java
License:Apache License
public InstructorsTable(InstructorAttributePropertiesInterface properties, boolean selectable) { setStyleName("unitime-Instructorss"); iSelectable = selectable;/* ww w . ja v a2s . co m*/ iProperties = properties; List<UniTimeTableHeader> header = new ArrayList<UniTimeTableHeader>(); for (InstructorsColumn column : InstructorsColumn.values()) { int nrCells = getNbrCells(column); for (int idx = 0; idx < nrCells; idx++) { UniTimeTableHeader h = new UniTimeTableHeader(getColumnName(column, idx), getColumnAlignment(column, idx)); header.add(h); } } for (final InstructorsColumn column : InstructorsColumn.values()) { if (InstructorComparator.isApplicable(column) && getNbrCells(column) > 0) { final UniTimeTableHeader h = header.get(getCellIndex(column)); Operation op = new SortOperation() { @Override public void execute() { doSort(column); } @Override public boolean isApplicable() { return getRowCount() > 1 && h.isVisible(); } @Override public boolean hasSeparator() { return true; } @Override public String getName() { return MESSAGES.opSortBy(getColumnName()); } @Override public String getColumnName() { return h.getHTML().replace("<br>", " "); } }; h.addOperation(op); } } addRow(null, header); for (int i = 0; i < getCellCount(0); i++) getCellFormatter().setStyleName(0, i, "unitime-ClickableTableHeader"); setSortBy(InstructorCookie.getInstance().getSortAttributesBy()); if (iSelectable) { header.get(0).addOperation(new Operation() { @Override public void execute() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; ch.setValue(true); } setSelected(row, true); } } @Override public boolean isApplicable() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; if (!ch.getValue()) return true; } } return false; } @Override public boolean hasSeparator() { return false; } @Override public String getName() { return MESSAGES.opSelectAll(); } }); header.get(0).addOperation(new Operation() { @Override public void execute() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; ch.setValue(false); } setSelected(row, false); } } @Override public boolean isApplicable() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; if (ch.getValue()) return true; } } return false; } @Override public boolean hasSeparator() { return false; } @Override public String getName() { return MESSAGES.opClearSelection(); } }); setAllowSelection(true); addMouseClickListener(new MouseClickListener<InstructorInterface>() { @Override public void onMouseClick(TableEvent<InstructorInterface> event) { selectInstructor(event.getRow(), isSelected(event.getRow())); } }); } }
From source file:org.unitime.timetable.gwt.client.rooms.RoomEdit.java
License:Apache License
protected void futureChanged() { if ((iRoom.getUniqueId() == null && iProperties.hasFutureSessions()) || iRoom.hasFutureRooms()) { for (int i = 1; i < iApplyTo.getRowCount(); i++) { CheckBox ch = (CheckBox) iApplyTo.getWidget(i, 0); if (ch.getValue()) { iEventStatus.setHint(MESSAGES.eventStatusHint(iRoom.hasSessionName() ? iRoom.getSessionName() : iProperties.getAcademicSessionName())); return; }/* w w w . j a v a2s . c om*/ } } iEventStatus.clearHint(); }
From source file:org.unitime.timetable.gwt.client.rooms.RoomEdit.java
License:Apache License
protected void fillFutureFlags(RoomUpdateRpcRequest request, boolean includeWhenNoFlags) { request.clearFutureFlags();//from ww w. j av a2 s. c o m if (iRoom.getUniqueId() == null && iProperties.hasFutureSessions()) { for (int i = 1; i < iApplyTo.getRowCount(); i++) { CheckBox ch = (CheckBox) iApplyTo.getWidget(i, 0); if (ch.getValue()) { int flags = 0; for (FutureOperation op : FutureOperation.values()) { CheckBox x = (CheckBox) iApplyTo.getWidget(i, 6 + op.ordinal()); if (x.getValue()) flags = op.set(flags); } if (flags == 0 && !includeWhenNoFlags) continue; request.setFutureFlag(-iApplyTo.getData(i).getSession().getId(), flags); RoomCookie.getInstance().setFutureFlags(iApplyTo.getData(i).getSession().getId(), flags); } else { RoomCookie.getInstance().setFutureFlags(iApplyTo.getData(i).getSession().getId(), null); } } } else if (iRoom.hasFutureRooms()) { for (int i = 1; i < iApplyTo.getRowCount(); i++) { CheckBox ch = (CheckBox) iApplyTo.getWidget(i, 0); if (ch.getValue()) { int flags = 0; for (FutureOperation op : FutureOperation.values()) { CheckBox x = (CheckBox) iApplyTo.getWidget(i, 6 + op.ordinal()); if (x.getValue()) flags = op.set(flags); } if (flags == 0 && !includeWhenNoFlags) continue; request.setFutureFlag(iApplyTo.getData(i).getId(), flags); RoomCookie.getInstance().setFutureFlags(iApplyTo.getData(i).getSession().getId(), flags); } else { RoomCookie.getInstance().setFutureFlags(iApplyTo.getData(i).getSession().getId(), null); } } } }
From source file:org.unitime.timetable.gwt.client.rooms.RoomEdit.java
License:Apache License
protected String generateAlsoUpdateMessage(boolean includeWhenNoFlags) { if ((iRoom.getUniqueId() == null && iProperties.hasFutureSessions()) || iRoom.hasFutureRooms()) { List<String> ret = new ArrayList<String>(); for (int i = 1; i < iApplyTo.getRowCount(); i++) { CheckBox ch = (CheckBox) iApplyTo.getWidget(i, 0); if (ch.getValue()) { int flags = 0; for (FutureOperation op : FutureOperation.values()) { CheckBox x = (CheckBox) iApplyTo.getWidget(i, 6 + op.ordinal()); if (x.getValue()) flags = op.set(flags); }//from ww w . j av a 2 s . c o m if (flags == 0 && !includeWhenNoFlags) continue; ret.add(iApplyTo.getData(i).getSession().getLabel()); } } if (!ret.isEmpty()) return ToolBox.toString(ret); } return null; }
From source file:org.unitime.timetable.gwt.client.rooms.RoomFeatureEdit.java
License:Apache License
protected String generateAlsoUpdateMessage() { if (!iProperties.hasFutureSessions()) return null; List<String> ret = new ArrayList<String>(); for (AcademicSessionInterface session : iProperties.getFutureSessions()) { CheckBox ch = iFutureSessionsToggles.get(session.getId()); if (ch != null && ch.getValue()) { ret.add(session.getLabel()); }// w w w . j a va 2s. c o m } if (!ret.isEmpty()) return ToolBox.toString(ret); return null; }
From source file:org.unitime.timetable.gwt.client.rooms.RoomFeatureEdit.java
License:Apache License
protected void fillFutureFlags(UpdateRoomFeatureRequest request) { if (iProperties.hasFutureSessions()) { for (AcademicSessionInterface session : iProperties.getFutureSessions()) { CheckBox ch = iFutureSessionsToggles.get(session.getId()); if (ch != null) { Integer flags = RoomCookie.getInstance().getFutureFlags(session.getId()); if (ch.getValue()) { request.addFutureSession(session.getId()); if (flags == null) RoomCookie.getInstance().setFutureFlags(session.getId(), FutureOperation.getFlagDefaultsEnabled()); } else { if (flags != null) RoomCookie.getInstance().setFutureFlags(session.getId(), null); }/*from www.jav a2s. co m*/ } } } }
From source file:org.unitime.timetable.gwt.client.rooms.RoomGroupEdit.java
License:Apache License
protected void fillFutureFlags(UpdateRoomGroupRequest request) { if (iProperties.hasFutureSessions()) { for (AcademicSessionInterface session : iProperties.getFutureSessions()) { CheckBox ch = iFutureSessionsToggles.get(session.getId()); if (ch != null) { Integer flags = RoomCookie.getInstance().getFutureFlags(session.getId()); if (ch.getValue()) { request.addFutureSession(session.getId()); if (flags == null) RoomCookie.getInstance().setFutureFlags(session.getId(), FutureOperation.getFlagDefaultsEnabled()); } else { if (flags != null) RoomCookie.getInstance().setFutureFlags(session.getId(), null); }/* w w w . j a v a 2 s .c om*/ } } } }
From source file:org.unitime.timetable.gwt.client.rooms.RoomsTable.java
License:Apache License
public void setProperties(RoomPropertiesInterface properties) { iProperties = properties;/*from w w w .ja v a 2 s .co m*/ super.clearTable(); List<UniTimeTableHeader> header = new ArrayList<UniTimeTableHeader>(); for (RoomsColumn column : RoomsColumn.values()) { int nrCells = getNbrCells(column); for (int idx = 0; idx < nrCells; idx++) { UniTimeTableHeader h = new UniTimeTableHeader(getColumnName(column, idx), getColumnAlignment(column, idx)); header.add(h); } } if (iSelectable) { header.get(0).addOperation(new Operation() { @Override public void execute() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; ch.setValue(true); } setSelected(row, true); } } @Override public boolean isApplicable() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; if (!ch.getValue()) return true; } } return false; } @Override public boolean hasSeparator() { return false; } @Override public String getName() { return MESSAGES.opSelectAll(); } }); header.get(0).addOperation(new Operation() { @Override public void execute() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; ch.setValue(false); } setSelected(row, false); } } @Override public boolean isApplicable() { for (int row = 1; row < getRowCount(); row++) { Widget w = getWidget(row, 0); if (w != null && w instanceof CheckBox) { CheckBox ch = (CheckBox) w; if (ch.getValue()) return true; } } return false; } @Override public boolean hasSeparator() { return false; } @Override public String getName() { return MESSAGES.opClearSelection(); } }); } if (RoomCookie.getInstance().getFlags(iMode) == 0) { int flags = 0; for (RoomsColumn column : RoomsColumn.values()) { if (iMode.hasColumn(column)) { int nrCells = getNbrCells(column); int cellIdx = getCellIndex(column); for (int idx = 0; idx < nrCells; idx++) { flags += (1 << (cellIdx + idx)); } } } RoomCookie.getInstance().setFlags(iMode, flags); } addRow(null, header); iShowHideOperations.clear(); for (final RoomsColumn column : RoomsColumn.values()) { int nrCells = getNbrCells(column); int cellIdx = getCellIndex(column); for (int idx = 0; idx < nrCells; idx++) { final int colIdx = cellIdx + idx; final String cName = getColumnName(column, idx).replace("<br>", " "); UniTimeTableHeader h = header.get(colIdx); if (hasShowHideOperation(column)) { Operation op = new AriaOperation() { @Override public void execute() { boolean visible = isColumnVisible(colIdx); setColumnVisible(colIdx, !visible); RoomCookie.getInstance().set(iMode, colIdx, !visible); } @Override public boolean isApplicable() { return (iFlags & (1 << colIdx)) != 0; } @Override public boolean hasSeparator() { if (iSelectable && column == RoomsColumn.EXTERNAL_ID) return true; return false; } @Override public String getName() { return isColumnVisible(colIdx) ? MESSAGES.opHide(cName) : MESSAGES.opShow(cName); } @Override public String getAriaLabel() { return isColumnVisible(colIdx) ? ARIA.opHide(cName) : ARIA.opShow(cName); } }; iShowHideOperations.add(op); if (colIdx > 0) header.get(0).addOperation(op); RoomsColumn g = getShowHideGroup(column); if (g == null) { h.addOperation(op); } else { for (RoomsColumn c : RoomsColumn.values()) { if (g.equals(getShowHideGroup(c))) for (int i = 0; i < getNbrCells(c); i++) header.get(getCellIndex(c) + i).addOperation(op); } } } } } iDepartmentOperations.clear(); for (final DeptMode d : DeptMode.values()) { Operation op = new Operation() { @Override public void execute() { RoomCookie.getInstance().setDeptMode(d.ordinal()); refreshTable(); } @Override public boolean isApplicable() { return getRowCount() > 0; } @Override public boolean hasSeparator() { return d.ordinal() == 0; } @Override public String getName() { if (RoomCookie.getInstance().getDeptMode() == d.ordinal()) return MESSAGES.opUncheck(d.getName()); else return MESSAGES.opCheck(d.getName()); } }; iDepartmentOperations.add(op); for (RoomsColumn c : RoomsColumn.values()) { if (hasDepartmentOperation(c)) for (int i = 0; i < getNbrCells(c); i++) header.get(getCellIndex(c) + i).addOperation(op); } } iSortOperations.clear(); for (final RoomsColumn column : RoomsColumn.values()) { if (RoomsComparator.isApplicable(column)) { final UniTimeTableHeader h = header.get(getCellIndex(column)); Operation op = new SortOperation() { @Override public void execute() { if (column == iSortBy) { iAsc = !iAsc; } else { iSortBy = column; iAsc = true; } RoomCookie.getInstance().setSortRoomsBy(getSortBy()); sort(); } @Override public boolean isApplicable() { return getRowCount() > 1 && h.isVisible(); } @Override public boolean hasSeparator() { return true; } @Override public String getName() { return MESSAGES.opSortBy(getColumnName()); } @Override public String getColumnName() { return h.getHTML().replace("<br>", " "); } }; iSortOperations.add(op); h.addOperation(op); } } for (Operation op : getOtherOperations()) header.get(0).addOperation(op); for (int i = 0; i < getCellCount(0); i++) getCellFormatter().setStyleName(0, i, "unitime-ClickableTableHeader"); resetVisibility(); setSortBy(RoomCookie.getInstance().getRoomsSortBy()); setVisible(false); if (iSelectable) { setAllowSelection(true); addMouseClickListener(new MouseClickListener<RoomDetailInterface>() { @Override public void onMouseClick(TableEvent<RoomDetailInterface> event) { selectRoom(event.getRow(), isSelected(event.getRow())); } }); } }
From source file:org.unitime.timetable.gwt.client.widgets.CourseFinderMultipleCourses.java
License:Apache License
@Override public void setValue(RequestedCourse value, final boolean fireEvents) { iCheckedCourses.clear();//ww w . j a v a 2 s . c o m for (int r = 0; r < iCourses.getRowCount(); r++) { CourseAssignment ca = iCourses.getData(r); if (iCourses.getWidget(r, 0) instanceof CheckBox && ca != null) { CheckBox c = (CheckBox) iCourses.getWidget(r, 0); c.setValue(false); c.setText(""); } } String query = (value == null || !value.isCourse() ? "" : value.getCourseName()); iSelectedMethods.clear(); if (iRequired != null) iRequired.setValue(false); for (CheckBox ch : iInstructionalMethods.values()) if (ch.isEnabled()) ch.setValue(false); if (value != null && value.hasSelectedIntructionalMethods()) for (Preference id : value.getSelectedIntructionalMethods()) { iSelectedMethods.add(id); if (id.isRequired() && iRequired != null) iRequired.setValue(true); CheckBox ch = iInstructionalMethods.get(id); if (ch != null && ch.isEnabled()) ch.setValue(true); } if (iDetails != null) for (CourseFinderCourseDetails d : iDetails) d.onSetValue(value); if (query.isEmpty() && !iShowDefaultSuggestions) { iLastQuery = null; iCourses.clearTable(1); iCourses.setEmptyMessage(MESSAGES.courseSelectionNoCourseFilter()); updateCourseDetails(); } else if (!query.equals(iLastQuery)) { iLastQuery = query; iDataProvider.getData(query, new AsyncCallback<Collection<CourseAssignment>>() { public void onFailure(Throwable caught) { iCourses.clearTable(1); iCourses.setEmptyMessage(caught.getMessage()); if (isVisible()) AriaStatus.getInstance().setText(caught.getMessage()); updateCourseDetails(); ResponseEvent.fire(CourseFinderMultipleCourses.this, false); } public void onSuccess(Collection<CourseAssignment> result) { iCourses.clearTable(1); boolean hasCredit = false, hasNote = false; for (final CourseAssignment record : result) { List<Widget> line = new ArrayList<Widget>(); CheckBox ch = new CheckBox(); ch.setValue( iCheckedCourses.contains(new RequestedCourse(record, CONSTANTS.showCourseTitle()))); ch.setText(ch.getValue() ? String.valueOf(iCheckedCourses .indexOf(new RequestedCourse(record, CONSTANTS.showCourseTitle())) + 1) : ""); ch.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { RequestedCourse rc = new RequestedCourse(); rc.setCourseId(record.getCourseId()); rc.setCourseName(MESSAGES.courseName(record.getSubject(), record.getCourseNbr())); if (record.hasTitle() && (!record.hasUniqueName() || iShowCourseTitles)) rc.setCourseName(MESSAGES.courseNameWithTitle(record.getSubject(), record.getCourseNbr(), record.getTitle())); rc.setCourseTitle(record.getTitle()); rc.setCredit(record.guessCreditRange()); if (event.getValue()) { iCheckedCourses.add(rc); } else { iCheckedCourses.remove(rc); } for (int r = 0; r < iCourses.getRowCount(); r++) { CourseAssignment ca = iCourses.getData(r); if (iCourses.getWidget(r, 0) instanceof CheckBox && ca != null) { CheckBox c = (CheckBox) iCourses.getWidget(r, 0); c.setText(c.getValue() ? String.valueOf(iCheckedCourses.indexOf( new RequestedCourse(ca, CONSTANTS.showCourseTitle())) + 1) : ""); } } } }); line.add(ch); line.add(new Label(record.getSubject(), false)); line.add(new Label(record.getCourseNbr(), false)); line.add(new HTML(record.getLimit() == null || record.getLimit() == 0 || record.getEnrollment() == null ? "" : record.getLimit() < 0 ? "∞" : (record.getLimit() - record.getEnrollment()) + " / " + record.getLimit(), false)); line.add(new Label(record.getTitle() == null ? "" : record.getTitle(), false)); if (record.hasCredit()) { Label credit = new Label(record.getCreditAbbv(), false); if (record.hasCredit()) credit.setTitle(record.getCreditText()); line.add(credit); hasCredit = true; } else { line.add(new Label()); } line.add(new Label(record.getNote() == null ? "" : record.getNote())); if (record.hasNote()) hasNote = true; if (record.hasTitle()) { if (record.hasNote()) { line.add(new AriaHiddenLabel( ARIA.courseFinderCourseWithTitleAndNote(record.getSubject(), record.getCourseNbr(), record.getTitle(), record.getNote()))); } else { line.add(new AriaHiddenLabel(ARIA.courseFinderCourseWithTitle(record.getSubject(), record.getCourseNbr(), record.getTitle()))); } } else { if (record.hasNote()) { line.add(new AriaHiddenLabel(ARIA.courseFinderCourseWithNote(record.getSubject(), record.getCourseNbr(), record.getNote()))); } else { line.add(new AriaHiddenLabel( ARIA.courseFinderCourse(record.getSubject(), record.getCourseNbr()))); } } int row = iCourses.addRow(record, line); if (iLastQuery .equalsIgnoreCase(MESSAGES.courseName(record.getSubject(), record.getCourseNbr())) || (record.getTitle() != null && iLastQuery.equalsIgnoreCase(MESSAGES.courseNameWithTitle( record.getSubject(), record.getCourseNbr(), record.getTitle())))) iCourses.setSelected(row, true); } iCourses.setColumnVisible(4, hasCredit); iCourses.setColumnVisible(5, hasNote); if (result.size() == 1) iCourses.setSelected(1, true); if (iCourses.getSelectedRow() >= 0) { scrollToSelectedRow(); if (fireEvents) ValueChangeEvent.fire(CourseFinderMultipleCourses.this, getValue()); } updateCourseDetails(); ResponseEvent.fire(CourseFinderMultipleCourses.this, !result.isEmpty()); } }); } if (iRequired != null) { iRequired.setEnabled(isEnabled() && (iSpecReg == null || iSpecReg.isCanRequire())); iRequired.setVisible(iSpecReg == null || iSpecReg.isCanRequire()); } }