List of usage examples for com.google.gwt.user.client Window getScrollLeft
public static int getScrollLeft()
From source file:org.unitime.timetable.gwt.client.page.Refresh.java
License:Apache License
public static void refreshPage() { String url = Window.Location.getHref(); if (url.indexOf('#') >= 0) url = url.substring(0, url.lastIndexOf('#')); url += "#" + Window.getScrollLeft() + ":" + Window.getScrollTop(); Window.Location.assign(url); new Timer() { @Override/*ww w .j ava2 s. c o m*/ public void run() { Window.Location.reload(); } }.schedule(100); }
From source file:org.unitime.timetable.gwt.client.page.UniTimeMenuBar.java
License:Apache License
private void move(boolean show) { iLastClientWidth = Window.getClientWidth(); iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); iMenu.getElement().getStyle().setWidth(iLastClientWidth - 2, Unit.PX); iMenu.getElement().getStyle().setLeft(iLastScrollLeft, Unit.PX); iMenu.getElement().getStyle().setTop(iLastScrollTop, Unit.PX); iMenu.setVisible(true);/*ww w . j ava 2s . c o m*/ }
From source file:org.unitime.timetable.gwt.client.page.UniTimeMenuBar.java
License:Apache License
private boolean needsMove() { return iLastClientWidth != Window.getClientWidth() || iLastScrollLeft != Window.getScrollLeft() || iLastScrollTop != Window.getScrollTop(); }
From source file:org.unitime.timetable.gwt.client.rooms.RoomDepartmentsEdit.java
License:Apache License
public void show() { UniTimePageLabel.getInstance().setPageName(MESSAGES.pageEditRoomsDepartments()); setVisible(true);//w ww . j a v a 2s . c o m iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); onShow(); Window.scrollTo(0, 0); }
From source file:org.unitime.timetable.gwt.client.rooms.RoomDetail.java
License:Apache License
public void show() { UniTimePageLabel.getInstance().setPageName(MESSAGES.pageRoomDetail()); setVisible(true);// ww w . jav a 2s . c o m iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); onShow(); Window.scrollTo(0, 0); }
From source file:org.unitime.timetable.gwt.client.rooms.RoomEdit.java
License:Apache License
public void show() { UniTimePageLabel.getInstance()/*w ww . jav a 2 s. c o m*/ .setPageName(iRoom.getUniqueId() == null ? MESSAGES.pageAddRoom() : MESSAGES.pageEditRoom()); setVisible(true); iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); onShow(); Window.scrollTo(0, 0); if (iGoogleMap != null && !iGoogleMapInitialized) { iGoogleMapInitialized = true; ScriptInjector.fromUrl("https://maps.google.com/maps/api/js?sensor=false&callback=setupGoogleMap") .setWindow(ScriptInjector.TOP_WINDOW).setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception e) { UniTimeNotifications.error(e.getMessage(), e); iGoogleMap = null; iGoogleMapControl = null; } }).inject(); } else if (iGoogleMap != null) { setMarker(); } }
From source file:org.unitime.timetable.gwt.client.rooms.RoomFeatureEdit.java
License:Apache License
public void show() { UniTimePageLabel.getInstance().setPageName( iFeature.getId() == null ? MESSAGES.pageAddRoomFeature() : MESSAGES.pageEditRoomFeature()); setVisible(true);/*from ww w . j a va 2s. co m*/ iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); onShow(); Window.scrollTo(0, 0); }
From source file:org.unitime.timetable.gwt.client.rooms.RoomGroupEdit.java
License:Apache License
public void show() { UniTimePageLabel.getInstance()//w ww . j a v a2 s . c om .setPageName(iGroup.getId() == null ? MESSAGES.pageAddRoomGroup() : MESSAGES.pageEditRoomGroup()); setVisible(true); iLastScrollLeft = Window.getScrollLeft(); iLastScrollTop = Window.getScrollTop(); onShow(); Window.scrollTo(0, 0); }
From source file:org.unitime.timetable.gwt.client.sectioning.EnrollmentTable.java
License:Apache License
public void showChangeLog(final ClassAssignmentInterface.Student student, final AsyncCallback<Boolean> callback) { iSectioningService.changeLog("id:" + student.getExternalId(), new AsyncCallback<List<ClassAssignmentInterface.SectioningAction>>() { @Override/* w w w . j a va2 s. co m*/ public void onFailure(Throwable caught) { callback.onFailure(caught); } @Override public void onSuccess(List<ClassAssignmentInterface.SectioningAction> logs) { if (logs == null || logs.isEmpty()) { callback.onSuccess(false); return; } final UniTimeTable<ClassAssignmentInterface.SectioningAction> table = new UniTimeTable<ClassAssignmentInterface.SectioningAction>(); table.addRow(null, new UniTimeTableHeader(MESSAGES.colOperation()), new UniTimeTableHeader(MESSAGES.colTimeStamp()), new UniTimeTableHeader(MESSAGES.colResult()), new UniTimeTableHeader(MESSAGES.colUser()), new UniTimeTableHeader(MESSAGES.colMessage())); for (ClassAssignmentInterface.SectioningAction log : logs) { table.addRow(log, new TopCell(log.getOperation()), new TopCell(sTSF.format(log.getTimeStamp())), new TopCell(log.getResult()), new TopCell(log.getUser() == null ? "" : log.getUser()), new HTML(log.getMessage() == null ? "" : log.getMessage())); } table.addMouseClickListener( new MouseClickListener<ClassAssignmentInterface.SectioningAction>() { @Override public void onMouseClick(TableEvent<SectioningAction> event) { if (event.getData() != null && event.getData().getProto() != null) { final HTML widget = new HTML(event.getData().getProto()); final ScrollPanel scroll = new ScrollPanel(widget); scroll.setHeight(((int) (0.8 * Window.getClientHeight())) + "px"); scroll.setStyleName("unitime-ScrollPanel"); final UniTimeDialogBox dialog = new UniTimeDialogBox(true, false); dialog.setWidget(scroll); dialog.setText(MESSAGES.dialogChangeMessage(student.getName())); dialog.setEscapeToHide(true); dialog.addOpenHandler(new OpenHandler<UniTimeDialogBox>() { @Override public void onOpen(OpenEvent<UniTimeDialogBox> event) { RootPanel.getBodyElement().getStyle() .setOverflow(Overflow.HIDDEN); scroll.setHeight(Math.min(widget.getElement().getScrollHeight(), Window.getClientHeight() * 80 / 100) + "px"); dialog.setPopupPosition( Math.max( Window.getScrollLeft() + (Window.getClientWidth() - dialog.getOffsetWidth()) / 2, 0), Math.max( Window.getScrollTop() + (Window.getClientHeight() - dialog.getOffsetHeight()) / 2, 0)); } }); dialog.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { table.clearHover(); RootPanel.getBodyElement().getStyle() .setOverflow(Overflow.AUTO); } }); dialog.center(); } } }); final UniTimeDialogBox dialog = new UniTimeDialogBox(true, false); final ScrollPanel scroll = new ScrollPanel(table); scroll.setHeight(((int) (0.8 * Window.getClientHeight())) + "px"); scroll.setStyleName("unitime-ScrollPanel"); dialog.setWidget(scroll); dialog.setText(MESSAGES.dialogChangeLog(student.getName())); dialog.setEscapeToHide(true); dialog.addOpenHandler(new OpenHandler<UniTimeDialogBox>() { @Override public void onOpen(OpenEvent<UniTimeDialogBox> event) { RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN); scroll.setHeight(Math.min(table.getElement().getScrollHeight(), Window.getClientHeight() * 80 / 100) + "px"); dialog.setPopupPosition( Math.max( Window.getScrollLeft() + (Window.getClientWidth() - dialog.getOffsetWidth()) / 2, 0), Math.max( Window.getScrollTop() + (Window.getClientHeight() - dialog.getOffsetHeight()) / 2, 0)); } }); dialog.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { table.clearHover(); RootPanel.getBodyElement().getStyle().setOverflow(Overflow.AUTO); } }); callback.onSuccess(true); dialog.center(); } }); }
From source file:org.unitime.timetable.gwt.client.sectioning.SectioningStatusPage.java
License:Apache License
public SectioningStatusPage(boolean online) { iOnline = online;// w ww. j a v a2 s . c o m iPanel = new VerticalPanel(); iSectioningPanel = new VerticalPanel(); iFilterPanel = new HorizontalPanel(); iFilterPanel.setSpacing(3); Label filterLabel = new Label(MESSAGES.filter()); iFilterPanel.add(filterLabel); iFilterPanel.setCellVerticalAlignment(filterLabel, HasVerticalAlignment.ALIGN_MIDDLE); iFilter = new SectioningStatusFilterBox(online); iFilterPanel.add(iFilter); iSearch = new Button(MESSAGES.buttonSearch()); iSearch.setAccessKey('s'); iSearch.addStyleName("unitime-NoPrint"); iFilterPanel.add(iSearch); iFilterPanel.setCellVerticalAlignment(iSearch, HasVerticalAlignment.ALIGN_TOP); iLoadingImage = new Image(RESOURCES.loading_small()); iLoadingImage.setVisible(false); iFilterPanel.add(iLoadingImage); iFilterPanel.setCellVerticalAlignment(iLoadingImage, HasVerticalAlignment.ALIGN_MIDDLE); iSectioningPanel.add(iFilterPanel); iSectioningPanel.setCellHorizontalAlignment(iFilterPanel, HasHorizontalAlignment.ALIGN_CENTER); iCourseTable = new UniTimeTable<EnrollmentInfo>(); iStudentTable = new UniTimeTable<StudentInfo>(); iLogTable = new UniTimeTable<SectioningAction>(); VerticalPanel courseTableWithHint = new VerticalPanel(); courseTableWithHint.add(iCourseTable); iCourseTableHint = new HTML(MESSAGES.sectioningStatusReservationHint()); iCourseTableHint.setStyleName("unitime-Hint"); courseTableWithHint.add(iCourseTableHint); courseTableWithHint.setCellHorizontalAlignment(iCourseTableHint, HasHorizontalAlignment.ALIGN_RIGHT); VerticalPanel studentTableWithHint = new VerticalPanel(); studentTableWithHint.add(iStudentTable); iStudentTableHint = new HTML(MESSAGES.sectioningStatusPriorityHint()); iStudentTableHint.setStyleName("unitime-Hint"); studentTableWithHint.add(iStudentTableHint); studentTableWithHint.setCellHorizontalAlignment(iStudentTableHint, HasHorizontalAlignment.ALIGN_RIGHT); iTabPanel = new UniTimeTabPanel(); iTabPanel.add(courseTableWithHint, MESSAGES.tabEnrollments(), true); iTabPanel.selectTab(0); iTabPanel.add(studentTableWithHint, MESSAGES.tabStudents(), true); iTabPanel.setVisible(false); iTabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { iTabIndex = event.getSelectedItem(); loadDataIfNeeded(); } }); iTabPanelWithFocus = new FocusPanel(iTabPanel); iTabPanelWithFocus.setStyleName("unitime-FocusPanel"); iSectioningPanel.add(iTabPanelWithFocus); iTabPanelWithFocus.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeEvent().getCtrlKey() && (event.getNativeKeyCode() == 'e' || event.getNativeKeyCode() == 'E')) { iTabPanel.selectTab(0); event.preventDefault(); } if (event.getNativeEvent().getCtrlKey() && (event.getNativeKeyCode() == 's' || event.getNativeKeyCode() == 'S')) { iTabPanel.selectTab(1); event.preventDefault(); } if (event.getNativeEvent().getCtrlKey() && (event.getNativeKeyCode() == 'l' || event.getNativeKeyCode() == 'L')) { iTabPanel.selectTab(2); event.preventDefault(); } } }); iSectioningPanel.setWidth("100%"); iPanel.add(iSectioningPanel); iError = new HTML(); iError.setStyleName("unitime-ErrorMessage"); iError.setVisible(false); iPanel.add(iError); iPanel.setCellHorizontalAlignment(iError, HasHorizontalAlignment.ALIGN_CENTER); initWidget(iPanel); iSearch.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { loadData(); } }); iFilter.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (iFilter.getValue().equals(iLastFilterOnEnter) && !iFilter.getValue().equals(iCourseFilter)) loadData(); else iLastFilterOnEnter = iFilter.getValue(); } } }); iCourseTable.addMouseClickListener(new MouseClickListener<ClassAssignmentInterface.EnrollmentInfo>() { @Override public void onMouseClick(final TableEvent<EnrollmentInfo> event) { if (event.getData() == null || event.getData().getCourseId() == null) return; // header or footer iCourseTable.clearHover(); setLoading(true); final Long id = (event.getData().getConfigId() == null ? event.getData().getOfferingId() : -event.getData().getClazzId()); iError.setVisible(false); if (event.getData().getConfigId() == null) LoadingWidget.getInstance().show(MESSAGES.loadingEnrollments( MESSAGES.course(event.getData().getSubject(), event.getData().getCourseNbr()))); else LoadingWidget.getInstance() .show(MESSAGES.loadingEnrollments( MESSAGES.clazz(event.getData().getSubject(), event.getData().getCourseNbr(), event.getData().getSubpart(), event.getData().getClazz()))); if (iOnline) { iSectioningService.canApprove(id, new AsyncCallback<List<Long>>() { @Override public void onSuccess(final List<Long> courseIdsCanApprove) { iSectioningService.findEnrollments(iOnline, iCourseFilter, iCourseFilterRequest, event.getData().getCourseId(), event.getData().getClazzId(), new AsyncCallback<List<Enrollment>>() { @Override public void onFailure(Throwable caught) { LoadingWidget.getInstance().hide(); UniTimeNotifications.error(caught); setLoading(false); iError.setHTML(caught.getMessage()); iError.setVisible(true); ToolBox.checkAccess(caught); } @Override public void onSuccess(List<Enrollment> result) { LoadingWidget.getInstance().hide(); setLoading(false); iEnrollmentTable.clear(); iEnrollmentTable.setId(id); iEnrollmentTable.populate(result, courseIdsCanApprove); if (event.getData().getConfigId() == null) iEnrollmentDialog.setText(MESSAGES.titleEnrollments( MESSAGES.course(event.getData().getSubject(), event.getData().getCourseNbr()))); else iEnrollmentDialog.setText(MESSAGES.titleEnrollments(MESSAGES.clazz( event.getData().getSubject(), event.getData().getCourseNbr(), event.getData().getSubpart(), event.getData().getClazz()))); iEnrollmentDialog.center(); } }); } @Override public void onFailure(Throwable caught) { LoadingWidget.getInstance().hide(); UniTimeNotifications.error(caught); setLoading(false); iError.setHTML(caught.getMessage()); iError.setVisible(true); ToolBox.checkAccess(caught); } }); } else { iSectioningService.findEnrollments(iOnline, iCourseFilter, iCourseFilterRequest, event.getData().getCourseId(), event.getData().getClazzId(), new AsyncCallback<List<Enrollment>>() { @Override public void onFailure(Throwable caught) { LoadingWidget.getInstance().hide(); UniTimeNotifications.error(caught); setLoading(false); iError.setHTML(caught.getMessage()); iError.setVisible(true); ToolBox.checkAccess(caught); } @Override public void onSuccess(List<Enrollment> result) { LoadingWidget.getInstance().hide(); setLoading(false); iEnrollmentTable.clear(); iEnrollmentTable.setId(id); iEnrollmentTable.populate(result, null); if (event.getData().getConfigId() == null) iEnrollmentDialog.setText(MESSAGES.titleEnrollments(MESSAGES.course( event.getData().getSubject(), event.getData().getCourseNbr()))); else iEnrollmentDialog.setText(MESSAGES.titleEnrollments(MESSAGES.clazz( event.getData().getSubject(), event.getData().getCourseNbr(), event.getData().getSubpart(), event.getData().getClazz()))); iEnrollmentDialog.center(); } }); } } }); iStudentTable.addMouseClickListener(new MouseClickListener<StudentInfo>() { @Override public void onMouseClick(final TableEvent<StudentInfo> event) { if (event.getData() == null || event.getData().getStudent() == null) return; // header or footer iStudentTable.clearHover(); LoadingWidget.getInstance() .show(MESSAGES.loadingEnrollment(event.getData().getStudent().getName())); iError.setVisible(false); iEnrollmentTable.showStudentSchedule(event.getData().getStudent(), new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { LoadingWidget.getInstance().hide(); iError.setHTML(caught.getMessage()); iError.setVisible(true); } @Override public void onSuccess(Boolean result) { LoadingWidget.getInstance().hide(); } }); } }); iLogTable.addMouseClickListener(new MouseClickListener<ClassAssignmentInterface.SectioningAction>() { @Override public void onMouseClick(TableEvent<SectioningAction> event) { if (event.getData() != null && event.getData().getProto() != null) { final HTML widget = new HTML(event.getData().getProto()); final ScrollPanel scroll = new ScrollPanel(widget); scroll.setHeight(((int) (0.8 * Window.getClientHeight())) + "px"); scroll.setStyleName("unitime-ScrollPanel"); final UniTimeDialogBox dialog = new UniTimeDialogBox(true, false); dialog.setWidget(scroll); dialog.setText(MESSAGES.dialogChangeMessage(event.getData().getStudent().getName())); dialog.setEscapeToHide(true); dialog.addOpenHandler(new OpenHandler<UniTimeDialogBox>() { @Override public void onOpen(OpenEvent<UniTimeDialogBox> event) { RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN); scroll.setHeight(Math.min(widget.getElement().getScrollHeight(), Window.getClientHeight() * 80 / 100) + "px"); dialog.setPopupPosition( Math.max(Window.getScrollLeft() + (Window.getClientWidth() - dialog.getOffsetWidth()) / 2, 0), Math.max( Window.getScrollTop() + (Window.getClientHeight() - dialog.getOffsetHeight()) / 2, 0)); } }); dialog.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { iLogTable.clearHover(); RootPanel.getBodyElement().getStyle().setOverflow(Overflow.AUTO); } }); dialog.center(); } } }); History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { iCourseTable.clearTable(); iStudentTable.clearTable(); iLogTable.clearTable(); if (event.getValue().endsWith("@")) { iFilter.setValue(event.getValue().substring(0, event.getValue().length() - 1)); iTabPanel.selectTab(1); } else if (event.getValue().endsWith("$")) { iFilter.setValue(event.getValue().substring(0, event.getValue().length() - 1)); iTabPanel.selectTab(2); } else { iFilter.setValue(event.getValue()); if (iTabIndex != 0) iTabPanel.selectTab(0); else loadData(); } } }); iEnrollmentTable = new EnrollmentTable(false, iOnline); iEnrollmentScroll = new ScrollPanel(iEnrollmentTable); iEnrollmentScroll.setHeight(((int) (0.8 * Window.getClientHeight())) + "px"); iEnrollmentScroll.setStyleName("unitime-ScrollPanel"); iEnrollmentDialog = new UniTimeDialogBox(true, false); iEnrollmentDialog.setEscapeToHide(true); iEnrollmentDialog.setWidget(iEnrollmentScroll); iEnrollmentDialog.addOpenHandler(new OpenHandler<UniTimeDialogBox>() { @Override public void onOpen(OpenEvent<UniTimeDialogBox> event) { RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN); iEnrollmentScroll.setHeight(Math.min(iEnrollmentTable.getElement().getScrollHeight(), Window.getClientHeight() * 80 / 100) + "px"); iEnrollmentDialog.setPopupPosition( Math.max(Window.getScrollLeft() + (Window.getClientWidth() - iEnrollmentDialog.getOffsetWidth()) / 2, 0), Math.max(Window.getScrollTop() + (Window.getClientHeight() - iEnrollmentDialog.getOffsetHeight()) / 2, 0)); } }); iEnrollmentTable.getHeader().addButton("close", MESSAGES.buttonClose(), new ClickHandler() { @Override public void onClick(ClickEvent event) { iEnrollmentDialog.hide(); } }); iEnrollmentDialog.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { RootPanel.getBodyElement().getStyle().setOverflow(Overflow.AUTO); } }); if (iOnline) { iSectioningService.getProperties(null, new AsyncCallback<SectioningProperties>() { @Override public void onSuccess(SectioningProperties result) { iProperties = result; if (iProperties.isChangeLog()) iTabPanel.add(iLogTable, MESSAGES.tabChangeLog(), true); checkLastQuery(); } @Override public void onFailure(Throwable caught) { iError.setHTML(caught.getMessage()); iError.setVisible(true); } }); } else { checkLastQuery(); } iStatus = new UniTimeWidget<ListBox>(new ListBox()); iStatus.getWidget().addItem(""); iStatus.getWidget().setSelectedIndex(0); iSectioningService.lookupStudentSectioningStates(new AsyncCallback<Map<String, String>>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(Map<String, String> result) { iStates = result; for (final String ref : new TreeSet<String>(iStates.keySet())) { iStatus.getWidget().addItem(iStates.get(ref), ref); } for (int i = 0; i < iStatus.getWidget().getItemCount(); i++) { if ("Cancelled".equalsIgnoreCase(iStatus.getWidget().getValue(i))) { iStatus.getWidget().setSelectedIndex(i); break; } } } }); iSubject = new UniTimeTextBox(512, 473); iSubject.setText(MESSAGES.defaulSubject()); iCC = new UniTimeTextBox(512, 473); iMessage = new TextArea(); iMessage.setStyleName("unitime-TextArea"); iMessage.setVisibleLines(10); iMessage.setCharacterWidth(80); }