/** Constructor. */ private ExportBox() { super(false); panel = new VerticalPanel(); panel.getElement().getStyle().setMarginTop(1, Unit.EM); setHeadline(R.lang.Export()); setDraggable(true); setWidth(WIDTH_PX + "px"); btnExportXML = new Button(R.lang.exportInFile()); btnExportXML.getElement().getStyle().setFloat(Float.RIGHT); btnExportXML.addClickHandler(this); btnClose = new Button(R.lang.Close()); btnClose.getElement().getStyle().setMarginLeft(1, Unit.EM); btnClose.getElement().getStyle().setFloat(Float.RIGHT); btnClose.addClickHandler(this); textarea = new TextArea(); textarea.setWidth((WIDTH_PX - 10) + "px"); textarea.setHeight("200px"); btnPanel = new FlowPanel(); btnPanel.add(btnClose); btnPanel.add(btnExportXML); panel.add(textarea); panel.add(btnPanel); setContentWidget(panel); }
public void onClick(ClickEvent e) { Element target = e.getNativeEvent().getEventTarget().cast(); boolean isEditing = assignmentsTable.isVisible(); if (target == btApply.getElement()) { if (isEditing) { hide(); app.getActiveEuclidianView().requestFocusInWindow(); app.storeUndoInfo(); app.getKernel().notifyRepaint(); } else { assignmentsTable.setVisible(true); checkAssignmentsTable.setVisible(false); btTest.setText(app.getPlain("Test")); btApply.setText(app.getPlain("OK")); hide(); setGlassEnabled(true); center(); } } else if (target == btTest.getElement()) { if (isEditing) { assignmentsTable.setVisible(false); checkAssignmentsTable.setVisible(true); check(); btTest.setText(app.getPlain("Check")); btApply.setText(app.getPlain("Back")); hide(); setGlassEnabled(false); center(); } else { check(); } } }
/** * @function setLabelsAndIds * @created_date : Jan 2, 2014 * @description To set Labels and Id for buttons. * @parm(s) : * @return : void * @throws : <Mentioned if any exceptions> */ private void setLabelsAndIds() { btnResourceLink.setText(i18n.GL0548()); btnResourceLink.getElement().setId("btnResourceLink"); btnResourceLink.getElement().setAttribute("alt", i18n.GL0548()); btnResourceLink.getElement().setAttribute("title", i18n.GL0548()); lblGooruFieldTrip.setText(i18n.GL0549()); lblGooruFieldTrip.getElement().setId("lblGooruFieldTrip"); lblGooruFieldTrip.getElement().setAttribute("alt", i18n.GL0549()); lblGooruFieldTrip.getElement().setAttribute("title", i18n.GL0549()); // lblGooruFieldTripDescUnforseen.setText(i18n.GL0550); // lblGooruFieldTripDescOriginal.setText(i18n.GL0552); lblGooruFieldTripDescOriginal.setText(""); lblGooruFieldTripDescOriginal.getElement().setId("lblGooruFieldTripDescOriginal"); lblGooruFieldTripDescOriginal.getElement().setAttribute("alt", ""); lblGooruFieldTripDescOriginal.getElement().setAttribute("title", ""); lblDontForget.setText(i18n.GL0551()); lblDontForget.getElement().setId("lblDontForget"); lblDontForget.getElement().setAttribute("alt", i18n.GL0551()); lblDontForget.getElement().setAttribute("title", i18n.GL0551()); imgFieldTrip.getElement().setId("imgFieldTrip"); imgFieldTrip.setUrl("images/framebraker/field-trip.png"); resoruceFrameBrakerContainer.getElement().setId("fpnlResoruceFrameBrakerContainer"); resourceCategory.getElement().setId("pnlResourceCategory"); lblGooruFieldTripDescUnforseen.getElement().setId("lblGooruFieldTripDescUnforseen"); supportTip.getElement().setId("lblSupportTip"); // learnMoreLbl.setText("Learn more."); }
private void createGUI() { getCaption().setText(app.getMenu("Exercise.CreateNew")); setWidget(mainWidget = new VerticalPanel()); addDomHandlers(mainWidget); assignmentsTable = new FlexTable(); FlexCellFormatter cellFormatter = assignmentsTable.getFlexCellFormatter(); cellFormatter.setColSpan(0, 1, 2); assignmentsTable.setWidget(0, 1, new Label(app.getPlain("Tool"))); assignmentsTable.setWidget(0, 2, new Label(app.getPlain("HintForCorrect"))); assignmentsTable.setWidget(0, 3, new Label(app.getPlain("Fraction"))); createAssignmentsTable(); checkAssignmentsTable = new FlexTable(); checkAssignmentsTable.setVisible(false); mainWidget.add(assignmentsTable); mainWidget.add(checkAssignmentsTable); addList = new UnorderedList(); addDomHandlers(addList); // addIcon = new ListItem(); Image addIcon = new Image(GuiResources.INSTANCE.menu_icon_file_new()); ListItem addListItem = new ListItem(); addListItem.addStyleName("toolbar_item"); addListItem.add(addIcon); addList.add(addListItem); userAddModes = new ToolbarSubemuW(app, 1); userAddModes.addStyleName("toolbar_item"); userAddModes.setVisible(false); for (int i = 0; i < app.getKernel().getMacroNumber(); i++) { if (!exercise.usesMacro(i)) { ListItem item = userAddModes.addItem(i + EuclidianConstants.MACRO_MODE_ID_OFFSET); addDomHandlers(item); } } addList.add(userAddModes); mainWidget.add(addList); mainWidget.add(bottomWidget = new FlowPanel()); bottomWidget.setStyleName("DialogButtonPanel"); btApply = new Button(app.getPlain("OK")); btApply.addClickHandler(this); btApply.getElement().getStyle().setMargin(3, Style.Unit.PX); addCancelButton(); btTest = new Button(app.getPlain("Test")); btTest.addClickHandler(this); btTest.getElement().getStyle().setMargin(3, Style.Unit.PX); bottomWidget.add(btTest); bottomWidget.add(btApply); // bottomWidget.add(btCancel); }
public void setPositiveBtnStatus(boolean status) { if (status) { btnPositive.getElement().removeClassName("disabled"); btnPositive.setEnabled(status); } else { btnPositive.getElement().addClassName("disabled"); btnPositive.setEnabled(status); } }
public DeleteContentPopup() { super(false); add(binder.createAndBindUi(this)); this.setGlassEnabled(true); h3Panel.setVisible(false); lblRemoving.setVisible(false); lblRemoving.getElement().getStyle().setMargin(26, Unit.PX); txtConfirmAction.setVisible(false); setButtonVisibility(true); setElementId(); txtConfirmAction.addKeyUpHandler(new ValidateConfirmText()); txtConfirmAction.getElement().getStyle().setColor("#515151"); txtConfirmAction.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { if (!txtConfirmAction.getText().isEmpty()) { if (txtConfirmAction .getText() .toLowerCase() .equalsIgnoreCase(i18n.GL1175().toLowerCase())) { txtConfirmAction.setText(""); txtConfirmAction.getElement().getStyle().setColor("#000000"); } } } }); txtConfirmAction.addBlurHandler( new BlurHandler() { @Override public void onBlur(BlurEvent event) { if (txtConfirmAction.getText().isEmpty()) { txtConfirmAction.getElement().getStyle().setColor("#515151"); } } }); StringUtil.setAttributes(txtConfirmAction, true); btnNegitive.setText(StringUtil.generateMessage(i18n.GL0142())); btnNegitive.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL0142())); btnNegitive.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL0142())); btnPositive.setText(StringUtil.generateMessage(i18n.GL0190())); btnPositive.getElement().setAttribute("alt", StringUtil.generateMessage(i18n.GL0190())); btnPositive.getElement().setAttribute("title", StringUtil.generateMessage(i18n.GL0190())); /*lblDeleteText.setText(i18n.GL2189()); StringUtil.setAttributes(lblDeleteText.getElement(), "lblDeleteText", null, "lblDeleteText");*/ Window.enableScrolling(false); AppClientFactory.fireEvent(new SetHeaderZIndexEvent(98, false)); this.center(); }
/** * Instantiates a new xml tree view. * * @param cellTreeNode the cell tree node */ public XmlTreeView(CellTreeNode cellTreeNode) { clearMessages(); createRootNode(cellTreeNode); addHandlers(); mainPanel.getElement().setId("mainPanel_FlowPanel"); saveBtn.getElement().setId("saveBtn_Button"); buttonExpand.getElement().setId("buttonExpand_Button"); buttonCollapse.getElement().setId("buttonCollapse_Button"); }
private void toogleWindowLog() { if (windowOpen) { $("#logRow").hide(); $(clearLogButton.getElement()).hide(); windowOpen = false; windowToogleButton.setText(SHOW_WINDOW_EVENT); } else { $("#logRow").show(); $(clearLogButton.getElement()).show(); windowOpen = true; windowToogleButton.setText(HIDE_WINDOW_EVENT); } }
public void selectButton(Object obj) { for (int i = 0; i < panel.getWidgetCount(); i++) { Button b = (Button) panel.getWidget(i); if (b.getElement().getPropertyObject("object") == obj) b.addStyleName("Ribbon-selected"); else b.removeStyleName("Ribbon-selected"); } }
void show() { if (popup != null) { popup.hide(); popup = null; return; } final PopupPanel p = new PopupPanel(true); p.setStyleName(style.popup()); p.addAutoHidePartner(activatingButton.getElement()); p.addCloseHandler( new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(this); p.showRelativeTo(activatingButton); GlobalKey.dialog(p); message.setFocus(true); popup = p; }
public void run(final RootPanel rp, final String nick) { if (Cookies.getCookie(nick) == null) Cookies.setCookie(nick, "" + 0); cl.setPageSize(500); final Button sendMessage = new Button( "sendMessage", new ClickHandler() { public void onClick(ClickEvent event) { if (!message.getText().equals("")) { new Post().postJson(SERVERURL, nick.toString(), message.getText()); message.setText(""); } } }); rp.get("mainDiv2").setVisible(true); message.getElement().setAttribute("placeholder", "Introduce your message"); message.getElement().setAttribute("id", "message"); cl.getElement().setAttribute("id", "chatBox"); sendMessage.getElement().setAttribute("id", "sendMessage"); sendMessage.setText("Send"); vp.getElement().setAttribute("id", "verticalPanel"); hp.getElement().setAttribute("id", "horizontalPanel"); panel.getElement().setAttribute("id", "scroller"); hp.add(message); hp.add(sendMessage); panel.add(cl); vp.add(panel); vp.add(hp); rp.get("mainDiv2").add(vp); Timer t = new Timer() { @Override public void run() { getMessages(); if (chatList != null && Integer.parseInt(Cookies.getCookie(nick)) < chatList.size()) { cl.setRowCount(chatList.size() + 1, true); cl.setRowData( Integer.parseInt(Cookies.getCookie(nick)), chatList.subList(Integer.parseInt(Cookies.getCookie(nick)), chatList.size())); panel.setVerticalScrollPosition(panel.getMaximumVerticalScrollPosition() - 1); Cookies.setCookie(nick, "" + chatList.size()); } } }; t.scheduleRepeating(1000); }
private void createDialogBox() { dialogBox = new DialogBox(); dialogBox.setText("RESTful Call"); dialogBox.setAnimationEnabled(true); closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); textToServerLabel = new Label(); serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); closeButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { dialogBox.hide(); } }); }
@Inject public AddCollectionView() { setWidget(uiBinder.createAndBindUi(this)); hideText.setText(i18n.GL0592()); hideText.getElement().setId("lblHideText"); hideText.getElement().setAttribute("alt", i18n.GL0592()); hideText.getElement().setAttribute("title", i18n.GL0592()); addcollectionText.getElement().setInnerHTML(i18n.GL0690()); addcollectionText.getElement().setId("pnlAddcollectionText"); addcollectionText.getElement().setAttribute("alt", i18n.GL0690()); addcollectionText.getElement().setAttribute("title", i18n.GL0690()); renameText.setText(i18n.GL0593()); renameText.getElement().setId("lblRenameText"); renameText.getElement().setAttribute("alt", i18n.GL0593()); renameText.getElement().setAttribute("title", i18n.GL0593()); addToShelfCollectionButton.setText(i18n.GL0590()); addToShelfCollectionButton.getElement().setId("btnAddToShelfCollectionButton"); addToShelfCollectionButton.getElement().setAttribute("alt", i18n.GL0590()); addToShelfCollectionButton.getElement().setAttribute("title", i18n.GL0590()); collectionAddedSuccessMessageContainer.setVisible(false); getAddToShelfCollectionButton().addClickHandler(new OnAddCollectionClick()); collectionTitleInCoverPage.addKeyUpHandler(new onKeyErrorMsg()); workSpaceLink.setText(i18n.GL0589()); workSpaceLink.getElement().setId("lnkWorkSpaceLink"); workSpaceLink.getElement().setAttribute("alt", i18n.GL0589()); workSpaceLink.getElement().setAttribute("title", i18n.GL0589()); addToCollectionWidgetContainer.getElement().setId("pnlAddToCollectionWidgetContainer"); collectionAddImageContainer.getElement().setId("pnlCollectionAddImageContainer"); addResourceInsteadLabelContainerInCollectionImage .getElement() .setId("pnlAddResourceInsteadLabelContainerInCollectionImage"); collectionAddedSuccessMessageContainer .getElement() .setId("pnlCollectionAddedSuccessMessageContainer"); successMessageLabelText.getElement().setId("lblSuccessMessageLabelText"); addCollectionInsteadLabelContainer.getElement().setId("pnlAddCollectionInsteadLabelContainer"); collectionTitleInCoverPage.getElement().setId("txtCollectionTitleInCoverPage"); StringUtil.setAttributes(collectionTitleInCoverPage, true); addingLabel.getElement().setId("lblAddingLabel"); addErrorLabel.getElement().setId("errlblAddErrorLabel"); hideButton.getElement().setId("epnlHideButton"); }
public String getButtonText(Object obj) { for (int i = 0; i < panel.getWidgetCount(); i++) { Button b = (Button) panel.getWidget(i); if (b.getElement().getPropertyObject("object") == obj) return b.getText(); } return null; }
public void setDeleteValidate(String deleteCode) { isValidate = true; this.deleteCode = deleteCode; txtConfirmAction.setVisible(true); btnPositive.setEnabled(false); btnPositive.getElement().addClassName("disabled"); }
private void initStage1(final FlowPanel div) { div.add(new HTMLPanel("h2", "1. Set the start and end dates")); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); hpanel.setSpacing(10); final DatePicker dateFrom = new DatePicker(); final DatePicker dateTo = new DatePicker(); hpanel.add(new Label("Start date:")); hpanel.add(dateFrom); hpanel.add(new Label("End date:")); hpanel.add(dateTo); final Button cont = WidgetFactory.createButton( "Continue", new ClickHandler() { @Override public void onClick(ClickEvent event) { final long twelveHours = 12 * 60 * 60 * 1000; long timeFrom = dateFrom.getValue().getTime() - twelveHours; long timeTo = dateTo.getValue().getTime() + twelveHours; initStage2(timeFrom, timeTo, div); } }); cont.setEnabled(false); cont.getElement().addClassName("scran24-admin-button"); dateFrom.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if (event.getValue() != null && dateTo.getValue() != null) { cont.setEnabled(true); } } }); dateTo.addValueChangeHandler( new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if (event.getValue() != null && dateFrom.getValue() != null) { cont.setEnabled(true); } } }); div.add(hpanel); div.add(cont); }
private void setElementId() { lblOops.setText(i18n.GL0061()); lblErrorIEMessage.setText(i18n.GL2038()); btnOk.setText(i18n.GL0190()); StringUtil.setAttributes(lblOops.getElement(), i18n.GL0061(), i18n.GL0061(), i18n.GL0061()); StringUtil.setAttributes( lblErrorIEMessage.getElement(), i18n.GL2038(), i18n.GL2038(), i18n.GL2038()); StringUtil.setAttributes(btnOk.getElement(), i18n.GL0190(), i18n.GL0190(), i18n.GL0190()); }
/** This is the entry point method. */ public void onModuleLoad() { sendButton = new Button("Send"); nameField = new TextBox(); nameField.setText("GWT User"); errorLabel = new Label(); // We can add style names to widgets sendButton.addStyleName("sendButton"); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(errorLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create the popup dialog box dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); textToServerLabel = new Label(); serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox final ClickHandler buttonClickHandler = new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }; closeButton.addClickHandler(buttonClickHandler); // Add a handler to send the name to the server ChangeEventHandler handler = new ChangeEventHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); }
@UiHandler("hintsButton") public void ClickOnHintButton(ClickEvent clickEvent) { if (hintsButton.getStyleName().equals(oeStyle.hintsActiveButton())) { if (collectionItemDo.getResource().getHints().size() > hintsLength) { startHintDataLogEvent(getQuestionHintsDo(hintsLength).getHintId()); hintsContainer.add( getHTML(getQuestionHintsDo(hintsLength).getHintText(), oeStyle.hintsText())); hintsButton.setText( "" + i18n.GL0317() + " (" + ((collectionItemDo.getResource().getHints().size() - hintsLength) - 1) + " Left)"); hintsButton .getElement() .setAttribute( "alt", " " + i18n.GL0317() + " (" + collectionItemDo.getResource().getHints().size() + " Left)"); hintsButton .getElement() .setAttribute( "title", " " + i18n.GL0317() + " (" + collectionItemDo.getResource().getHints().size() + " Left)"); hintsLength++; if (collectionItemDo.getResource().getHints().size() == hintsLength) { hintsButton.setStyleName(oeStyle.hintsInActiveButton()); } } else { hintsButton.setStyleName(oeStyle.hintsInActiveButton()); } } }
private void setElementId() { btnPositive.getElement().setId("btnPositive"); btnNegitive.getElement().setId("btnNegitive"); lblTitle.getElement().setId("lblTitle"); txtConfirmAction.getElement().setId("txtConfirmAction"); lblRemoving.getElement().setId("lblRemoving"); closeBtn.getElement().getStyle().setCursor(Cursor.POINTER); h5Panel.setText("Warning: this cannot be undone"); paragraphPnl.setText("Please type in delete"); chkBoxList.add(chkBox1); chkBoxList.add(chkBox2); chkBoxList.add(chkBox3); chkBox1.getElement().setId("checkboxG12"); chkBox2.getElement().setId("checkboxG13"); chkBox3.getElement().setId("checkboxG14"); checkboxG12.getElement().setAttribute("for", "checkboxG12"); checkboxG13.getElement().setAttribute("for", "checkboxG13"); checkboxG14.getElement().setAttribute("for", "checkboxG14"); chkBox1.setValue(false); chkBox2.setValue(false); chkBox3.setValue(false); if (AppClientFactory.getPlaceManager() .getCurrentPlaceRequest() .getNameToken() .equals(PlaceTokens.EDIT_CLASS)) { checkboxG12.setText(i18n.GL3575()); checkboxG13.setText(i18n.GL3576()); checkboxG14.setText(i18n.GL3577()); checkboxG13.getElement().getStyle().setLineHeight(18, Unit.PX); } else { checkboxG12.setText(i18n.GL3579()); checkboxG13.setText(i18n.GL3573()); checkboxG14.setText(i18n.GL3574()); } }
/** * The constructor sets up the UI and passes the data fetching parameters to the sub widgets * * @param service * @param documentID * @param instructor * @param unsavedDocumentStrategy */ public InstructorPreferencesView( CachedOpenWorkingCopyDocument openDocument, InstructorGWT instructor) { this.openDocument = openDocument; instructor.verify(); this.instructor = instructor; HTML instructorName = new HTML("Instructor Time Preferences"); instructorName.setStyleName("bigBold"); DOM.setElementAttribute(instructorName.getElement(), "id", "instructorName"); InstructorPreferencesView.this.add(instructorName); InstructorPreferencesView.this.timePrefs = new TimePrefsWidget( InstructorPreferencesView.this.openDocument, InstructorPreferencesView.this.instructor); InstructorPreferencesView.this.setSpacing(20); InstructorPreferencesView.this.add(timePrefs); InstructorPreferencesView.this.setStyleName("preferencesPanel"); InstructorPreferencesView.this.coursePrefs = new CoursePrefsWidget( InstructorPreferencesView.this.openDocument, InstructorPreferencesView.this.instructor); InstructorPreferencesView.this.coursePrefs.setStyleName("otherCenterness"); InstructorPreferencesView.this.coursePrefs.afterPush(); HTML cprefs = new HTML("Instructor Course Preferences"); cprefs.addStyleName("bigBold"); InstructorPreferencesView.this.add(cprefs); InstructorPreferencesView.this.add(coursePrefs); closebutton = new Button( "Close", new ClickHandler() { public void onClick(ClickEvent event) { parent.hide(); } }); if (additionalCloseHandler != null) { closebutton.addClickHandler(additionalCloseHandler); additionalCloseHandler = null; } DOM.setElementAttribute(closebutton.getElement(), "id", "s_prefCloseBtn"); InstructorPreferencesView.this.add(closebutton); InstructorPreferencesView.this.setCellHorizontalAlignment(closebutton, ALIGN_RIGHT); }
@Override public void resetQuestionView() { openEndedQuestionText.setHTML(""); hintsButton.setText(i18n.GL0667()); hintsButton.getElement().setAttribute("alt", i18n.GL0667()); hintsButton.getElement().setAttribute("title", i18n.GL0667()); hintsButton.setStyleName(oeStyle.hintsActiveButton()); explanaionButton.setStyleName(oeStyle.hintsActiveButton()); explanationContainer.removeStyleName(oeStyle.explanationTextBorder()); hintsContainer.clear(); explanationContainer.clear(); clearAnswerOptionsContainer(); openEndedQuestionImage.getElement().removeAttribute("src"); }
private Widget createFooter() { Button applyButton = new Button(field.getApplyButtonLabel(), new ApplyClickHandler()); applyButton.getElement().setId("applyButton"); applyButton.setStyleName("goon-Button"); applyButton.getElement().getStyle().setMarginTop(Widgets.defaultSpacing, Unit.PX); Button cancelButton = new Button("Abbrechen", new CancelClickHandler()); cancelButton.getElement().setId("cancelButton"); cancelButton.setStyleName("goon-Button"); BuilderPanel buttonRow = new BuilderPanel().setHorizontal().setSpacing(0); buttonRow.setChildTextAlign(TextAlign.RIGHT); buttonRow.add(Widgets.horizontalSpacer()); buttonRow.setChildWidth("1px"); List<? extends IsWidget> additionalButtons = field.getAdditionalDialogButtons(this); buttonRow.addWithPadding(3, new Object[] {cancelButton}); buttonRow.addWithPadding(3, new Object[] {additionalButtons}); buttonRow.addWithPadding(3, new Object[] {applyButton}); return buttonRow.asWidget(); }
public void setId() { saveBtn.setText(i18n.GL0141()); saveBtn.getElement().setId("saveBtnId"); saveBtn.getElement().setAttribute("alt", i18n.GL0141()); saveBtn.getElement().setAttribute("title", i18n.GL0141()); errorLabel.getElement().setId("errorLblId"); saveLblText.setText(i18n.GL3426()); saveLblText.getElement().setId("saveLblTxtId"); saveLblText.setVisible(false); assignedCourse.setText(i18n.GL3440()); courseAssigned.setText(i18n.GL3441()); studentsNotes.setText(i18n.GL3442()); createCourseBtn.setText(i18n.GL3443()); lessonPacingPanel.setText(i18n.GL3444()); minimumScrPanel.setText(i18n.GL3445()); miniNotesPanel.setText(i18n.GL3446()); pacingWorks.setText(i18n.GL3447()); pacingNotes.setText(i18n.GL3448()); assessmentsLbl.setText(i18n.GL3449()); collectionLbl.setText(i18n.GL3450()); contentRedirectionLbl.setText(i18n.GL3593()); }
@Inject public QuestionResourceView() { setWidget(uiBinder.createAndBindUi(this)); questiontext.getElement().setInnerHTML(i18n.GL0308()); questiontext.getElement().setId("pnlQuestiontext"); questiontext.getElement().setAttribute("alt", i18n.GL0308()); questiontext.getElement().setAttribute("title", i18n.GL0308()); hintsButton.setText(i18n.GL0667()); hintsButton.getElement().setId("btnHintsButton"); hintsButton.getElement().setAttribute("alt", i18n.GL0667()); hintsButton.getElement().setAttribute("title", i18n.GL0667()); explanaionButton.setText(i18n.GL0316()); explanaionButton.getElement().setId("btnexplanaionButton"); explanaionButton.getElement().setAttribute("alt", i18n.GL0316()); explanaionButton.getElement().setAttribute("title", i18n.GL0316()); openEndedQuestionText.getElement().setId("htmlOpenEndedQuestionText"); questionContainer.getElement().setId("fpnlQuestionContainer"); openEndedQuestionImage.getElement().setId("imgOpenEndedQuestionImage"); hintsContainer.getElement().setId("fpnlHintsContainer"); explanationContainer.getElement().setId("pnlExplanationContainer"); }
/** This is the entry point method. */ public void onModuleLoad() { // Create the popup dialog box dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); dialogBox.setModal(true); closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); errorLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(errorLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox closeButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); } }); authService.isLoggedIn( new AsyncCallback<Boolean>() { public void onFailure(Throwable arg0) { showError("Error", Message.SERVER_ERROR); } public void onSuccess(Boolean res) { if (res) { displayMainUI(); } else { displayLoginForm(); } } }); }
public NoScenario() { slidePanel = new SlidePanel(SLIDER_WIDTH, SLIDER_HEIGHT); slidePanel.addStyleName(ADD_SCENARIO_BOX); slidePanel.getFooterPanel().addStyleName(FOOTER_CSS_CLASS); btnNext = new Button(R.lang.Next()); btnNext.addClickHandler(this); btnNext.getElement().getStyle().setFloat(Float.RIGHT); btnPrevious = new Button(R.lang.Previous()); btnPrevious.addClickHandler(this); slidePanel.addFooterWidget(btnPrevious); slidePanel.addFooterWidget(btnNext); sac = new ScenarioAddController(true, false, false); sac.addBlurHandlerSName(this); sac.addKeyUpHandlerSName(this); mecController = new MEControllerSettings(); mecController.addValueChangeHandler(this); mecPanel = new FlowPanel(); Headline headline = new Headline(R.lang.measurementEnvironmentController()); headline.getElement().getStyle().setMarginTop(0, Unit.PX); mecPanel.add(headline); mecPanel.add(mecController.getView()); mecPanel.getElement().getStyle().setPadding(1, Unit.EM); slidePanel.addWidget(sac.getView()); slidePanel.addWidget(mecPanel); add(slidePanel); updateButtons(); }
public ScheduleEditor(ScheduleDialogType type) { super(); isBlockoutDialog = (type == ScheduleDialogType.BLOCKOUT); startTimePicker = new TimePicker(); setStylePrimaryName("scheduleEditor"); // $NON-NLS-1$ scheduleCombo = createScheduleCombo(); Label l = new Label(MSGS.recurrenceColon()); l.setStyleName(SCHEDULE_LABEL); add(l); add(scheduleCombo); SimplePanel hspacer = new SimplePanel(); hspacer.setWidth("100px"); // $NON-NLS-1$ if (!isBlockoutDialog) { startTimePanel = createStartTimePanel(); add(startTimePanel); } else { // Blockout End TimePicker blockoutEndTimePicker = new TimePicker(); blockoutEndTimePicker.setHour("01"); // $NON-NLS-1$ blockoutEndTimePicker.setMinute("00"); // $NON-NLS-1$ blockoutEndTimePicker.setTimeOfDay(TimeUtil.TimeOfDay.PM); // Blockout End Caption Panel blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE); final String[] daysList = new String[365]; final String[] hoursList = new String[24]; final String[] minutesList = new String[60]; // Populate list for (Integer i = 0; i < 365; i++) { String iStr = i.toString(); daysList[i] = iStr; if (i < 60) { minutesList[i] = iStr; if (i < 24) { hoursList[i] = iStr; } } } // Units of time Drop Down daysListBox = new ListBox(); daysListBox.getElement().setId("daysListBox"); // $NON-NLS-1$ populateListItems(daysListBox, daysList, 0, 365); final Label daysLabel = new Label(MSGS.dayOrDays()); daysLabel.getElement().setAttribute("for", daysListBox.getElement().getId()); // $NON-NLS-1$ hoursListBox = new ListBox(); hoursListBox.getElement().setId("hoursListBox"); // $NON-NLS-1$ populateListItems(hoursListBox, hoursList, 0, 24); final Label hoursLabel = new Label(MSGS.hourOrHours()); hoursLabel.getElement().setAttribute("for", hoursListBox.getElement().getId()); // $NON-NLS-1$ minutesListBox = new ListBox(); minutesListBox.getElement().setId("minutesListBox"); // $NON-NLS-1$ populateListItems(minutesListBox, minutesList, 0, 60); final Label minutesLabel = new Label(MSGS.minuteOrMinutes()); minutesLabel .getElement() .setAttribute("for", minutesListBox.getElement().getId()); // $NON-NLS-1$ final HorizontalPanel durationPanel = new HorizontalPanel(); durationPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); durationPanel.setSpacing(blockoutEndTimePicker.getSpacing()); durationPanel.add(daysListBox); durationPanel.add(daysLabel); durationPanel.add(hoursListBox); durationPanel.add(hoursLabel); durationPanel.add(minutesListBox); durationPanel.add(minutesLabel); // Bind change handler this.scheduleCombo.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String scheduleType = scheduleCombo.getItemText(scheduleCombo.getSelectedIndex()); if (ScheduleType.RUN_ONCE.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 365); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.HOURS.toString().equals(scheduleType)) { hide(true, daysListBox, daysLabel, hoursListBox, hoursLabel); show(true, minutesListBox, minutesLabel); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.DAILY.toString().equals(scheduleType)) { hide(true, daysListBox, daysLabel); show(true, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.WEEKLY.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 7); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.MONTHLY.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 28); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.YEARLY.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 365); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } } }); /* * Radio Buttons for duration */ this.durationRadioButton = new RadioButton("durationRadioGroup", "durationRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$ this.durationRadioButton.setText(MSGS.duration()); this.durationRadioButton.setValue(Boolean.TRUE); this.durationRadioButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE); durationPanel.getElement().getStyle().clearDisplay(); } }); this.endTimeRadioButton = new RadioButton("durationRadioGroup", "endTimeRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$ this.endTimeRadioButton.setText(MSGS.endTime()); this.endTimeRadioButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { blockoutEndTimePicker.getElement().getStyle().clearDisplay(); durationPanel.getElement().getStyle().setDisplay(Display.NONE); } }); // Radio Buttons Panel HorizontalPanel radioButtonsPanel = new HorizontalPanel(); radioButtonsPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); radioButtonsPanel.add(this.durationRadioButton); radioButtonsPanel.add(this.endTimeRadioButton); // Ends Panel VerticalPanel endsPanel = new VerticalPanel(); endsPanel.add(radioButtonsPanel); endsPanel.add(blockoutEndTimePicker); endsPanel.add(durationPanel); // Blockout period CaptionPanel blockoutStartCaptionPanel = new CaptionPanel(MSGS.startTime()); HorizontalPanel blockoutStartPanel = new HorizontalPanel(); blockoutStartPanel.add(getStartTimePicker()); timeZonePicker = new ListBox(); timeZonePicker.setStyleName("timeZonePicker"); timeZonePicker.setVisibleItemCount(1); blockoutStartPanel.add(timeZonePicker); timeZonePicker.getElement().getParentElement().getStyle().setPaddingTop(5, Unit.PX); blockoutStartCaptionPanel.add(blockoutStartPanel); populateTimeZonePicker(); // Ends Caption Panel CaptionPanel endCaptionPanel = new CaptionPanel(MSGS.endsCaptionTitle()); endCaptionPanel.add(endsPanel); VerticalPanel blockoutPanel = new VerticalPanel(); blockoutPanel.setWidth("100%"); // $NON-NLS-1$ blockoutPanel.add(blockoutStartCaptionPanel); blockoutPanel.add(endCaptionPanel); add(blockoutPanel); } VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); // $NON-NLS-1$ add(vp); setCellHeight(vp, "100%"); // $NON-NLS-1$ runOnceEditor = new RunOnceEditor(startTimePicker); vp.add(runOnceEditor); scheduleTypeMap.put(ScheduleType.RUN_ONCE, runOnceEditor); runOnceEditor.setVisible(true); recurrenceEditor = new RecurrenceEditor(startTimePicker); vp.add(recurrenceEditor); scheduleTypeMap.put(ScheduleType.SECONDS, recurrenceEditor); scheduleTypeMap.put(ScheduleType.MINUTES, recurrenceEditor); scheduleTypeMap.put(ScheduleType.HOURS, recurrenceEditor); scheduleTypeMap.put(ScheduleType.DAILY, recurrenceEditor); scheduleTypeMap.put(ScheduleType.WEEKLY, recurrenceEditor); scheduleTypeMap.put(ScheduleType.MONTHLY, recurrenceEditor); scheduleTypeMap.put(ScheduleType.YEARLY, recurrenceEditor); recurrenceEditor.setVisible(false); cronEditor = new CronEditor(); scheduleTypeMap.put(ScheduleType.CRON, cronEditor); cronEditor.setVisible(false); if (!isBlockoutDialog) { vp.add(cronEditor); VerticalPanel blockoutButtonPanel = new VerticalPanel(); blockoutButtonPanel.setWidth("100%"); // $NON-NLS-1$ // blockoutButtonPanel.setHeight("30%"); blockoutButtonPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); blockoutButtonPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); // We want to add a button to check for blockout conflicts blockoutCheckButton.setStyleName("pentaho-button"); // $NON-NLS-1$ blockoutCheckButton.getElement().setId("blockout-check-button"); // $NON-NLS-1$ blockoutCheckButton.setVisible(false); hspacer.setHeight("50px"); // $NON-NLS-1$ blockoutButtonPanel.add(hspacer); blockoutButtonPanel.add(blockoutCheckButton); vp.add(hspacer); add(blockoutButtonPanel); } configureOnChangeHandler(); }
/** This is the entry point method. */ public void onModuleLoad() { final Button sendButton = new Button("Send"); final TextBox nameField = new TextBox(); nameField.setText("Deepanjali"); final Label errorLabel = new Label(); // We can add style names to widgets sendButton.addStyleName("sendButton"); // Add the nameField and sendButton to the RootPanel // Use RootPanel.get() to get the entire body element RootPanel.get("nameFieldContainer").add(nameField); RootPanel.get("sendButtonContainer").add(sendButton); RootPanel.get("errorLabelContainer").add(errorLabel); // Focus the cursor on the name field when the app loads nameField.setFocus(true); nameField.selectAll(); // Create the popup dialog box final DialogBox dialogBox = new DialogBox(); dialogBox.setText("Remote Procedure Call"); dialogBox.setAnimationEnabled(true); final Button closeButton = new Button("Close"); // We can set the id of a widget by accessing its Element closeButton.getElement().setId("closeButton"); final Label textToServerLabel = new Label(); final HTML serverResponseLabel = new HTML(); VerticalPanel dialogVPanel = new VerticalPanel(); dialogVPanel.addStyleName("dialogVPanel"); dialogVPanel.add(new HTML("<b>Sending name to the server:</b>")); dialogVPanel.add(textToServerLabel); dialogVPanel.add(new HTML("<br><b>Server replies:</b>")); dialogVPanel.add(serverResponseLabel); dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT); dialogVPanel.add(closeButton); dialogBox.setWidget(dialogVPanel); // Add a handler to close the DialogBox closeButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { dialogBox.hide(); sendButton.setEnabled(true); sendButton.setFocus(true); } }); // Create a handler for the sendButton and nameField class MyHandler implements ClickHandler, KeyUpHandler { /** Fired when the user clicks on the sendButton. */ public void onClick(ClickEvent event) { sendNameToServer(); } /** Fired when the user types in the nameField. */ public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { sendNameToServer(); } } /** Send the name from the nameField to the server and wait for a response. */ private void sendNameToServer() { // First, we validate the input. errorLabel.setText(""); String textToServer = nameField.getText(); if (!FieldVerifier.isValidName(textToServer)) { errorLabel.setText("Please enter at least four characters"); return; } // Then, we send the input to the server. sendButton.setEnabled(false); textToServerLabel.setText(textToServer); serverResponseLabel.setText(""); greetingService.greetServer( textToServer, new AsyncCallback<String>() { public void onFailure(Throwable caught) { // Show the RPC error message to the user dialogBox.setText("Remote Procedure Call - Failure"); serverResponseLabel.addStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(SERVER_ERROR); dialogBox.center(); closeButton.setFocus(true); } public void onSuccess(String result) { dialogBox.setText("Remote Procedure Call"); serverResponseLabel.removeStyleName("serverResponseLabelError"); serverResponseLabel.setHTML(result); dialogBox.center(); closeButton.setFocus(true); } }); } } // Add a handler to send the name to the server MyHandler handler = new MyHandler(); sendButton.addClickHandler(handler); nameField.addKeyUpHandler(handler); }
public void Configure_start_time() { final DialogBox dialogBox = new DialogBox(); dialogBox.addStyleName("g-DialogBox"); DOM.setStyleAttribute(dialogBox.getElement(), "border", "0px"); dialogBox.setText("Set Time"); dialogBox.setSize("294", "207"); final AbsolutePanel absolutePanel = new AbsolutePanel(); dialogBox.setWidget(absolutePanel); absolutePanel.setSize("294px", "187px"); // 自定义datebox的输出格式,在这里采用了简洁的输出格式"M/d/yy H:mm" final DateBox dateBox = new DateBox(); DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat( "M/d/yy H:mm"); // DateTimeFormat只能通过函数getFormat来生成满足特定pattern的对象,因为其构造函数为protected DateBox.DefaultFormat defaultFormat = new DateBox.DefaultFormat(dateTimeFormat); dateBox.setFormat(defaultFormat); absolutePanel.add(dateBox, 109, 35); dateBox.setWidth("150px"); final Label dateLabel = new Label("Date:"); absolutePanel.add(dateLabel, 36, 35); dateLabel.setSize("38px", "18px"); final Label dateLabel_1 = new Label("Time:"); absolutePanel.add(dateLabel_1, 36, 80); dateLabel_1.setSize("38px", "18px"); final ListBox listBox = new ListBox(); absolutePanel.add(listBox, 109, 77); listBox.setSize("150px", "21px"); String[] minutes = {"00", "15", "30", "45"}; String[] hours = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }; String[] times = new String[96]; // System.out.println(minutes.length+" "+hours.length+" "+times.length); for (int i = 0; i < 24; i++) { for (int j = 0; j < 4; j++) { times[4 * i + j] = hours[i] + ":" + minutes[j]; } } for (int i = 0; i < 96; i++) { listBox.addItem(times[i]); } final Button okButton = new Button(); DOM.setStyleAttribute(okButton.getElement(), "fontSize", "10pt"); okButton.removeStyleName("gwt-Button"); okButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // TODO Auto-generated method stub TextBox inner_textBox = dateBox.getTextBox(); if (inner_textBox.getText() == null || inner_textBox.getText().equals("")) { dateBox.addStyleName("dateBoxFormatError"); // 如果用户没编辑日期,则datebox框变红,等待用户更正 } else { String dateString = inner_textBox.getText(); int index = listBox.getSelectedIndex(); String timeString = listBox.getValue(index); if (timeString != null) { String[] date_and_time = dateString.split(" "); date_and_time[1] = timeString; dateString = date_and_time[0] + " " + date_and_time[1]; start_time = dateString; } dialogBox.hide(); } System.out.println(start_time); } }); absolutePanel.add(okButton, 93, 129); okButton.setSize("105px", "21px"); okButton.setText("OK"); dialogBox.center(); }