1
2
3
4
5 package ecar.taglib.util;
6
7 import java.io.IOException;
8 import java.util.ArrayList;
9 import java.util.Collection;
10 import java.util.Iterator;
11 import java.util.List;
12
13 import javax.servlet.jsp.JspException;
14 import javax.servlet.jsp.JspWriter;
15 import javax.servlet.jsp.PageContext;
16 import javax.servlet.jsp.tagext.Tag;
17
18 import org.apache.log4j.Logger;
19
20 import comum.database.Dao;
21 import comum.util.Pagina;
22 import comum.util.Util;
23
24 import ecar.dao.ConfiguracaoDao;
25 import ecar.dao.SisGrupoAtributoDao;
26 import ecar.dao.SituacaoDao;
27 import ecar.dao.UsuarioDao;
28 import ecar.exception.ECARException;
29 import ecar.login.SegurancaECAR;
30 import ecar.permissao.ValidaPermissao;
31 import ecar.pojo.AreaAre;
32 import ecar.pojo.AtributoLivre;
33 import ecar.pojo.EstruturaAtributoEttat;
34 import ecar.pojo.EstruturaEtt;
35 import ecar.pojo.ItemEstruturaIett;
36 import ecar.pojo.ItemEstruturaSisAtributoIettSatb;
37 import ecar.pojo.ObjetoEstrutura;
38 import ecar.pojo.OrgaoOrg;
39 import ecar.pojo.PeriodicidadePrdc;
40 import ecar.pojo.SisAtributoSatb;
41 import ecar.pojo.SisGrupoAtributoSga;
42 import ecar.pojo.SituacaoSit;
43 import ecar.pojo.SubAreaSare;
44 import ecar.util.Dominios;
45
46
47
48
49
50 public class FormEstruturaAtributoFiltroTag implements Tag {
51
52 ValidaPermissao validaPermissao = new ValidaPermissao();
53 private ObjetoEstrutura atributo;
54 private ItemEstruturaIett itemEstrutura;
55 private EstruturaEtt estrutura;
56 private Boolean desabilitar;
57 private SegurancaECAR seguranca;
58 private Boolean exibirBotoes = new Boolean(true);
59
60 private PageContext page = null;
61 private String contextPath = null;
62 private String codEstrutura = null;
63
64 private UsuarioDao usu = null;
65
66
67
68
69
70
71
72
73
74
75 public int doStartTag() throws JspException {
76 try {
77 usu = new UsuarioDao();
78 if (atributo.iGetTipo() == EstruturaAtributoEttat.class){
79
80 String nomeMetodo = "geraHTML" + Util.primeiraLetraToUpperCase(atributo.iGetNome());
81 if(atributo.iGetGrupoAtributosLivres() != null){
82 nomeMetodo = "geraHTMLAtributoLivre";
83 }
84
85 this.getClass().getMethod(nomeMetodo, null).invoke(this, null);
86
87 }
88
89
90 } catch (Exception e) {
91
92 }
93 return Tag.EVAL_BODY_INCLUDE;
94 }
95
96
97
98
99
100
101
102
103 public void geraHTMLPesquisaFuncaoAcompanhamento() {
104 try {
105 String codigo = "";
106 String valor = "";
107 boolean indAtivoUsu = true;
108 if(getItemEstrutura().getCodIett() != null){
109 codigo = atributo.iGetValorCodFk(getItemEstrutura());
110 valor = atributo.iGetValor(getItemEstrutura());
111 }
112 if (codigo != null && !"".equals(codigo) && codigo.startsWith("U")){
113 indAtivoUsu = usu.verificarUsuarioAtivo(Long.valueOf(codigo.substring(1)));
114 }
115 criaPesquisa(atributo.iGetNome(),
116 indAtivoUsu,
117 atributo.iGetLabel(),
118 "ecar.popup.PopUpUsuarioEGrupo",
119 "50",
120 codigo,
121 valor,
122 "100",
123 atributo.iGetDica());
124 } catch (ECARException e) {
125 Logger logger = Logger.getLogger(this.getClass());
126 logger.error(e);
127 }
128 }
129
130
131
132
133
134
135
136
137 public void geraHTMLNomeIett() {
138 try {
139 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
140 criaTextArea(codEstrutura + "_nomeIett", atributo.iGetLabel(), "4", "60",
141 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
142 } else {
143 criaInputText(codEstrutura + "_nomeIett", atributo.iGetLabel(),
144 atributo.iGetTamanhoConteudoAtrib().toString(),
145 atributo.iGetTamanhoConteudoAtrib().toString(),
146 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
147 }
148 } catch (ECARException e) {
149 Logger logger = Logger.getLogger(this.getClass());
150 logger.error(e);
151 }
152 }
153
154
155
156
157
158
159
160
161 public void geraHTMLSiglaIett() {
162 try {
163 criaInputText(codEstrutura + "_siglaIett", atributo.iGetLabel(), "12", "10", atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
164 } catch (ECARException e) {
165 Logger logger = Logger.getLogger(this.getClass());
166 logger.error(e);
167 }
168 }
169
170
171
172
173
174
175
176
177 public void geraHTMLDescricaoIett() {
178 try {
179 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
180 criaTextArea(codEstrutura + "_descricaoIett", atributo.iGetLabel(), "4", "60",
181 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
182 } else {
183 criaInputText(codEstrutura + "_descricaoIett", atributo.iGetLabel(),
184 atributo.iGetTamanhoConteudoAtrib().toString(),
185 atributo.iGetTamanhoConteudoAtrib().toString(),
186 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
187 }
188 } catch (ECARException e) {
189 Logger logger = Logger.getLogger(this.getClass());
190 logger.error(e);
191 }
192 }
193
194
195
196
197
198
199
200
201 public void geraHTMLOrigemIett() {
202 try {
203 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
204 criaTextArea(codEstrutura + "_origemIett", atributo.iGetLabel(), "4", "60",
205 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
206 } else {
207 criaInputText(codEstrutura + "_origemIett", atributo.iGetLabel(),
208 atributo.iGetTamanhoConteudoAtrib().toString(),
209 atributo.iGetTamanhoConteudoAtrib().toString(),
210 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
211 }
212 } catch (ECARException e) {
213 Logger logger = Logger.getLogger(this.getClass());
214 logger.error(e);
215 }
216 }
217
218
219
220
221
222
223
224
225 public void geraHTMLObjetivoGeralIett() {
226 try {
227 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
228 criaTextArea(codEstrutura + "_objetivoGeralIett", atributo.iGetLabel(), "4", "60",
229 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
230 } else {
231 criaInputText(codEstrutura + "_objetivoGeralIett", atributo.iGetLabel(),
232 atributo.iGetTamanhoConteudoAtrib().toString(),
233 atributo.iGetTamanhoConteudoAtrib().toString(),
234 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
235 }
236 } catch (ECARException e) {
237 Logger logger = Logger.getLogger(this.getClass());
238 logger.error(e);
239 }
240 }
241
242
243
244
245
246
247
248
249 public void geraHTMLObjetivoEspecificoIett() {
250 try {
251 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
252 criaTextArea(codEstrutura + "_objetivoEspecificoIett", atributo.iGetLabel(), "4", "60",
253 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
254 } else {
255 criaInputText(codEstrutura + "_objetivoEspecificoIett", atributo.iGetLabel(),
256 atributo.iGetTamanhoConteudoAtrib().toString(),
257 atributo.iGetTamanhoConteudoAtrib().toString(),
258 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
259 }
260 } catch (ECARException e) {
261 Logger logger = Logger.getLogger(this.getClass());
262 logger.error(e);
263 }
264 }
265
266
267
268
269
270
271
272
273 public void geraHTMLBeneficiosIett() {
274 try {
275 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
276 criaTextArea(codEstrutura + "_beneficiosIett", atributo.iGetLabel(), "4", "60",
277 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
278 } else {
279 criaInputText(codEstrutura + "_beneficiosIett", atributo.iGetLabel(),
280 atributo.iGetTamanhoConteudoAtrib().toString(),
281 atributo.iGetTamanhoConteudoAtrib().toString(),
282 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
283 }
284 } catch (ECARException e) {
285 Logger logger = Logger.getLogger(this.getClass());
286 logger.error(e);
287 }
288 }
289
290
291
292
293
294
295
296
297 public void geraHTMLDataInicioIett() {
298 try {
299 criaInputTextData(codEstrutura + "_dataInicioIett", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
300 } catch (ECARException e) {
301 Logger logger = Logger.getLogger(this.getClass());
302 logger.error(e);
303 }
304 }
305
306
307
308
309
310
311
312
313 public void geraHTMLDataTerminoIett() {
314 try {
315 criaInputTextData(codEstrutura + "_dataTerminoIett", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
316 } catch (ECARException e) {
317 Logger logger = Logger.getLogger(this.getClass());
318 logger.error(e);
319 }
320 }
321
322
323
324
325
326
327
328
329 public void geraHTMLIndCriticaIett() {
330 List opcoes = new ArrayList();
331 opcoes.add(new String[] { "S", "Sim" });
332 opcoes.add(new String[] { "N", "Não" });
333 try {
334 criaRadio(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), opcoes, atributo.iGetDica());
335 } catch (ECARException e) {
336 Logger logger = Logger.getLogger(this.getClass());
337 logger.error(e);
338 }
339 }
340
341
342
343
344
345
346
347
348 public void geraHTMLValPrevistoFuturoIett() {
349 String valor = "";
350 try {
351 if(!"".equals(atributo.iGetValor(getItemEstrutura())))
352 valor = Pagina.trocaNullNumeroDecimalSemMilhar(Double.valueOf(atributo.iGetValor(getItemEstrutura())));
353
354 criaInputTextMoeda(codEstrutura + "_valPrevistoFuturoIett", atributo.iGetLabel(), "12", "30", valor, atributo.iGetDica());
355 } catch (ECARException e) {
356 Logger logger = Logger.getLogger(this.getClass());
357 logger.error(e);
358 }
359 }
360
361
362
363
364
365
366
367
368 public void geraHTMLDataInicioMonitoramentoIett() {
369 try{
370 criaInputTextData(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
371 }
372 catch (ECARException e) {
373 Logger logger = Logger.getLogger(this.getClass());
374 logger.error(e);
375 }
376
377 }
378
379
380
381
382
383
384
385
386 public void geraHTMLDataInclusaoIett() {
387 try{
388
389
390
391
392
393
394
395
396 criaInputTextData(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
397
398
399 }
400 catch (ECARException e) {
401 Logger logger = Logger.getLogger(this.getClass());
402 logger.error(e);
403 }
404 }
405
406
407
408
409
410
411
412
413 public void geraHTMLUsuarioUsuByCodUsuIncIett() {
414 try{
415 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
416 criaTextArea(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), "4", "60",
417 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
418 } else {
419 criaInputText(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(),
420 atributo.iGetTamanhoConteudoAtrib().toString(),
421 atributo.iGetTamanhoConteudoAtrib().toString(),
422 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
423 }
424 }
425 catch (ECARException e) {
426 Logger logger = Logger.getLogger(this.getClass());
427 logger.error(e);
428 }
429 }
430
431
432
433
434
435
436
437
438 public void geraHTMLDataUltManutencaoIett() {
439 try{
440 criaInputTextData(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
441 }
442 catch (ECARException e) {
443 Logger logger = Logger.getLogger(this.getClass());
444 logger.error(e);
445 }
446 }
447
448
449
450
451
452
453
454
455 public void geraHTMLUsuarioUsuByCodUsuUltManutIett() {
456 try{
457 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
458 criaTextArea(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), "4", "60",
459 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
460 } else {
461 criaInputText(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(),
462 atributo.iGetTamanhoConteudoAtrib().toString(),
463 atributo.iGetTamanhoConteudoAtrib().toString(),
464 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
465 }
466 }
467 catch (ECARException e) {
468 Logger logger = Logger.getLogger(this.getClass());
469 logger.error(e);
470 }
471 }
472
473
474
475
476
477
478 public void geraHTMLIndAtivoIett() {
479 List opcoes = new ArrayList();
480 opcoes.add(new String[] { "S", "Sim" });
481 opcoes.add(new String[] { "N", "Não" });
482 try {
483 criaRadio(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), opcoes, atributo.iGetDica());
484 } catch (ECARException e) {
485 Logger logger = Logger.getLogger(this.getClass());
486 logger.error(e);
487 }
488 }
489
490
491
492
493
494
495
496
497 public void geraHTMLDataR1() {
498 try {
499 criaInputTextData(codEstrutura + "_dataR1", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
500 } catch (ECARException e) {
501 Logger logger = Logger.getLogger(this.getClass());
502 logger.error(e);
503 }
504 }
505
506
507
508
509
510
511
512
513 public void geraHTMLDataR2() {
514 try {
515 criaInputTextData(codEstrutura + "_dataR2", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
516 } catch (ECARException e) {
517 Logger logger = Logger.getLogger(this.getClass());
518 logger.error(e);
519 }
520 }
521
522
523
524
525
526
527
528
529 public void geraHTMLDataR3() {
530 try {
531 criaInputTextData(codEstrutura + "_dataR3", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
532 } catch (ECARException e) {
533 Logger logger = Logger.getLogger(this.getClass());
534 logger.error(e);
535 }
536 }
537
538
539
540
541
542
543
544
545 public void geraHTMLDataR4() {
546 try {
547 criaInputTextData(codEstrutura + "_dataR4", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
548 } catch (ECARException e) {
549 Logger logger = Logger.getLogger(this.getClass());
550 logger.error(e);
551 }
552 }
553
554
555
556
557
558
559
560
561 public void geraHTMLDataR5() {
562 try {
563 criaInputTextData(codEstrutura + "_dataR5", atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
564 } catch (ECARException e) {
565 Logger logger = Logger.getLogger(this.getClass());
566 logger.error(e);
567 }
568 }
569
570
571
572
573
574
575
576
577 public void geraHTMLDescricaoR1() {
578 try {
579 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
580 criaTextArea(codEstrutura + "_descricaoR1", atributo.iGetLabel(), "4", "60",
581 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
582 } else {
583 criaInputText(codEstrutura + "_descricaoR1", atributo.iGetLabel(),
584 atributo.iGetTamanhoConteudoAtrib().toString(),
585 atributo.iGetTamanhoConteudoAtrib().toString(),
586 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
587 }
588 } catch (ECARException e) {
589 Logger logger = Logger.getLogger(this.getClass());
590 logger.error(e);
591 }
592 }
593
594
595
596
597
598
599
600
601 public void geraHTMLDescricaoR2() {
602 try {
603 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
604 criaTextArea(codEstrutura + "_descricaoR2", atributo.iGetLabel(), "4", "60",
605 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
606 } else {
607 criaInputText(codEstrutura + "_descricaoR2", atributo.iGetLabel(),
608 atributo.iGetTamanhoConteudoAtrib().toString(),
609 atributo.iGetTamanhoConteudoAtrib().toString(),
610 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
611 }
612 } catch (ECARException e) {
613 Logger logger = Logger.getLogger(this.getClass());
614 logger.error(e);
615 }
616 }
617
618
619
620
621
622
623
624
625 public void geraHTMLDescricaoR3() {
626 try {
627 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
628 criaTextArea(codEstrutura + "_descricaoR3", atributo.iGetLabel(), "4", "60",
629 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
630 } else {
631 criaInputText(codEstrutura + "_descricaoR3", atributo.iGetLabel(),
632 atributo.iGetTamanhoConteudoAtrib().toString(),
633 atributo.iGetTamanhoConteudoAtrib().toString(),
634 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
635 }
636 } catch (ECARException e) {
637 Logger logger = Logger.getLogger(this.getClass());
638 logger.error(e);
639 }
640 }
641
642
643
644
645
646
647
648
649 public void geraHTMLDescricaoR4() {
650 try {
651 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
652 criaTextArea(codEstrutura + "_descricaoR4", atributo.iGetLabel(), "4", "60",
653 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
654 } else {
655 criaInputText(codEstrutura + "_descricaoR4", atributo.iGetLabel(),
656 atributo.iGetTamanhoConteudoAtrib().toString(),
657 atributo.iGetTamanhoConteudoAtrib().toString(),
658 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
659 }
660 } catch (ECARException e) {
661 Logger logger = Logger.getLogger(this.getClass());
662 logger.error(e);
663 }
664 }
665
666
667
668
669
670
671
672
673 public void geraHTMLDescricaoR5() {
674 try {
675 if (atributo.iGetTamanhoConteudoAtrib() > ObjetoEstrutura.DEFAULT_TAMANHO_CAMPO_TEXT) {
676 criaTextArea(codEstrutura + "_descricaoR5", atributo.iGetLabel(), "4", "60",
677 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
678 } else {
679 criaInputText(codEstrutura + "_descricaoR5", atributo.iGetLabel(),
680 atributo.iGetTamanhoConteudoAtrib().toString(),
681 atributo.iGetTamanhoConteudoAtrib().toString(),
682 atributo.iGetValor(getItemEstrutura()), atributo.iGetDica());
683 }
684 } catch (ECARException e) {
685 Logger logger = Logger.getLogger(this.getClass());
686 logger.error(e);
687 }
688 }
689
690
691
692
693
694
695
696
697 public void geraHTMLAreaAre() {
698 AreaAre area = new AreaAre();
699 area.setIndAtivoAre("S");
700 try {
701 List areas = new Dao().pesquisar(area, new String[] { atributo.iGetNomeFk(), "asc" });
702 List options = new ArrayList();
703 Iterator it = areas.iterator();
704 while (it.hasNext()) {
705 area = (AreaAre) it.next();
706 options.add(new String[] { area.getCodAre().toString(), Util.invocaGet(area, atributo.iGetNomeFk()).toString() });
707 }
708
709
710 criaSelect(codEstrutura + "_areaAre", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstrutura()), options, "", atributo.iGetDica());
711
712
713 } catch (ECARException e) {
714 Logger logger = Logger.getLogger(this.getClass());
715 logger.error(e);
716 }
717 }
718
719
720
721
722
723
724
725
726 public void geraHTMLSubAreaSare() {
727 SubAreaSare sArea = new SubAreaSare();
728 sArea.setIndAtivoSare("S");
729 try {
730 List sAreas = new Dao().pesquisar(sArea, new String[] { atributo.iGetNomeFk(), "asc" });
731 List options = new ArrayList();
732 Iterator it = sAreas.iterator();
733 while (it.hasNext()) {
734 sArea = (SubAreaSare) it.next();
735 options.add(new String[] { sArea.getCodSare().toString(), Util.invocaGet(sArea, atributo.iGetNomeFk()).toString() });
736 }
737 criaSelect(codEstrutura + "_subAreaSare", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstrutura()), options, "", atributo.iGetDica());
738 } catch (ECARException e) {
739 Logger logger = Logger.getLogger(this.getClass());
740 logger.error(e);
741 }
742 }
743
744
745
746
747
748
749
750
751 public void geraHTMLUnidadeOrcamentariaUO() {
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769 criaDiv(codEstrutura + "_unidadeOrcamentariaDiv", atributo.iGetLabel(), atributo.iGetDica());
770 }
771
772
773
774
775
776
777
778
779 public void geraHTMLOrgaoOrgByCodOrgaoResponsavel1Iett() {
780 OrgaoOrg orgao = new OrgaoOrg();
781 orgao.setIndAtivoOrg("S");
782 try {
783 List orgaos = new Dao().pesquisar(orgao, new String[] {
784 atributo.iGetNomeFk(), "asc" });
785 List options = new ArrayList();
786 Iterator it = orgaos.iterator();
787 while (it.hasNext()) {
788 orgao = (OrgaoOrg) it.next();
789 options.add(new String[] { orgao.getCodOrg().toString(), Util.invocaGet(orgao, atributo.iGetNomeFk()).toString() });
790 }
791
792 String disabled = (getBloquearCampo()) ? "disabled" : "";
793
794 String scripts = "onchange=\"javascript:carregaUnidadeOrc(this.value,'" + disabled + "', '" + codEstrutura + "');\"";
795
796 criaSelect(codEstrutura + "_orgaoOrgByCodOrgaoResponsavel1Iett", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstrutura()), options, scripts, atributo.iGetDica());
797 } catch (ECARException e) {
798 Logger logger = Logger.getLogger(this.getClass());
799 logger.error(e);
800 }
801 }
802
803
804
805
806
807
808
809
810 public void geraHTMLOrgaoOrgByCodOrgaoResponsavel2Iett() {
811 OrgaoOrg orgao = new OrgaoOrg();
812 orgao.setIndAtivoOrg("S");
813 try {
814 List orgaos = new Dao().pesquisar(orgao, new String[] {atributo.iGetNomeFk(), "asc" });
815 List options = new ArrayList();
816 Iterator it = orgaos.iterator();
817 while (it.hasNext()) {
818 orgao = (OrgaoOrg) it.next();
819 options.add(new String[] { orgao.getCodOrg().toString(), Util.invocaGet(orgao, atributo.iGetNomeFk()).toString() });
820 }
821 criaSelect(codEstrutura + "_orgaoOrgByCodOrgaoResponsavel2Iett", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstrutura()), options, "", atributo.iGetDica());
822 } catch (ECARException e) {
823 Logger logger = Logger.getLogger(this.getClass());
824 logger.error(e);
825 }
826 }
827
828
829
830
831
832
833
834
835 public void geraHTMLPeriodicidadePrdc() {
836 PeriodicidadePrdc prd = new PeriodicidadePrdc();
837 try {
838 List periodicidades = new Dao().pesquisar(prd, new String[] {atributo.iGetNomeFk(), "asc" });
839 List options = new ArrayList();
840 Iterator it = periodicidades.iterator();
841 while (it.hasNext()) {
842 prd = (PeriodicidadePrdc) it.next();
843 options.add(new String[] { prd.getCodPrdc().toString(), Util.invocaGet(prd, atributo.iGetNomeFk()).toString() });
844 }
845 PeriodicidadePrdc perConfig = new ConfiguracaoDao(null).getConfiguracao().getPeriodicidadePrdc();
846 if((getItemEstrutura() == null || getItemEstrutura().getCodIett() == null) && perConfig != null){
847 criaSelect(codEstrutura + "_periodicidadePrdc", atributo.iGetLabel(), perConfig.getCodPrdc().toString(), options, "", atributo.iGetDica());
848 }
849 else {
850 criaSelect(codEstrutura + "_periodicidadePrdc", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstrutura()), options, "", atributo.iGetDica());
851 }
852 } catch (ECARException e) {
853 Logger logger = Logger.getLogger(this.getClass());
854 logger.error(e);
855 }
856 }
857
858
859
860
861
862
863
864
865 public void geraHTMLSituacaoSit() {
866 SituacaoSit situacao = new SituacaoSit();
867 try {
868 List situacoes = new SituacaoDao(null).getSituacaoByEstrutura(estrutura, new String[] {"descricaoSit","asc"});
869
870 List options = new ArrayList();
871 Iterator it = situacoes.iterator();
872 while(it.hasNext()){
873 situacao = (SituacaoSit) it.next();
874 options.add(new String[] {situacao.getCodSit().toString(), Util.invocaGet(situacao, atributo.iGetNomeFk()).toString() });
875 }
876 criaSelect(codEstrutura + "_situacaoSit", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstrutura()), options, "", atributo.iGetDica());
877 } catch (ECARException e) {
878 Logger logger = Logger.getLogger(this.getClass());
879 logger.error(e);
880 }
881 }
882
883
884
885
886
887
888
889
890
891 public void geraHTMLAtributoLivre() throws ECARException, JspException{
892
893 if(atributo.iGetGrupoAtributosLivres() != null){
894
895
896 JspWriter writer = this.page.getOut();
897
898 SisGrupoAtributoSga grupoAtributo = atributo.iGetGrupoAtributosLivres();
899 int tipoInput = grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().intValue();
900
901
902
903
904
905
906
907
908
909 if (tipoInput == Input.CHECKBOX ||
910 tipoInput == Input.COMBOBOX ||
911 tipoInput == Input.LISTBOX ||
912 tipoInput == Input.MULTIPLO ||
913 tipoInput == Input.MULTITEXTO ||
914 tipoInput == Input.RADIO_BUTTON ||
915 tipoInput == Input.TEXT ||
916 tipoInput == Input.TEXTAREA ||
917 tipoInput == Input.VALIDACAO) {
918
919 Input input = new Input(writer);
920 input.setTelaFiltro(new Boolean(true));
921 input.setLabel(atributo.iGetLabel());
922 input.setTipo(tipoInput);
923 input.setObrigatorio("N");
924
925 input.setPathRaiz(this.getContextPath());
926
927 input.setSize(atributo.iGetTamanhoConteudoAtrib().toString());
928
929 if (getBloquearCampo()) {
930 input.setDisabled("S");
931 }
932 input.setNome(codEstrutura + "_a" + grupoAtributo.getCodSga().toString());
933 input.setClassLabel("label");
934
935 List aributosLivresSelecionados = new ArrayList();
936
937 if(getItemEstrutura().getItemEstruturaSisAtributoIettSatbs() != null){
938 Iterator itAtribLivres = getItemEstrutura().getItemEstruturaSisAtributoIettSatbs().iterator();
939 while(itAtribLivres.hasNext()){
940 ItemEstruturaSisAtributoIettSatb atributo = (ItemEstruturaSisAtributoIettSatb) itAtribLivres.next();
941 AtributoLivre atributoLivre = new AtributoLivre();
942 atributoLivre.setInformacao(atributo.getInformacaoIettSatb());
943 atributoLivre.setSisAtributoSatb(atributo.getSisAtributoSatb());
944 aributosLivresSelecionados.add(atributoLivre);
945 }
946 }
947
948 input.setSelecionados(aributosLivresSelecionados);
949 input.setSisAtributo((SisAtributoSatb)grupoAtributo.getSisAtributoSatbs().iterator().next());
950 if(atributo.iGetDica() != null)
951 input.setDica(atributo.iGetDica());
952
953 input.doStartTag();
954
955 Options options = new Options(writer);
956
957 List opcoes = new ArrayList();
958 String selectedCodSapadrao = "";
959 if(grupoAtributo.getCodSga() != null && grupoAtributo.getCodSga().longValue() != 1){
960 if(grupoAtributo.getSisTipoOrdenacaoSto() != null){
961 opcoes = new SisGrupoAtributoDao(null).getAtributosOrdenados(grupoAtributo);
962 }
963 }
964
965 if(!opcoes.isEmpty()) {
966 options.setOptions(opcoes);
967 options.setValor("codSatb");
968 options.setLabel("descricaoSatb");
969
970 options.setParent(input);
971 options.setNome(codEstrutura + "_a" + grupoAtributo.getCodSga().toString());
972 options.doStartTag();
973 }
974
975 input.doEndTag();
976 }
977 }
978 }
979
980
981
982
983
984
985
986
987
988
989 public void geraHTMLNivelPlanejamento() throws ECARException, JspException {
990
991 JspWriter writer = this.page.getOut();
992
993 SisGrupoAtributoSga grupoAtributo = new ConfiguracaoDao(null).getConfiguracao().getSisGrupoAtributoSgaByCodSgaGrAtrNvPlan();
994
995 Input input = new Input(writer);
996 input.setLabel(grupoAtributo.getDescricaoSga());
997 input.setTipo(grupoAtributo.getSisTipoExibicGrupoSteg().getCodSteg().intValue());
998 input.setObrigatorio("N");
999
1000 if(getBloquearCampo())
1001 input.setDisabled("S");
1002
1003 input.setNome(codEstrutura + "_a" + grupoAtributo.getCodSga().toString());
1004 input.setClassLabel("label");
1005
1006 List niveisSelecionados = new ArrayList();
1007
1008 if(getItemEstrutura().getItemEstruturaNivelIettns() != null){
1009 Iterator itNiveis = getItemEstrutura().getItemEstruturaNivelIettns().iterator();
1010 while(itNiveis.hasNext()){
1011 SisAtributoSatb nivel = (SisAtributoSatb) itNiveis.next();
1012 AtributoLivre atributoLivre = new AtributoLivre();
1013 atributoLivre.setSisAtributoSatb(nivel);
1014 niveisSelecionados.add(atributoLivre);
1015 }
1016 }
1017
1018 input.setSelecionados(niveisSelecionados);
1019 input.setSisAtributo((SisAtributoSatb)grupoAtributo.getSisAtributoSatbs().iterator().next());
1020
1021
1022 if(atributo.iGetDica() != null)
1023 input.setDica(atributo.iGetDica());
1024
1025 input.doStartTag();
1026
1027 Options options = new Options(writer);
1028
1029 List opcoes = new ArrayList();
1030 if(grupoAtributo.getCodSga() != null && grupoAtributo.getCodSga().longValue() != 1){
1031 if(grupoAtributo.getSisTipoOrdenacaoSto() != null){
1032 opcoes = new SisGrupoAtributoDao(null).getAtributosOrdenados(grupoAtributo);
1033 }
1034 }
1035
1036 List opcoesAtivos = new ArrayList();
1037 if(!opcoes.isEmpty()) {
1038 Iterator opcoesIt = opcoes.iterator();
1039 while(opcoesIt.hasNext()) {
1040 SisAtributoSatb sisAtributoSatb = (SisAtributoSatb)opcoesIt.next();
1041 if(sisAtributoSatb.getIndAtivoSatb().equals(Dominios.SIM)) {
1042 opcoesAtivos.add(sisAtributoSatb);
1043 }
1044 }
1045 options.setOptions(opcoesAtivos);
1046 options.setValor("codSatb");
1047 options.setLabel("descricaoSatb");
1048 options.setImagem(getContextPath() + "/images/relAcomp/");
1049 options.setParent(input);
1050 options.doStartTag();
1051 }
1052
1053 input.doEndTag();
1054
1055 }
1056
1057
1058
1059
1060
1061
1062
1063
1064 public void geraHTMLFuncaoAcompanhamento() {
1065 try {
1066
1067
1068 String codigo = "";
1069 boolean indAtivoUsu = true;
1070 if (codigo != null && !"".equals(codigo)){
1071 indAtivoUsu = usu.verificarUsuarioAtivo(Long.valueOf(codigo));
1072 }
1073
1074 criaPesquisa(codEstrutura + "_" + atributo.iGetNome(), indAtivoUsu, atributo.iGetLabel(),
1075 "ecar.pojo.UsuarioUsu", "50", atributo.iGetValorCodFk(getItemEstrutura()), atributo.iGetValor(getItemEstrutura()), "100", atributo.iGetDica());
1076 } catch (ECARException e) {
1077 Logger logger = Logger.getLogger(this.getClass());
1078 logger.error(e);
1079 }
1080 }
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091 public void geraHTMLIndMonitoramentoIett() {
1092 List opcoes = new ArrayList();
1093 opcoes.add(new String[] { "S", "Sim" });
1094 opcoes.add(new String[] { "N", "Não" });
1095 try {
1096 criaRadio(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), opcoes, atributo.iGetDica());
1097 } catch (ECARException e) {
1098 Logger logger = Logger.getLogger(this.getClass());
1099 logger.error(e);
1100 }
1101 }
1102
1103
1104
1105
1106
1107
1108
1109
1110 public void geraHTMLIndBloqPlanejamentoIett() {
1111 List opcoes = new ArrayList();
1112 opcoes.add(new String[] { "S", "Sim" });
1113 opcoes.add(new String[] { "N", "Não" });
1114 try {
1115 criaRadio(codEstrutura + "_" + atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstrutura()), opcoes, atributo.iGetDica());
1116 } catch (ECARException e) {
1117 Logger logger = Logger.getLogger(this.getClass());
1118 logger.error(e);
1119 }
1120 }
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137 public void criaPesquisa(String nome, boolean IndAtivoUsu, String label, String classePesquisa, String size, String valor, String valorText, String maxlength, String dica) {
1138 JspWriter writer = this.page.getOut();
1139 StringBuffer s = new StringBuffer();
1140
1141 try {
1142
1143 s.append("<TR><TD class=\"label\">");
1144
1145
1146 String imagem_inativa = "";
1147 if (! IndAtivoUsu){
1148 imagem_inativa="<img src=\"../../images/icon_usuario_inativo.png\" title=\"Usuário Inativo\">";
1149 }
1150
1151
1152 s.append(label);
1153
1154 s.append("</TD>")
1155 .append("<TD>")
1156 .append("<input type=\"text\" disabled name=\"nome")
1157 .append(nome)
1158 .append("\" size=\"")
1159 .append(size)
1160 .append("\" value=\"")
1161 .append(valorText)
1162 .append("\" maxlength=\"")
1163 .append(maxlength)
1164 .append("\"")
1165 .append(">")
1166 .append(imagem_inativa)
1167 .append("<input type=\"hidden\" name=\"")
1168 .append(nome)
1169 .append("\" value=\"")
1170 .append(valor)
1171 .append("\">");
1172
1173
1174 if(this.getExibirBotoes().booleanValue()){
1175 s.append(" <input type=\"button\" name=\"pesq\" value=\"Pesquisar\" class=\"botao\" ");
1176 if (getBloquearCampo())
1177 s.append(" disabled");
1178
1179 s.append(" onclick=\"popup_pesquisa('")
1180 .append(classePesquisa)
1181 .append("', 'retorno")
1182 .append(nome)
1183 .append("');\">")
1184 .append(" <input type=\"button\" name=\"pesq\" value=\"Limpar\" class=\"botao\" ")
1185 .append("onclick=\"document.form.alterou.value='S';document.form.nome")
1186 .append(nome)
1187 .append(".value=''; document.form.")
1188 .append(nome)
1189 .append(".value=''\"");
1190
1191 if (getBloquearCampo())
1192 s.append(" disabled");
1193
1194 s.append(">");
1195 }
1196
1197
1198
1199 if( dica != null && !"".equals(dica) )
1200 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1201
1202 s.append("</TD></TR>");
1203 writer.print(s.toString());
1204
1205 } catch (IOException e) {
1206 Logger logger = Logger.getLogger(this.getClass());
1207 logger.error(e);
1208 }
1209 }
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224 public void criaSelect(String nome, String label, String valor, Collection opcoes, String scripts, String dica) {
1225
1226 JspWriter writer = this.page.getOut();
1227 StringBuffer s = new StringBuffer();
1228
1229 try {
1230
1231 s.append("<TR><TD class=\"label\">");
1232
1233
1234 s.append(label);
1235
1236 s.append("</TD>");
1237 s.append("<TD>");
1238 s.append("<select name=\"").append(nome).append("\" ").append(scripts);
1239 if (getBloquearCampo())
1240 s.append(" disabled");
1241 s.append(">");
1242 s.append("<option value=\"\"></option>");
1243 if (opcoes != null) {
1244 Iterator it = opcoes.iterator();
1245 while (it.hasNext()) {
1246 String[] chaveValor = (String[]) it.next();
1247 s.append("<option value=\"").append(chaveValor[0]).append("\"");
1248 if (chaveValor[0].equals(valor))
1249 s.append(" selected ");
1250 s.append(">");
1251 s.append(chaveValor[1]);
1252 s.append("</option>");
1253 }
1254 }
1255 s.append("</select>");
1256 s.append("");
1257
1258
1259 if( dica != null && !"".equals(dica) )
1260 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1261
1262 s.append("</TD></TR>");
1263
1264 writer.print(s.toString());
1265 } catch (IOException e) {
1266 Logger logger = Logger.getLogger(this.getClass());
1267 logger.error(e);
1268 }
1269 }
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283 public void criaRadio(String nome, String label, String valor, Collection opcoes, String dica) {
1284 JspWriter writer = this.page.getOut();
1285 StringBuffer s = new StringBuffer();
1286 try {
1287 s.append("<TR><TD class=\"label\">");
1288 s.append(label);
1289 s.append("</TD>");
1290 s.append("<TD>");
1291 if (opcoes != null) {
1292 Iterator it = opcoes.iterator();
1293 while (it.hasNext()) {
1294 String[] chaveValor = (String[]) it.next();
1295 s.append("<input type=\"radio\" class=\"form_check_radio\" name=\"").append(nome)
1296 .append("\" value=\"").append(chaveValor[0]).append("\"");
1297
1298 if (getBloquearCampo())
1299 s.append(" disabled");
1300 if (chaveValor[0].equals(valor))
1301 s.append(" checked ");
1302 s.append(">");
1303 s.append(chaveValor[1]);
1304 }
1305 s.append(" <input type=\"button\" name=\"buttonLimpar\" value=\"Limpar\" class=\"botao\" ")
1306 .append("onclick=\"limparRadioButtons(document.getElementsByName('" + nome + "'));\"");
1307 s.append(">");
1308 }
1309
1310
1311
1312 if( dica != null && !"".equals(dica) )
1313 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1314
1315 s.append("</TD></TR>");
1316 writer.print(s.toString());
1317 } catch (IOException e) {
1318 Logger logger = Logger.getLogger(this.getClass());
1319 logger.error(e);
1320 }
1321 }
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333 public void criaInputButton(String label, String name, String onclick) {
1334 if(!this.getExibirBotoes().booleanValue())
1335 return;
1336
1337 JspWriter writer = this.page.getOut();
1338 StringBuffer s = new StringBuffer();
1339 try {
1340 s.append("<TR><TD> </TD><TD>");
1341 s.append("<input type=\"button\" ");
1342
1343
1344
1345
1346 if (getDesabilitar() != null && getDesabilitar()) {
1347 s.append(" disabled ");
1348 }
1349 s.append("value=\"").append(label).append("\" name=\"bt").append(name).append("\" onclick=\"")
1350 .append(onclick).append("\"").append("></TD></TR>");
1351 writer.print(s.toString());
1352 } catch (IOException e) {
1353 Logger logger = Logger.getLogger(this.getClass());
1354 logger.error(e);
1355 }
1356 }
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367 public void criaInputHidden(String nome,String valor) {
1368 JspWriter writer = this.page.getOut();
1369 StringBuffer s = new StringBuffer();
1370 try {
1371 s.append("<input type=\"hidden\" name=\"").append(nome).append("\" value=\"").append(valor).append("\">");
1372 writer.print(s.toString());
1373 } catch (IOException e) {
1374 Logger logger = Logger.getLogger(this.getClass());
1375 logger.error(e);
1376 }
1377 }
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392 public void criaInputText(String nome, String label, String size, String maxlength, String valor, String dica) {
1393 JspWriter writer = this.page.getOut();
1394 StringBuffer s = new StringBuffer();
1395
1396 try {
1397
1398
1399 if(atributo.iGetTamanhoConteudoAtrib() != null){
1400 maxlength = String.valueOf(atributo.iGetTamanhoConteudoAtrib().intValue());
1401 }
1402
1403
1404 s.append("<TR><TD class=\"label\">");
1405
1406
1407 s.append(label);
1408
1409 s.append("</TD>")
1410 .append("<TD nowrap>")
1411 .append("<input type=\"text\" name=\"")
1412 .append(nome)
1413 .append("\" size=\"")
1414 .append(size)
1415 .append("\" value=\"")
1416 .append(valor)
1417 .append("\" maxlength=\"")
1418 .append(maxlength)
1419 .append("\"");
1420
1421 if (getBloquearCampo())
1422 s.append(" disabled");
1423
1424 s.append(">");
1425
1426
1427
1428 if( dica != null && !"".equals(dica) )
1429 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1430
1431 s.append("</TD></TR>");
1432 writer.print(s.toString());
1433 } catch (IOException e) {
1434 Logger logger = Logger.getLogger(this.getClass());
1435 logger.error(e);
1436 }
1437 }
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452 public void criaLabelText(String nome, String label, String size, String maxlength, String valor, String dica) {
1453 JspWriter writer = this.page.getOut();
1454 StringBuffer s = new StringBuffer();
1455 try {
1456 s.append("<TR><TD class=\"label\">");
1457 s.append(label);
1458 s.append("</TD>")
1459 .append("<TD>")
1460 .append(valor );
1461
1462
1463
1464 if( dica != null && !"".equals(dica) )
1465 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1466
1467 s.append("</TD></TR>");
1468
1469 writer.print(s.toString());
1470 } catch (IOException e) {
1471 Logger logger = Logger.getLogger(this.getClass());
1472 logger.error(e);
1473 }
1474 }
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489 public void criaInputTextMoeda(String nome, String label, String size, String maxlength, String valor, String dica) {
1490 JspWriter writer = this.page.getOut();
1491 StringBuffer s = new StringBuffer();
1492 try {
1493 s.append("<TR><TD class=\"label\">");
1494 s.append(label);
1495 s.append("</TD>");
1496 s.append("<TD nowrap>");
1497
1498 s.append("<input type=\"text\" name=\"")
1499 .append(nome+"_Inicio")
1500 .append("\" size=\"")
1501 .append(size)
1502 .append("\" value=\"")
1503 .append(valor)
1504 .append("\" maxlength=\"")
1505 .append(maxlength)
1506 .append("\"");
1507 if (getBloquearCampo())
1508 s.append(" disabled");
1509
1510
1511 s.append("<!--/TD>");
1512 s.append("<TD class=\"label\" colspan=\"3\"-->");
1513 s.append(" a ");
1514 s.append("<!--/TD>")
1515 .append("<TD nowrap-->")
1516 .append("<input type=\"text\" name=\"")
1517 .append(nome+"_Fim")
1518 .append("\" size=\"11\" value=\"")
1519 .append(valor)
1520 .append("\" maxlength=\"10\"");
1521
1522 s.append(">");
1523
1524
1525
1526 if( dica != null && !"".equals(dica) )
1527 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1528
1529 s.append("</TD></TR>");
1530 writer.print(s.toString());
1531 } catch (IOException e) {
1532 Logger logger = Logger.getLogger(this.getClass());
1533 logger.error(e);
1534 }
1535 }
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548 public void criaInputTextData(String nome, String label, String valor, String dica) {
1549 JspWriter writer = this.page.getOut();
1550 StringBuffer s = new StringBuffer();
1551 try {
1552 s.append("<TR><TD class=\"label\">");
1553 s.append(label);
1554 s.append("</TD>")
1555 .append("<TD nowrap>")
1556 .append("<input type=\"text\" name=\"")
1557 .append(nome+"_Inicio")
1558 .append("\" size=\"11\" value=\"")
1559 .append(valor)
1560 .append("\" maxlength=\"10\" onkeyup=\"mascaraData(event, this);\"");
1561 if (getBloquearCampo())
1562 s.append(" disabled");
1563
1564 s.append(">");
1565
1566
1567 s.append("<!--/TD>");
1568 s.append("<TD class=\"label\" colspan=\"3\"-->");
1569 s.append(" a ");
1570 s.append("<!--/TD>")
1571 .append("<TD nowrap-->")
1572 .append("<input type=\"text\" name=\"")
1573 .append(nome+"_Fim")
1574 .append("\" size=\"11\" value=\"")
1575 .append(valor)
1576 .append("\" maxlength=\"10\" onkeyup=\"mascaraData(event, this);\"");
1577 if (getBloquearCampo())
1578 s.append(" disabled");
1579
1580 s.append(">");
1581 s.append("</TD>");
1582
1583
1584
1585 if( dica != null && !"".equals(dica) )
1586 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1587
1588 s.append("</TR>");
1589 writer.print(s.toString());
1590 } catch (IOException e) {
1591 Logger logger = Logger.getLogger(this.getClass());
1592 logger.error(e);
1593 }
1594 }
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609 public void criaTextArea(String nome, String label, String rows, String cols, String valor, String dica) {
1610 JspWriter writer = this.page.getOut();
1611 StringBuffer s = new StringBuffer();
1612
1613 try {
1614 s.append("<TR><TD class=\"label\">");
1615
1616 s.append(label)
1617 .append("</TD>");
1618
1619 s.append("<TD>")
1620 .append("<div style=\"float: left;\">")
1621 .append("<textarea name=\"")
1622 .append(nome)
1623 .append("\" rows=\"")
1624 .append(rows)
1625 .append("\" cols=\"")
1626 .append(cols);
1627
1628 String tam = "2000";
1629 if(atributo.iGetTamanhoConteudoAtrib() != null){
1630 tam = String.valueOf(atributo.iGetTamanhoConteudoAtrib().intValue());
1631 }
1632 s.append("\" onkeyup=\"return validaTamanhoLimite(this, " + tam + ");\"");
1633 if (getBloquearCampo()) {
1634 s.append(" style=\"background-color:#FFF;color:#999999;\" readonly=\"readonly\"");
1635 }
1636 s.append(">")
1637 .append(valor)
1638 .append("</textarea>")
1639 .append("</div><div style=\"float: left;\"><br><br>");
1640
1641
1642
1643 if( dica != null && !"".equals(dica) )
1644 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1645
1646 s.append("</div>")
1647 .append("</TD></TR>");
1648
1649 writer.print(s.toString());
1650 } catch (IOException e) {
1651 Logger logger = Logger.getLogger(this.getClass());
1652 logger.error(e);
1653 }
1654 }
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664 public void criaJScriptArea(List areas) {
1665 JspWriter writer = this.page.getOut();
1666 StringBuffer s = new StringBuffer();
1667 AreaAre area;
1668 SubAreaSare subArea;
1669 List lSubAreas = new ArrayList(0);
1670 try {
1671 s.append("\n<script language=\"javascript\">\n");
1672 s.append("aSubArea = new Array(").append(areas.size()).append(1).append(");\n");
1673
1674 s.append("for (var i = 0; i < aSubArea.length; ++i) { \n");
1675 s.append(" aSubArea[i] = new Array();\n");
1676 s.append("}\n");
1677 s.append("aSubArea[0][0] = new Option('Selecione uma Área','');\n");
1678
1679 for (int i = 0; i < areas.size(); i++) {
1680 area = (AreaAre) areas.get(i);
1681 s.append("aSubArea[").append(i+1).append("][0] = new Option('');\n");
1682 lSubAreas.clear();
1683
1684 int indiceSubArea = 1;
1685 for (int j = 0; j < lSubAreas.size(); j++) {
1686 subArea = (SubAreaSare) lSubAreas.get(j);
1687 if ("S".equals(subArea.getIndAtivoSare()))
1688 s.append("aSubArea[").append(i+1).append("][").append(indiceSubArea++)
1689 .append("] = new Option('").append(subArea.getNomeSare()).append("','")
1690 .append(subArea.getCodSare().toString()).append("');\n");
1691 }
1692 }
1693 s.append("</script>\n");
1694 writer.print(s.toString());
1695 } catch (IOException e) {
1696 Logger logger = Logger.getLogger(this.getClass());
1697 logger.error(e);
1698 }
1699 }
1700
1701
1702
1703
1704
1705
1706
1707 public void criaDiv(String nome, String label, String dica){
1708 JspWriter writer = this.page.getOut();
1709 StringBuffer s = new StringBuffer();
1710
1711 try {
1712 s.append("<TR><TD class=\"label\">");
1713 s.append(label)
1714 .append("</TD>");
1715
1716 s.append("<TD>")
1717 .append("<div id=\"")
1718 .append(nome)
1719 .append("\" style=\"float: left;\"></div>")
1720 .append("<div style=\"float: left;\">");
1721
1722
1723
1724 if( dica != null && !"".equals(dica) )
1725 s.append(Util.getTagDica(nome, this.getContextPath(), dica));
1726
1727 s.append("</div>")
1728 .append("</TD></TR>");
1729
1730 writer.print(s.toString());
1731 } catch (IOException e) {
1732 Logger logger = Logger.getLogger(this.getClass());
1733 logger.error(e);
1734 }
1735 }
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746 public int doEndTag() throws JspException {
1747 return Tag.EVAL_PAGE;
1748 }
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758 public void setPageContext(PageContext arg0) {
1759 this.page = arg0;
1760 }
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770 public void setParent(Tag arg0) {
1771 }
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781 public Tag getParent() {
1782 return null;
1783 }
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793 public PageContext getPage() {
1794 return page;
1795 }
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805 public void setPage(PageContext page) {
1806 this.page = page;
1807 }
1808
1809
1810
1811
1812
1813
1814
1815
1816 public void release() {
1817
1818 }
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829 public ObjetoEstrutura getAtributo() {
1830 return atributo;
1831 }
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841 public void setAtributo(ObjetoEstrutura atributo) {
1842 this.atributo = atributo;
1843 }
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853 public Boolean getDesabilitar() {
1854 return desabilitar;
1855 }
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865 public void setDesabilitar(Boolean desabilitar) {
1866 this.desabilitar = desabilitar;
1867 }
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877 public ItemEstruturaIett getItemEstrutura() {
1878 return itemEstrutura;
1879 }
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889 public void setItemEstrutura(ItemEstruturaIett itemEstrutura) {
1890 this.itemEstrutura = itemEstrutura;
1891 }
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901 public SegurancaECAR getSeguranca() {
1902 return seguranca;
1903 }
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913 public void setSeguranca(SegurancaECAR seguranca) {
1914 this.seguranca = seguranca;
1915 }
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925 public Boolean getExibirBotoes() {
1926 return exibirBotoes;
1927 }
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937 public void setExibirBotoes(Boolean exibirBotoes) {
1938 this.exibirBotoes = exibirBotoes;
1939 }
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949 public String getContextPath() {
1950 return contextPath;
1951 }
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961 public void setContextPath(String contextPath) {
1962 this.contextPath = contextPath;
1963 }
1964
1965
1966
1967
1968
1969
1970
1971
1972 public Boolean getBloquearCampo() {
1973
1974 if (getDesabilitar() != null && getDesabilitar()) {
1975 return true;
1976 }
1977
1978 if(getItemEstrutura().getIndBloqPlanejamentoIett() != null &&
1979 "S".equals(getItemEstrutura().getIndBloqPlanejamentoIett())) {
1980
1981
1982 if (atributo.iGetBloqueado()) {
1983 return true;
1984 }
1985 }
1986
1987 return false;
1988
1989 }
1990
1991 public String getCodEstrutura() {
1992 return codEstrutura;
1993 }
1994
1995 public void setCodEstrutura(String codEstrutura) {
1996 this.codEstrutura = codEstrutura;
1997 }
1998
1999 public EstruturaEtt getEstrutura() {
2000 return estrutura;
2001 }
2002
2003 public void setEstrutura(EstruturaEtt estrutura) {
2004 this.estrutura = estrutura;
2005 }
2006
2007 }