List of usage examples for com.google.gwt.i18n.client DateTimeFormat getShortDateTimeFormat
@Deprecated public static DateTimeFormat getShortDateTimeFormat()
From source file:at.ait.dme.yuma.client.image.annotation.ImageAnnotationTreeNode.java
License:EUPL
/** * adds the header information: user, date and rates *//*from w w w. jav a2s . c o m*/ public void addHeader() { headerPanel.setStyleName("imageAnnotation-header"); if (annotation.getScope() == ImageAnnotation.Scope.PRIVATE) { privateAnnotation.setStyleName("imageAnnotation-private-annotation-image"); headerPanel.add(privateAnnotation); } headerUser.setText(annotation.getCreatedBy()); headerUser.setStyleName("imageAnnotation-header-user"); headerPanel.add(headerUser); if (annotation.getCreated() != null) { headerDate .setText("(" + DateTimeFormat.getShortDateTimeFormat().format(annotation.getModified()) + ")"); headerDate.setStyleName("imageAnnotation-header-date"); } headerPanel.add(headerDate); if (annotation.hasFragment()) { fragment.setStyleName("imageAnnotation-header-fragment"); headerPanel.add(fragment); } if (annotation.hasFragment() && (Application.getBbox() != null || Application.isInTileMode())) { mapAnnotation.setStyleName("imageAnnotation-header-map"); mapAnnotation.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { WindowPanel window = MinMaxWindowPanel.createMinMaxWindowPanel(550, 300, 500, 300); window.setWidget(new GoogleMapsComposite(annotation)); window.show(); } }); headerPanel.add(mapAnnotation); } // rate information not yet implemented /* * if(annotation.getRate()==null || annotation.getRate()==0) * rateValue.setStyleName("imageAnnotation-header-rate"); else * if(annotation.getRate()>0) * rateValue.setStyleName("imageAnnotation-header-rate-plus"); else * rateValue.setStyleName("imageAnnotation-header-rate-minus"); */ rateValue.setStyleName("imageAnnotation-header-rate"); rateValue.setText("+0"); annotationRatePanel.add(rateValue); rateMinus.setStyleName("imageAnnotation-header-rate-image-minus"); annotationRatePanel.add(rateMinus); ratePlus.setStyleName("imageAnnotation-header-rate-image-plus"); annotationRatePanel.add(ratePlus); if (Application.getFlaggedId() != null && Application.getFlaggedId().equals(annotation.getId())) { flag.setStyleName("imageAnnotation-header-flag-red-image"); flagged = true; } else { flag.setStyleName("imageAnnotation-header-flag-blue-image"); } Anchor flagAnchor = new Anchor(); flagAnchor.setHref(createFlagLink()); flagAnchor.setTarget("_blank"); flagAnchor.getElement().appendChild(flag.getElement()); annotationRatePanel.add(flagAnchor); headerPanel.add(annotationRatePanel); annotationPanel.add(headerPanel); // Init CSS style deselect(); }
From source file:ccc.client.gwt.widgets.AbstractResourceTable.java
License:Open Source License
/** * Config method for the columns./* w w w.j av a 2 s . c om*/ * * @param configs list of configurations. */ public void createColumnConfigs(final List<ColumnConfig> configs) { final GridCellRenderer<BeanModel> rsRenderer = ResourceTypeRendererFactory.rendererForResourceSummary(); final ColumnConfig typeColumn = new ColumnConfig(ResourceSummary.Properties.TYPE, UI_CONSTANTS.type(), 40); typeColumn.setRenderer(rsRenderer); configs.add(typeColumn); final ColumnConfig workingCopyColumn = new ColumnConfig(ResourceSummary.Properties.WORKING_COPY, UI_CONSTANTS.draft(), 40); workingCopyColumn.setSortable(false); workingCopyColumn.setMenuDisabled(true); workingCopyColumn.setRenderer(rsRenderer); configs.add(workingCopyColumn); final ColumnConfig mmIncludeColumn = new ColumnConfig(ResourceSummary.Properties.MM_INCLUDE, UI_CONSTANTS.menu(), 40); mmIncludeColumn.setRenderer(rsRenderer); configs.add(mmIncludeColumn); final ColumnConfig createdColumn = new ColumnConfig(ResourceSummary.Properties.DATE_CREATED, UI_CONSTANTS.dateCreated(), 100); createdColumn.setDateTimeFormat(DateTimeFormat.getShortDateTimeFormat()); createdColumn.setHidden(true); configs.add(createdColumn); final ColumnConfig updatedColumn = new ColumnConfig(ResourceSummary.Properties.DATE_CHANGED, UI_CONSTANTS.dateChanged(), 100); updatedColumn.setDateTimeFormat(DateTimeFormat.getShortDateTimeFormat()); updatedColumn.setHidden(true); configs.add(updatedColumn); final ColumnConfig visibleColumn = new ColumnConfig(ResourceSummary.Properties.VISIBLE, UI_CONSTANTS.visible(), 45); visibleColumn.setRenderer(rsRenderer); visibleColumn.setHidden(true); configs.add(visibleColumn); final ColumnConfig lockedColumn = new ColumnConfig(ResourceSummary.Properties.LOCKED, UI_CONSTANTS.lockedBy(), 80); configs.add(lockedColumn); final ColumnConfig publishedByColumn = new ColumnConfig(ResourceSummary.Properties.PUBLISHED, UI_CONSTANTS.publishedBy(), 80); configs.add(publishedByColumn); final ColumnConfig nameColumn = new ColumnConfig(ResourceSummary.Properties.NAME, UI_CONSTANTS.name(), 250); configs.add(nameColumn); final ColumnConfig titleColumn = new ColumnConfig(ResourceSummary.Properties.TITLE, UI_CONSTANTS.title(), 250); configs.add(titleColumn); final ColumnConfig changedByColumn = new ColumnConfig(ResourceSummary.Properties.CHANGED_BY, UI_CONSTANTS.changedBy(), 80); changedByColumn.setHidden(true); configs.add(changedByColumn); }
From source file:ccc.client.gwt.widgets.ActionTable.java
License:Open Source License
private void createColumnConfigs(final List<ColumnConfig> configs) { addColumn(configs, ActionSummary.Properties.TYPE, UI_CONSTANTS.action(), TYPE_COLUMN) .setRenderer(ResourceTypeRendererFactory.rendererForActionSummary()); addColumn(configs, ActionSummary.Properties.USERNAME, UI_CONSTANTS.scheduledBy(), SMALL_COLUMN); addColumn(configs, ActionSummary.Properties.EXECUTE_AFTER, UI_CONSTANTS.scheduledFor(), SMALL_COLUMN) .setDateTimeFormat(DateTimeFormat.getShortDateTimeFormat()); addColumn(configs, ActionSummary.Properties.STATUS, UI_CONSTANTS.status(), SMALL_COLUMN) .setRenderer(ResourceTypeRendererFactory.rendererForActionSummary()); addColumn(configs, ActionSummary.Properties.FAILURE_CODE, UI_CONSTANTS.failureCode(), SMALL_COLUMN); addColumn(configs, ActionSummary.Properties.SUBJECT_TYPE, UI_CONSTANTS.type(), V_SMALL_COLUMN) .setRenderer(ResourceTypeRendererFactory.rendererForActionSummary()); addColumn(configs, ActionSummary.Properties.PATH, UI_CONSTANTS.resourcePath(), MEDIUM_COLUMN); }
From source file:ccc.client.gwt.widgets.ResourceTable.java
License:Open Source License
/** * Config method for the columns.//from ww w .j av a 2 s .c om * * @param configs list of configurations. */ @Override public void createColumnConfigs(final List<ColumnConfig> configs) { final GridCellRenderer<BeanModel> rsRenderer = ResourceTypeRendererFactory.rendererForResourceSummary(); final ColumnConfig typeColumn = new ColumnConfig(ResourceSummary.Properties.TYPE, UI_CONSTANTS.type(), 40); typeColumn.setRenderer(rsRenderer); configs.add(typeColumn); final ColumnConfig workingCopyColumn = new ColumnConfig(ResourceSummary.Properties.WORKING_COPY, UI_CONSTANTS.draft(), 40); workingCopyColumn.setSortable(false); workingCopyColumn.setMenuDisabled(true); workingCopyColumn.setRenderer(rsRenderer); configs.add(workingCopyColumn); final ColumnConfig mmIncludeColumn = new ColumnConfig(ResourceSummary.Properties.MM_INCLUDE, UI_CONSTANTS.menu(), 40); mmIncludeColumn.setRenderer(rsRenderer); configs.add(mmIncludeColumn); final ColumnConfig createdColumn = new ColumnConfig(ResourceSummary.Properties.DATE_CREATED, UI_CONSTANTS.dateCreated(), 100); createdColumn.setDateTimeFormat(DateTimeFormat.getShortDateTimeFormat()); createdColumn.setHidden(true); configs.add(createdColumn); final ColumnConfig updatedColumn = new ColumnConfig(ResourceSummary.Properties.DATE_CHANGED, UI_CONSTANTS.dateChanged(), 100); updatedColumn.setDateTimeFormat(DateTimeFormat.getShortDateTimeFormat()); updatedColumn.setHidden(true); configs.add(updatedColumn); final ColumnConfig visibleColumn = new ColumnConfig(ResourceSummary.Properties.VISIBLE, UI_CONSTANTS.visible(), 45); visibleColumn.setRenderer(rsRenderer); visibleColumn.setHidden(true); configs.add(visibleColumn); final ColumnConfig lockedColumn = new ColumnConfig(ResourceSummary.Properties.LOCKED, UI_CONSTANTS.lockedBy(), 80); configs.add(lockedColumn); final ColumnConfig publishedByColumn = new ColumnConfig(ResourceSummary.Properties.PUBLISHED, UI_CONSTANTS.publishedBy(), 80); configs.add(publishedByColumn); final ColumnConfig changedByColumn = new ColumnConfig(ResourceSummary.Properties.CHANGED_BY, UI_CONSTANTS.changedBy(), 45); configs.add(changedByColumn); final ColumnConfig nameColumn = new ColumnConfig(ResourceSummary.Properties.NAME, UI_CONSTANTS.name(), 250); configs.add(nameColumn); final ColumnConfig titleColumn = new ColumnConfig(ResourceSummary.Properties.TITLE, UI_CONSTANTS.title(), 250); configs.add(titleColumn); }
From source file:com.automaster.client.ui.paineis.tabs.financeiro.dialogs.NovoLancamento.java
public NovoLancamento(final int codCliente, final ListGrid listLancamentos, final ListGrid listFaturas, final Label labelLanc, final Label labelfaturas, final Label labelSaldo, final TabConsultaFaturaLancamento objFaturaLancamento) { final NovoLancamento objLancamento = this; setTitle("Novo lanamento"); setWidth(800);/* w ww . j ava 2 s . c o m*/ setHeight(550); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); setLayoutAlign(Alignment.CENTER); setMembersMargin(5); final DynamicForm formNovoLancamento = new DynamicForm(); formNovoLancamento.setAutoFocus(true); Label label = new Label("<strong><h3>Cadastrar novo Lanamento</h3></strong>"); label.setAlign(Alignment.CENTER); label.setHeight(30); Label labelListaFat = new Label("<strong><h3>Faturas a pagar</h3></strong>"); labelListaFat.setAlign(Alignment.CENTER); labelListaFat.setHeight(20); final Label saldoFaturasApagar = new Label(); saldoFaturasApagar.setAlign(Alignment.RIGHT); saldoFaturasApagar.setHeight(20); saldoFaturasApagar.setWidth(750); Label labelListaFatSelecionadas = new Label( "<strong><h3>Faturas a ser alteradas pelo lanamento</h3></strong>"); labelListaFatSelecionadas.setAlign(Alignment.CENTER); labelListaFatSelecionadas.setHeight(20); final DateTimeItem itemDataEhora = new DateTimeItem("dataEhora", "Data e Hora"); itemDataEhora.setRequired(true); itemDataEhora.setWidth(300); itemDataEhora.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME); itemDataEhora.setDefaultValue(new Date(System.currentTimeMillis())); itemDataEhora.setHint("<nbr>*</nbr>"); final TextItem itemValor = new TextItem(); itemValor.setTitle("Valor"); itemValor.setName("valor"); itemValor.setLength(16); itemValor.setRequired(true); itemValor.setHint("<nbr>*</nbr>"); itemValor.setDefaultValue(""); itemValor.setKeyPressFilter("[0-9]"); itemValor.setMaskSaveLiterals(true); itemValor.setCharacterCasing(CharacterCasing.UPPER); itemValor.setWidth(300); itemValor.setHint("<nbr>*</nbr>"); formNovoLancamento.setItems(itemDataEhora, itemValor); HLayout hButoes = new HLayout(); hButoes.setWidth(200); hButoes.setMembersMargin(3); hButoes.setLayoutAlign(Alignment.CENTER); IButton cadastrar = new IButton("Cadastrar"); IButton limpar = new IButton("Limpar"); hButoes.setMargin(5); hButoes.addMember(cadastrar); hButoes.addMember(limpar); addCloseClickHandler(new CloseClickHandler() { @Override public void onCloseClick(CloseClickEvent event) { destroy(); } }); final ListGrid listaDeFaturas = new ListGrid() { @Override protected Canvas getExpansionComponent(final ListGridRecord record) { //final ListGrid grid = this; final Label label = new Label( "<strong style=\"font-size:10px; \">LANAMENTOS PARA ESTA FATURA</strong>"); label.setAlign(Alignment.CENTER); label.setHeight(20); VLayout layout = new VLayout(5); layout.setPadding(5); //GWT.log("" + record.getAttribute("codigo")); final ListGridField codLancamento = new ListGridField("codLancamento", "Cdigo lanamento"); codLancamento.setAlign(Alignment.CENTER); codLancamento.setHidden(true); final ListGridField codFatura = new ListGridField("codFatura", "Cdigo fatura"); codFatura.setAlign(Alignment.CENTER); codFatura.setHidden(true); final ListGridField dataEhora = new ListGridField("dataEhora", "Data e Hora"); dataEhora.setAlign(Alignment.CENTER); final ListGridField valor = new ListGridField("valor", "Valor lan."); valor.setAlign(Alignment.CENTER); final ListGridField valorPago = new ListGridField("valorPago", "Pago Fat."); valorPago.setAlign(Alignment.CENTER); final ListGridField estado = new ListGridField("estado", "Status"); estado.setAlign(Alignment.CENTER); estado.setHidden(true); final ListGrid lancGrid = new ListGrid(); lancGrid.setHeight(224); lancGrid.setCellHeight(22); lancGrid.setFields(codLancamento, codFatura, dataEhora, valor, valorPago, estado); Info.dbService.buscarFaturaHasLancamentoPorFatura(record.getAttributeAsInt("codigo"), new AsyncCallback<ArrayList<TreeMap<String, String>>>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(ArrayList<TreeMap<String, String>> historico) { if (historico != null) { for (TreeMap<String, String> histFat : historico) { Record regs = new Record(); regs.setAttribute("codFatura", histFat.get("codFatura")); regs.setAttribute("codLancamento", histFat.get("codLancamento")); regs.setAttribute("dataEhora", DateTimeFormat.getShortDateTimeFormat() .format(new Date(Long.parseLong(histFat.get("dataEhora"))))); regs.setAttribute("valor", Info.formataSaldo(Double.parseDouble(histFat.get("valor")))); regs.setAttribute("valorPago", Info.formataSaldo(Double.parseDouble(histFat.get("valorPago")))); regs.setAttribute("estado", (Boolean.parseBoolean(histFat.get("estado")) == false) ? "<nbr class=\"negativo\">Em aberto</nbr>" : "<nbr class=\"positivo\">Quitada</nbr>"); lancGrid.addData(regs); } } } }); lancGrid.setShowAllRecords(true); lancGrid.setCanPickFields(false); layout.addMember(label); layout.addMember(lancGrid); return layout; } @Override protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { String fieldName = this.getFieldName(colNum); final ListGrid listAux = this; if (fieldName.equals("juroMulta")) { HLayout recordCanvas = new HLayout(3); recordCanvas.setHeight(22); recordCanvas.setWidth100(); recordCanvas.setAlign(Alignment.CENTER); ImgButton jurosMultaImg = new ImgButton(); jurosMultaImg.setShowDown(false); jurosMultaImg.setShowRollOver(false); jurosMultaImg.setLayoutAlign(Alignment.CENTER); jurosMultaImg.setSrc("[SKIN]actions/remove.png"); jurosMultaImg.setPrompt("Remover juros e multa"); jurosMultaImg.setHeight(16); jurosMultaImg.setWidth(16); jurosMultaImg.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { //arrayFaturasBD.get(listAux.getRecordIndex(record)).put("count", String.valueOf(1)); EditarJurosFatura editarFatura = new EditarJurosFatura(listAux, record, arrayFaturasBD, saldoFaturasApagar, totalFaturasApagar, objLancamento); editarFatura.setAnimateTime(1200); editarFatura.animateShow(AnimationEffect.FADE); } }); recordCanvas.addMember(jurosMultaImg); return recordCanvas; } else { return null; } } }; final ListGrid faturasSelecionadas = new ListGrid(); faturasSelecionadas.setShowAllRecords(true); faturasSelecionadas.setAnimateRollUnder(true); faturasSelecionadas.setAlternateRecordStyles(false); faturasSelecionadas.setCanPickFields(false); faturasSelecionadas.setAnimateSelectionUnder(true); faturasSelecionadas.setWidth(789); faturasSelecionadas.setHeight(135); final ListGridField codClienteFat = new ListGridField("codCliente", "Cdigo Cliente"); codClienteFat.setAlign(Alignment.CENTER); codClienteFat.setHidden(true); final ListGridField codigo = new ListGridField("codigo", "Cdigo"); codigo.setAlign(Alignment.CENTER); codigo.setHidden(true); final ListGridField valor = new ListGridField("valor", "Valor"); valor.setAlign(Alignment.CENTER); final ListGridField valorPago = new ListGridField("valorPago", "Valor pago"); valorPago.setAlign(Alignment.CENTER); final ListGridField valorTotal = new ListGridField("valorTotal", "Valor Total"); valorTotal.setAlign(Alignment.CENTER); final ListGridField jurosEmulta = new ListGridField("jurosEmulta", "Juros e multa"); jurosEmulta.setAlign(Alignment.CENTER); final ListGridField valorApagar = new ListGridField("valorApagar", "a Pagar"); valorApagar.setAlign(Alignment.CENTER); final ListGridField dataFatura = new ListGridField("dataFatura", "Data"); dataFatura.setAlign(Alignment.CENTER); final ListGridField mes = new ListGridField("mesReferencia", "Ms"); mes.setAlign(Alignment.CENTER); final ListGridField estadoFat = new ListGridField("estado", "Status"); estadoFat.setAlign(Alignment.CENTER); ListGridField removeJurosMulta = new ListGridField("juroMulta", "remover M e J"); removeJurosMulta.setAlign(Alignment.CENTER); ListGridField count = new ListGridField("count", "count"); count.setAlign(Alignment.CENTER); count.setHidden(true); /////////////////////////////////////////////////////////////////////////// final ListGridField codClienteSelect = new ListGridField("codCliente", "Cdigo Cliente"); codClienteSelect.setAlign(Alignment.CENTER); codClienteSelect.setHidden(true); final ListGridField codigoSelect = new ListGridField("codigo", "Cdigo"); codigoSelect.setAlign(Alignment.CENTER); codigoSelect.setHidden(true); final ListGridField valorSelect = new ListGridField("valor", "Valor"); valorSelect.setAlign(Alignment.CENTER); final ListGridField valorPagoSelect = new ListGridField("valorPago", "Crdito a lanar"); valorPagoSelect.setAlign(Alignment.CENTER); final ListGridField valorTotalSelect = new ListGridField("valorTotal", "Valor Total"); valorTotalSelect.setAlign(Alignment.CENTER); final ListGridField valorApagarSelect = new ListGridField("valorApagar", "Dbito restante"); valorApagarSelect.setAlign(Alignment.CENTER); final ListGridField dataFaturaSelect = new ListGridField("dataFatura", "Data Venc."); dataFaturaSelect.setAlign(Alignment.CENTER); final ListGridField mesSelect = new ListGridField("mesReferencia", "Ms"); mesSelect.setAlign(Alignment.CENTER); final ListGridField estadoFatSelect = new ListGridField("estado", "Status"); estadoFatSelect.setAlign(Alignment.CENTER); //////////////////////////////////////////////////////////////////////////////////////////////////////// Info.dbService.buscarTodasTaxas(new AsyncCallback<ArrayList<TreeMap<String, String>>>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(ArrayList<TreeMap<String, String>> taxas) { if (taxas != null) { for (TreeMap<String, String> txs : taxas) { if (Integer.parseInt(txs.get("codTaxa")) == 1) { multa = Double.parseDouble(txs.get("valor")); } else if (Integer.parseInt(txs.get("codTaxa")) == 2) { juros = Double.parseDouble(txs.get("valor")); } } } } }); //GWT.log("Linha NL - 01"); listaDeFaturas.setFields(codClienteFat, codigo, dataFatura, valor, jurosEmulta, mes, valorTotal, valorPago, valorApagar, removeJurosMulta, count); //GWT.log("Linha NL - 02"); listaDeFaturas.setWidth(789); listaDeFaturas.setHeight(135); listaDeFaturas.setShowAllRecords(true); listaDeFaturas.setCanPickFields(false); //listaDeFaturas.setSortDirection(SortDirection.DESCENDING); //listaDeFaturas.setSortField("dataFatura"); listaDeFaturas.setShowRecordComponents(true); listaDeFaturas.setShowRecordComponentsByCell(true); listaDeFaturas.setCanResizeFields(true); listaDeFaturas.setDrawAheadRatio(4); listaDeFaturas.setCanExpandRecords(true); ///************************************************************************************************************************************************************//// Info.dbService.buscarFaturaEmAbertoPorCliente(codCliente, new AsyncCallback<ArrayList<TreeMap<String, String>>>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(ArrayList<TreeMap<String, String>> faturasCliente) { //////////////////////////////////////////////////////////////////****************************************\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Date dataAtual = new Date(System.currentTimeMillis()); long diaAtual = dataAtual.getTime(); long diferencaDeDatas = 0; long diaVencimento = 0; TreeMap<String, String> faturaAuxiliar = new TreeMap<String, String>(); if (faturasCliente != null) { for (TreeMap<String, String> fats : faturasCliente) { if (faturasCliente.get(0).get("codFatura") != null && faturaAuxiliar.get(fats.get("codFatura")) == null) { Date dataDeVencimento = new Date(Long.parseLong(fats.get("dataVencimento"))); diaVencimento = dataDeVencimento.getTime(); diferencaDeDatas = diaAtual - diaVencimento; TreeMap<String, String> faturaBD = new TreeMap<String, String>(); faturaBD.put("codFatura", fats.get("codFatura")); faturaBD.put("codCliente", fats.get("codCliente")); faturaBD.put("dataVencimento", fats.get("dataVencimento")); faturaBD.put("valor", String .valueOf(Info.formataSaldo(Double.parseDouble(fats.get("valor"))))); faturaBD.put("estado", fats.get("estado")); faturaBD.put("valorPago", (fats.get("totalLancamentos") == null) ? String.valueOf(Info.formataSaldo(0)) : String.valueOf(Info.formataSaldo( Double.parseDouble(fats.get("totalLancamentos"))))); faturaBD.put("mesReferencia", fats.get("mes")); faturaBD.put("count", "0"); //GWT.log("" + fats.get("valorApagar")); double totalPago = (fats.get("totalLancamentos") == null) ? 0 : (Double.parseDouble(fats.get("totalLancamentos"))); //GWT.log("Valor a pagar"+(Double.parseDouble(fats.get("valor")) - (totalPago))); if (diferencaDeDatas <= 0) { double valor = Double.parseDouble(fats.get("valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal(valor) : Info.formataDecimal( Double.parseDouble(fats.get("valor")) - (totalPago)); faturaBD.put("jurosEmulta", String.valueOf(Info.formataSaldo(Double.parseDouble("0")))); faturaBD.put("valorApagar", String.valueOf( Info.formataSaldo(Info.formataDecimal((valorAtualFatura))))); faturaBD.put("valorTotal", String.valueOf(Info.formataSaldo( Info.formataDecimal(Double.parseDouble(fats.get("valor")))))); diferencaDeDatas = 0; } else if (diferencaDeDatas > 0 && diferencaDeDatas < 86400000) { double valor = Double.parseDouble(fats.get("valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal(valor) + (valor * multa) : Info.formataDecimal(Double.parseDouble(fats.get("valor")) - (totalPago) + (valor * multa)); faturaBD.put("jurosEmulta", String .valueOf(Info.formataSaldo((Info.formataDecimal(valor * multa))))); faturaBD.put("valorApagar", String.valueOf(Info.formataSaldo(valorAtualFatura))); faturaBD.put("valorTotal", String.valueOf(Info.formataSaldo( Info.formataDecimal(Double.parseDouble(fats.get("valor")) + ((Double.parseDouble(fats.get("valor")) * multa)))))); diferencaDeDatas = 0; } else if (diferencaDeDatas > 86400000) { double valor = Double.parseDouble(fats.get("valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal(valor) + (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor)) : Info.formataDecimal(Double.parseDouble(fats.get("valor")) - (totalPago) + (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor))); faturaBD.put("jurosEmulta", String.valueOf(Info.formataSaldo(Info.formataDecimal((valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor)))))); faturaBD.put("valorApagar", String.valueOf(Info.formataSaldo(valorAtualFatura))); faturaBD.put("valorTotal", String.valueOf(Info.formataSaldo( Info.formataDecimal(Double.parseDouble(fats.get("valor")) + ((Double.parseDouble(fats.get("valor")) * multa)) + ((diferencaDeDatas / 86400000) * (juros * Double.parseDouble(fats.get("valor")))))))); diferencaDeDatas = 0; } arrayFaturasBD.add(faturaBD); faturaAuxiliar.put(fats.get("codFatura"), fats.get("codFatura")); } } } ////////////////////////////////////////////////////////////////*******************************************\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ for (TreeMap<String, String> fats : arrayFaturasBD) { Record fat = new Record(); fat.setAttribute("codigo", fats.get("codFatura")); fat.setAttribute("codCliente", fats.get("codCliente")); fat.setAttribute("dataFatura", DateTimeFormat.getShortDateFormat() .format(new Date(Long.parseLong(fats.get("dataVencimento"))))); fat.setAttribute("valor", fats.get("valor")); fat.setAttribute("estado", (Boolean.parseBoolean(fats.get("estado")) == false) ? "<nbr class=\negativo\"> Em aberto</nbr>" : "<nbr class=\"positivo\">Quitada</nbr>"); fat.setAttribute("valorPago", fats.get("valorPago")); fat.setAttribute("mesReferencia", fats.get("mesReferencia")); fat.setAttribute("valorApagar", fats.get("valorApagar")); fat.setAttribute("valorTotal", fats.get("valorTotal")); fat.setAttribute("jurosEmulta", fats.get("jurosEmulta")); fat.setAttribute("count", Integer.parseInt(fats.get("count"))); listaDeFaturas.addData(fat); totalFaturasApagar = totalFaturasApagar + Double.parseDouble(fats.get("valorApagar").replaceAll(",", "\\.")); } saldoFaturasApagar.redraw(); saldoFaturasApagar .setContents("<strong style=\"font-size:22px; color:red;\">total de dbito: - R$" + Info.formataSaldo(Info.formataDecimal(totalFaturasApagar)) + " </strong>"); } }); ///************************************************************************************************************************************************************//// //fats = listaDeFaturas.getRecords(); faturasSelecionadas.setFields(codClienteSelect, codigoSelect, dataFaturaSelect, valorSelect, mesSelect, valorTotalSelect, valorPagoSelect, valorApagarSelect); itemValor.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { String tecla; tecla = event.getKeyName(); //GWT.log("Tecla " + tecla + " KeyCod = " + event.getCharacterValue()); //GWT.log("Objeto JavaScript "+ Info.FormataMoeda(itemValor.getValueAsString(), ".", ",", tecla)); String aux = ""; if (event.getCharacterValue() != null && event.getCharacterValue() >= 48 && event.getCharacterValue() <= 57) { aux = Info.FormataMoeda( (itemValor.getValueAsString() != null) ? itemValor.getValueAsString() : "0", ".", ",", tecla); flagItemValor = true; } //GWT.log("Aux=" + aux); //itemValor.setValue(aux); campo = aux; //Info.FormataMoeda(itemValor.getJsObj(), ".", ",", tecla); } }); final TreeMap<String, String> faturaAux = new TreeMap<String, String>(); itemValor.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { faturasSelecionadas.setData(new RecordList()); //GWT.log("Entrou no changed: " + event.getValue()); if (flagItemValor) { itemValor.setValue(campo); } flagItemValor = false; final String novoLancamento = campo; if ((event.getValue() != null && !novoLancamento.equalsIgnoreCase(""))) { double valorNovoApagar = 0; double valorNovoLancamento = 0; //GWT.log("valorNovoLancamento ReplaceAll: " + itemValor.getDisplayValue().replaceAll("\\.", "").replaceAll(",", "\\.")); valorNovoLancamento = Double .parseDouble(itemValor.getDisplayValue().replaceAll("\\.", "").replaceAll(",", "\\.")); //GWT.log("valorNovoLancamento: " + valorNovoLancamento); valorNovoLancamento = Info.formataDecimal(valorNovoLancamento); fats = listaDeFaturas.getRecords(); // GWT.log("fats.length: " + fats.length); for (int i = 0; i < fats.length; i++) { double valorAtualFatura = Double .parseDouble(arrayFaturasBD.get(i).get("valorApagar").replaceAll(",", "\\.")); if (valorAtualFatura <= valorNovoLancamento) { fats[i].setAttribute("valorApagar", String.valueOf(Info.formataSaldo(0))); faturasSelecionadas.addData(fats[i]); valorNovoLancamento = valorNovoLancamento - valorAtualFatura; valorNovoLancamento = Info.formataDecimal(valorNovoLancamento); /*Linha 451*/ fats[i].setAttribute("valorPago", String.valueOf(Info.formataSaldo(valorAtualFatura))); } else { //GWT.log("valorNovoLancamento ELSE: " + valorNovoLancamento); if (valorNovoLancamento > 0) { //GWT.log("Valor a pagar ELSE: " + fats[i].getAttribute("valorApagar").replaceAll("\\.", "").replaceAll(",", "\\.")); valorNovoApagar = Double.parseDouble((arrayFaturasBD.get(i).get("valorApagar") .replaceAll("\\.", "").replaceAll(",", "\\."))) - valorNovoLancamento; valorNovoApagar = Info.formataDecimal(valorNovoApagar); fats[i].setAttribute("valorPago", String.valueOf(Info.formataSaldo(valorNovoLancamento))); fats[i].setAttribute("valorApagar", String.valueOf(Info.formataSaldo(valorNovoApagar))); faturasSelecionadas.addData(fats[i]); valorNovoLancamento = 0; } } } } else { fatsAux = faturasSelecionadas.getRecords(); faturaAux.clear(); if (!faturasSelecionadas.getRecordList().isEmpty()) { for (int i = 0; i < fatsAux.length; i++) { faturasSelecionadas.removeData(fatsAux[i]); } } fats = listaDeFaturas.getRecords(); for (int i = 0; i < fats.length; i++) { listaDeFaturas.removeData(fats[i]); } for (TreeMap<String, String> fats : arrayFaturasBD) { Record fat = new Record(); fat.setAttribute("codigo", fats.get("codFatura")); fat.setAttribute("codCliente", fats.get("codCliente")); fat.setAttribute("dataFatura", DateTimeFormat.getShortDateFormat() .format(new Date(Long.parseLong(fats.get("dataVencimento"))))); fat.setAttribute("valor", fats.get("valor")); fat.setAttribute("estado", (Boolean.parseBoolean(fats.get("estado")) == false) ? "<nbr class=\negativo\"> Em aberto</nbr>" : "<nbr class=\"positivo\">Quitada</nbr>"); fat.setAttribute("valorPago", fats.get("valorPago")); fat.setAttribute("mesReferencia", fats.get("mesReferencia")); fat.setAttribute("valorApagar", fats.get("valorApagar")); fat.setAttribute("valorTotal", fats.get("valorTotal")); fat.setAttribute("jurosEmulta", fats.get("jurosEmulta")); fat.setAttribute("count", Integer.parseInt(fats.get("count"))); listaDeFaturas.addData(fat); } } } }); //GWT.log("arrayFaturasBD: " + arrayFaturasBD); cadastrar.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (formNovoLancamento.validate()) { contador = 0; final Window janelaCarregando = new Window(); janelaCarregando.setShowTitle(false); janelaCarregando.setWidth(100); janelaCarregando.setHeight(50); janelaCarregando.setShowEdges(false); janelaCarregando.setShowCloseButton(false); janelaCarregando.setShowMinimizeButton(false); janelaCarregando.setIsModal(true); janelaCarregando.setShowModalMask(true); janelaCarregando.centerInPage(); janelaCarregando.setLayoutAlign(Alignment.CENTER); final Label mensagem = new Label("Carregando.."); mensagem.setHeight(16); new Timer() { public void run() { if (contador != 100) { contador += 1 + (int) (5 * Math.random()); schedule(1 + (int) (50 * Math.random())); mensagem.setContents("Carregando: " + contador + "%"); janelaCarregando.addItem(mensagem); janelaCarregando.setAnimateTime(1200); janelaCarregando.animateShow(AnimationEffect.FADE); if (contador >= 100) { mensagem.setContents("Carregando: 100%"); /* TreeMap que vai para o banco como Novo lanamento*/ TreeMap<String, String> novoLancamento = new TreeMap<String, String>(); novoLancamento.put("codCliente", String.valueOf(codCliente)); Timestamp dataEhora = new Timestamp(itemDataEhora.getValueAsDate().getTime()); String valorFinalLanc = itemValor.getDisplayValue().replaceAll("\\.", "") .replaceAll(",", "\\."); //GWT.log("Valor Sem virgula:" + valorFinalLanc); novoLancamento.put("valor", valorFinalLanc); /* TreeMap que vai para o banco como Novo lanamento*/ /* arrayList de TreeMap que vai para o banco como Novo fatura_has_lancamento*/ ArrayList<TreeMap<String, String>> arrayListFaturas = new ArrayList<TreeMap<String, String>>(); if (!faturasSelecionadas.getRecordList().isEmpty()) { ListGridRecord fats[] = faturasSelecionadas.getRecords(); for (int i = 0; i < fats.length; i++) { //GWT.log("valorApagar: " + arrayFaturasBD.get(i).get("valorApagar")); TreeMap<String, String> treeMapFatura = new TreeMap<String, String>(); treeMapFatura.put("codCliente", String.valueOf(codCliente)); treeMapFatura.put("codFatura", fats[i].getAttribute("codigo")); treeMapFatura.put("valorTotal", Info.formataReaisFloat(fats[i].getAttribute("valorTotal"))); treeMapFatura.put("valorApagar", Info.formataReaisFloat(fats[i].getAttribute("valorApagar"))); treeMapFatura.put("valorPago", Info.formataReaisFloat(fats[i].getAttribute("valorPago"))); arrayListFaturas.add(treeMapFatura); } } Info.dbService.cadastrarLancamento(novoLancamento, arrayListFaturas, dataEhora, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { //GWT.log("caught: "+caught); throw new UnsupportedOperationException( "Not supported yet.!!!!!!!!!!!!!!"); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(Void result) { listFaturas.setData(new RecordList()); arrayFaturasBD.clear(); //GWT.log("" + arrayFaturasBD); Info.dbService.buscarUltimoLancamento( new AsyncCallback<TreeMap<String, String>>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException( "Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess( TreeMap<String, String> ultimoLancamento) { if (ultimoLancamento != null) { Record regLancamento = new Record(); //GWT.log("codUltimoLanc: " + ultimoLancamento.get("codLancamento")); regLancamento.setAttribute("codCliente", ultimoLancamento.get("codCliente")); regLancamento.setAttribute("codigo", ultimoLancamento .get("codLancamento")); regLancamento.setAttribute("data", DateTimeFormat .getShortDateTimeFormat() .format(new Date( Long.parseLong( ultimoLancamento .get("dataEhora"))))); regLancamento.setAttribute("valor", "R$" + Info.formataValor(Float .parseFloat(ultimoLancamento .get("valor")))); listLancamentos.addData(regLancamento); ///////////////////////////////////////////////////////////////////////////////////////////////////////////// Info.dbService.buscarTodasTaxas( new AsyncCallback<ArrayList<TreeMap<String, String>>>() { @Override public void onFailure( Throwable caught) { throw new UnsupportedOperationException( "Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess( ArrayList<TreeMap<String, String>> taxas) { if (taxas != null) { for (TreeMap<String, String> txs : taxas) { if (Integer .parseInt( txs.get("codTaxa")) == 1) { multa = Double .parseDouble( txs.get("valor")); } else if (Integer .parseInt( txs.get("codTaxa")) == 2) { juros = Double .parseDouble( txs.get("valor")); } } } } }); Info.dbService.buscarFaturaPorCliente( codCliente, new AsyncCallback<ArrayList<TreeMap<String, String>>>() { @Override public void onFailure( Throwable caught) { throw new UnsupportedOperationException( "Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess( ArrayList<TreeMap<String, String>> faturasCliente) { Date dataAtual = new Date( System.currentTimeMillis()); long diaAtual = dataAtual .getTime(); long diferencaDeDatas = 0; long diaVencimento = 0; TreeMap<String, String> faturaAuxiliar = new TreeMap<String, String>(); if (faturasCliente != null) { for (TreeMap<String, String> fats : faturasCliente) { if (faturasCliente .get(0) .get("codFatura") != null && faturaAuxiliar .get(fats .get("codFatura")) == null) { Date dataDeVencimento = new Date( Long.parseLong( fats.get( "dataVencimento"))); diaVencimento = dataDeVencimento .getTime(); diferencaDeDatas = diaAtual - diaVencimento; TreeMap<String, String> faturaBD = new TreeMap<String, String>(); faturaBD.put( "codFatura", fats.get( "codFatura")); faturaBD.put( "codCliente", fats.get( "codCliente")); faturaBD.put( "dataVencimento", fats.get( "dataVencimento")); faturaBD.put( "valor", String.valueOf( Info.formataSaldo( Double.parseDouble( fats.get( "valor"))))); faturaBD.put( "estado", fats.get( "estado")); faturaBD.put( "valorPago", (fats.get( "totalLancamentos") == null) ? String.valueOf( Info.formataSaldo( 0)) : String.valueOf( Info.formataSaldo( Double.parseDouble( fats.get( "totalLancamentos"))))); faturaBD.put( "mesReferencia", fats.get( "mes")); faturaBD.put( "count", "0"); //GWT.log("" + fats.get("valorApagar")); double totalPago = (fats .get("totalLancamentos") == null) ? 0 : (Double .parseDouble( fats.get( "totalLancamentos"))); //GWT.log("Valor a pagar"+(Double.parseDouble(fats.get("valor")) - (totalPago))); if (diferencaDeDatas <= 0) { double valor = Double .parseDouble( fats.get( "valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal( valor) : Info.formataDecimal( Double.parseDouble( fats.get( "valor")) - (totalPago)); faturaBD.put( "jurosEmulta", String.valueOf( Info.formataSaldo( Double.parseDouble( "0")))); faturaBD.put( "valorApagar", String.valueOf( Info.formataSaldo( Info.formataDecimal( (valorAtualFatura))))); faturaBD.put( "valorTotal", String.valueOf( Info.formataSaldo( Info.formataDecimal( Double.parseDouble( fats.get( "valor")))))); diferencaDeDatas = 0; } else if (diferencaDeDatas > 0 && diferencaDeDatas < 86400000) { double valor = Double .parseDouble( fats.get( "valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal( valor) + (valor * multa) : Info.formataDecimal( Double.parseDouble( fats.get( "valor")) - (totalPago) + (valor * multa)); faturaBD.put( "jurosEmulta", String.valueOf( Info.formataSaldo( (Info.formataDecimal( valor * multa))))); faturaBD.put( "valorApagar", String.valueOf( Info.formataSaldo( valorAtualFatura))); faturaBD.put( "valorTotal", String.valueOf( Info.formataSaldo( Info.formataDecimal( Double.parseDouble( fats.get( "valor")) + ((Double .parseDouble( fats.get( "valor")) * multa)))))); diferencaDeDatas = 0; } else if (diferencaDeDatas > 86400000) { double valor = Double .parseDouble( fats.get( "valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal( valor) + (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor)) : Info.formataDecimal( Double.parseDouble( fats.get( "valor")) - (totalPago) + (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor))); faturaBD.put( "jurosEmulta", String.valueOf( Info.formataSaldo( Info.formataDecimal( (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor)))))); faturaBD.put( "valorApagar", String.valueOf( Info.formataSaldo( valorAtualFatura))); faturaBD.put( "valorTotal", String.valueOf( Info.formataSaldo( Info.formataDecimal( Double.parseDouble( fats.get( "valor")) + ((Double .parseDouble( fats.get( "valor")) * multa)) + ((diferencaDeDatas / 86400000) * (juros * Double .parseDouble( fats.get( "valor")))))))); diferencaDeDatas = 0; } arrayFaturasBD .add(faturaBD); faturaAuxiliar .put(fats .get("codFatura"), fats.get( "codFatura")); } } objFaturaLancamento .setTotalLancamentos( 0); objFaturaLancamento .setTotalFaturas( 0); objFaturaLancamento .setSaldo(0); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//////////// for (TreeMap<String, String> fatsGrid : arrayFaturasBD) { Record fat = new Record(); fat.setAttribute( "codigo", fatsGrid.get( "codFatura")); fat.setAttribute( "codCliente", fatsGrid.get( "codCliente")); fat.setAttribute( "dataFatura", DateTimeFormat .getShortDateFormat() .format(new Date( Long.parseLong( fatsGrid.get( "dataVencimento"))))); fat.setAttribute( "valor", fatsGrid.get( "valor")); fat.setAttribute( "estado", (Boolean.parseBoolean( fatsGrid.get( "estado")) == false) ? "<nbr class=\negativo\"> Em aberto</nbr>" : "<nbr class=\"positivo\">Quitada</nbr>"); fat.setAttribute( "valorPago", fatsGrid.get( "valorPago")); fat.setAttribute( "mesReferencia", fatsGrid.get( "mesReferencia")); fat.setAttribute( "valorApagar", (Boolean.parseBoolean( fatsGrid.get( "estado")) == false) ? fatsGrid .get("valorApagar") : Info.formataSaldo( 0)); fat.setAttribute( "valorTotal", fatsGrid.get( "valorTotal")); fat.setAttribute( "jurosEmulta", (Boolean.parseBoolean( fatsGrid.get( "estado")) == false) ? fatsGrid .get("jurosEmulta") : Info.formataSaldo( 0)); fat.setAttribute( "count", Integer.parseInt( fatsGrid.get( "count"))); listFaturas.addData( fat); //GWT.log("fatsGrid.get(\"codFatura\"): "+fatsGrid.get("codFatura")); //GWT.log("fatsGrid.get(\"estado\")): " + fatsGrid.get("estado")); //GWT.log("fatsGrid.get(\"valorPago\"): " + fatsGrid.get("valorPago")); objFaturaLancamento .setTotalFaturas( objFaturaLancamento .getTotalFaturas() + ((Double .parseDouble( fat.getAttributeAsString( "valorPago") .replaceAll( "\\.", "") .replaceAll( ",", ".")) > 0 && Boolean .parseBoolean( fatsGrid.get( "estado")) == true) ? Double.parseDouble( fat.getAttributeAsString( "valorPago") .replaceAll( "\\.", "") .replaceAll( ",", ".")) : (Double .parseDouble( fat.getAttributeAsString( "valorPago") .replaceAll( "\\.", "") .replaceAll( ",", ".")) + Double.parseDouble( fat.getAttributeAsString( "valorApagar") .replaceAll( "\\.", "") .replaceAll( ",", "."))))); } Info.dbService .buscarTotalLancamentos( codCliente, new AsyncCallback<Double>() { @Override public void onFailure( Throwable caught) { throw new UnsupportedOperationException( "Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess( Double totLanc) { labelLanc .redraw(); labelLanc .setContents( "<strong style=\"font-size:20px; \">Total de Lanamentos: R$" + Info.formataSaldo( totLanc) + "</strong>"); objFaturaLancamento .setTotalLancamentos( totLanc); labelfaturas .redraw(); labelfaturas .setContents( "<strong style=\"font-size:20px; \">Total de Faturas: R$" + Info.formataSaldo( objFaturaLancamento .getTotalFaturas()) + "</strong>"); objFaturaLancamento .setSaldo( objFaturaLancamento .getTotalLancamentos() - objFaturaLancamento .getTotalFaturas()); if (objFaturaLancamento .getSaldo() == 0) { labelSaldo .redraw(); labelSaldo .setContents( "<strong style=\"font-size:25px; \">Saldo Atual: R$00,00\n</strong>"); } else if (objFaturaLancamento .getSaldo() > 0) { labelSaldo .redraw(); labelSaldo .setContents( "<strong class=\"saldo-positivo\">Crdito Atual: R$" + Info.formataSaldo( Info.formataDecimal( objFaturaLancamento .getSaldo())) + "\n</strong>"); } else { labelSaldo .redraw(); labelSaldo .setContents( "<strong class=\"saldo-negativo\">Dbito Atual: R$" + Info.formataSaldo( Info.formataDecimal( objFaturaLancamento .getSaldo())) + "\n</strong>"); } } }); } else { Info.dbService .buscarTotalLancamentos( codCliente, new AsyncCallback<Double>() { @Override public void onFailure( Throwable caught) { throw new UnsupportedOperationException( "Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess( Double totLanc) { objFaturaLancamento .setTotalLancamentos( totLanc); labelLanc .redraw(); labelLanc .setContents( "<strong style=\"font-size:20px; \">Total de Lanamentos: R$" + Info.formataSaldo( Info.formataDecimal( objFaturaLancamento .getTotalLancamentos())) + "</strong>"); labelfaturas .redraw(); //GWT.log("objFaturaLancamento.getTotalFaturas()): " + objFaturaLancamento.getTotalFaturas()); labelfaturas .setContents( "<strong style=\"font-size:20px; \">Total de Faturas: R$" + Info.formataSaldo( Info.formataDecimal( objFaturaLancamento .getTotalFaturas())) + "</strong>"); objFaturaLancamento .setSaldo( objFaturaLancamento .getTotalLancamentos() - objFaturaLancamento .getTotalFaturas()); if (objFaturaLancamento .getSaldo() == 0) { labelSaldo .redraw(); labelSaldo .setContents( "<strong style=\"font-size:25px; \">Saldo Atual: R$00,00\n</strong>"); } else if (objFaturaLancamento .getSaldo() > 0) { labelSaldo .redraw(); labelSaldo .setContents( "<strong class=\"saldo-positivo\">Crdito Atual: R$" + Info.formataSaldo( Info.formataDecimal( objFaturaLancamento .getSaldo())) + "\n</strong>"); } else { labelSaldo .redraw(); labelSaldo .setContents( "<strong class=\"saldo-negativo\">Dbito Atual: R$" + Info.formataSaldo( Info.formataDecimal( objFaturaLancamento .getSaldo())) + "\n</strong>"); } } }); } } }); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } }); } }); janelaCarregando.addItem(mensagem); janelaCarregando.setAnimateTime(1200); janelaCarregando.animateHide(AnimationEffect.FADE); contador = 100; destroy(); } } else { contador = 0; } } }.schedule(50); } } }); limpar.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { itemValor.setDefaultValue(""); itemDataEhora.setValue(new Date(System.currentTimeMillis())); formNovoLancamento.focusInItem(itemValor); } }); addItem(label); addItem(formNovoLancamento); addItem(labelListaFat); addItem(listaDeFaturas); addItem(saldoFaturasApagar); addItem(labelListaFatSelecionadas); addItem(faturasSelecionadas); addItem(hButoes); }
From source file:com.automaster.client.ui.paineis.tabs.financeiro.TabConsultaFaturaLancamento.java
private void buscarPorCodCliente(final int codCliente) { Info.dbService.buscarPorCodCliente(codCliente, new AsyncCallback<TreeMap<String, ArrayList<TreeMap<String, String>>>>() { @Override//from w ww . j a v a 2s .com public void onFailure(Throwable caught) { //GWT.log(caught.getMessage()); throw new UnsupportedOperationException("Not supported yet..........................."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(TreeMap<String, ArrayList<TreeMap<String, String>>> dadosCliente) { if (dadosCliente != null) { ArrayList<TreeMap<String, String>> clienteAuxiliar = dadosCliente .get(dadosCliente.firstKey()); if (!cliente.getRecordList().isEmpty()) { cliente.selectAllRecords(); cliente.removeSelectedData(); } clienteCod = Integer.parseInt(clienteAuxiliar.get(0).get("codCliente")); addImg.setDisabled(false); addFat.setDisabled(false); Record regCliente = new Record(); regCliente.setAttribute("codigo", clienteAuxiliar.get(0).get("codCliente")); regCliente.setAttribute("nome", clienteAuxiliar.get(0).get("nomeCliente")); regCliente.setAttribute("dataAdesao", DateTimeFormat.getShortDateFormat() .format(new Date(Long.parseLong(clienteAuxiliar.get(0).get("dataAdesao"))))); regCliente.setAttribute("unidade", clienteAuxiliar.get(0).get("nomeUnidade")); codigo.setHidden(true); if (clienteAuxiliar.get(0).get("cpf") == null) { regCliente.setAttribute("cnpj", Info.formataCNPJ(clienteAuxiliar.get(0).get("cnpj"))); regCliente.setAttribute("dataAbert", DateTimeFormat.getShortDateFormat().format( new Date(Long.parseLong(clienteAuxiliar.get(0).get("dataAbertura"))))); cliente.setFields(nome, cnpj, dataAbert, dataAdesao, unidade, codigo); } else { regCliente.setAttribute("cpf", Info.formataCPF(clienteAuxiliar.get(0).get("cpf"))); regCliente.setAttribute("dataNasc", DateTimeFormat.getShortDateFormat() .format(new Date(Long.parseLong(clienteAuxiliar.get(0).get("dataNasc"))))); cliente.setFields(nome, cpf, dataNasc, dataAdesao, unidade, codigo); } cliente.addData(regCliente); if (!lancamentos.getRecordList().isEmpty()) { lancamentos.selectAllRecords(); lancamentos.removeSelectedData(); labelLancamentos.redraw(); labelLancamentos.setContents( "<strong style=\"font-size:20px; \">Total de Lanamentos pendentes: R$00,00</strong>"); totalLancamentos = 0; } TreeMap<String, String> lancamentoAuxiliar = new TreeMap<String, String>(); for (TreeMap<String, String> lanc : clienteAuxiliar) { if (clienteAuxiliar.get(0).get("codLancamento") != null && lancamentoAuxiliar.get(lanc.get("codLancamento")) == null) { Record regLanc = new Record(); regLanc.setAttribute("codCliente", lanc.get("codCliente")); regLanc.setAttribute("codigo", lanc.get("codLancamento")); regLanc.setAttribute("data", DateTimeFormat.getShortDateTimeFormat() .format(new Date(Long.parseLong(lanc.get("dataLancamento"))), null)); regLanc.setAttribute("valor", "R$" + Info.formataValor(Float.parseFloat(lanc.get("valorLancamento")))); lancamentos.addData(regLanc); lancamentoAuxiliar.put(lanc.get("codLancamento"), lanc.get("codLancamento")); } } ///************************************************************************************************************************************************************//// Info.dbService.buscarFaturaPorCliente(codCliente, new AsyncCallback<ArrayList<TreeMap<String, String>>>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(ArrayList<TreeMap<String, String>> faturasCliente) { arrayFaturasBD.clear(); if (!faturas.getRecordList().isEmpty()) { faturas.selectAllRecords(); faturas.removeSelectedData(); labelFatura.redraw(); labelFatura.setContents( "<strong style=\"font-size:20px; \">Total de Faturas a pagar: R$00,00</strong>"); totalFaturas = 0; } //////////////////////////////////////////////////////////////////****************************************\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Date dataAtual = new Date(System.currentTimeMillis()); long diaAtual = dataAtual.getTime(); long diferencaDeDatas = 0; long diaVencimento = 0; TreeMap<String, String> faturaAuxiliar = new TreeMap<String, String>(); if (faturasCliente != null) { for (TreeMap<String, String> fats : faturasCliente) { if (faturasCliente.get(0).get("codFatura") != null && faturaAuxiliar.get(fats.get("codFatura")) == null) { Date dataDeVencimento = new Date( Long.parseLong(fats.get("dataVencimento"))); diaVencimento = dataDeVencimento.getTime(); diferencaDeDatas = diaAtual - diaVencimento; TreeMap<String, String> faturaBD = new TreeMap<String, String>(); faturaBD.put("codFatura", fats.get("codFatura")); faturaBD.put("codCliente", fats.get("codCliente")); faturaBD.put("dataVencimento", fats.get("dataVencimento")); faturaBD.put("valor", String.valueOf(Info.formataSaldo( Double.parseDouble(fats.get("valor"))))); faturaBD.put("estado", fats.get("estado")); faturaBD.put("valorPago", (fats.get("totalLancamentos") == null) ? String.valueOf(Info.formataSaldo(0)) : String.valueOf(Info.formataSaldo( Double.parseDouble(fats.get( "totalLancamentos"))))); faturaBD.put("mesReferencia", fats.get("mes")); faturaBD.put("count", "0"); //GWT.log("" + fats.get("valorApagar")); double totalPago = (fats.get("totalLancamentos") == null) ? 0 : (Double .parseDouble(fats.get("totalLancamentos"))); //GWT.log("diferencaDeDatas: "+diferencaDeDatas); if (diferencaDeDatas <= 0) { double valor = Double.parseDouble(fats.get("valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal(valor) : Info.formataDecimal( Double.parseDouble(fats.get("valor")) - (totalPago)); faturaBD.put("jurosEmulta", String.valueOf( Info.formataSaldo(Double.parseDouble("0")))); faturaBD.put("valorApagar", String.valueOf(Info.formataSaldo(Info .formataDecimal((valorAtualFatura))))); faturaBD.put("valorTotal", String.valueOf( Info.formataSaldo(Info.formataDecimal(Double .parseDouble(fats.get("valor")))))); diferencaDeDatas = 0; } else if (diferencaDeDatas > 0 && diferencaDeDatas < 86400000) { double valor = Double.parseDouble(fats.get("valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal(valor) + (valor * multa) : Info.formataDecimal( Double.parseDouble(fats.get("valor")) - (totalPago) + (valor * multa)); faturaBD.put("jurosEmulta", String.valueOf(Info.formataSaldo( (Info.formataDecimal(valor * multa))))); faturaBD.put("valorApagar", String .valueOf(Info.formataSaldo(valorAtualFatura))); faturaBD.put("valorTotal", String.valueOf( Info.formataSaldo(Info.formataDecimal(Double .parseDouble(fats.get("valor")) + ((Double .parseDouble(fats.get("valor")) * multa)))))); diferencaDeDatas = 0; } else if (diferencaDeDatas > 86400000) { double valor = Double.parseDouble(fats.get("valor")); double valorAtualFatura = (totalPago == 0) ? Info.formataDecimal(valor) + (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor)) : Info.formataDecimal( Double.parseDouble(fats.get("valor")) - (totalPago) + (valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor))); faturaBD.put("jurosEmulta", String.valueOf(Info.formataSaldo( Info.formataDecimal((valor * multa) + ((diferencaDeDatas / 86400000) * (juros * valor)))))); faturaBD.put("valorApagar", String .valueOf(Info.formataSaldo(valorAtualFatura))); faturaBD.put("valorTotal", String.valueOf( Info.formataSaldo(Info.formataDecimal(Double .parseDouble(fats.get("valor")) + ((Double.parseDouble( fats.get("valor")) * multa)) + ((diferencaDeDatas / 86400000) * (juros * Double .parseDouble(fats.get( "valor")))))))); diferencaDeDatas = 0; } arrayFaturasBD.add(faturaBD); faturaAuxiliar.put(fats.get("codFatura"), fats.get("codFatura")); } } } setTotalLancamentos(0); setTotalFaturas(0); setSaldo(0); ////////////////////////////////////////////////////////////////*******************************************\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ for (TreeMap<String, String> fats : arrayFaturasBD) { Record fat = new Record(); fat.setAttribute("codigo", fats.get("codFatura")); fat.setAttribute("codCliente", fats.get("codCliente")); fat.setAttribute("dataFatura", DateTimeFormat.getShortDateFormat().format(new Date( Long.parseLong(fats.get("dataVencimento"))))); fat.setAttribute("valor", fats.get("valor")); fat.setAttribute("estado", (Boolean.parseBoolean(fats.get("estado")) == false) ? "<nbr class=\negativo\"> Em aberto</nbr>" : "<nbr class=\"positivo\">Quitada</nbr>"); fat.setAttribute("valorPago", fats.get("valorPago")); fat.setAttribute("mesReferencia", fats.get("mesReferencia")); fat.setAttribute("valorApagar", (Boolean.parseBoolean(fats.get("estado")) == false) ? fats.get("valorApagar") : Info.formataSaldo(0)); fat.setAttribute("valorTotal", fats.get("valorTotal")); fat.setAttribute("jurosEmulta", (Boolean.parseBoolean(fats.get("estado")) == false) ? fats.get("jurosEmulta") : Info.formataSaldo(0)); fat.setAttribute("count", Integer.parseInt(fats.get("count"))); faturas.addData(fat); setTotalFaturas(getTotalFaturas() + ((Double .parseDouble(fat.getAttributeAsString("valorPago") .replaceAll("\\.", "").replaceAll(",", ".")) > 0 && Boolean.parseBoolean(fats.get("estado")) == true) ? Double.parseDouble( fat.getAttributeAsString("valorPago") .replaceAll( "\\.", "") .replaceAll(",", ".")) : (Double.parseDouble(fat .getAttributeAsString("valorPago") .replaceAll("\\.", "").replaceAll(",", ".")) + Double.parseDouble(fat .getAttributeAsString("valorApagar") .replaceAll("\\.", "") .replaceAll(",", "."))))); //GWT.log("getTotalFaturas() 1 : "+Double.parseDouble(fat.getAttributeAsString("valorApagar").replaceAll("\\.", "").replaceAll(",", "."))); //GWT.log("getTotalFaturas(): "+getTotalFaturas()); } ////////////////////////////////////////////////////////****************************************************//////////////////////////////////// Info.dbService.buscarTotalLancamentos(codCliente, new AsyncCallback<Double>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException( "Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(Double totLanc) { setTotalLancamentos(totLanc); labelLancamentos.redraw(); labelLancamentos.setContents( "<strong style=\"font-size:20px; \">Total de Lanamentos: R$" + Info.formataSaldo(Info.formataDecimal( getTotalLancamentos())) + "</strong>"); labelFatura.redraw(); labelFatura.setContents( "<strong style=\"font-size:20px; \">Total de Faturas: R$" + Info.formataSaldo(Info.formataDecimal( getTotalFaturas())) + "</strong>"); setSaldo(getTotalLancamentos() - getTotalFaturas()); if (getSaldo() == 0) { labelSaldo.redraw(); labelSaldo.setContents( "<strong style=\"font-size:25px; \">Saldo Atual: R$00,00\n</strong>"); } else if (getSaldo() > 0) { labelSaldo.redraw(); labelSaldo.setContents( "<strong class=\"saldo-positivo\">Crdito Atual: R$" + Info.formataSaldo(Info .formataDecimal(getSaldo())) + "\n</strong>"); } else { labelSaldo.redraw(); labelSaldo.setContents( "<strong class=\"saldo-negativo\">Dbito Atual: R$" + Info.formataSaldo(Info .formataDecimal(getSaldo())) + "\n</strong>"); } } }); } }); } else { SC.warn("Erro ao Consultar Cliente"); } } }); }
From source file:com.automaster.client.ui.paineis.tabs.TabBuscarCliente.java
private void buscarPorCodCliente(int codCliente) { Info.dbService.buscarPorCodCliente(codCliente, new AsyncCallback<TreeMap<String, ArrayList<TreeMap<String, String>>>>() { @Override// ww w. j a v a 2 s .com public void onFailure(Throwable caught) { //GWT.log(caught.getMessage()); throw new UnsupportedOperationException("Not supported yet..........................."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess(TreeMap<String, ArrayList<TreeMap<String, String>>> cliente) { if (cliente != null) { //Fazendo Cpia do Cliente Retornado setClienteEdicao(cliente); //final ArrayList<TreeMap<String, String>> clienteAuxiliar = cliente.pollFirstEntry().getValue(); clienteAuxiliar = getClienteEdicao().get(getClienteEdicao().firstKey()); if (!dadosCliente.getRecordList().isEmpty()) { dadosCliente.selectAllRecords(); dadosCliente.removeSelectedData(); } //GWT.log("Tipo: "+clienteAuxiliar.get(0).get("tipoCliente")); codigoCliente = Integer.parseInt(clienteAuxiliar.get(0).get("codCliente")); nomeCliente = clienteAuxiliar.get(0).get("nomeCliente"); Record regCliente = new Record(); regCliente.setAttribute("nome", clienteAuxiliar.get(0).get("nomeCliente")); regCliente.setAttribute("dataAdesao", DateTimeFormat.getShortDateFormat() .format(new Date(Long.parseLong(clienteAuxiliar.get(0).get("dataAdesao"))))); regCliente.setAttribute("unidade", clienteAuxiliar.get(0).get("nomeUnidade")); //GWT.log(""+clienteAuxiliar.get(0).get("cpf")); if (clienteAuxiliar.get(0).get("cpf") == null) { regCliente.setAttribute("cnpj", Info.formataCNPJ(clienteAuxiliar.get(0).get("cnpj"))); regCliente.setAttribute("dataAbert", DateTimeFormat.getShortDateFormat().format( new Date(Long.parseLong(clienteAuxiliar.get(0).get("dataAbertura"))))); dadosCliente.setFields(nome, cnpj, dataAbert, dataAdesao, unidade, codigo); } else { regCliente.setAttribute("cpf", Info.formataCPF(clienteAuxiliar.get(0).get("cpf"))); regCliente.setAttribute("dataNasc", DateTimeFormat.getShortDateFormat() .format(new Date(Long.parseLong(clienteAuxiliar.get(0).get("dataNasc"))))); dadosCliente.setFields(nome, cpf, dataNasc, dataAdesao, unidade, codigo); } dadosCliente.addData(regCliente); if (!enderecos.getRecordList().isEmpty()) { enderecos.selectAllRecords(); enderecos.removeSelectedData(); } TreeMap<String, String> endAuxiliar = new TreeMap<String, String>(); for (TreeMap<String, String> ends : clienteAuxiliar) { if (clienteAuxiliar.get(0).get("codEndereco") != null && endAuxiliar.get(ends.get("codEndereco")) == null) { Record regEnd = new Record(); regEnd.setAttribute("codigo", ends.get("codEndereco")); regEnd.setAttribute("descricao", ends.get("descricaoEndereco")); regEnd.setAttribute("logradouro", ends.get("logradouro")); regEnd.setAttribute("numero", ends.get("numeroEndereco")); regEnd.setAttribute("bairro", ends.get("bairro")); regEnd.setAttribute("cep", ends.get("cep")); regEnd.setAttribute("cidade", ends.get("nomeCidade")); regEnd.setAttribute("cidadeCod", ends.get("codCidade")); regEnd.setAttribute("estado", ends.get("estadoUf")); regEnd.setAttribute("estadoCod", ends.get("codEstado")); regEnd.setAttribute("referencia", (ends.get("referenciaEndereco") == null || ends.get("referenciaEndereco").equalsIgnoreCase("") ? "Sem informao" : ends.get("referenciaEndereco"))); enderecos.addData(regEnd); endAuxiliar.put(ends.get("codEndereco"), ends.get("codEndereco")); } } if (!telefones.getRecordList().isEmpty()) { telefones.selectAllRecords(); telefones.removeSelectedData(); } TreeMap<String, String> foneAuxiliar = new TreeMap<String, String>(); for (TreeMap<String, String> tels : clienteAuxiliar) { if (clienteAuxiliar.get(0).get("codFone") != null && foneAuxiliar.get(tels.get("codFone")) == null) { Record regTel = new Record(); regTel.setAttribute("codigo", tels.get("codFone")); regTel.setAttribute("descricao", tels.get("descricaoFone")); regTel.setAttribute("numero", Info.formataTelefone(tels.get("numeroFone"))); telefones.addData(regTel); foneAuxiliar.put(tels.get("codFone"), tels.get("codFone")); } } if (!emails.getRecordList().isEmpty()) { emails.selectAllRecords(); emails.removeSelectedData(); } TreeMap<String, String> emailAuxiliar = new TreeMap<String, String>(); for (TreeMap<String, String> ems : clienteAuxiliar) { if (clienteAuxiliar.get(0).get("codEmail") != null && emailAuxiliar.get(ems.get("codEmail")) == null) { Record regEmails = new Record(); regEmails.setAttribute("codigo", ems.get("codEmail")); regEmails.setAttribute("descricao", ems.get("descricaoEmail")); regEmails.setAttribute("email", ems.get("email")); emails.addData(regEmails); emailAuxiliar.put(ems.get("codEmail"), ems.get("codEmail")); } } if (!logins.getRecordList().isEmpty()) { logins.selectAllRecords(); logins.removeSelectedData(); } TreeMap<String, String> usuarioAuxiliar = new TreeMap<String, String>(); for (TreeMap<String, String> user : clienteAuxiliar) { if (clienteAuxiliar.get(0).get("codUsuario") != null && usuarioAuxiliar.get(user.get("codUsuario")) == null) { Record regUsers = new Record(); regUsers.setAttribute("codigo", user.get("codUsuario")); regUsers.setAttribute("usuario", user.get("usuario")); regUsers.setAttribute("senha", user.get("senha")); regUsers.setAttribute("statusCod", user.get("ativoUsuario")); regUsers.setAttribute("status", ((user.get("ativoUsuario").equalsIgnoreCase("t")) ? "Ativo" : "Bloqueado")); regUsers.setAttribute("codGrupo", user.get("codGrupo")); regUsers.setAttribute("grupo", user.get("nomeGrupo")); regUsers.setAttribute("resetUsuario", ((user.get("resetUsuario").equalsIgnoreCase("t")) ? "Resetado" : "Resetar")); logins.addData(regUsers); usuarioAuxiliar.put(user.get("codUsuario"), user.get("codUsuario")); } } if (!lancamento.getRecordList().isEmpty()) { lancamento.selectAllRecords(); lancamento.removeSelectedData(); } TreeMap<String, String> lancamentoAuxiliar = new TreeMap<String, String>(); for (TreeMap<String, String> lanc : clienteAuxiliar) { if (clienteAuxiliar.get(0).get("codLancamento") != null && lancamentoAuxiliar.get(lanc.get("codLancamento")) == null) { Record regLanc = new Record(); regLanc.setAttribute("codigo", lanc.get("codLancamento")); regLanc.setAttribute("data", DateTimeFormat.getShortDateTimeFormat() .format(new Date(Long.parseLong(lanc.get("dataLancamento"))))); regLanc.setAttribute("valor", "R$" + Info.formataSaldo(Double.parseDouble(lanc.get("valorLancamento")))); lancamento.addData(regLanc); lancamentoAuxiliar.put(lanc.get("codLancamento"), lanc.get("codLancamento")); } } editCliente.setDisabled(false); addLancamento.setDisabled(false); addVeiculo.setDisabled(false); Info.dbService.buscarVeiculoPorCliente( Integer.parseInt(clienteAuxiliar.get(0).get("codCliente")), new AsyncCallback<TreeMap<String, ArrayList<TreeMap<String, String>>>>() { @Override public void onFailure(Throwable caught) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } @Override public void onSuccess( TreeMap<String, ArrayList<TreeMap<String, String>>> dadosVeic) { if (dadosVeic != null) { if (!veicPlacas.getRecordList().isEmpty()) { veicPlacas.selectAllRecords(); veicPlacas.removeSelectedData(); tabelaVeiculos.redraw(); tabelaVeiculos.setContents(tabelaVazia); } veiculos = new TreeMap<String, ArrayList<TreeMap<String, String>>>( dadosVeic); TreeMap<String, ArrayList<TreeMap<String, String>>> veiculosAux = new TreeMap<String, ArrayList<TreeMap<String, String>>>( veiculos); ListGridRecord[] registeredPlacaRecords = new ListGridRecord[dadosVeic .size()]; if (veiculos.size() > 0) { editVeiculo.setDisabled(true); placaClicada.clear(); for (int i = 0; i < veiculos.size(); i++) { final ListGridRecord recordVeiculos = new ListGridRecord(); recordVeiculos.setAttribute("placa", veiculosAux.pollFirstEntry().getValue().get(0) .get("placaVeiculo")); registeredPlacaRecords[i] = recordVeiculos; } DataSourceTextField placaVeiculo = new DataSourceTextField( "placa", "Placa"); placaVeiculo.setRequired(true); placaVeiculo.setPrimaryKey(true); DataSource ds = new DataSource(); ds.setClientOnly(true); ds.setFields(placaVeiculo); for (int i = 0; i < registeredPlacaRecords.length; i++) { ds.addData(registeredPlacaRecords[i]); } veicPlacas.setDataSource(ds); veicPlacas.fetchData(); veicPlacas.setSelectionType(SelectionStyle.SINGLE); } else { placaClicada.clear(); editVeiculo.setDisabled(true); } } } }); } else { SC.warn("Erro ao Consultar Veculos do Cliente"); } } }); }
From source file:com.google.gwt.sample.i18n.client.DateTimeFormatExampleController.java
License:Apache License
@Override protected String doGetPattern(String patternKey) { // Date + Time if ("fullDateTime".equals(patternKey)) { return DateTimeFormat.getFullDateTimeFormat().getPattern(); }//from ww w. j a v a2 s . c o m if ("longDateTime".equals(patternKey)) { return DateTimeFormat.getLongDateTimeFormat().getPattern(); } if ("mediumDateTime".equals(patternKey)) { return DateTimeFormat.getMediumDateTimeFormat().getPattern(); } if ("shortDateTime".equals(patternKey)) { return DateTimeFormat.getShortDateTimeFormat().getPattern(); } // Date only if ("fullDate".equals(patternKey)) { return DateTimeFormat.getFullDateFormat().getPattern(); } if ("longDate".equals(patternKey)) { return DateTimeFormat.getLongDateFormat().getPattern(); } if ("mediumDate".equals(patternKey)) { return DateTimeFormat.getMediumDateFormat().getPattern(); } if ("shortDate".equals(patternKey)) { return DateTimeFormat.getShortDateFormat().getPattern(); } // Time only if ("fullTime".equals(patternKey)) { return DateTimeFormat.getFullTimeFormat().getPattern(); } if ("longTime".equals(patternKey)) { return DateTimeFormat.getLongTimeFormat().getPattern(); } if ("mediumTime".equals(patternKey)) { return DateTimeFormat.getMediumTimeFormat().getPattern(); } if ("shortTime".equals(patternKey)) { return DateTimeFormat.getShortTimeFormat().getPattern(); } throw new IllegalArgumentException("Unknown pattern key '" + patternKey + "'"); }
From source file:fr.aliasource.webmail.client.reader.invitation.InvitationPanel.java
License:GNU General Public License
private VerticalPanel fillInfoEventPanel() { VerticalPanel vp = new VerticalPanel(); vp.setStyleName("detailEvent noWrap"); Label lb = new Label(strings.newEvent()); vp.add(lb);/*from ww w. ja v a2 s.c o m*/ this.infoEventPanel = new FlexTable(); infoEventPanel.addStyleName("leftPanel"); infoEventPanel.setText(0, 0, strings.invitationTitle() + ":"); infoEventPanel.setText(0, 1, invitationInfo.getEvent().getTitle()); infoEventPanel.setText(1, 0, strings.invitationOwner() + ":"); infoEventPanel.setText(1, 1, invitationInfo.getEvent().getOwner()); infoEventPanel.setText(2, 0, strings.invitationWhen() + ":"); if (invitationInfo.getEvent().getDtStart() != null) { DateTimeFormat dtfStart = DateTimeFormat.getShortDateTimeFormat(); String sStart = dtfStart.format(invitationInfo.getEvent().getDtStart()); DateTimeFormat dtfEnd = DateTimeFormat.getShortTimeFormat(); String sEnd = dtfEnd.format(invitationInfo.getEvent().getDtEnd()); infoEventPanel.setText(2, 1, sStart + " - " + sEnd); } infoEventPanel.setText(3, 0, strings.invitationWhere() + ":"); infoEventPanel.setText(3, 1, invitationInfo.getEvent().getLocation()); String who = getWho(); if (!"".endsWith(who)) { infoEventPanel.setText(4, 0, strings.invitationWho() + ":"); infoEventPanel.setText(4, 1, who); } Element moreDetail = DOM.createElement("a"); moreDetail.setAttribute("href", invitationInfo.getCalendarUrl()); moreDetail.setInnerText(strings.moreActions()); HTML linkMoreDetail = new HTML(); linkMoreDetail.getElement().appendChild(moreDetail); infoEventPanel.setWidget(5, 1, linkMoreDetail); accept = getGoingLink(strings.invitationYes(), "invitationYes", INVITATION_ACCEPT); maybe = getGoingLink(strings.invitationMaybe(), "invitationMaybe", INVITATION_MAYBE); refuse = getGoingLink(strings.invitationNo(), "invitationNo", INVITATION_REFUSE); updateGoingLink(""); for (int i = 0; i < infoEventPanel.getRowCount(); ++i) { infoEventPanel.getCellFormatter().setStyleName(i, 0, "keys"); } infoEventPanel.getRowFormatter().addStyleName(0, "titleEvent"); infoEventPanel.getRowFormatter().addStyleName(1, "ownerEvent"); infoEventPanel.getRowFormatter().addStyleName(2, "startEvent"); vp.add(infoEventPanel); return vp; }
From source file:info.geekinaction.autoalert.view.FormatUtil.java
License:Open Source License
/** * @see FormatUtil#formatDate(Date)// w ww. ja v a 2 s .c o m */ public static String formatDate(Date date) { return formatDate(date, DateTimeFormat.getShortDateTimeFormat()); }