List of usage examples for com.google.gwt.safehtml.shared SafeHtml SafeHtml
SafeHtml
From source file:cimav.client.view.nomina.NominaMovimientosUI.java
private void initTableColumns() { // Concepto/*from ww w. j a v a 2 s .co m*/ Column<Movimiento, SafeHtml> conceptoCol = new Column<Movimiento, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Movimiento object) { SafeHtmlBuilder a = new SafeHtmlBuilder(); if (object.getConcepto().getSuma()) { a.appendHtmlConstant("<span>" + object.getConcepto().getName() + "</span>"); } else { a.appendHtmlConstant("<span style='color: grey; font-style: italic;'>" + object.getConcepto().getName() + "</span>"); } return a.toSafeHtml(); } }; dataGrid.addColumn(conceptoCol, "Concepto"); dataGrid.setColumnWidth(conceptoCol, 80, Style.Unit.PCT); // Cantidad Column<Movimiento, SafeHtml> cantidadCol = new Column<Movimiento, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Movimiento object) { String result = Utils.formatCantidad(object.getCantidad()); SafeHtmlBuilder a = new SafeHtmlBuilder(); if (object.getConcepto().getSuma()) { a.appendHtmlConstant("<span style='padding-right: 5px;'>" + result + "</span>"); } else { a.appendHtmlConstant("<span style='padding-right: 5px; color: grey; font-style: italic;'>" + result + "</span>"); } return a.toSafeHtml(); } }; cantidadCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); SafeHtmlHeader headerCantidad = new SafeHtmlHeader(new SafeHtml() { @Override public String asString() { return "<p style='text-align:center; margin-bottom: 0px;'>Cantidad</p>"; } }); if (ETipoConcepto.PERCEPCION.equals(this.tipoConcepto) || ETipoConcepto.DEDUCCION.equals(this.tipoConcepto)) { SafeHtmlHeader footerCantidad = new SafeHtmlHeader(new SafeHtml() { @Override public String asString() { String result = "0.00"; List<Movimiento> items = dataGrid.getVisibleItems(); if (!items.isEmpty()) { // create MathContext object with 2 precision BigDecimal totalPercepciones = BigDecimal.ZERO; for (Movimiento nomQuin : items) { if (nomQuin.getConcepto().getSuma()) { // si el concepto suma (ej. Despensa no suma) totalPercepciones = totalPercepciones.add(nomQuin.getCantidad()); } } result = Utils.formatCurrency(totalPercepciones); } return "<p style=\"text-align:right;\">" + result.trim() + "</p>"; } }); dataGrid.addColumn(cantidadCol, headerCantidad, footerCantidad); } else { dataGrid.addColumn(cantidadCol, headerCantidad); } dataGrid.setColumnWidth(cantidadCol, 20, Style.Unit.PCT); }
From source file:cimav.client.view.nomina.NominaRepercucionesUI.java
private void initTableColumns() { // Concepto//from www .ja v a 2 s .co m Column<Movimiento, SafeHtml> conceptoCol = new Column<Movimiento, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Movimiento object) { SafeHtmlBuilder a = new SafeHtmlBuilder(); if (object.getConcepto().getSuma()) { a.appendHtmlConstant("<span>" + object.getConcepto().getName() + "</span>"); } else { a.appendHtmlConstant("<span style='color: grey; font-style: italic;'>" + object.getConcepto().getName() + "</span>"); } return a.toSafeHtml(); } }; dataGrid.addColumn(conceptoCol, "Concepto"); dataGrid.setColumnWidth(conceptoCol, 80, Style.Unit.PCT); // Cantidad Column<Movimiento, SafeHtml> cantidadCol = new Column<Movimiento, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Movimiento object) { String result = Utils.formatCantidad(object.getCantidad()); SafeHtmlBuilder a = new SafeHtmlBuilder(); if (object.getConcepto().getSuma()) { a.appendHtmlConstant("<span style='padding-right: 5px;'>" + result + "</span>"); } else { a.appendHtmlConstant("<span style='padding-right: 5px; color: grey; font-style: italic;'>" + result + "</span>"); } return a.toSafeHtml(); } }; cantidadCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); SafeHtmlHeader headerCantidad = new SafeHtmlHeader(new SafeHtml() { @Override public String asString() { return "<p style='text-align:center; margin-bottom: 0px;'>Empleado</p>"; } }); dataGrid.addColumn(cantidadCol, headerCantidad); dataGrid.setColumnWidth(cantidadCol, 20, Style.Unit.PCT); // Cantidad_empresa Column<Movimiento, SafeHtml> cantidadEmpresaCol = new Column<Movimiento, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(Movimiento object) { String result = Utils.formatCantidad(object.getCantidadEmpresa()); SafeHtmlBuilder a = new SafeHtmlBuilder(); a.appendHtmlConstant("<span style='padding-right: 5px;'>" + result + "</span>"); return a.toSafeHtml(); } }; cantidadEmpresaCol.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); SafeHtmlHeader headerCantidadEmpresa = new SafeHtmlHeader(new SafeHtml() { @Override public String asString() { return "<p style='text-align:center; margin-bottom: 0px;'>Empresa</p>"; } }); dataGrid.addColumn(cantidadEmpresaCol, headerCantidadEmpresa); dataGrid.setColumnWidth(cantidadEmpresaCol, 20, Style.Unit.PCT); }
From source file:com.codenvy.ide.ext.github.client.projectimporter.importerpage.GithubImporterPageViewImpl.java
License:Open Source License
/** Creates table what contains list of available repositories. * @param ideResources*///from w ww. j a v a 2 s . c o m private void createRepositoriesTable(Resources ideResources) { repositories = new CellTable<ProjectData>(15, ideResources); Column<ProjectData, ImageResource> iconColumn = new Column<ProjectData, ImageResource>( new ImageResourceCell()) { @Override public ImageResource getValue(ProjectData item) { return resources.project(); } }; Column<ProjectData, SafeHtml> repositoryColumn = new Column<ProjectData, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(final ProjectData item) { return new SafeHtml() { public String asString() { return item.getName(); } }; } }; Column<ProjectData, SafeHtml> descriptionColumn = new Column<ProjectData, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(final ProjectData item) { return new SafeHtml() { public String asString() { return "<span>" + item.getDescription() + "</span>"; } }; } }; repositories.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>")); repositories.setColumnWidth(iconColumn, 28, Style.Unit.PX); repositories.addColumn(repositoryColumn, locale.samplesListRepositoryColumn()); repositories.addColumn(descriptionColumn, locale.samplesListDescriptionColumn()); // don't show loading indicator repositories.setLoadingIndicator(null); final SingleSelectionModel<ProjectData> selectionModel = new SingleSelectionModel<ProjectData>(); selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { @Override public void onSelectionChange(SelectionChangeEvent event) { ProjectData selectedObject = selectionModel.getSelectedObject(); delegate.onRepositorySelected(selectedObject); } }); repositories.setSelectionModel(selectionModel); }
From source file:com.dianaui.universal.core.client.ui.TimePicker.java
License:Apache License
private void initContainer() { final String incrementHourId = HTMLPanel.createUniqueId(); final String incrementMinuteId = HTMLPanel.createUniqueId(); final String incrementSecondId = HTMLPanel.createUniqueId(); final String hourContainerId = HTMLPanel.createUniqueId(); final String minuteContainerId = HTMLPanel.createUniqueId(); final String secondContainerId = HTMLPanel.createUniqueId(); final String decrementHourId = HTMLPanel.createUniqueId(); final String decrementMinuteId = HTMLPanel.createUniqueId(); final String decrementSecondId = HTMLPanel.createUniqueId(); final String periodId = HTMLPanel.createUniqueId(); container = new HTMLPanel(new SafeHtml() { private String getSeparator(final String separator) { return "<td class=\"" + Styles.SEPARATOR + "\">" + separator + "</td>"; }//from w ww .j a v a 2 s .co m @Override public String asString() { return "<table>" + "<tr>" + "<td id=\"" + incrementHourId + "\"></td>" + getSeparator(" ") + "<td id=\"" + incrementMinuteId + "\"></td>" + (secondsEnabled ? getSeparator(" ") + "<td id=\"" + incrementSecondId + "\"></td>" : "") + "</tr>" + "<tr>" + "<td id=\"" + hourContainerId + "\"></td>" + getSeparator(":") + "<td id=\"" + minuteContainerId + "\"></td>" + (secondsEnabled ? getSeparator(":") + "<td id=\"" + secondContainerId + "\"></td>" : "") + (hourFormat == HourFormat._12 ? "<td id=\"" + periodId + "\"></td>" : "") + "</tr>" + "<tr>" + "<td id=\"" + decrementHourId + "\"></td>" + getSeparator(" ") + "<td id=\"" + decrementMinuteId + "\"></td>" + (secondsEnabled ? getSeparator(" ") + "<td id=\"" + decrementSecondId + "\"></td>" : "") + "</tr>" + "</table>"; } }); container.setStyleName(Styles.TIMEPICKER_WIDGET); container.addStyleName(Styles.DROPDOWN_MENU); // attach widgets container.add(incrementHour, incrementHourId); container.add(incrementMinute, incrementMinuteId); if (secondsEnabled) container.add(incrementSecond, incrementSecondId); container.add(hourBox, hourContainerId); container.add(minuteBox, minuteContainerId); if (secondsEnabled) container.add(secondBox, secondContainerId); container.add(decrementHour, decrementHourId); container.add(decrementMinute, decrementMinuteId); if (secondsEnabled) container.add(decrementSecond, decrementSecondId); if (hourFormat == HourFormat._12) container.add(togglePeriodLabel, periodId); add(container); }
From source file:com.ephesoft.gxt.admin.client.view.batchclass.BatchClassMenuView.java
License:Open Source License
/** * /* w w w .j a v a 2s.c o m*/ */ @SuppressWarnings("serial") private void intializeMenuItems() { exportMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.EXPORT_BATCH_CLASS); } }); deleteMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.DELETE_BATCH_CLASS); } }); copyMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.COPY_BATCH_CLASS); } }); unlockMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.UNLOCK_BATCH_CLASS_MENU); } }); applyMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.APPLY); } }); keyGenMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.KEY_GENERATOR); } }); }
From source file:com.ephesoft.gxt.admin.client.view.batchclassfield.BatchClassFieldMenuView.java
License:Open Source License
/** * Initialize menu items./*from w ww .ja v a 2 s . c o m*/ */ @SuppressWarnings("serial") private void intializeMenuItems() { addMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.ADD_BUTTON); } }); deleteMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.DELETE); } }); regexValidationMenuItem = new CustomMenuItem(SafeHtmlUtils .fromSafeConstant(LocaleDictionary.getConstantValue(BatchClassManagementConstants.VALIDATE_REGEX))); }
From source file:com.ephesoft.gxt.admin.client.view.document.DocumentTypeMenuView.java
License:Open Source License
/** * /* ww w. j a v a 2 s.co m*/ */ @SuppressWarnings("serial") private void intializeMenuItems() { add = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.ADD_BUTTON); // return // LocaleDictionary.getLocaleDictionary().getConstantValue(DocumentTypeConstants.ADD_DOCUMENT_TYPE); } }); copyDocumentType = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.COPY); // return // LocaleDictionary.getLocaleDictionary().getConstantValue(DocumentTypeConstants.COPY_DOCUMENT_TYPE); } }); delete = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.DELETE); // return // LocaleDictionary.getLocaleDictionary().getConstantValue(DocumentTypeConstants.DELETE_DOCUMENT_TYPE); } }); learnFiles = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.LEARN_FILES); // return // LocaleDictionary.getLocaleDictionary().getConstantValue(DocumentTypeConstants.VIEW_LEARN_FILES); } }); // testClassification = new MenuItem(new SafeHtml() { // // @Override // public String asString() { // return "Test Classification"; // // return // // LocaleDictionary.getLocaleDictionary().getConstantValue(DocumentTypeConstants.TEST_CLASSIFICATION); // } // }); exportDocumentType = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.EXPORT); // return // LocaleDictionary.getLocaleDictionary().getConstantValue(DocumentTypeConstants.EXPORT_DOCUMENT_TYPE); } }); }
From source file:com.ephesoft.gxt.admin.client.view.email.EmailMenuView.java
License:Open Source License
/** * Intialize menu items.//from w ww. j a v a 2 s . co m */ @SuppressWarnings("serial") private void intializeMenuItems() { addEmailMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.LABEL_ADD_BUTTON); } }); deleteEmailMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.LABEL_DELETE_BUTTON); } }); testEmailMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.TEST_EMAIL); } }); }
From source file:com.ephesoft.gxt.admin.client.view.kvextraction.AdvancedKVExtraction.AdvancedKVExtractionButtonPanelView.java
License:Open Source License
@SuppressWarnings("serial") private void intializeMenuItems() { applyMenuItem = new CustomMenuItem(new SafeHtml() { @Override//ww w . j a v a 2 s . c o m public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.APPLY); } }); testAdvKVMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.TEST_ADVANCED_KV); } }); clearMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.CLEAR); } }); cancelMenuItem = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.CANCEL); } }); }
From source file:com.ephesoft.gxt.admin.client.view.kvextraction.KVExtractionMenuView.java
License:Open Source License
private void intializeMenuItems() { delete = new CustomMenuItem(new SafeHtml() { @Override// www. ja v a 2 s. c om public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.DELETE); } }); advAdd = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.ADV_ADD); } }); advEdit = new CustomMenuItem(new SafeHtml() { @Override public String asString() { return LocaleDictionary.getConstantValue(BatchClassConstants.ADV_EDIT); } }); regexValidationMenuItem = new CustomMenuItem(SafeHtmlUtils .fromSafeConstant(LocaleDictionary.getConstantValue(BatchClassManagementConstants.VALIDATE_REGEX))); }