List of usage examples for com.google.gwt.user.client Window alert
public static void alert(String msg)
From source file:ch.unifr.pai.twice.utils.cursorSimulator.client.examples.CursorSimulation.java
License:Apache License
/** * Factory method for a mouse movement//from w ww .ja v a2s. c om * * @param x * destination X-coordinate * @param y * destination Y-coordinate * @param duration * of the movement * @return MouseMovement object */ public static MouseMovement m(int x, int y, int duration) { return new MouseMovement(x, y, duration, new Command() { @Override public void execute() { Window.alert("Movement done"); } }); }
From source file:ch.unifr.pai.twice.widgets.mpproxy.client.ScreenShotDistributor.java
License:Apache License
/** * Send the screenshot to the server//from www . j ava 2 s. com */ public void sendScreenShot() { String screen = Document.get().getDocumentElement().getInnerHTML(); if (!screen.equals(lastSent) || lastLeft != Window.getScrollLeft() || lastTop != Window.getScrollTop()) { String url = Window.Location.getHref(); URLParser p = new URLParser(url, Rewriter.getServletPath(Window.Location.getHref())); RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, GWT.getModuleBaseURL() + "manager?url=" + p.getProxyBasePath() + "&width=" + Window.getClientWidth() + "&height=" + Window.getClientHeight() + "&top=" + Window.getScrollTop() + "&left=" + Window.getScrollLeft()); lastSent = screen; lastLeft = Window.getScrollLeft(); lastTop = Window.getScrollTop(); screen = screen.replace('\n', ' '); screen = screen.replaceAll("<body", "<body><div class=\"readOnlyView\" style=\"width:" + Window.getClientWidth() + "; height:" + Window.getClientHeight() + ";\""); screen = screen.replaceAll("<\\/body>", "</div></body>"); screen = screen.replaceAll("(<script).*?(\\/script>)", ""); try { rb.sendRequest(screen, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { // TODO Auto-generated method stub } @Override public void onError(Request request, Throwable exception) { Window.alert("Screenshot sent"); } }); } catch (RequestException e) { e.printStackTrace(); } } }
From source file:cimav.client.view.catalogos.conceptos.ConceptosChosen.java
public ConceptosChosen(ETipoConcepto tipoConcepto, ETipoMovimiento tipoMovimiento) { this.tipoConcepto = tipoConcepto; this.tipoMovimiento = tipoMovimiento; initWidget(uiBinder.createAndBindUi(this)); chosen = new ValueListBox<>(new Renderer<Concepto>() { @Override//from w w w .j av a 2 s . co m public String render(Concepto object) { if (object == null) { return "Ninguno"; } return object.getName(); } @Override public void render(Concepto object, Appendable appendable) throws IOException { String s = render(object); appendable.append(s); } }); htmlPanel.add(chosen); rest = new ConceptoREST(); rest.addRESTExecutedListener(new BaseREST.RESTExecutedListener() { @Override public void onRESTExecuted(MethodEvent restEvent) { if (restEvent.getMethod().equals(EMethod.FIND_ALL)) { if (restEvent.getTypeResult().equals(ETypeResult.SUCCESS)) { conceptos = (List<Concepto>) restEvent.getResult(); // Agregar el Null como valor vlido // conceptos.add(null); //chosen.setAcceptableValues(conceptos); setConceptosAceptables(); //tipoConcepto, tipoMovimiento); } else { Window.alert("Fall carga de Conceptos"); } } } }); rest.findAll(); }
From source file:cimav.client.view.catalogos.departamentos.DeptoChosen.java
public DeptoChosen() { initWidget(uiBinder.createAndBindUi(this)); chosen = new ChosenValueListBox<>(new Renderer<Departamento>() { @Override//from w ww. j a v a 2 s. com public String render(Departamento object) { if (object == null) { return "None"; } return object.getName(); } @Override public void render(Departamento object, Appendable appendable) throws IOException { String s = render(object); appendable.append(s); } }); htmlPanel.add(chosen); deptoREST = new DepartamentoREST(); deptoREST.addRESTExecutedListener(new BaseREST.RESTExecutedListener() { @Override public void onRESTExecuted(MethodEvent restEvent) { if (restEvent.getMethod().equals(EMethod.FIND_ALL)) { if (restEvent.getTypeResult().equals(ETypeResult.SUCCESS)) { List<Departamento> deptos = (List<Departamento>) restEvent.getResult(); // Agregar el Null como valor vlido deptos.add(null); chosen.setAcceptableValues(deptos); } else { Window.alert("Fall carga de Departamentos"); } } } }); deptoREST.findAll(); }
From source file:cimav.client.view.catalogos.departamentos.DeptosEditorUi.java
public DeptosEditorUi() { initWidget(uiBinder.createAndBindUi(this)); empleadosBaseProvider = new EmpleadosBaseProvider(); FlexTable.FlexCellFormatter cellFormatterGeneral = flexEditorGeneral.getFlexCellFormatter(); flexEditorGeneral.setCellSpacing(0); flexEditorGeneral.setCellPadding(0); // flexEditorGeneral.getColumnFormatter().setWidth(0, "50px;"); nombreLbl = new Label(); nombreLbl.addStyleName("code-label"); nombreLbl.getElement().getStyle().setFontSize(100.0, Style.Unit.PCT); nombreLbl.getElement().getStyle().setDisplay(Style.Display.INLINE_BLOCK); nombreTxtBox = new TextBox(); nombreTxtBox.setWidth("600px"); String htmlColSpc = "<span style='margin-right: 10px;'></span>"; String htmlRowSpc = "<span style='margin-bottom: 10px; display: block;'></span>"; flexEditorGeneral.setWidget(0, 0, new HTML("<strong>Cdigo</strong>")); flexEditorGeneral.setWidget(1, 0, nombreLbl); flexEditorGeneral.setWidget(2, 0, new HTML(htmlRowSpc)); flexEditorGeneral.setWidget(3, 0, new HTML("<strong>Nombre</strong>")); flexEditorGeneral.setWidget(4, 0, nombreTxtBox); CellList.Resources cellListResources = GWT.create(ICellListResources.class); cellListEmpleados = new CellList<>(new EmpleadoListCell(null), cellListResources, empleadosBaseProvider.getDataProvider()); // cellList.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.ENABLED); // cellList.setSelectionModel(selectionModel); // selectionModel.addSelectionChangeHandler(new EmpleadosUI.SelectionHandler()); cellListEmpleados.setPageSize(260); // mximo son 400 empleados. Al mostrarlos todos, no se requiere Pager. scrollPanel.add(cellListEmpleados);/*w w w .j a v a2 s. c o m*/ // SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class); // pager = new SimplePager(SimplePager.TextLocation.CENTER, pagerResources, false, 0, true); // pager.setDisplay(dataGrid); /* Inyectarle style absolute al Abuelo para que funcione el scroll del cellList */ Element divAbue = cellListEmpleados.getElement().getParentElement().getParentElement(); divAbue.getStyle().setPosition(Style.Position.ABSOLUTE); divAbue.getStyle().setTop(0, Style.Unit.PX); divAbue.getStyle().setLeft(0, Style.Unit.PX); divAbue.getStyle().setBottom(0, Style.Unit.PX); divAbue.getStyle().setRight(0, Style.Unit.PX); // Add the CellList to the adapter in the database. empleadosBaseProvider.addDataDisplay(cellListEmpleados); saveBtn.addClickHandler(new SaveClickHandler()); cancelBtn.addClickHandler(new CancelClickHandler()); DeptosProvider.get().addMethodExecutedListener(new ProviderMethodExecutedListener()); empleadosBaseProvider.addMethodExecutedListener(new EmpleadosProviderMethodExecutedListener()); /* Binding */ try { binder = DataBinder.forType(Departamento.class); selected = binder.bind(nombreLbl, "code").bind(nombreTxtBox, "name").getModel(); binder.addPropertyChangeHandler(new BinderPropertyChange()); } catch (Exception e) { Window.alert("DeptosEditorUI DataBinder.bind:> " + e.getMessage()); } }
From source file:cimav.client.view.catalogos.departamentos.DeptosEditorUi.java
private boolean isValid() { boolean result = true; Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); Set<ConstraintViolation<Departamento>> violations = validator.validate(selected); if (!violations.isEmpty()) { result = false;//from w ww .j a v a 2 s. c om StringBuilder builder = new StringBuilder(); for (ConstraintViolation<Departamento> violation : violations) { // builder.append(violation.getMessage()); // builder.append(" : <i>("); // builder.append(violation.getPropertyPath().toString()); // builder.append(" = "); // builder.append("" + violation.getInvalidValue()); // builder.append(")</i>"); // builder.append("<br/>"); builder.append(" ").append(violation.getMessage()).append("\n"); builder.append(" ").append(violation.getPropertyPath().toString()).append(" = ") .append(violation.getInvalidValue()).append("\n\n"); } Window.alert(builder.toString()); } return result; }
From source file:cimav.client.view.catalogos.empleados.EmpleadosEditorUI.java
private void bindModel() { /* Binding */ try {/*from w ww. j a va2 s .c o m*/ empleadoBinder = DataBinder.forType(Empleado.class); empleadoSelected = empleadoBinder.bind(nombreTxtBox, "nombre").bind(paternoTxtBox, "apellidoPaterno") .bind(maternoTxtBox, "apellidoMaterno").bind(rfcTxtBox, "rfc").bind(curpTxtBox, "curp") .bind(fechaSNIDatePicker, "fechaSni").bind(imssTxtBox, "imss") .bind(imssClinicaChosen, "clinica").bind(bancoChosen, "banco") .bind(cuentaBancoTxtBox, "cuentaBanco").bind(cuentaCimavTxtBox, "cuentaCimav") // // laboral .bind(sedeChosen, "sede").bind(deptoChosen.getChosen(), "departamento") .bind(fechaIngresoDatePicker, "fechaIngreso").bind(fechaSNIDatePicker, "fechaSni") .bind(fechaContratoFinDatePicker, "fechaFinContrato") .bind(fechaContratoInicioDatePicker, "fechaInicioContrato") .bind(fechaBajaDatePicker, "fechaBaja").bind(fechaAntiguedadDatePicker, "fechaAntiguedad") .bind(statusEmpladoChose, "status").bind(jefeChosen.getChosen(), "jefe") .bind(grupoChosen, "grupo").bind(tabuladorChosen.getChosen(), "nivel") .bind(tipoEmpleadoChosen.getChosen(), "tipoEmpleado") .bind(tipoContratoChosen.getChosen(), "tipoContrato") .bind(tipoAntiguedadChosen.getChosen(), "tipoAntiguedad") .bind(tipoSniChosen.getChosen(), "tipoSNI").bind(numSNITxtBox, "numSni") .bind(numEstimulosProductividadTxtBox, "estimulosProductividad") .bind(porcenSegSepacionIndTxtBox, "porcenSegSeparacionInd").bind(pensionBanco, "pensionBanco") //.bind(pensionTipo, "pensionTipo") .bind(pensionUI.get(), "pensionTipo").bind(pensionPorcentaje, "pensionPorcen") .bind(pensionBeneficiario, "pensionBeneficiario").bind(pensionCuenta, "pensionCuenta") // personal .bind(sexoChose, "sexo").bind(edoCivilChose, "edoCivil") .bind(fechaNacimientoDatePicker, "fechaNacimiento").bind(direccionCalle, "direccionCalle") .bind(direccionColonia, "direccionColonia").bind(direccionCP, "direccionCP") .bind(telefono, "telefono").bind(emailPersonal, "emailPersonal").getModel(); empleadoBinder.addPropertyChangeHandler(new BinderPropertyChange()); } catch (Exception e) { Window.alert("EmpleadosEditorUI DataBinder.bind:> " + e.getMessage()); } }
From source file:cimav.client.view.catalogos.empleados.EmpleadosEditorUI.java
private boolean isValid() { boolean result = true; Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); Set<ConstraintViolation<Empleado>> violations = validator.validate(empleadoSelected); if (!violations.isEmpty()) { result = false;/* ww w . j a v a 2s .c o m*/ StringBuilder builder = new StringBuilder(); for (ConstraintViolation<Empleado> violation : violations) { // builder.append(violation.getMessage()); // builder.append(" : <i>("); // builder.append(violation.getPropertyPath().toString()); // builder.append(" = "); // builder.append("" + violation.getInvalidValue()); // builder.append(")</i>"); // builder.append("<br/>"); builder.append(" ").append(violation.getMessage()).append("\n"); builder.append(" ").append(violation.getPropertyPath().toString()).append(" = ") .append(violation.getInvalidValue()).append("\n\n"); } Window.alert(builder.toString()); } return result; }
From source file:cimav.client.view.catalogos.tabulador.TabuladorChosen.java
public TabuladorChosen() { initWidget(uiBinder.createAndBindUi(this)); chosen = new ChosenValueListBox<>(new Renderer<Tabulador>() { @Override//w w w . j a v a 2 s . c o m public String render(Tabulador object) { if (object == null) { return "None"; } //String result = Strings.padEnd(object.getCode(), 8, ' '); // JsArrayMixed args = JavaScriptObject.createArray().cast(); // args.push(object.getCode()); // String result = format("%1$-8s", args); String result = object.getCode(); result = result + object.getName(); return result; } @Override public void render(Tabulador object, Appendable appendable) throws IOException { if (object != null) { String s = render(object); appendable.append(s); } } }); chosen.setWidth("400px"); htmlPanel.add(chosen); rest = new TabuladorREST(); rest.addRESTExecutedListener(new BaseREST.RESTExecutedListener() { @Override public void onRESTExecuted(MethodEvent restEvent) { if (restEvent.getMethod().equals(EMethod.FIND_ALL)) { if (restEvent.getTypeResult().equals(ETypeResult.SUCCESS)) { List<Tabulador> tabuladores = (List<Tabulador>) restEvent.getResult(); tabuladores.add(null); chosen.setAcceptableValues(tabuladores); } else { Window.alert("Fall carga de Tabuladores"); } } } }); rest.findAll(); }
From source file:cimav.client.view.common.EmpleadoListCell.java
@Override public void render(Cell.Context context, EmpleadoBase value, SafeHtmlBuilder sb) { if (value == null) { return;/*w ww. j a v a 2 s .c o m*/ } boolean isSelected = this.selectionModel != null && this.selectionModel.getSelectedObject() != null && this.selectionModel.getSelectedObject().equals(value); String es_null = "---"; String grupoStr = value.getGrupo() != null ? value.getGrupo().getCode() : es_null; boolean tieneEstimulos = EGrupo.CYT.equals(value.getGrupo()); if (tieneEstimulos) { String estimulos = value.getEstimulosProductividad() != null ? "" + value.getEstimulosProductividad() : es_null; grupoStr = grupoStr + "(" + estimulos + ")"; } String estimulosCyt = value.getEstimulosProductividad() != null ? "" + value.getEstimulosProductividad() : es_null; String deptoCodeStr = value.getDepartamento() != null ? value.getDepartamento().getCode() : es_null; String deptoNameStr = value.getDepartamento() != null ? value.getDepartamento().getName() : es_null; String nivelStr = value.getNivel() != null ? value.getNivel().getCode() : es_null; String nivelNombreStr = value.getNivel() != null ? value.getNivel().getName() : es_null; String sedeStr = value.getSede() != null ? value.getSede().getAbrev() : es_null; DateTimeFormat dtf = DateTimeFormat.getFormat("dd/MMM/yyyy"); String fechaAntStr = dtf.format(value.getFechaAntiguedad()); String diasMesesAniosStr = "Nulo"; if (value.getPantYears() != null) { diasMesesAniosStr = value.getPantYears() + " aos(s), " + value.getPantMonths() + " mese(s), " + value.getPantDayOdd() + " das(s)"; } String td_selec_id = "td_selec_" + value.getId(); String html = "<table width='100%' cellspacing='0' cellpadding='0' style='cursor: pointer; text-align: left; vertical-align: middle; border-bottom:1px solid lightgray;'>\n" + " <tbody> \n" + " <tr >\n" + " <td rowspan='6' id='" + td_selec_id + "_left' class'td_selection' style='height:auto; width: 5px; SELECTED_COLOR_REEMPLAZO'></td>\n" + " <td colspan='3' style='height:10px;'></td>\n" + " <td rowspan='6' id='" + td_selec_id + "_right' class'td_selection' style='height:auto; width: 5px; SELECTED_COLOR_REEMPLAZO'></td>\n" + " </tr>\n" + " <tr>\n" + " <td width='78px' rowspan='3' style='text-align: center;'>" + " <img data-toggle='tooltip' data-placement='left' title='TOOL_TIP_ID_REEMPLAZO' src='URL_FOTO_REEMPLAZO' style='border:1px solid lightgray; margin-top: 3px; border-radius:50%; padding:2px;'/>" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td colspan='2' style='vertical-align: top;'><h5 style='margin-top: 0px; margin-bottom: 0px;'>NOMBRE_REEMPLAZO</h5></td>\n" + " </tr>\n" + " <tr >\n" + " <td colspan='1' style='line-height: 1.8;'> " + " <code class='label-cyt-grp-niv'><span >CODE_REEMPLAZO</span></code> " + " <code class='label-cyt-grp-niv'><span >GRUPO_REEMPLAZO</span></code> " + " <code class='label-cyt-grp-niv' data-toggle='tooltip' data-placement='left' title='TOOL_TIP_NIVEL_REEMPLAZO'><span >NIVEL_REEMPLAZO</span></code> " + " <code class='label-cyt-grp-niv'><span >SEDE_REEMPLAZO</span></code> " + " <code class='label-cyt-grp-niv' data-toggle='tooltip' data-placement='left' title='DATO_ANTIGUEDAD_REEMPLAZO'><span >FECHA_ANTIGUEDAD_REEMPLAZO</span></code> " + " </td>\n" + " </tr>\n" + " <tr style='border-bottom:1px solid lightgray;'>\n" + " <td style='text-align:center;' ></td>\n" + " <td colspan='3' style='height:10px;'></td>\n" + " </tr>\n" + " </tbody> " + "</table>"; if (isSelected) { html = html.replace("SELECTED_COLOR_REEMPLAZO", "background-color: " + colorSelected + ";"); // 628cd5;"); } else if (value.isDirty() != null && value.isDirty()) { html = html.replace("SELECTED_COLOR_REEMPLAZO", "background-color: lightgray;"); } else { html = html.replace("SELECTED_COLOR_REEMPLAZO", "background-color: #F8F8F8;"); } try { String idReem = "---"; if (value.getId() != null) { idReem = value.getId().toString(); } html = html.replace("TOOL_TIP_ID_REEMPLAZO", idReem); html = html.replace("CODE_REEMPLAZO", chkStrNull(value.getCode())); html = html.replace("URL_FOTO_REEMPLAZO", chkStrNull(value.getUrlPhoto())); html = html.replace("NOMBRE_REEMPLAZO", chkStrNull(value.getName())); html = html.replace("GRUPO_REEMPLAZO", chkStrNull(grupoStr)); html = html.replace("TOOL_TIP_NIVEL_REEMPLAZO", chkStrNull(nivelNombreStr)); html = html.replace("NIVEL_REEMPLAZO", chkStrNull(nivelStr)); html = html.replace("DEPTO_CODIGO_REEMPLAZO", chkStrNull(deptoCodeStr)); html = html.replace("TOOL_TIP_DEPTO_REEMPLAZO", chkStrNull(deptoNameStr)); html = html.replace("SEDE_REEMPLAZO", chkStrNull(sedeStr)); html = html.replace("FECHA_ANTIGUEDAD_REEMPLAZO", chkStrNull(fechaAntStr)); html = html.replace("DATO_ANTIGUEDAD_REEMPLAZO", chkStrNull(diasMesesAniosStr)); if (value.getId() != null) { html = html.replace("ID_REEMPLAZO", value.getId().toString()); } else { html = html.replace("ID_REEMPLAZO", "---"); } sb.appendHtmlConstant(html); } catch (Exception e) { Window.alert("Catch it! " + html); } }