List of usage examples for com.google.gwt.user.client.ui Label Label
protected Label(Element element)
From source file:cimav.client.view.nomina.HorasExtrasUI.java
private void buildGrid() { List<HoraExtra> list = new ArrayList<>(); provider = new ListDataProvider<>(list); ICustomDataGridResource dataGridResource = GWT.create(ICustomDataGridResource.class); dataGridResource.dataGridStyle().ensureInjected(); dataGrid = new DataGrid<>(60, dataGridResource); //dataGrid = new DataGrid<>(provider.getKeyProvider()); dataGrid.getElement().setId("idDataGrid"); dataGrid.setAutoHeaderRefreshDisabled(true); dataGrid.setEmptyTableWidget(new Label("Sin Horas Extras")); dataGrid.setPageSize(20);// w w w . ja v a2s .c o m diaCell = new DatePickerCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM)); horasCell = new NomCantidadInputCell(); initTableColumns(); // Add the CellList to the adapter in the database. provider.addDataDisplay(dataGrid); dataGrid.addRowHoverHandler(new RowHoverEvent.Handler() { @Override public void onRowHover(RowHoverEvent event) { TableRowElement rowEle = event.getHoveringRow(); Element removeHoraExtraEle = rowEle.getElementsByTagName("a").getItem(0); if (event.isUnHover()) { GQuery.$(removeHoraExtraEle).css(CSS.VISIBILITY.with(Style.Visibility.HIDDEN)); } else { GQuery.$(removeHoraExtraEle).css(CSS.VISIBILITY.with(Style.Visibility.VISIBLE)); } } }); }
From source file:cimav.client.view.nomina.NominaFaltasUI.java
private void buildGrid() { List<Incidencia> list = new ArrayList<>(); provider = new ListDataProvider<>(list); ICustomDataGridResource dataGridResource = GWT.create(ICustomDataGridResource.class); dataGridResource.dataGridStyle().ensureInjected(); dataGrid = new DataGrid<>(60, dataGridResource); //dataGrid = new DataGrid<>(provider.getKeyProvider()); dataGrid.getElement().setId("idDataGrid"); dataGrid.setAutoHeaderRefreshDisabled(true); dataGrid.setEmptyTableWidget(new Label("Sin incidencias")); dataGrid.setPageSize(20);//from ww w. j a va 2 s .c o m fechaInicioCell = new DatePickerCell(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM)); diasCell = new NomIntegerInputCell("80"); folioCell = new NomTextInputCell(); initTableColumns(); // // Add the CellList to the adapter in the database. provider.addDataDisplay(dataGrid); dataGrid.addRowHoverHandler(new RowHoverEvent.Handler() { @Override public void onRowHover(RowHoverEvent event) { TableRowElement rowEle = event.getHoveringRow(); Element removeFaltaEle = rowEle.getElementsByTagName("a").getItem(0); if (event.isUnHover()) { GQuery.$(removeFaltaEle).css(CSS.VISIBILITY.with(Style.Visibility.HIDDEN)); } else { GQuery.$(removeFaltaEle).css(CSS.VISIBILITY.with(Style.Visibility.VISIBLE)); } } }); }
From source file:cimav.client.view.nomina.NominaMovimientosUI.java
private void buildGrid() { List<Movimiento> nominaQuincenalList = new ArrayList<>(); provider = new ListDataProvider<>(nominaQuincenalList); ICustomDataGridResource dataGridResource = GWT.create(ICustomDataGridResource.class); dataGridResource.dataGridStyle().ensureInjected(); dataGrid = new DataGrid<>(60, dataGridResource); dataGrid.setAutoHeaderRefreshDisabled(true); dataGrid.setEmptyTableWidget(new Label("Sin movimientos de momento")); dataGrid.setPageSize(20);//from www . ja va 2 s . c o m dataGrid.setMinimumTableWidth(400, Style.Unit.PX); initTableColumns(); provider.addDataDisplay(dataGrid); }
From source file:cimav.client.view.nomina.NominaRepercucionesUI.java
private void buildGrid() { List<Movimiento> nominaQuincenalList = new ArrayList<>(); provider = new ListDataProvider<>(nominaQuincenalList); ICustomDataGridResource dataGridResource = GWT.create(ICustomDataGridResource.class); dataGridResource.dataGridStyle().ensureInjected(); dataGrid = new DataGrid<>(60, dataGridResource); dataGrid.setAutoHeaderRefreshDisabled(true); dataGrid.setEmptyTableWidget(new Label("Sin repercuciones de momento")); dataGrid.setPageSize(20);/* ww w. j a va 2 s.com*/ dataGrid.setMinimumTableWidth(400, Style.Unit.PX); initTableColumns(); provider.addDataDisplay(dataGrid); }
From source file:cimav.client.view.nomina.NominaSaldoUI.java
private void buildGrid() { List<Movimiento> nominaQuincenalList = new ArrayList<>(); provider = new ListDataProvider<>(nominaQuincenalList); ICustomDataGridResource dataGridResource = GWT.create(ICustomDataGridResource.class); dataGridResource.dataGridStyle().ensureInjected(); dataGrid = new DataGrid<>(60, dataGridResource); //dataGrid = new DataGrid<>(provider.getKeyProvider()); dataGrid.getElement().setId("idDataGrid"); dataGrid.setAutoHeaderRefreshDisabled(true); dataGrid.setEmptyTableWidget(new Label("Sin movimientos")); dataGrid.setPageSize(20);//from ww w. j a v a 2s.c om quincenasCell = new NomIntegerInputCell("24"); saldoCell = new NomCantidadInputCell(); permanenteCell = new CheckboxCell(); initTableColumns(); // Add the CellList to the adapter in the database. provider.addDataDisplay(dataGrid); dataGrid.addRowHoverHandler(new RowHoverEvent.Handler() { @Override public void onRowHover(RowHoverEvent event) { TableRowElement rowEle = event.getHoveringRow(); Element removeSaldoEle = rowEle.getElementsByTagName("a").getItem(0); if (event.isUnHover()) { GQuery.$(removeSaldoEle).css(CSS.VISIBILITY.with(Style.Visibility.HIDDEN)); } else { GQuery.$(removeSaldoEle).css(CSS.VISIBILITY.with(Style.Visibility.VISIBLE)); } } }); }
From source file:cimav.visorglass.client.widgets.PanelesLayout.java
License:Apache License
public PanelesLayout(GWTServiceAsync gwtServiceAsync) { initWidget(uiBinder.createAndBindUi(this)); this.gwtServiceAsync = gwtServiceAsync; // Crea el Modelo arbolModel = new ArbolModel(); // Crea el node Root TreeItem root = new TreeItem(SafeHtmlUtils.fromString("<h2>La Root</h2>")); // Cambia Recursos del Arbol CellTree.Resources cellTreeResources = GWT.create(ICellTreeResources.class); CellTree.CellTreeMessages cellTreeMsgs = GWT.<CellTree.CellTreeMessages>create(ICellTreeMessages.class); // Crea el arbol cellArbol = new CellTree(arbolModel, root, cellTreeResources, cellTreeMsgs); cellArbol.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.ENABLED); // agrega el arbol a su Panel //flowPanelArbol.add(cellArbol); cellArbol.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); cellArbol.getElement().getStyle().setTop(10, Style.Unit.PX); cellArbol.getElement().getStyle().setLeft(0, Style.Unit.PX); cellArbol.getElement().getStyle().setBottom(0, Style.Unit.PX); cellArbol.getElement().getStyle().setRight(0, Style.Unit.PX); scrollPanelArbol.add(cellArbol);//from w w w . ja v a 2s.c o m /* Inyectarle style absolute al Abuelo para que funcione el scroll del cellArbol */ Element divAbue2 = cellArbol.getElement().getParentElement().getParentElement(); divAbue2.getStyle().setPosition(Style.Position.ABSOLUTE); divAbue2.getStyle().setTop(0, Style.Unit.PX); divAbue2.getStyle().setLeft(0, Style.Unit.PX); divAbue2.getStyle().setBottom(0, Style.Unit.PX); divAbue2.getStyle().setRight(0, Style.Unit.PX); // Crea CellList de Documentos, sus resources, su Celda, su SelectionModel y su Listener. documentoSelectionModel = new SingleSelectionModel<Documento>(); CellList.Resources cellListResources = GWT.create(ICellListResources.class); documentosCellList = new CellList<Documento>(new DocumentoCell(documentoSelectionModel), cellListResources); documentosCellList.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.ENABLED); documentosCellList.setSelectionModel(documentoSelectionModel); documentosCellList.setPageSize(500); // listener documentoSelectionModel.addSelectionChangeHandler(new DocumentoSelectionHandler()); // Style absolute documentosCellList.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); documentosCellList.getElement().getStyle().setTop(0, Style.Unit.PX); documentosCellList.getElement().getStyle().setLeft(0, Style.Unit.PX); documentosCellList.getElement().getStyle().setBottom(0, Style.Unit.PX); documentosCellList.getElement().getStyle().setRight(0, Style.Unit.PX); // Agregarlo a su panel scrollPanelDocumentos.add(documentosCellList); /* Inyectarle style absolute al Abuelo para que funcione el scroll del cellList */ Element divAbue = documentosCellList.getElement().getParentElement().getParentElement(); divAbue.getStyle().setPosition(Style.Position.ABSOLUTE); divAbue.getStyle().setTop(0, Style.Unit.PX); divAbue.getStyle().setLeft(0, Style.Unit.PX); divAbue.getStyle().setBottom(0, Style.Unit.PX); divAbue.getStyle().setRight(0, Style.Unit.PX); // Listener de los Botones de Paneles btnArbol.addClickHandler(new BtnArbolClickHandler()); btnDocumentos.addClickHandler(new BtnDocumentosClickHandler()); btnVisor.addClickHandler(new BtnVisorClickHandler()); // Arega etiquetas flotantes y sus listeners Label arbolLabel = new Label("Arbol"); arbolLabel.setStyleName("jsfiddle_label"); arbolLabel.addMouseOverHandler(new JSFiddlerMouseOver()); arbolLabel.addMouseOutHandler(new JSFiddlerMouseOut()); flowPanelArbol.add(arbolLabel); documentosLabel = new Label("Documentos"); documentosLabel.setStyleName("jsfiddle_label"); documentosLabel.addMouseOverHandler(new JSFiddlerMouseOver()); documentosLabel.addMouseOutHandler(new JSFiddlerMouseOut()); flowPanelDecoratorDocumentos.add(documentosLabel); Label visorLabel = new Label("Visor"); visorLabel.setStyleName("jsfiddle_label"); visorLabel.addMouseOverHandler(new JSFiddlerMouseOver()); visorLabel.addMouseOutHandler(new JSFiddlerMouseOut()); flowPanelDecoratorVisor.add(visorLabel); frameDocViewer.addLoadHandler(new FrameLoadHandler()); reloadIcon = new Icon(IconType.ROTATE_RIGHT); reloadIcon.setSize(IconSize.LARGE); reloadIcon.setMuted(false); reloadIcon.setSpin(false); reloadIcon.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); reloadIcon.getElement().getStyle().setTop(3, Style.Unit.PX); reloadIcon.getElement().getStyle().setLeft(3, Style.Unit.PX); reloadIcon.getElement().getStyle().setColor("gray"); reloadIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER); reloadIcon.addDomHandler(new ReloadGoogleDocMouseDownHandler(), MouseDownEvent.getType()); // flowPanelDecoratorVisor.add(reloadIcon); // NOTE Quitar documentos btnDocumentos.setVisible(false); }
From source file:cl.uai.client.EMarkingWeb.java
License:Open Source License
/** * This is the entry point method./*from w ww . j a v a 2 s .c om*/ */ public void onModuleLoad() { // Pointer to CSS manager. It has to go first! GWT.<Resources>create(Resources.class).css().ensureInjected(); // Log messages String msg = "\nInitializing EMarking 3.0\n" + "Platform: " + Navigator.getPlatform() + "\n" + "User agent: " + Navigator.getUserAgent() + "\n" + "App name: " + Navigator.getAppName() + "\n" + "App code name: " + Navigator.getAppCodeName() + "\n" + "App version: " + Navigator.getAppVersion(); logger.fine(msg); // List of errors after trying to initialize ArrayList<String> errors = new ArrayList<String>(); // Get id for eMarkingWeb's DIV tag final String eMarkingDivId = "emarking"; if (RootPanel.get(eMarkingDivId) == null) { errors.add("Can not initalize. EMarking requires an existing DIV tag with id: emarking."); return; } RootPanel.get(eMarkingDivId).add(new Label("Loading")); int draftId = 0; int preferredWidth = 860; boolean showRubric = true; boolean showColors = false; try { // First, if there's a URL parameter, replace the value if (Window.Location.getParameter("id") != null) { draftId = Integer.parseInt(Window.Location.getParameter("id")); } // Validate that the submission id is a positive integer if (draftId <= 0) { errors.add("Submission id must be a non negative integer."); } // Reading the image width float imagewidth = 0; if (RootPanel.get(eMarkingDivId).getElement().getAttribute("imagewidth") != null) imagewidth = Float.parseFloat(RootPanel.get(eMarkingDivId).getElement().getAttribute("imagewidth")); String cookie_width = Cookies.getCookie("emarking_width"); if (cookie_width != null) { preferredWidth = Integer.parseInt(cookie_width); } else if (imagewidth > 0) { preferredWidth = (int) (imagewidth / 0.6f); } // Validate that the preferredWidth is a positive integer greater than 10 if (preferredWidth <= 10) { errors.add("Preferred width should be a positive integer greater than 10."); } // Validate that the preferredWidth is a positive integer greater than 10 if (preferredWidth <= 10) { errors.add("Preferred width should be a positive integer greater than 10."); } String cookie_showrubric = Cookies.getCookie("emarking_showrubric"); if (cookie_showrubric != null) { showRubric = Integer.parseInt(cookie_showrubric) == 1; } String cookie_showcolors = Cookies.getCookie("emarking_showcolors"); if (cookie_showcolors != null) { showColors = Integer.parseInt(cookie_showcolors) == 1; } } catch (Exception e) { logger.severe(e.getMessage()); errors.add( "Error in HTML for eMarkingWeb can not initalize. Invalid submissionId value (must be integer)."); } // Read div attribute for readonly String moodleurl = null; if (RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl") != null) moodleurl = RootPanel.get(eMarkingDivId).getElement().getAttribute("moodleurl"); logger.fine("\nShowRubric: " + showRubric + "\nShow colors:" + showColors + "\nPreferred width:" + preferredWidth + "\nMoodle ajax url: " + moodleurl); if (moodleurl == null) errors.add("Invalid Moodle ajax url"); // If there are errors die with a configuration message if (errors.size() > 0) { Label errorsLabel = new Label(); String text = ""; for (int i = 0; i < errors.size(); i++) { text += "\n" + errors.get(i); } errorsLabel.setText(text); errorsLabel.setTitle("Fatal error while initializing eMarking-Web"); RootPanel.get(eMarkingDivId).clear(); RootPanel.get(eMarkingDivId).add(errorsLabel); } else { // Set eMarking's main interface submission id according to HTML MarkingInterface.setDraftId(draftId); EMarkingConfiguration.setShowRubricOnLoad(showRubric); EMarkingConfiguration.setColoredRubric(showColors); // Ajax URL in moodle EMarkingConfiguration.setMoodleUrl(moodleurl); // Automagically resize popup to use most of the window int width = screenWidth(); int height = screenHeight(); // Preferred width can not be bigger than the screen if (width < preferredWidth) { preferredWidth = width; } // Resize the popup window and move it to the top left corner Window.resizeTo(preferredWidth, height); Window.moveTo(0, 0); // Initialize eMarking's interface markingInterface = new MarkingInterface(); // Add eMarking to the browser RootPanel.get(eMarkingDivId).clear(); RootPanel.get(eMarkingDivId).add(markingInterface); RootPanel.getBodyElement().focus(); } }
From source file:cl.uai.client.page.EditMarkDialog.java
License:Open Source License
/** * Creates a comment dialog at a specific position * //from ww w . j av a2 s.c o m * @param posx Top position for the dialog * @param posy Left position for the dialog * @param level An optional rubric level in case we are editing one */ public EditMarkDialog(int posx, int posy, int level, int regradeid) { super(true, false); this.regradeId = regradeid; this.levelId = level; Level lvl = MarkingInterface.submissionData.getLevelById(levelId); if (EMarkingConfiguration.getKeywords() != null && EMarkingConfiguration.getKeywords().length() > 0) { logger.fine("Keywords: " + EMarkingConfiguration.getKeywords()); } if (!EMarkingConfiguration.getKeywords().equals("") && (level > 0 || regradeid > 0)) { feedbackArray = new ArrayList<FeedbackObject>(); feedbackPanel = new FeedbackInterface(); feedbackPanel.setParent(this); } else { simplePanel = true; } superPanel = new HorizontalPanel(); superPanel.addStyleName(Resources.INSTANCE.css().feedbackdialog()); feedbackForStudent = new VerticalPanel(); feedbackForStudent.addStyleName(Resources.INSTANCE.css().feedbackforstudent()); feedbackSummary = new ScrollPanel(feedbackForStudent); feedbackSummary.addStyleName(Resources.INSTANCE.css().feedbacksummary()); mainPanel = new VerticalPanel(); mainPanel.addStyleName(Resources.INSTANCE.css().editmarkdialog()); // Adds the CSS style and other settings this.addStyleName(Resources.INSTANCE.css().commentdialog()); this.setAnimationEnabled(true); this.setGlassEnabled(true); bonusTxt = new TextBox(); bonusTxt.addStyleName(Resources.INSTANCE.css().bonuslist()); this.levelsList = new ListBox(); this.levelsList.addStyleName(Resources.INSTANCE.css().levelslist()); this.levelsList.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { int levelid = Integer.parseInt(levelsList.getValue(levelsList.getSelectedIndex())); levelId = levelid; Level lvl = MarkingInterface.submissionData.getLevelById(levelId); setBonus(lvl.getBonus()); } }); // If there's a rubric level we should edit a Mark // otherwise we are just editing its comment if (this.levelId == 0) { this.setHTML(MarkingInterface.messages.AddEditComment()); } else { this.setHTML(MarkingInterface.messages.AddEditMark() + "<br/>" + lvl.getCriterion().getDescription()); } // Position the dialog if (simplePanel) { this.setPopupPosition(posx, posy); } else { // The Dialog is more big, so we need to fix the position this.setPopupPosition((int) (Window.getClientWidth() * 0.08), (int) (Window.getClientHeight() * 0.15)); } if (this.levelId > 0) { loadLevelsList(); HorizontalPanel hpanelLevels = new HorizontalPanel(); hpanelLevels.setWidth("100%"); Label messages = new Label(MarkingInterface.messages.Level()); hpanelLevels.add(messages); hpanelLevels.add(levelsList); hpanelLevels.setCellHorizontalAlignment(levelsList, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanelLevels); mainPanel.setCellHorizontalAlignment(hpanelLevels, HasHorizontalAlignment.ALIGN_RIGHT); } // Save button Button btnSave = new Button(MarkingInterface.messages.Save()); btnSave.addStyleName(Resources.INSTANCE.css().btnsave()); btnSave.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (levelId > 0 && !bonusIsValid()) { Window.alert(MarkingInterface.messages.InvalidBonusValue()); return; } cancelled = false; hide(); } }); // Cancel button Button btnCancel = new Button(MarkingInterface.messages.Cancel()); btnSave.addStyleName(Resources.INSTANCE.css().btncancel()); btnCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { cancelled = true; hide(); } }); // The comment text box TextArea txt = new TextArea(); txt.setVisibleLines(5); txt.getElement().getStyle().setMarginBottom(5, Unit.PT); txtComment = new SuggestBox(EMarkingWeb.markingInterface.previousCommentsOracle, txt); txtComment.setAutoSelectEnabled(false); txtComment.addStyleName(Resources.INSTANCE.css().editmarksuggestbox()); HorizontalPanel hpanelComment = new HorizontalPanel(); hpanelComment.setWidth("100%"); hpanelComment.add(new Label(MarkingInterface.messages.Comment())); hpanelComment.add(txtComment); hpanelComment.setCellHorizontalAlignment(txtComment, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanelComment); mainPanel.setCellHorizontalAlignment(hpanelComment, HasHorizontalAlignment.ALIGN_RIGHT); // If the rubric level is not null then create the bonus list and add it to the dialog if (this.levelId > 0) { setBonus(lvl.getBonus()); HorizontalPanel hpanelBonus = new HorizontalPanel(); hpanelBonus.setWidth("100%"); hpanelBonus.add(new Label(MarkingInterface.messages.SetBonus())); hpanelBonus.add(bonusTxt); hpanelBonus.setCellHorizontalAlignment(bonusTxt, HasHorizontalAlignment.ALIGN_RIGHT); if (EMarkingConfiguration.isFormativeFeedbackOnly()) { hpanelBonus.setVisible(false); } mainPanel.add(hpanelBonus); mainPanel.setCellHorizontalAlignment(hpanelBonus, HasHorizontalAlignment.ALIGN_RIGHT); } // The regrade comment text box txt = new TextArea(); txt.setVisibleLines(5); txt.getElement().getStyle().setMarginBottom(5, Unit.PT); txtRegradeComment = new SuggestBox(EMarkingWeb.markingInterface.previousCommentsOracle, txt); if (this.regradeId > 0) { mainPanel.add(new HTML("<hr>")); mainPanel.add(new Label(MarkingInterface.messages.Regrade())); // Add the textbox HorizontalPanel hpanelRegradeComment = new HorizontalPanel(); hpanelRegradeComment.setWidth("100%"); hpanelRegradeComment.add(new Label(MarkingInterface.messages.RegradeComment())); hpanelRegradeComment.add(txtRegradeComment); hpanelRegradeComment.setCellHorizontalAlignment(txtRegradeComment, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanelRegradeComment); mainPanel.setCellHorizontalAlignment(hpanelRegradeComment, HasHorizontalAlignment.ALIGN_RIGHT); } // Add buttons HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setSpacing(2); hpanel.setWidth("100%"); hpanel.add(btnSave); hpanel.add(btnCancel); hpanel.setCellWidth(btnSave, "100%"); hpanel.setCellWidth(btnCancel, "0px"); hpanel.setCellHorizontalAlignment(btnCancel, HasHorizontalAlignment.ALIGN_RIGHT); hpanel.setCellHorizontalAlignment(btnSave, HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(hpanel); mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT); if (simplePanel) { // No feedback this.setWidget(mainPanel); } else { // Remove CSS Style mainPanel.removeStyleName(Resources.INSTANCE.css().editmarkdialog()); mainPanel.addStyleName(Resources.INSTANCE.css().editmarkdialogWithFeedback()); bonusTxt.removeStyleName(Resources.INSTANCE.css().bonuslist()); bonusTxt.addStyleName(Resources.INSTANCE.css().bonuslistWithFeedback()); this.levelsList.removeStyleName(Resources.INSTANCE.css().levelslist()); this.levelsList.addStyleName(Resources.INSTANCE.css().levelslistWithFeedback()); txtComment.removeStyleName(Resources.INSTANCE.css().editmarksuggestbox()); txtComment.addStyleName(Resources.INSTANCE.css().editmarksuggestboxWithFeedback()); // Add feedback panel mainPanel.add(new HTML("<h4>Feedback</h4>")); mainPanel.add(feedbackSummary); superPanel.add(mainPanel); superPanel.add(feedbackPanel); this.setWidget(superPanel); } }
From source file:cl.uai.client.page.MarkingPagesInterface.java
License:Open Source License
public void loadAllTabs() { // Check if submission data is invalid if (MarkingInterface.submissionData.getId() <= 0) { return;/*w w w. j a v a 2 s . c om*/ } EMarkingWeb.markingInterface.addLoading(false); // Ajax request to get the tab image and number of pages AjaxRequest.ajaxRequest("action=getalltabs", new AsyncCallback<AjaxData>() { @Override public void onFailure(Throwable caught) { logger.severe("Error getting tab info from Moodle!"); logger.severe(caught.getMessage()); Window.alert(caught.getMessage()); EMarkingWeb.markingInterface.finishLoading(); } @Override public void onSuccess(AjaxData result) { // If something goes wrong clear the tabs and show error message if (!result.getError().equals("")) { pagesPanel.clear(); pagesPanel.add(new Label(MarkingInterface.messages.ErrorLoadingSubmission())); EMarkingWeb.markingInterface.finishLoading(); return; } // We remove any possible drop controller that could have been before (when resizing window or showing rubric) EMarkingWeb.markingInterface.getDragController().unregisterDropControllers(); // Parse Json values List<Map<String, String>> alltabs = AjaxRequest.getValuesFromResult(result); int tabnum = 0; for (Map<String, String> tabinfo : alltabs) { tabnum++; // Get image info in case we don't have it if (numPages <= 0) { numPages = Integer.parseInt(tabinfo.get("totalpages")); } // Get the image width and height int width = Integer.parseInt(tabinfo.get("width")); int height = Integer.parseInt(tabinfo.get("height")); boolean showmarker = Integer.parseInt(tabinfo.get("showmarker")) == 1; // Parse Json values List<Map<String, String>> allcomments = AjaxRequest .getValuesFromResultString(tabinfo.get("comments")); double screenWidth = scrollContainerForPages.getOffsetWidth(); int newwidth = (int) screenWidth; double ratio = (double) width / (double) height; int newheight = (int) (screenWidth / ratio); MarkingPage page = new MarkingPage(tabnum, tabinfo.get("url"), newwidth, newheight, allcomments); if (!showmarker) { page.setVisible(false); } pagesPanel.insert(page, tabnum - 1); } scrollToPage(0); EMarkingWeb.markingInterface.getToolbar().getMarkingButtons().updateStats(); EMarkingWeb.markingInterface.finishLoading(); } }); }
From source file:cl.uai.client.page.RequestRegradeDialog.java
License:Open Source License
/** * Creates a comment dialog at a specific position */// ww w . j a v a 2s.c om public RequestRegradeDialog() { super(true, false); this.addStyleName(Resources.INSTANCE.css().requestregradedialog()); this.mainPanel = new VerticalPanel(); this.mainPanel.setWidth("100%"); motive = new ListBox(); motive.setWidth("390px"); motive.addItem(MarkingInterface.messages.Select(), "0"); for (int motiveId : EMarkingConfiguration.getRegradeMotives().keySet()) { String motiveName = EMarkingConfiguration.getRegradeMotives().get(motiveId); motive.addItem(motiveName, Integer.toString(motiveId)); } HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.add(new Label(MarkingInterface.messages.Motive())); hpanel.add(motive); hpanel.setCellHorizontalAlignment(motive, HasAlignment.ALIGN_RIGHT); this.mainPanel.add(hpanel); comment = new TextArea(); comment.setVisibleLines(10); comment.setWidth("380px"); comment.setHeight("150px"); hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); hpanel.add(new Label(MarkingInterface.messages.CommentForMarker())); hpanel.add(comment); hpanel.setCellHorizontalAlignment(comment, HasAlignment.ALIGN_RIGHT); this.mainPanel.add(hpanel); // Adds the CSS style and other settings this.addStyleName(Resources.INSTANCE.css().commentdialog()); this.setAnimationEnabled(true); this.setGlassEnabled(true); this.setHTML(MarkingInterface.messages.RequestRegrade()); // Save button Button btnSave = new Button(MarkingInterface.messages.Save()); btnSave.addStyleName(Resources.INSTANCE.css().btnsave()); btnSave.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (comment.getText().length() > 500) { Window.alert(MarkingInterface.messages.RequestMaximumLength(comment.getText().length())); return; } else if (motive.isItemSelected(0)) { Window.alert(MarkingInterface.messages.MotiveIsMandatory()); return; } else { cancelled = false; hide(); } } }); // Cancel button Button btnCancel = new Button(MarkingInterface.messages.Cancel()); btnSave.addStyleName(Resources.INSTANCE.css().btncancel()); btnCancel.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { cancelled = true; hide(); } }); // Add buttons hpanel = new HorizontalPanel(); hpanel.add(btnSave); hpanel.add(btnCancel); mainPanel.add(hpanel); mainPanel.setCellHorizontalAlignment(hpanel, HasHorizontalAlignment.ALIGN_RIGHT); this.setWidget(mainPanel); }