List of usage examples for com.google.gwt.user.client.ui HTML HTML
protected HTML(Element element)
From source file:cl.uai.client.MarkingInterface.java
License:Open Source License
/** /**//from w ww .jav a 2 s.c o m * */ public MarkingInterface() { // The timer will check if no other resize events have been called in the last 200 ms resizeTimer = new Timer() { @Override public void run() { Date now = new Date(); long diff = now.getTime() - resizeTime.getTime(); // The last resize was in less than 200 ms if (diff < 200) { resizeTimer.schedule(200); } else { // More than 200 ms, we accept no more resize is being done resizeTimeout = false; Date oneyear = new Date(); CalendarUtil.addMonthsToDate(oneyear, 12); Cookies.setCookie("emarking_width", Integer.toString(Window.getClientWidth()), oneyear); EMarkingWeb.markingInterface.loadSubmissionData(); } } }; // Focus panel to catch key events focusPanel = new FocusPanel(); // Main panel has two rows: Toolbar and Marking panel mainPanel = new VerticalPanel(); mainPanel.addStyleName(Resources.INSTANCE.css().interfaceMainPanel()); focusPanel.setWidget(mainPanel); // Toolbar goes up toolbar = new MarkingToolBar(); mainPanel.add(toolbar); focusPanel.addKeyDownHandler(new MarkingInterfaceKeyDownHandler(toolbar)); // Marking panel containing the marking interface interfacePanel = new SplitLayoutPanel() { @Override public void onResize() { super.onResize(); markingPagesInterface.resizePage(this.getCenterWidth()); }; }; interfacePanel.animate(180); interfacePanel.addStyleName(Resources.INSTANCE.css().interfacepanel()); loadingMessage = new HTML(messages.Loading() + " " + EMarkingConfiguration.getMoodleUrl()); bubbleButtons = new ArrayList<BubbleButton>(); bubbleButtons.add(new ShowRubricButton(Window.getClientWidth() - 40, 0, 0)); bubbleButtons.add(new ShowChatButton(Window.getClientWidth() - 40, 45, NodeChat.SOURCE_CHAT)); bubbleButtons.add(new ShowWallButton(Window.getClientWidth() - 40, 90, NodeChat.SOURCE_WALL)); bubbleButtons.add(new ShowHelpButton(Window.getClientWidth() - 40, 135, NodeChat.SOURCE_SOS)); interfacePanel.add(loadingMessage); // interfacePanel.setCellHorizontalAlignment(loadingMessage, HasAlignment.ALIGN_CENTER); markingPanel = new AbsolutePanel(); markingPanel.add(interfacePanel); for (BubbleButton b : bubbleButtons) { markingPanel.add(b); } mainPanel.add(markingPanel); // Timer for pinging system timer = new Timer() { @Override public void run() { // If there are ticks to wait before trying again, update message and update ticks if (ticksUntilTrying > 0) { loadingMessage.setHTML(messages.CantReachServerRetrying(ticksUntilTrying)); ticksUntilTrying--; } else { // Updating next trial for one more second and trying onLoad again timerWaitingTurns++; ticksUntilTrying = Math.min(timerWaitingTurns, 60); loadingMessage.setHTML(messages.Loading() + " " + EMarkingConfiguration.getMoodleUrl()); onLoad(); } } }; heartBeatTimer = new Timer() { @Override public void run() { String extradata = ""; if (submissionData != null) extradata = "&marker=" + submissionData.getMarkerid() + "&draft=" + submissionData.getId(); final String requestUrl = extradata; AjaxRequest.ajaxRequest("action=heartbeat" + extradata, new AsyncCallback<AjaxData>() { @Override public void onSuccess(AjaxData result) { logger.info("Heartbeat! " + requestUrl); } @Override public void onFailure(Throwable caught) { logger.warning("Failure on heartbeat"); } }); } }; // Drag and Drop controller attached to marking panel dragController = new PickupDragController(markingPanel, false); waitDialog = new DialogBox(false, true); waitDialog.setGlassEnabled(true); waitDialog.addStyleName(Resources.INSTANCE.css().commentdialog()); waitDialog.setHTML(MarkingInterface.messages.Loading()); ProgressBar pbar = new ProgressBar(ProgressBarBase.Style.STRIPED); pbar.setActive(true); pbar.setPercent(100); waitDialog.setWidget(pbar); this.initWidget(focusPanel); }
From source file:cl.uai.client.page.EditMarkDialog.java
License:Open Source License
/** * Creates a comment dialog at a specific position * /*ww w . j a v a 2 s. c om*/ * @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.toolbar.MarkingToolBar.java
License:Open Source License
/** * Creates the interface/* w w w. j a va 2 s.co m*/ */ public MarkingToolBar() { logger.fine("Entering MarkingToolbar"); grade = new DraftGrade(); markingButtons = new MarkingButtons(); markingButtons.setVisible(false); examButtons = new ExamButtons(true); examButtons.setVisible(true); extraButtons = new ExamButtons(false); extraButtons.setVisible(true); viewButtons = new ViewButtons(); viewButtons.setVisible(false); chatButtons = new ChatButtons(); chatButtons.setVisible(false); helpButtons = new HelpButtons(); helpButtons.setVisible(false); tabButtonsPanel = new TabPanel(); tabButtonsPanel.addStyleName(Resources.INSTANCE.css().tabbuttons()); tabButtonsPanel.add(markingButtons, MarkingInterface.messages.Mark().toUpperCase()); tabButtonsPanel.add(examButtons, MarkingInterface.messages.Exam().toUpperCase()); tabButtonsPanel.add(viewButtons, MarkingInterface.messages.View().toUpperCase()); tabButtonsPanel.add(chatButtons, MarkingInterface.messages.Collaboration().toUpperCase()); tabButtonsPanel.add(helpButtons, MarkingInterface.messages.Help().toUpperCase()); buttonsPanel = new HorizontalPanel(); buttonsPanel.setVisible(false); buttonsPanel.addStyleName(Resources.INSTANCE.css().buttonspanel()); buttonsPanel.add(tabButtonsPanel); buttonsPanel.setCellHorizontalAlignment(markingButtons, HasHorizontalAlignment.ALIGN_LEFT); buttonsPanel.setCellWidth(markingButtons, "50%"); SubmissionGradeData sdata = MarkingInterface.submissionData; if (sdata != null && EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_MARKER_TRAINING && EMarkingConfiguration.isChatEnabled()) { buttonsPanel.add(new HTML("Hola, ac habran estadisticas de correccin")); buttonsPanel.setCellWidth(markingButtons, "30%"); } buttonsPanel.add(grade); buttonsPanel.setCellVerticalAlignment(grade, HasVerticalAlignment.ALIGN_MIDDLE); buttonsPanel.setCellHorizontalAlignment(grade, HasHorizontalAlignment.ALIGN_RIGHT); buttonsPanel.setCellWidth(grade, "10%"); extraButtons = new ExamButtons(false); extraButtons.getFinishMarkingButton().setVisible(true); extraButtons.getSaveAndJumpToNextButton().setVisible(true); extraButtons.getSaveChangesButton().setVisible(true); buttonsPanel.add(extraButtons); buttonsPanel.setCellVerticalAlignment(extraButtons, HasVerticalAlignment.ALIGN_MIDDLE); buttonsPanel.setCellHorizontalAlignment(extraButtons, HasHorizontalAlignment.ALIGN_RIGHT); buttonsPanel.setCellWidth(extraButtons, "40%"); this.initWidget(buttonsPanel); }
From source file:cl.uai.client.toolbar.sortpages.SortPagesFlexTable.java
License:Open Source License
/** * Creates a FlexTable with the desired number of rows and columns, making each row draggable via * the provided drag controller./* w w w .ja v a2s . co m*/ * * @param rows desired number of table rows * @param cols desired number of table columns * @param tableRowDragController the drag controller to enable dragging of table rows */ public SortPagesFlexTable(int rows, int cols, FlexTableRowDragController tableRowDragController) { addStyleName(Resources.INSTANCE.css().sortpagesflextable()); for (int row = 0; row < rows; row++) { HTML handle = new HTML(MarkingInterface.messages.PageNumber(row + 1)); handle.addStyleName(Resources.INSTANCE.css().sortpagesdraghandle()); setWidget(row, 0, handle); tableRowDragController.makeDraggable(handle); } }
From source file:client.about.page.NameResolverPage.java
License:Open Source License
/** * //w ww. ja v a 2 s. c om */ public NameResolverPage() { final VerticalPanel panel = new VerticalPanel(); panel.add(new HTML(shortLicense)); this.initWidget(panel); }
From source file:client.argon.page.ArgonEndpointCreatePage.java
License:Open Source License
public void onSuccess(final Object result) { this.activity.setVisible(false); this.button.setEnabled(true); final String message = "Endpoint created and inserted"; final InfoDialog dialog = new InfoDialog("Create Endpoint", new HTML(message)); dialog.show();//from w ww . j a v a2 s. co m dialog.center(); }
From source file:client.argon.page.ArgonInternalLinkCreatePage.java
License:Open Source License
@Override public void onSuccess(final Object result) { this.activity.setVisible(false); this.button.setEnabled(true); final String message = "InternalLink created and inserted"; final InfoDialog dialog = new InfoDialog("Create Internal Link", new HTML(message)); dialog.show();//w ww . j av a 2 s. c om dialog.center(); }
From source file:client.argon.page.ArgonRouterCreatePage.java
License:Open Source License
public void onSuccess(final Object result) { this.activity.setVisible(false); this.button.setEnabled(true); final String message = "Router created and inserted"; final InfoDialog dialog = new InfoDialog("Create Router", new HTML(message)); dialog.show();//from w w w . java 2 s.c om dialog.center(); }
From source file:client.attic.CreateReservation.java
License:Open Source License
public CreateReservation() { final Button button = new Button(); this.vert = new VerticalPanel(); final ClickListener listener = new ClickListener() { public void onClick(final Widget sender) { final ArgonManagementServiceAsync emailService = (ArgonManagementServiceAsync) GWT .create(ArgonManagementService.class); final ServiceDefTarget endpoint = (ServiceDefTarget) emailService; final String moduleRelativeURL = GWT.getModuleBaseURL() + "/gui/server/argon"; endpoint.setServiceEntryPoint(moduleRelativeURL); // (3) Create an asynchronous callback to handle the result. //// w ww . j av a 2 s.com final AsyncCallback callback = new AsyncCallback() { public void onSuccess(final Object result) { final InfoDialog dialog = new InfoDialog("Result", (String) result); dialog.show(); dialog.center(); } public void onFailure(final Throwable caught) { final InfoDialog dialog = new InfoDialog("Failure", new HTML(caught.toString())); dialog.show(); dialog.center(); } }; emailService.getDomainName(callback); } }; button.addClickListener(listener); button.setText("Click me"); this.vert.add(button); this.vert.setWidth("100%"); this.initWidget(this.vert); }
From source file:client.helper.Debug.java
License:Open Source License
/** * Show some text.// ww w.j a v a2s . co m * * @param value * The text */ public static void show(final String value) { final InfoDialog dialog = new InfoDialog("Debug", new HTML(value)); dialog.show(); dialog.center(); }