List of usage examples for com.google.gwt.user.client.ui CheckBox CheckBox
public CheckBox()
From source file:org.ednovo.gooru.client.mvp.gsearch.SearchAbstractView.java
License:Open Source License
/** * @param filterPanel instance of DisclosurePanelUc which gets added widget * @param key check box name/* w w w.ja v a 2s .c o m*/ * @param value check box value */ public void renderCheckBox(PPanel filterPanel, String key, final String value) { final CheckBox categoryChk = new CheckBox(); categoryChk.setText(value); categoryChk.setName(key); categoryChk.setStyleName("checkbox"); //categoryChk.addStyleName(value.toLowerCase()); filterPanel.add(categoryChk); if (value.equalsIgnoreCase("Mobile Friendly")) { final Image mobilefriendly = new Image(); mobilefriendly.setUrl("images/mos/questionmark.png"); mobilefriendly.getElement().getStyle().setCursor(Cursor.POINTER); mobilefriendly.setAltText(i18n.GL0732()); mobilefriendly.setTitle(i18n.GL0732()); mobilefriendly.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { toolTip = new ToolTip(i18n.GL0454() + "" + " " + i18n.GL04431() + " " + " "); toolTip.getTootltipContent().getElement().setAttribute("style", "width: 258px;"); toolTip.getElement().getStyle().setBackgroundColor("transparent"); toolTip.getElement().getStyle().setPosition(Position.ABSOLUTE); toolTip.setPopupPosition(mobilefriendly.getAbsoluteLeft() - (50 + 22), mobilefriendly.getAbsoluteTop() + 22); toolTip.show(); } }); mobilefriendly.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { EventTarget target = event.getRelatedTarget(); if (Element.is(target)) { if (!toolTip.getElement().isOrHasChild(Element.as(target))) { toolTip.hide(); } } } }); filterPanel.add(mobilefriendly); categoryChk.getElement().setAttribute("style", "display: inline-block;"); } categoryChk.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { callSearch(); } }); }
From source file:org.ednovo.gooru.client.mvp.home.SearchHomeFilterVc.java
License:Open Source License
/** * Create filter widget such as grade , subject, resource type * @param filterList instance of {@link SearchFilterDo} *///ww w . ja va 2 s.co m public void setData(SearchFilterDo filterList) { Collection<String> categories = filterList.getCategories().values(); List<String> subjects = filterList.getSubjects(); Label gradeLabel = new Label(GL1076.toUpperCase()); gradeLabel.setStyleName(HomeCBundle.INSTANCE.css().filterSubHeader()); filterGradeFloPanel.clear(); filterGradeFloPanel.add(gradeLabel); Iterator<Map.Entry<String, String>> gradesIterator = filterList.getGradeLevels().entrySet().iterator(); while (gradesIterator.hasNext()) { Map.Entry<String, String> entry = gradesIterator.next(); filterCheBox = new CheckBox(); filterCheBox.setText(entry.getValue()); filterCheBox.setStyleName("filterCheckBox"); filterGradeFloPanel.add(filterCheBox); } Label categoryLabel = new Label(GL1310.toUpperCase()); categoryLabel.setStyleName(HomeCBundle.INSTANCE.css().filterSubHeader()); filterColOneResourceTypeFloPanel.clear(); filterColTwoResourceTypeFloPanel.clear(); filterColOneResourceTypeFloPanel.add(categoryLabel); int i = 0; for (String category : categories) { filterCheBox = new CheckBox(); filterCheBox.setText(category); filterCheBox.setStyleName("filterCheckBox"); if (i < 4) { filterColOneResourceTypeFloPanel.add(filterCheBox); } else { filterColTwoResourceTypeFloPanel.add(filterCheBox); } i++; } Label subjectLabel = new Label(GL1311.toUpperCase()); subjectLabel.setStyleName(HomeCBundle.INSTANCE.css().filterSubHeader()); filterSubjectFloPanel.clear(); filterSubjectFloPanel.add(subjectLabel); for (String subject : subjects) { filterCheBox = new CheckBox(); filterCheBox.setText(subject); filterCheBox.setStyleName("filterCheckBox"); filterSubjectFloPanel.add(filterCheBox); } }
From source file:org.ednovo.gooru.client.mvp.search.SearchFilterVc.java
License:Open Source License
/** * @param disclosurePanelVc instance of DisclosurePanelUc which gets added widget * @param key check box name//from w ww. j av a 2 s . c o m * @param value check box value */ public void renderCheckBox(DisclosurePanelUc disclosurePanelVc, String key, String value) { CheckBox categoryChk = new CheckBox(); categoryChk.setText(value); categoryChk.setName(key); if (value.equalsIgnoreCase("videos")) { MixpanelUtil.mixpanelEvent("search_video_filter_selected"); categoryChk.getElement().setId("chkVideos"); } else if (value.equalsIgnoreCase("webpage")) { MixpanelUtil.mixpanelEvent("search_webpage_filter_selected"); categoryChk.getElement().setId("chkwebpage"); } /*else if(value.equalsIgnoreCase("websites")) { MixpanelUtil.mixpanelEvent("search_websites_filter_selected"); categoryChk.getElement().setId("chkwebsites"); }*/ else if (value.equalsIgnoreCase("interactives")) { MixpanelUtil.mixpanelEvent("search_interactives_filter_selected"); categoryChk.getElement().setId("chkInteractives"); } else if (value.equalsIgnoreCase("questions")) { MixpanelUtil.mixpanelEvent("search_questions_filter_selected"); categoryChk.getElement().setId("chkQuestions"); } else if (value.equalsIgnoreCase("images")) { MixpanelUtil.mixpanelEvent("search_images_filter_selected"); categoryChk.getElement().setId("chkImages"); } else if (value.equalsIgnoreCase("texts")) { MixpanelUtil.mixpanelEvent("search_texts_filter_selected"); categoryChk.getElement().setId("chkTexts"); } else if (value.equalsIgnoreCase("audios")) { MixpanelUtil.mixpanelEvent("search_audios_filter_selected"); categoryChk.getElement().setId("chkAudios"); } /*else if(value.equalsIgnoreCase("others")){ MixpanelUtil.mixpanelEvent("search_others_filter_selected"); categoryChk.getElement().setId("chkOther"); }*/ else if (value.equalsIgnoreCase("science")) { categoryChk.getElement().setId("chkScience"); } else if (value.equalsIgnoreCase("math")) { categoryChk.getElement().setId("chkMath"); } else if (value.equalsIgnoreCase("Social Sciences")) { categoryChk.getElement().setId("chkSocialSciences"); } else if (value.equalsIgnoreCase("Language Arts")) { categoryChk.getElement().setId("chkLanguageArts"); } else if (value.equalsIgnoreCase("Arts and Humanities")) { categoryChk.getElement().setId("chkArts&Humanities"); } else if (value.equalsIgnoreCase("Technology and Engineering")) { categoryChk.getElement().setId("chkTechnology&Engineering"); } else if (value.equalsIgnoreCase("Elementary School")) { categoryChk.getElement().setId("chkElementarySchool"); } else if (value.equalsIgnoreCase("Middle School")) { categoryChk.getElement().setId("chkMiddleSchool"); } else if (value.equalsIgnoreCase("High School")) { categoryChk.getElement().setId("chkHighSchool"); } else if (value.equalsIgnoreCase("Higher Education")) { categoryChk.getElement().setId("chkHigherEducation"); } else if (value.equalsIgnoreCase("Show only Quizzes")) { categoryChk.getElement().setId("chkShowonlyQuizzes"); } categoryChk.setStyleName(CssTokens.FILTER_CHECKBOX); categoryChk.addStyleName(value.toLowerCase()); disclosurePanelVc.addWidget(categoryChk); categoryChk.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { AppClientFactory.fireEvent(new GetSearchKeyWordEvent()); } }); }
From source file:org.ednovo.gooru.client.mvp.search.SearchFilterVc.java
License:Open Source License
/** * @param disclosurePanelVc instance of DisclosurePanelUc which gets added widget * @param key check box name//from w w w . j av a 2s . c om * @param value check box value */ public void renderCheckBox(HTMLPanel disclosurePanelVc, String key, String value) { if (chkNotFriendly == null) { chkNotFriendly = new CheckBox(); } chkNotFriendly.setText(value); disclosurePanelVc.setStyleName("mobilefriendlyContainer"); chkNotFriendly.setName(key); if (value.equalsIgnoreCase("Mobile Friendly")) { chkNotFriendly.getElement().setId("chkNotFriendly"); chkNotFriendly.getElement().getStyle().setMarginTop(20, Unit.PX); /*chkNotFriendly.getElement().getStyle().setMarginLeft(9, Unit.PX); chkNotFriendly.getElement().getStyle().setWidth(102, Unit.PX);*/ } chkNotFriendly.setStyleName(CssTokens.FILTER_CHECKBOX); chkNotFriendly.addStyleName(value.toLowerCase()); disclosurePanelVc.add(chkNotFriendly); chkNotFriendly.addValueChangeHandler(new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { if (chkNotFriendly.getValue()) { MixpanelUtil.MOS_Filter("Selected"); } else { MixpanelUtil.MOS_Filter("Unselected"); } AppClientFactory.fireEvent(new GetSearchKeyWordEvent()); } }); }
From source file:org.emftools.samples.school.webdemo.client.WebDemoEntryPoint.java
License:Open Source License
public void onModuleLoad() { // Orientation selection orientationListBox = new ListBox(); orientationListBox.addItem("Top down"); orientationListBox.addItem("Left to right"); orientationListBox.setSelectedIndex(0); RootPanel.get("orientationContainer").add(orientationListBox); // Align same EClasses alignSameEClassesCheckBox = new CheckBox(); alignSameEClassesCheckBox.setValue(true); RootPanel.get("alignSameEClassesContainer").add(alignSameEClassesCheckBox); // Image container diagramScrollPanel = new ScrollPanel(); diagramScrollPanel.setPixelSize(690, 500); diagramImage = new Image(); diagramImage.setUrl("timer.gif"); diagramScrollPanel.add(diagramImage); RootPanel.get("imageContainer").add(diagramScrollPanel); hiddenDiagramImage = new Image(); hiddenDiagramImage.setVisible(false); RootPanel.get().add(hiddenDiagramImage); // Orientation selection zoomListBox = new ListBox(); for (int zoomFactor : zoomFactors) { zoomListBox.addItem(zoomFactor + "%"); }// ww w.j a va 2 s.co m zoomListBox.setSelectedIndex(2); RootPanel.get("zoomContainer").add(zoomListBox); // Classroom condition classroomOclExpressionTextArea = new TextArea(); defaultTexteAreaStyleName = classroomOclExpressionTextArea.getStyleName(); classroomOclExpressionTextArea.setValue("true"); RootPanel.get("classroomOclExpressionContainer").add(classroomOclExpressionTextArea); // Student condition studentOclExpressionTextArea = new TextArea(); studentOclExpressionTextArea.setValue("true"); RootPanel.get("studentOclExpressionContainer").add(studentOclExpressionTextArea); // Classroom Status label classroomStatusLabel = new Label(); classroomStatusLabel.setText(" "); classroomStatusLabel.setStyleName("badvalue"); RootPanel.get("classroomStatusContainer").add(classroomStatusLabel); // Student Status label studentStatusLabel = new Label(); studentStatusLabel.setText(" "); studentStatusLabel.setStyleName("badvalue"); RootPanel.get("studentStatusContainer").add(studentStatusLabel); // Change handler orientationListBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { updateDiagram(); } }); alignSameEClassesCheckBox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { updateDiagram(); } }); zoomListBox.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { updateDiagram(); } }); classroomOclExpressionTextArea.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { oclExpressionHasChanged("Classroom", classroomOclExpressionTextArea, classroomStatusLabel); } }); studentOclExpressionTextArea.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { oclExpressionHasChanged("Student", studentOclExpressionTextArea, studentStatusLabel); } }); // Updates the diagram updateDiagram(); }
From source file:org.eurekastreams.web.client.ui.common.notification.NotificationSettingsWidget.java
License:Apache License
/** * Builds the personal/group grid for notification preferences. * * @param notifiers//from ww w. j a va 2s. c o m * List of notifiers. * @param categories * Names and enum values of the notification preference categories to include in this grid. * @param filters * User's current notification preferences. * @return Grid. */ private Grid buildNotificationFilterGrid(final Map<String, String> notifiers, final Map<String, String> categories, final Collection<NotificationFilterPreferenceDTO> filters) { Grid grid = settingsGrid; grid.resize(1 + categories.size(), 1 + notifiers.size()); // display each category name (one per row) int row = 0; for (String categoryName : categories.values()) { row++; grid.setText(row, 0, categoryName); } // display each notifier column int col = 0; for (Map.Entry<String, String> entry : notifiers.entrySet()) { col++; final String notifierType = entry.getKey(); // display the names of the notifiers grid.setText(0, col, entry.getValue()); grid.getColumnFormatter().addStyleName(col, style.gridColumn()); // create the checkboxes for that notifier per category row = 0; for (String category : categories.keySet()) { row++; CheckBox checkBox = new CheckBox(); checkBox.setValue(true); grid.setWidget(row, col, checkBox); checkboxIndex.put(new NotificationFilterPreferenceDTO(notifierType, category), checkBox); } } // uncheck checkboxes for suppressed entries for (NotificationFilterPreferenceDTO pref : filters) { pref.setPersonId(0); HasValue<Boolean> checkBox = checkboxIndex.get(pref); if (checkBox != null) { checkBox.setValue(false); } } return grid; }
From source file:org.footware.client.dialogs.UploadTrackBox.java
License:Apache License
public UploadTrackBox() { setText("Upload a Track"); Grid g = new Grid(7, 2); setAutoHideEnabled(true);//from w w w. ja v a 2 s.c o m setGlassEnabled(true); // trackName = new TextBox(); // trackName.setName(NAME); // g.setWidget(0, 0, new HTML("Name")); // g.setWidget(0, 1, trackName); privacy = new ListBox(); privacy.setName(PRIVACY); privacy.addItem("Public", PRIVACY_PUBLIC); privacy.addItem("Private", PRIVACY_PRIVATE); g.setWidget(1, 0, new HTML("Privacy")); g.setWidget(1, 1, privacy); enableComments = new CheckBox(); enableComments.setName(COMMENTS); g.setWidget(2, 0, new HTML("Enable comments")); g.setWidget(2, 1, enableComments); notes = new TextArea(); notes.setName(NOTES); notes.setSize("200px", "50px"); g.setWidget(3, 0, new HTML("Notes")); g.setWidget(3, 1, notes); email = new TextBox(); email.setVisible(false); g.setWidget(6, 0, email); file = new FileUpload(); file.setName(FILE); g.setWidget(4, 0, new HTML("Select File")); g.setWidget(4, 1, file); Button upload = new Button("Upload"); upload.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { doUpload(); hide(); } }); Button close = new Button("Cancel"); close.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { hide(); } }); g.setWidget(5, 0, upload); g.setWidget(5, 1, close); form = new FormPanel(); // TODO implement httpservlet to accept file. form.setAction("/footware/trackUpload"); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.add(g); add(form); }
From source file:org.freemedsoftware.gwt.client.screen.AccountsReceivableScreen.java
License:Open Source License
public AccountsReceivableScreen() { final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel);/*from w w w . j av a 2 s . c om*/ parentSearchTable = new FlexTable(); parentSearchTable.setSize("100%", "100%"); parentSearchTable.setBorderWidth(1); parentSearchTable.getElement().getStyle().setProperty("borderCollapse", "collapse"); verticalPanel.add(parentSearchTable); searchCriteriaVPanel = new VerticalPanel(); searchCriteriaVPanel.setWidth("100%"); searchCriteriaVPanel.setSpacing(5); parentSearchTable.setWidget(0, 0, searchCriteriaVPanel); parentSearchTable.getFlexCellFormatter().getElement(0, 0).setAttribute("width", "50%"); parentSearchTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP); Label lbSearch = new Label(_("Search Criteria")); lbSearch.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); lbSearch.getElement().getStyle().setProperty("fontSize", "15px"); lbSearch.getElement().getStyle().setProperty("textDecoration", "underline"); lbSearch.getElement().getStyle().setProperty("fontWeight", "bold"); searchCriteriaTable = new FlexTable(); searchCriteriaVPanel.add(lbSearch); searchCriteriaVPanel.add(searchCriteriaTable); int row = 0; final Label smartLNameSearchLabel = new Label(_("Patient Last Name") + ": "); searchCriteriaTable.setWidget(row, 0, smartLNameSearchLabel); patientlnTextBox = new TextBox(); searchCriteriaTable.setWidget(row, 1, patientlnTextBox); widgetTracker.put("Patient Last Name", row + ":1:" + "last_name"); widgetContainer.put("Patient Last Name", patientlnTextBox); final Label smartFNameSearchLabel = new Label(_("Patient First Name") + ": "); searchCriteriaTable.setWidget(row, 2, smartFNameSearchLabel); patientfnTextBox = new TextBox(); searchCriteriaTable.setWidget(row, 3, patientfnTextBox); widgetTracker.put(_("Patient First Name"), row + ":3:" + "last_name"); widgetContainer.put(_("Patient First Name"), patientfnTextBox); row++; final Label ptFullName = new Label(_("Patient Full Name") + ": "); searchCriteriaTable.setWidget(row, 0, ptFullName); patientWidget = new PatientWidget(); searchCriteriaTable.setWidget(row, 1, patientWidget); widgetTracker.put(_("Patient"), row + ":1:" + "patient"); widgetContainer.put(_("Patient"), patientWidget); row++; final Label fieldSearchLabel = new Label(_("Provider") + ": "); searchCriteriaTable.setWidget(row, 0, fieldSearchLabel); providerWidget = new SupportModuleWidget("ProviderModule"); searchCriteriaTable.setWidget(row, 1, providerWidget); widgetTracker.put(_("Provider"), row + ":1:" + "provider"); widgetContainer.put(_("Provider"), providerWidget); row++; final Label facilityLabel = new Label(_("Facility") + ": "); searchCriteriaTable.setWidget(row, 0, facilityLabel); facilityModule = new SupportModuleWidget("FacilityModule"); searchCriteriaTable.setWidget(row, 1, facilityModule); widgetTracker.put(_("Facility"), row + ":1:" + "facility"); widgetContainer.put(_("Facility"), facilityModule); row++; final Label dateOfServiceLabel = new Label(_("Date of Service") + ": "); searchCriteriaTable.setWidget(row, 0, dateOfServiceLabel); wDos = new CustomDatePicker(); searchCriteriaTable.setWidget(row, 1, wDos); widgetTracker.put(_("Date of Service"), row + ":1:" + "date_of"); widgetContainer.put(_("Date of Service"), wDos); row++; final Label transactionDateFrom = new Label(_("Transaction Date From") + ": "); searchCriteriaTable.setWidget(row, 0, transactionDateFrom); wDos2 = new CustomDatePicker(); searchCriteriaTable.setWidget(row, 1, wDos2); widgetTracker.put(_("Transaction Date From"), row + ":1:" + "date_from"); widgetContainer.put(_("Transaction Date From"), wDos2); final Label transactionDateTo = new Label(_("Transaction Date To") + ": "); searchCriteriaTable.setWidget(row, 2, transactionDateTo); wDos3 = new CustomDatePicker(); searchCriteriaTable.setWidget(row, 3, wDos3); widgetTracker.put(_("Transaction Date To"), row + ":3:" + "date_to"); widgetContainer.put(_("Transaction Date To"), wDos3); row++; final Label tagSearch = new Label(_("Tag Search") + ": "); searchCriteriaTable.setWidget(row, 0, tagSearch); tagWidget = new PatientTagWidget(); searchCriteriaTable.setWidget(row, 1, tagWidget); widgetTracker.put(_("Tag Search"), row + ":1:" + "tag"); widgetContainer.put(_("Tag Search"), tagWidget); row++; final HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.setSpacing(5); searchButton = new CustomButton(_("Search"), AppConstants.ICON_SEARCH); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { // TODO Auto-generated method stub refreshSearch(); } }); buttonPanel.add(searchButton); clearButton = new CustomButton(_("Clear"), AppConstants.ICON_CLEAR); clearButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { // TODO Auto-generated method stub clearForm(); } }); buttonPanel.add(clearButton); buttonPanel.setSpacing(5); searchCriteriaTable.setWidget(row, 1, buttonPanel); currentCriteriaPanel = new VerticalPanel(); currentCriteriaPanel.setWidth("100%"); currentCriteriaPanel.setSpacing(5); Label lbExistingCri = new Label(_("Current Criteria")); lbExistingCri.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); lbExistingCri.getElement().getStyle().setProperty("fontSize", "15px"); lbExistingCri.getElement().getStyle().setProperty("textDecoration", "underline"); lbExistingCri.getElement().getStyle().setProperty("fontWeight", "bold"); existingCriteriaTable = new FlexTable(); currentCriteriaPanel.add(lbExistingCri); // currentCriteriaPanel.add(existingCriteriaTable); parentSearchTable.setWidget(0, 1, currentCriteriaPanel); parentSearchTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP); final HorizontalPanel horizontalPanel = new HorizontalPanel(); verticalPanel.add(horizontalPanel); //creating search result table sortableTable = new CustomTable(); sortableTable.setWidth("100%"); // sortableTable.addColumn("", "selected"); sortableTable.addColumn(_("Svc Date"), "date_of"); sortableTable.addColumn(_("Acct Bal"), "total_balance"); sortableTable.addColumn(_("Provider"), "provider"); sortableTable.addColumn(_("Patient"), "patient"); sortableTable.addColumn(_("Item"), "item"); sortableTable.addColumn(_("Type"), "item_type"); sortableTable.addColumn(_("Svc"), "procedure_id"); sortableTable.addColumn(_("Date"), "payment_date"); sortableTable.addColumn(_("Adjs"), "money_in"); sortableTable.addColumn(_("Charges"), "money_out"); sortableTable.addColumn(_("Action"), "action"); sortableTable.setIndexName("item"); sortableTable.setTableRowClickHandler(new TableRowClickHandler() { @Override public void handleRowClick(HashMap<String, String> data, int col) { if (col == 1) { otherCreteriaMap.put(_("Date of Service"), data.get("date_of") + ":date_of:" + data.get("date_of")); refreshSearch(); } else if (col == 3) { otherCreteriaMap.put(_("Provider"), data.get("provider") + ":provider:" + data.get("provider_id")); refreshSearch(); } else if (col == 4) { otherCreteriaMap.put(_("Patient"), data.get("patient") + ":patient:" + data.get("patient_id")); refreshSearch(); } else if (col == 6) { otherCreteriaMap.put(_("Item Type"), data.get("item_type") + ":type:" + data.get("item_type_id")); refreshSearch(); } else if (col == 7) { otherCreteriaMap.put(_("Procedure"), data.get("procedure_id") + ":procedure:" + data.get("procedure_id")); refreshSearch(); } } }); sortableTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() { public Widget setColumn(String columnName, final HashMap<String, String> data) { Integer id = Integer.parseInt(data.get("procedure_id")); if (columnName.compareTo("action") == 0) { HorizontalPanel actionPanel = new HorizontalPanel(); actionPanel.setSpacing(5); HTML htmlLedger = new HTML( "<a href=\"javascript:undefined;\" style='color:blue'>" + _("Ledger") + "</a>"); actionPanel.add(htmlLedger); htmlLedger.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { LedgerPopup ledgerPopup = new LedgerPopup(data.get("procedure_id"), data.get("patient_id"), data.get("proc_cov_type")); ledgerPopup.removeAction(LedgerPopup.DEDUCTABLE); ledgerPopup.removeAction(LedgerPopup.COPAY); ledgerPopup.show(); ledgerPopup.center(); } }); return actionPanel; } if (columnName.compareTo("selected") == 0) { CheckBox c = new CheckBox(); c.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent arg0) { } }); // checkboxStack.put(c, id); return c; } else if (data.get("total_balance") != null) { Float balance = Float.parseFloat(data.get("total_balance")); Label label = new Label(data.get(columnName)); if (balance == 0) label.getElement().getStyle().setColor("#0B6126"); else if (balance < 0) label.getElement().getStyle().setColor("#FF0000"); return label; } else { return (Widget) null; } } }); sortableTableEmptyLabel.setStylePrimaryName("freemed-MessageText"); sortableTableEmptyLabel.setText(_("No patients found with the specified criteria.")); sortableTableEmptyLabel.setVisible(true); verticalPanel.add(sortableTable); // Set visible focus *after* this is shown, otherwise it won't focus. try { patientfnTextBox.setFocus(true); } catch (Exception e) { GWT.log("Caught exception: ", e); } Util.setFocus(patientlnTextBox); }
From source file:org.freemedsoftware.gwt.client.screen.CallInScreen.java
License:Open Source License
public CallInScreen() { super(ModuleName); final boolean canBook = CurrentState.isActionAllowed(SchedulerWidget.moduleName, AppConstants.WRITE); final HorizontalPanel horizontalPanel = new HorizontalPanel(); initWidget(horizontalPanel);//from w w w. ja va2s. c om horizontalPanel.setSize("100%", "100%"); final VerticalPanel verticalPanel = new VerticalPanel(); horizontalPanel.add(verticalPanel); verticalPanel.setSize("100%", "100%"); tabPanel = new TabPanel(); tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { // TODO Auto-generated method stub if (event.getSelectedItem() == 1 && formSelection.getWidgetValue().equals("Basic")) ((TextBox) basicFormFields.get("cifname")).setFocus(true); } }); verticalPanel.add(tabPanel); /* * final Label callInLabel = new Label("Call-in Patient Management."); * verticalPanelMenu.add(callInLabel); * callInLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); */ final HorizontalPanel headerHPanel = new HorizontalPanel(); headerHPanel.setWidth("100%"); verticalPanelMenu.add(headerHPanel); final HorizontalPanel menuButtonsPanel = new HorizontalPanel(); menuButtonsPanel.setSpacing(1); headerHPanel.add(menuButtonsPanel); if (canDelete || canWrite || canBook) { final CustomButton selectAllButton = new CustomButton(_("Select All"), AppConstants.ICON_SELECT_ALL); menuButtonsPanel.add(selectAllButton); selectAllButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent wvt) { Iterator<CheckBox> iter = checkboxStack.keySet().iterator(); while (iter.hasNext()) { CheckBox t = iter.next(); t.setValue(true); callInTable.selectionAdd(checkboxStack.get(t).toString()); // } } } }); } if (canDelete || canWrite || canBook) { final CustomButton selectNoneButton = new CustomButton(_("Select None"), AppConstants.ICON_SELECT_NONE); menuButtonsPanel.add(selectNoneButton); selectNoneButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { clearSelection(); } }); } if (canDelete) { final CustomButton deleteButton = new CustomButton(_("Delete"), AppConstants.ICON_DELETE); menuButtonsPanel.add(deleteButton); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (callInTable.getSelectedCount() < 1) Window.alert(_("Please select at least one entry!")); else if (Window.confirm(_("Are you sure you want to delete these item(s)?"))) { List<String> slectedItems = callInTable.getSelected(); Iterator<String> itr = slectedItems.iterator();// Get all // selected // items // from // custom // table int totalItems = slectedItems.size(); int curItem = 1; while (itr.hasNext()) deleteEntry(Integer.parseInt(itr.next()), curItem++, totalItems);// delete // messages // one by // one } } }); } if (canWrite) { final CustomButton enterButton = new CustomButton(_("Create Patient"), AppConstants.ICON_ADD_PERSON); menuButtonsPanel.add(enterButton); enterButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (callInTable.getSelectedCount() < 1) Window.alert(_("Please select at least one entry!")); else if (callInTable.getSelectedCount() > 1) Window.alert(_("You can create only a single patient at a time!")); else { List<String> slectedItems = callInTable.getSelected(); Integer id = Integer.parseInt(slectedItems.get(0)); final HashMap<String, String> data = callInTable.getDataById(id); if (data.get("archive") == null || data.get("archive").compareTo("0") == 0) { // openPatientForm(id,getCallInScreen()); callinConvertFromPatient(id, new CustomCommand() { @Override public void execute(Object id) { populate(null); Util.spawnPatientScreen((Integer) id, data.get("name")); } }); } else { Window.alert(_("You can't create patient of archived enteries!")); } } } }); } if (canBook) { final CustomButton bookButton = new CustomButton(_("Book"), AppConstants.ICON_BOOK_APP); menuButtonsPanel.add(bookButton); bookButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (callInTable.getSelectedCount() < 1) Window.alert(_("Please select at least one entry!")); else if (callInTable.getSelectedCount() > 1) Window.alert(_("You can book only a single appointment at a time!")); else { List<String> slectedItems = callInTable.getSelected(); Integer id = Integer.parseInt(slectedItems.get(0)); HashMap<String, String> data = callInTable.getDataById(id); if (data.get("archive") == null || data.get("archive").compareTo("0") == 0) { SchedulerScreen schedulerScreen = SchedulerScreen.getInstance(); EventData eventData = schedulerScreen.getSchedulerWidget().getNewExternalDataEvent(); eventData.setPatientId(id); if (data.get("provider") != null) eventData.setProviderId(Integer.parseInt(data.get("provider"))); eventData.setResourceType(AppConstants.APPOINTMENT_TYPE_CALLIN_PATIENT); schedulerScreen.getSchedulerWidget().setExternalDataEvent(eventData); Util.spawnTab(AppConstants.SCHEDULER, schedulerScreen); } else { Window.alert(_("You can't book archived enteries!")); } } } }); if (canModify) { final CustomButton modifyButton = new CustomButton(_("Modify"), AppConstants.ICON_MODIFY); menuButtonsPanel.add(modifyButton); modifyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (callInTable.getSelectedCount() < 1) Window.alert(_("Please select an entry!")); else if (callInTable.getSelectedCount() > 1) Window.alert(_("You can modify only a single entry at a time!")); else { List<String> slectedItems = callInTable.getSelected(); Integer id = Integer.parseInt(slectedItems.get(0)); selectedEntryId = id; HashMap<String, String> data = callInTable.getDataById(id); if (data.get("archive") == null || data.get("archive").compareTo("0") == 0) { tabPanel.selectTab(1); selectedEntryId = id; modifyEntry(selectedEntryId); } else { Util.confirm(_( "You can not modify an archived record. Do you want to un-archive this record?"), new Command() { @Override public void execute() { // TODO Auto-generated method stub unarchiveEntry(selectedEntryId); } }, null); } } } }); } } if (canWrite) { final CustomButton addEventButton = new CustomButton(_("Add Event"), AppConstants.ICON_ADD); menuButtonsPanel.add(addEventButton); addEventButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (callInTable.getSelectedCount() < 1) Window.alert(_("Please select an entry!")); else if (callInTable.getSelectedCount() > 1) Window.alert(_("You can modify only a single entry at a time!")); else { List<String> slectedItems = callInTable.getSelected(); Integer id = Integer.parseInt(slectedItems.get(0)); HashMap<String, String> data = callInTable.getDataById(id); String name = null; if (data != null && data.get("name") != null) { name = data.get("name"); } openAddEventForm(id, name); } } }); } if (canRead) { final CustomButton searchButton = new CustomButton(_("Search"), AppConstants.ICON_SEARCH); menuButtonsPanel.add(searchButton); searchButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { initSearchPopup(); } }); } callInTable = new CustomTable(); verticalPanelMenu.add(callInTable); callInTable.setAllowSelection(false); callInTable.setSize("100%", "100%"); // //what for is this used???To work on this callInTable.setIndexName("id"); // /// if (canDelete || canWrite || canBook) callInTable.addColumn("", "selected"); callInTable.addColumn(_("Date"), "call_date_mdy"); callInTable.addColumn(_("Name"), "name"); callInTable.addColumn(_("Contact Phone"), "contact_phone"); callInTable.addColumn(_("Coverage"), "coverage"); callInTable.addColumn(_("Complaint"), "complaint"); callInTable.setTableRowClickHandler(new TableRowClickHandler() { @Override public void handleRowClick(HashMap<String, String> data, int col) { try { if (col != 0 || !(canBook || canWrite || canDelete)) { final Integer callinId = Integer.parseInt(data.get("id")); showCallinInfo(callinId); } } catch (Exception e) { GWT.log("Caught exception: ", e); } } }); callInTable.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() { public Widget setColumn(String columnName, HashMap<String, String> data) { Integer id = Integer.parseInt(data.get("id")); if (columnName.compareTo("selected") == 0) { CheckBox c = new CheckBox(); c.addClickHandler(getCallInScreen()); checkboxStack.put(c, id); return c; } else if (data.get("archive") != null && data.get("archive").compareTo("1") == 0) { Label label = new Label(data.get(columnName)); label.setStyleName(AppConstants.STYLE_LABEL_ALERT); return label; } return (Widget) null; } }); tabPanel.add(verticalPanelMenu, _("Menu")); if (canWrite) { // tabPanel.add(createEntryTabBar(), "Entry"); entryVPanel = new VerticalPanel(); tabPanel.add(entryVPanel, _("Entry")); final HorizontalPanel selectionHPanel = new HorizontalPanel(); selectionHPanel.setStyleName(AppConstants.STYLE_LABEL_HEADER_SMALL); entryVPanel.add(selectionHPanel); selectionHPanel.setSpacing(5); final Label selectionLabel = new Label(_("Select Form Type") + ":"); selectionHPanel.add(selectionLabel); formSelection = new CustomListBox(); selectionHPanel.add(formSelection); formSelection.addItem("", ""); formSelection.addItem(_("Basic Entry Form"), "Basic"); formSelection.addChangeHandler(new ChangeHandler() { public void onChange(ChangeEvent arg0) { handleFormSelection(); } }); } // tabPanel.add(new VerticalPanel(),"Entry"); tabPanel.selectTab(0); // createEntryTabBar(); // callInTable.formatTable(5); // callInTable.getFlexTable().setWidth("100%"); // ////// populate(null); }
From source file:org.freemedsoftware.gwt.client.screen.MessagingScreen.java
License:Open Source License
private MessagingScreen() { super(moduleName); final VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel);/*from www. j a v a2s.c o m*/ final HorizontalPanel horizontalPanel = new HorizontalPanel(); verticalPanel.add(horizontalPanel); if (canRead) { horizontalPanel.add(messageTagSelect); messageTagSelect.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { try { String effective = messageTagSelect.getWidgetValue(); wMessages.clearAllSelections(); populate(effective); } catch (Exception ex) { Window.alert(ex.toString()); } } }); } if (canWrite) { final CustomButton composeButton = new CustomButton(_("Compose"), AppConstants.ICON_COMPOSE_MAIL); horizontalPanel.add(composeButton); composeButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { final MessagingComposeScreen p = new MessagingComposeScreen(); p.setParentScreen(getMessagingScreen()); CurrentState.getTabPanel().add(p, new ClosableTab(_("Compose Message"), p)); CurrentState.getTabPanel().selectTab(CurrentState.getTabPanel().getWidgetCount() - 1); } }); } if (canModify) { final CustomButton selectButton = new CustomButton(_("Change"), AppConstants.ICON_CHANGE); horizontalPanel.add(selectButton); selectButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { populate(((CustomListBox) evt.getSource()).getWidgetValue()); } }); } if (canModify) { final CustomButton moveButton = new CustomButton(_("Move"), AppConstants.ICON_MOVE_MAIL); horizontalPanel.add(moveButton); moveButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { Window.alert("STUB: move message(s)"); } }); } if (canRead) { final CustomButton selectAllButton = new CustomButton(_("Select All"), AppConstants.ICON_SELECT_ALL); horizontalPanel.add(selectAllButton); selectAllButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent wvt) { Iterator<CheckBox> iter = checkboxStack.keySet().iterator(); while (iter.hasNext()) { CheckBox t = iter.next(); t.setValue(true); if (!selectedItems.contains(checkboxStack.get(t))) { selectedItems.add(checkboxStack.get(t)); } } } }); } if (canRead) { final CustomButton selectNoneButton = new CustomButton(_("Select None"), AppConstants.ICON_SELECT_NONE); horizontalPanel.add(selectNoneButton); selectNoneButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { Iterator<CheckBox> iter = checkboxStack.keySet().iterator(); while (iter.hasNext()) { CheckBox t = iter.next(); t.setValue(false); if (selectedItems.contains(checkboxStack.get(t))) { selectedItems.remove(checkboxStack.get(t)); } } } }); } if (canDelete) { final CustomButton deleteButton = new CustomButton(_("Delete"), AppConstants.ICON_DELETE); horizontalPanel.add(deleteButton); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent evt) { if (Window.confirm(_("Are you sure you want to delete these item(s)?"))) { List<String> slectedItems = wMessages.getSelected(); // Get all selected items from custom table Iterator<String> itr = slectedItems.iterator(); while (itr.hasNext()) { deleteMessage(Integer.parseInt(itr.next())); } populate(messageTagSelect.getWidgetValue()); } } }); } final VerticalPanel verticalSplitPanel = new VerticalPanel(); verticalPanel.add(verticalSplitPanel); verticalSplitPanel.setSize("100%", "100%"); // verticalSplitPanel.setSplitPosition("50%"); if (canRead) { wMessages = new CustomTable(); // wMessages.setAllowSelection(true); // wMessages.setMultipleSelection(true); verticalSplitPanel.add(wMessages); wMessages.setSize("100%", "100%"); wMessages.addColumn(_("Selected"), "selected"); wMessages.addColumn(_("Received"), "stamp"); // col 1 wMessages.addColumn(_("From"), "from_user"); // col 2 wMessages.addColumn(_("Subject"), "subject"); // col 3 // wMessages.addColumn(_("Delete"), "delete"); // col 4 wMessages.setIndexName("id"); wMessages.setTableRowClickHandler(new TableRowClickHandler() { @Override public void handleRowClick(HashMap<String, String> data, int col) { try { final Integer messageId = Integer.parseInt(data.get("id")); if (col == 4) { deleteMessage(messageId); } else if (col != 0) { showMessage(messageId); msgView = new MessageView(); msgView.setMessageId(messageId); msgView.setMsgFrom(data.get("from_user")); msgView.setMsgDate(data.get("stamp")); msgView.setText(msgView.createMessageHtml(data.get("from_user"), data.get("stamp"), data.get("subject"), data.get("content"))); // showMessage(messageId); msgView.setMessagingScreen(getMessagingScreen()); popupMessageView = new Popup(); popupMessageView.setNewWidget(msgView); msgView.setOnClose(new Command() { public void execute() { popupMessageView.hide(); } }); popupMessageView.initialize(); } } catch (Exception e) { GWT.log("Caught exception: ", e); } } }); wMessages.setTableWidgetColumnSetInterface(new TableWidgetColumnSetInterface() { public Widget setColumn(String columnName, HashMap<String, String> data) { Integer id = Integer.parseInt(data.get("id")); if (columnName.compareTo("selected") == 0) { CheckBox c = new CheckBox(); c.addClickHandler(getMessagingScreen()); checkboxStack.put(c, id); return c; } else { return (Widget) null; } } }); } // verticalSplitPanel.setSize("100%", "100%"); // Start population routine populate(""); populateTagWidget(); // Register on the event bus CurrentState.getEventBus().addHandler(SystemEvent.TYPE, this); }