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.SituacaoDao;
25 import ecar.exception.ECARException;
26 import ecar.login.SegurancaECAR;
27 import ecar.permissao.ValidaPermissao;
28 import ecar.pojo.AreaAre;
29 import ecar.pojo.EstruturaAtributoEttat;
30 import ecar.pojo.ItemEstruturarevisaoIettrev;
31 import ecar.pojo.ObjetoEstrutura;
32 import ecar.pojo.OrgaoOrg;
33 import ecar.pojo.PeriodicidadePrdc;
34 import ecar.pojo.SituacaoSit;
35 import ecar.pojo.SubAreaSare;
36 import ecar.pojo.UnidadeOrcamentariaUO;
37
38
39
40
41
42
43 public class FormItemEstruturaRevisaoTag implements Tag {
44
45 ValidaPermissao validaPermissao = new ValidaPermissao();
46 private ObjetoEstrutura atributo;
47 private ItemEstruturarevisaoIettrev itemEstruturaRevisao;
48 private Boolean desabilitar;
49 private SegurancaECAR seguranca;
50 private Boolean exibirBotoes = new Boolean(true);
51
52
53 private PageContext page = null;
54
55
56
57
58
59
60
61
62
63
64 public int doStartTag() throws JspException {
65 try {
66 if (atributo.iGetTipo() == EstruturaAtributoEttat.class)
67 {
68 this.getClass().getMethod("geraHTML" + Util.primeiraLetraToUpperCase(atributo.iGetNome()), null).invoke(this, null);
69 }
70 else
71 geraHTMLPesquisaFuncaoAcompanhamento();
72 } catch (Exception e) {
73 Logger logger = Logger.getLogger(this.getClass());
74 logger.error(e);
75 }
76 return Tag.EVAL_BODY_INCLUDE;
77 }
78
79
80
81
82
83
84
85
86 public void geraHTMLPesquisaFuncaoAcompanhamento() {
87 try {
88 String codigo = "";
89 String valor = "";
90 if(getItemEstruturaRevisao().getCodIettrev() != null){
91 codigo = atributo.iGetValorCodFk(getItemEstruturaRevisao());
92 valor = atributo.iGetValor(getItemEstruturaRevisao());
93 }
94 criaPesquisa(atributo.iGetNome(),
95 atributo.iGetLabel(),
96 "ecar.popup.PopUpUsuario",
97 "50",
98 codigo,
99 valor,
100 "100");
101 } catch (ECARException e) {
102 Logger logger = Logger.getLogger(this.getClass());
103 logger.error(e);
104 }
105 }
106
107
108
109
110 public void geraHTMLNomeIett() {
111 try {
112 criaInputText("nomeIett", atributo.iGetLabel(), "50", "200", atributo.iGetValor(getItemEstruturaRevisao()));
113 } catch (ECARException e) {
114 Logger logger = Logger.getLogger(this.getClass());
115 logger.error(e);
116 }
117 }
118
119
120
121
122
123
124
125
126 public void geraHTMLSiglaIett() {
127 try {
128 criaInputText("siglaIett", atributo.iGetLabel(), "12", "10", atributo.iGetValor(getItemEstruturaRevisao()));
129 } catch (ECARException e) {
130 Logger logger = Logger.getLogger(this.getClass());
131 logger.error(e);
132 }
133 }
134
135
136
137
138
139
140
141
142 public void geraHTMLDescricaoIett() {
143 try {
144 criaTextArea("descricaoIett", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
145 } catch (ECARException e) {
146 Logger logger = Logger.getLogger(this.getClass());
147 logger.error(e);
148 }
149 }
150
151
152
153
154
155
156
157
158 public void geraHTMLJustificativaIett() {
159 criaTextArea("justificativaIett", "Justificativa", "4", "60", getItemEstruturaRevisao().getJustificativaIettrev().toString());
160 }
161
162
163
164
165
166
167
168
169
170 public void geraHTMLOrigemIett() {
171 try {
172 criaTextArea("origemIett", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
173 } catch (ECARException e) {
174 Logger logger = Logger.getLogger(this.getClass());
175 logger.error(e);
176 }
177 }
178
179
180
181
182
183
184
185
186 public void geraHTMLObjetivoGeralIett() {
187 try {
188 criaTextArea("objetivoGeralIett", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
189 } catch (ECARException e) {
190 Logger logger = Logger.getLogger(this.getClass());
191 logger.error(e);
192 }
193 }
194
195
196
197
198
199
200
201
202
203 public void geraHTMLObjetivoEspecificoIett() {
204 try {
205 criaTextArea("objetivoEspecificoIett", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
206 } catch (ECARException e) {
207 Logger logger = Logger.getLogger(this.getClass());
208 logger.error(e);
209 }
210 }
211
212
213
214
215
216
217
218
219 public void geraHTMLBeneficiosIett() {
220 try {
221 criaTextArea("beneficiosIett", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
222 } catch (ECARException e) {
223 Logger logger = Logger.getLogger(this.getClass());
224 logger.error(e);
225 }
226 }
227
228
229
230
231
232
233
234
235 public void geraHTMLDataInicioIett() {
236 try {
237 criaInputTextData("dataInicioIett", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
238 } catch (ECARException e) {
239 Logger logger = Logger.getLogger(this.getClass());
240 logger.error(e);
241 }
242 }
243
244
245
246
247
248
249
250
251 public void geraHTMLDataTerminoIett() {
252 try {
253 criaInputTextData("dataTerminoIett", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
254 } catch (ECARException e) {
255 Logger logger = Logger.getLogger(this.getClass());
256 logger.error(e);
257 }
258 }
259
260
261
262
263
264
265
266
267 public void geraHTMLIndCriticaIett() {
268 List opcoes = new ArrayList();
269 opcoes.add(new String[] { "S", "Sim" });
270 opcoes.add(new String[] { "N", "Não" });
271 try {
272 criaRadio(atributo.iGetNome(), atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()), opcoes);
273 } catch (ECARException e) {
274 Logger logger = Logger.getLogger(this.getClass());
275 logger.error(e);
276 }
277 }
278
279
280
281
282
283
284
285
286 public void geraHTMLValPrevistoFuturoIett() {
287 String valor = "";
288 try {
289 if(!"".equals(atributo.iGetValor(getItemEstruturaRevisao())))
290 valor = Pagina.trocaNullNumeroDecimalSemMilhar(Double.valueOf(atributo.iGetValor(getItemEstruturaRevisao())));
291
292 criaInputTextMoeda("valPrevistoFuturoIett", atributo.iGetLabel(), "12", "30", valor);
293 } catch (ECARException e) {
294 Logger logger = Logger.getLogger(this.getClass());
295 logger.error(e);
296 }
297 }
298
299
300
301
302
303
304
305
306 public void geraHTMLDataInicioMonitoramentoIett() {
307 }
308
309
310
311
312
313
314
315
316 public void geraHTMLDataInclusaoIett() {
317 try{
318 if (atributo.iGetObrigatorio() != null && atributo.iGetObrigatorio().booleanValue() == true){
319 criaLabelText(atributo.iGetNome(), atributo.iGetLabel(), "15", "15", atributo.iGetValor(getItemEstruturaRevisao()));
320 }
321 }
322 catch (ECARException e) {
323 Logger logger = Logger.getLogger(this.getClass());
324 logger.error(e);
325 }
326 }
327
328
329
330
331
332
333
334
335 public void geraHTMLUsuarioUsuByCodUsuIncIett() {
336 try{
337 if (atributo.iGetObrigatorio() != null && atributo.iGetObrigatorio().booleanValue() == true){
338 criaLabelText(atributo.iGetNome(), atributo.iGetLabel(), "50", "50", atributo.iGetValor(getItemEstruturaRevisao()));
339 }
340 }
341 catch (ECARException e) {
342 Logger logger = Logger.getLogger(this.getClass());
343 logger.error(e);
344 }
345 }
346
347
348
349
350
351
352
353
354 public void geraHTMLDataUltManutencaoIett() {
355
356
357
358
359
360
361
362
363
364 }
365
366
367
368
369
370
371 public void geraHTMLUsuarioUsuByCodUsuUltManutIett() {
372
373
374
375
376
377
378
379
380
381 }
382
383
384
385
386
387
388 public void geraHTMLIndAtivoIett() {
389 }
390
391
392
393
394
395
396
397
398 public void geraHTMLDataR1() {
399 try {
400 criaInputTextData("dataR1", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
401 } catch (ECARException e) {
402 Logger logger = Logger.getLogger(this.getClass());
403 logger.error(e);
404 }
405 }
406
407
408
409
410
411
412
413 public void geraHTMLDataR2() {
414 try {
415 criaInputTextData("dataR2", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
416 } catch (ECARException e) {
417 Logger logger = Logger.getLogger(this.getClass());
418 logger.error(e);
419 }
420 }
421
422
423
424
425
426
427
428
429 public void geraHTMLDataR3() {
430 try {
431 criaInputTextData("dataR3", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
432 } catch (ECARException e) {
433 Logger logger = Logger.getLogger(this.getClass());
434 logger.error(e);
435 }
436 }
437
438
439
440
441
442
443
444
445 public void geraHTMLDataR4() {
446 try {
447 criaInputTextData("dataR4", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
448 } catch (ECARException e) {
449 Logger logger = Logger.getLogger(this.getClass());
450 logger.error(e);
451 }
452 }
453
454
455
456
457
458
459
460
461 public void geraHTMLDataR5() {
462 try {
463 criaInputTextData("dataR5", atributo.iGetLabel(), atributo.iGetValor(getItemEstruturaRevisao()));
464 } catch (ECARException e) {
465 Logger logger = Logger.getLogger(this.getClass());
466 logger.error(e);
467 }
468 }
469
470
471
472
473
474
475
476
477 public void geraHTMLDescricaoR1() {
478 try {
479 criaTextArea("descricaoR1", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
480 } catch (ECARException e) {
481 Logger logger = Logger.getLogger(this.getClass());
482 logger.error(e);
483 }
484 }
485
486
487
488
489
490
491
492
493 public void geraHTMLDescricaoR2() {
494 try {
495 criaTextArea("descricaoR2", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
496 } catch (ECARException e) {
497 Logger logger = Logger.getLogger(this.getClass());
498 logger.error(e);
499 }
500 }
501
502
503
504
505
506
507
508
509 public void geraHTMLDescricaoR3() {
510 try {
511 criaTextArea("descricaoR3", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
512 } catch (ECARException e) {
513 Logger logger = Logger.getLogger(this.getClass());
514 logger.error(e);
515 }
516 }
517
518
519
520
521
522
523
524
525 public void geraHTMLDescricaoR4() {
526 try {
527 criaTextArea("descricaoR4", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
528 } catch (ECARException e) {
529 Logger logger = Logger.getLogger(this.getClass());
530 logger.error(e);
531 }
532 }
533
534
535
536
537
538
539
540
541 public void geraHTMLDescricaoR5() {
542 try {
543 criaTextArea("descricaoR5", atributo.iGetLabel(), "4", "60", atributo.iGetValor(getItemEstruturaRevisao()));
544 } catch (ECARException e) {
545 Logger logger = Logger.getLogger(this.getClass());
546 logger.error(e);
547 }
548 }
549
550
551
552
553
554
555
556
557 public void geraHTMLAreaAre() {
558 AreaAre area = new AreaAre();
559 area.setIndAtivoAre("S");
560 try {
561 List areas = new Dao().pesquisar(area, new String[] { atributo.iGetNomeFk(), "asc" });
562 List options = new ArrayList();
563 Iterator it = areas.iterator();
564 while (it.hasNext()) {
565 area = (AreaAre) it.next();
566 options.add(new String[] { area.getCodAre().toString(), Util.invocaGet(area, atributo.iGetNomeFk()).toString() });
567 }
568
569
570 criaSelect("areaAre", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
571
572
573 } catch (ECARException e) {
574 Logger logger = Logger.getLogger(this.getClass());
575 logger.error(e);
576 }
577 }
578
579
580
581
582
583
584
585
586 public void geraHTMLSubAreaSare() {
587 SubAreaSare sArea = new SubAreaSare();
588 sArea.setIndAtivoSare("S");
589 try {
590 List sAreas = new Dao().pesquisar(sArea, new String[] { atributo.iGetNomeFk(), "asc" });
591 List options = new ArrayList();
592 Iterator it = sAreas.iterator();
593 while (it.hasNext()) {
594 sArea = (SubAreaSare) it.next();
595 options.add(new String[] { sArea.getCodSare().toString(), Util.invocaGet(sArea, atributo.iGetNomeFk()).toString() });
596 }
597 criaSelect("subAreaSare", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
598 } catch (ECARException e) {
599 Logger logger = Logger.getLogger(this.getClass());
600 logger.error(e);
601 }
602 }
603
604
605
606
607
608
609
610
611 public void geraHTMLUnidadeOrcamentariaUO() {
612 UnidadeOrcamentariaUO unidade = new UnidadeOrcamentariaUO();
613 unidade.setIndAtivoUo("S");
614 try {
615 List unidades = new Dao().pesquisar(unidade, new String[] { atributo.iGetNomeFk(), "asc" });
616 List options = new ArrayList();
617 Iterator it = unidades.iterator();
618 while (it.hasNext()) {
619 unidade = (UnidadeOrcamentariaUO) it.next();
620 options.add(new String[] { unidade.getCodUo().toString(), Util.invocaGet(unidade, atributo.iGetNomeFk()).toString() });
621 }
622
623 criaSelect("unidadeOrcamentariaUo", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
624 } catch (ECARException e) {
625 Logger logger = Logger.getLogger(this.getClass());
626 logger.error(e);
627 }
628 }
629
630
631
632
633
634
635
636
637 public void geraHTMLOrgaoOrgByCodOrgaoResponsavel1Iett() {
638 OrgaoOrg orgao = new OrgaoOrg();
639 orgao.setIndAtivoOrg("S");
640 try {
641 List orgaos = new Dao().pesquisar(orgao, new String[] {
642 atributo.iGetNomeFk(), "asc" });
643 List options = new ArrayList();
644 Iterator it = orgaos.iterator();
645 while (it.hasNext()) {
646 orgao = (OrgaoOrg) it.next();
647 options.add(new String[] { orgao.getCodOrg().toString(), Util.invocaGet(orgao, atributo.iGetNomeFk()).toString() });
648 }
649 criaSelect("orgaoOrgByCodOrgaoResponsavel1Iett", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
650 } catch (ECARException e) {
651 Logger logger = Logger.getLogger(this.getClass());
652 logger.error(e);
653 }
654 }
655
656
657
658
659
660
661
662 public void geraHTMLOrgaoOrgByCodOrgaoResponsavel2Iett() {
663 OrgaoOrg orgao = new OrgaoOrg();
664 orgao.setIndAtivoOrg("S");
665 try {
666 List orgaos = new Dao().pesquisar(orgao, new String[] {atributo.iGetNomeFk(), "asc" });
667 List options = new ArrayList();
668 Iterator it = orgaos.iterator();
669 while (it.hasNext()) {
670 orgao = (OrgaoOrg) it.next();
671 options.add(new String[] { orgao.getCodOrg().toString(), Util.invocaGet(orgao, atributo.iGetNomeFk()).toString() });
672 }
673 criaSelect("orgaoOrgByCodOrgaoResponsavel2Iett", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
674 } catch (ECARException e) {
675 Logger logger = Logger.getLogger(this.getClass());
676 logger.error(e);
677 }
678 }
679
680
681
682
683
684
685
686
687 public void geraHTMLPeriodicidadePrdc() {
688 PeriodicidadePrdc prd = new PeriodicidadePrdc();
689 try {
690 List periodicidades = new Dao().pesquisar(prd, new String[] {atributo.iGetNomeFk(), "asc" });
691 List options = new ArrayList();
692 Iterator it = periodicidades.iterator();
693 while (it.hasNext()) {
694 prd = (PeriodicidadePrdc) it.next();
695 options.add(new String[] { prd.getCodPrdc().toString(), Util.invocaGet(prd, atributo.iGetNomeFk()).toString() });
696 }
697 criaSelect("periodicidadePrdc", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
698 } catch (ECARException e) {
699 Logger logger = Logger.getLogger(this.getClass());
700 logger.error(e);
701 }
702 }
703
704
705
706
707
708
709
710
711 public void geraHTMLSituacaoSit() {
712 SituacaoSit situacao = new SituacaoSit();
713 try {
714 List situacoes = new SituacaoDao(null).getSituacaoByEstrutura(itemEstruturaRevisao.getItemEstruturaIettrev().getEstruturaEtt(), new String[] {"descricaoSit","asc"});
715
716 List options = new ArrayList();
717 Iterator it = situacoes.iterator();
718 while(it.hasNext()){
719 situacao = (SituacaoSit) it.next();
720 options.add(new String[] {situacao.getCodSit().toString(), Util.invocaGet(situacao, atributo.iGetNomeFk()).toString() });
721 }
722 criaSelect("situacaoSit", atributo.iGetLabel(), atributo.iGetValorCodFk(getItemEstruturaRevisao()), options, "");
723 } catch (ECARException e) {
724 Logger logger = Logger.getLogger(this.getClass());
725 logger.error(e);
726 }
727 }
728
729
730
731
732
733
734
735
736 public void geraHTMLFuncaoAcompanhamento() {
737 try {
738 criaPesquisa(atributo.iGetNome(), atributo.iGetLabel(),
739 "ecar.pojo.UsuarioUsu", "50", atributo.iGetValorCodFk(getItemEstruturaRevisao()), atributo.iGetValor(getItemEstruturaRevisao()), "100");
740 } catch (ECARException e) {
741 Logger logger = Logger.getLogger(this.getClass());
742 logger.error(e);
743 }
744 }
745
746
747
748
749
750
751
752
753
754
755 public void geraHTMLIndMonitoramentoIett() {
756 String labelAtual = "Ativar ";
757 try {
758
759 boolean temPermissao = validaPermissao.permissaoAtivarMonitoramentoItem(getItemEstruturaRevisao().getItemEstruturaIettrev(), seguranca.getUsuario(), seguranca.getGruposAcesso());
760
761 if("S".equals(atributo.iGetValor(getItemEstruturaRevisao()))){
762 temPermissao = validaPermissao.permissaoDesativarMonitoramentoItem(getItemEstruturaRevisao().getItemEstruturaIettrev(), seguranca.getUsuario(), seguranca.getGruposAcesso());
763 labelAtual = "Retirar ";
764 }
765 if("N".equals(atributo.iGetValor(getItemEstruturaRevisao()))){
766 temPermissao = validaPermissao.permissaoAtivarMonitoramentoItem(getItemEstruturaRevisao().getItemEstruturaIettrev(), seguranca.getUsuario(), seguranca.getGruposAcesso());
767 labelAtual = "Ativar ";
768 }
769 if("".equals(atributo.iGetValor(getItemEstruturaRevisao()))){
770 temPermissao = validaPermissao.permissaoAtivarMonitoramentoItem(getItemEstruturaRevisao().getItemEstruturaIettrev(), seguranca.getUsuario(), seguranca.getGruposAcesso());
771 labelAtual = "Ativar ";
772 getItemEstruturaRevisao().setIndMonitoramentoIettrev("N");
773 }
774
775
776 if(temPermissao){
777 setDesabilitar(Boolean.FALSE);
778 }
779 else{
780 setDesabilitar(Boolean.TRUE);
781 }
782
783 StringBuffer auxScriptValueHidden = new StringBuffer("document.form.").append(atributo.iGetNome()).append(".value");
784 StringBuffer auxScriptValueHidden1 = new StringBuffer("'N'");
785 StringBuffer auxScriptValueHidden2 = new StringBuffer("'S'");
786 StringBuffer script = new StringBuffer(" if(")
787 .append(auxScriptValueHidden)
788 .append("==")
789 .append(auxScriptValueHidden2)
790 .append(") {")
791 .append(auxScriptValueHidden)
792 .append("=")
793 .append(auxScriptValueHidden1)
794 .append(";")
795 .append("aoClicarMonitoramento(document.form);this.disabled=true;")
796 .append("} ")
797 .append("else { if(")
798 .append(auxScriptValueHidden)
799 .append("==")
800 .append(auxScriptValueHidden1)
801 .append(") {")
802 .append(auxScriptValueHidden)
803 .append("=")
804 .append(auxScriptValueHidden2)
805 .append(";aoClicarMonitoramento(document.form);this.disabled=true;")
806 .append("} }");
807 criaInputButton(labelAtual + atributo.iGetLabel(), atributo.iGetNome() , script.toString());
808 criaInputHidden(atributo.iGetNome(), atributo.iGetValor(getItemEstruturaRevisao()));
809
810 } catch (ECARException e) {
811 Logger logger = Logger.getLogger(this.getClass());
812 logger.error(e);
813 }
814 }
815
816
817
818
819
820
821
822
823 public void geraHTMLIndBloqPlanejamentoIett() {
824 String labelAtual = "Bloquear ";
825
826 boolean temPermissao = validaPermissao.permissaoBloquearPlanejamentoItem(getItemEstruturaRevisao().getItemEstruturaIettrev(), seguranca.getUsuario(), seguranca.getGruposAcesso());
827
828 try {
829 if("S".equals(atributo.iGetValor(getItemEstruturaRevisao()))){
830 temPermissao = validaPermissao.permissaoLiberarPlanejamentoItem(getItemEstruturaRevisao().getItemEstruturaIettrev(), seguranca.getUsuario(), seguranca.getGruposAcesso());
831 labelAtual = "Liberar ";
832 }if("N".equals(atributo.iGetValor(getItemEstruturaRevisao())))
833 labelAtual = "Bloquear ";
834 if("".equals(atributo.iGetValor(getItemEstruturaRevisao()))){
835 labelAtual = "Bloquear ";
836 getItemEstruturaRevisao().setIndBloqPlanejamentoIettrev("N");
837 }
838
839
840 if(temPermissao){
841 setDesabilitar(Boolean.FALSE);
842 }
843 else{
844 setDesabilitar(Boolean.TRUE);
845 }
846
847 String auxScriptValueBtn = "document.form.bt" + atributo.iGetNome() + ".value";
848 String auxScriptValueHidden = "document.form." + atributo.iGetNome() + ".value";
849 String auxScriptValueHidden1 = "'N'";
850 String auxScriptValueHidden2 = "'S'";
851
852 String script = " if(" + auxScriptValueHidden + "==" + auxScriptValueHidden2 + ") {" +
853 auxScriptValueHidden + "=" + auxScriptValueHidden1 + ";aoClicarPlanejamento(document.form);this.disabled=true;} " +
854 "else { if(" + auxScriptValueHidden + "==" + auxScriptValueHidden1 + ") {" +
855 auxScriptValueHidden + "=" + auxScriptValueHidden2 + ";aoClicarPlanejamento(document.form);this.disabled=true;} }";
856
857 criaInputButton(labelAtual + atributo.iGetLabel(), atributo.iGetNome() , script);
858
859 criaInputHidden(atributo.iGetNome(), atributo.iGetValor(getItemEstruturaRevisao()));
860
861 } catch (ECARException e) {
862 Logger logger = Logger.getLogger(this.getClass());
863 logger.error(e);
864 }
865 }
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882 public void criaPesquisa(String nome, String label, String classePesquisa,
883 String size, String valor, String valorText, String maxlength) {
884 JspWriter writer = this.page.getOut();
885 StringBuffer s = new StringBuffer();
886 try {
887 s.append("<TR><TD class=\"label\">");
888 s.append(label);
889 s.append("</TD>");
890 s.append("<TD>");
891 s.append("<input type=\"text\" disabled name=\"nome" + nome +"rev"
892 + "\" size=\"" + size + "\" value=\"" + valorText
893 + "\" maxlength=\"" + maxlength + "\"");
894 s.append("><input type=\"hidden\" name=\"" + nome +"rev"+ "\" value=\""
895 + valor + "\">");
896
897 if(this.getExibirBotoes().booleanValue()){
898 s.append(" <input type=\"button\" name=\"pesq\" value=\"Pesquisar\" class=\"botao\" ");
899 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
900 s.append(" disabled");
901
902 s.append(" onclick=\"popup_pesquisa('" + classePesquisa
903 + "', 'retorno" + nome + "rev" + "');\">");
904 s.append(" <input type=\"button\" name=\"pesq\" value=\"Limpar\" class=\"botao\" " +
905 "onclick=\"document.form.nome" + nome +".value=''; document.form." + nome + ".value=''\"");
906
907 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
908 s.append(" disabled");
909
910 s.append(">");
911 }
912
913 s.append("</TD></TR>");
914 writer.print(s.toString());
915 } catch (IOException e) {
916 Logger logger = Logger.getLogger(this.getClass());
917 logger.error(e);
918 }
919 }
920
921
922
923
924
925
926
927
928
929
930
931
932
933 public void criaSelect(String nome, String label, String valor, Collection opcoes, String scripts) {
934 JspWriter writer = this.page.getOut();
935 StringBuffer s = new StringBuffer();
936 try {
937 s.append("<TR><TD class=\"label\">");
938 s.append(label);
939 s.append("</TD>");
940 s.append("<TD>");
941 s.append("<select name=\"" + nome + "rev" + "\" " + scripts);
942 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
943 s.append(" disabled");
944 s.append(">");
945 s.append("<option value=\"\"></option>");
946 if (opcoes != null) {
947 Iterator it = opcoes.iterator();
948 while (it.hasNext()) {
949 String[] chaveValor = (String[]) it.next();
950 s.append("<option value=\"" + chaveValor[0] + "\"");
951 if (chaveValor[0].equals(valor))
952 s.append(" selected ");
953 s.append(">");
954 s.append(chaveValor[1]);
955 s.append("</option>");
956 }
957 }
958 s.append("</select></TD></TR>");
959 writer.print(s.toString());
960 } catch (IOException e) {
961 Logger logger = Logger.getLogger(this.getClass());
962 logger.error(e);
963 }
964 }
965
966
967
968
969
970
971
972
973
974
975
976
977 public void criaRadio(String nome, String label, String valor,
978 Collection opcoes) {
979 JspWriter writer = this.page.getOut();
980 StringBuffer s = new StringBuffer();
981 try {
982 s.append("<TR><TD class=\"label\">");
983 s.append(label);
984 s.append("</TD>");
985 s.append("<TD>");
986 if (opcoes != null) {
987 Iterator it = opcoes.iterator();
988 while (it.hasNext()) {
989 String[] chaveValor = (String[]) it.next();
990 s.append("<input type=\"radio\" class=\"form_check_radio\" name=\"" + nome + "rev"
991 + "\" value=\"" + chaveValor[0] + "\"");
992 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
993 s.append(" disabled");
994 if (chaveValor[0].equals(valor))
995 s.append(" checked ");
996 s.append(">");
997 s.append(chaveValor[1]);
998 }
999 s.append(" <input type=\"button\" name=\"buttonLimpar\" value=\"Limpar\" class=\"botao\" ")
1000 .append("onclick=\"limparRadioButtons(document.getElementsByName('" + nome + "'));\"");
1001 s.append(">");
1002 }
1003 s.append("</TD></TR>");
1004 writer.print(s.toString());
1005 } catch (IOException e) {
1006 Logger logger = Logger.getLogger(this.getClass());
1007 logger.error(e);
1008 }
1009 }
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021 public void criaInputButton(String label, String name, String onclick){
1022 if(!this.getExibirBotoes().booleanValue())
1023 return;
1024
1025 JspWriter writer = this.page.getOut();
1026 StringBuffer s = new StringBuffer();
1027 try {
1028 s.append("<TR><TD> </TD><TD>");
1029 s.append("<input type=\"button\" ");
1030 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
1031 s.append(" disabled ");
1032 s.append("value=\"" + label + "\" name=\"bt" + name + "rev"+ "\" onclick=\"" + onclick + "\"");
1033 s.append("></TD></TR>");
1034 writer.print(s.toString());
1035 } catch (IOException e) {
1036 Logger logger = Logger.getLogger(this.getClass());
1037 logger.error(e);
1038 }
1039 }
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050 public void criaInputHidden(String nome,String valor) {
1051 JspWriter writer = this.page.getOut();
1052 StringBuffer s = new StringBuffer();
1053 try {
1054 s.append("<input type=\"hidden\" name=\"" + nome + "rev" + "\" value=\"" + valor + "\"");
1055 writer.print(s.toString());
1056 } catch (IOException e) {
1057 Logger logger = Logger.getLogger(this.getClass());
1058 logger.error(e);
1059 }
1060 }
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074 public void criaInputText(String nome, String label, String size,
1075 String maxlength, String valor) {
1076 JspWriter writer = this.page.getOut();
1077 StringBuffer s = new StringBuffer();
1078 try {
1079 s.append("<TR><TD class=\"label\">");
1080 s.append(label);
1081 s.append("</TD>");
1082 s.append("<TD>");
1083 s.append("<input type=\"text\" name=\"" + nome + "rev" + "\" size=\""
1084 + size + "\" value=\"" + valor + "\" maxlength=\""
1085 + maxlength + "\"");
1086 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
1087 s.append(" disabled");
1088 s.append("></TD></TR>");
1089 writer.print(s.toString());
1090 } catch (IOException e) {
1091 Logger logger = Logger.getLogger(this.getClass());
1092 logger.error(e);
1093 }
1094 }
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108 public void criaLabelText(String nome, String label, String size,
1109 String maxlength, String valor) {
1110 JspWriter writer = this.page.getOut();
1111 StringBuffer s = new StringBuffer();
1112 try {
1113 s.append("<TR><TD class=\"label\">");
1114 s.append(label);
1115 s.append("</TD>");
1116 s.append("<TD>");
1117 s.append(valor + "</TD></TR>");
1118 writer.print(s.toString());
1119 } catch (IOException e) {
1120 Logger logger = Logger.getLogger(this.getClass());
1121 logger.error(e);
1122 }
1123 }
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137 public void criaInputTextMoeda(String nome, String label, String size,
1138 String maxlength, String valor) {
1139 JspWriter writer = this.page.getOut();
1140 StringBuffer s = new StringBuffer();
1141 try {
1142 s.append("<TR><TD class=\"label\">");
1143 s.append(label);
1144 s.append("</TD>");
1145 s.append("<TD>");
1146
1147 s.append("<input type=\"text\" name=\""
1148 + nome + "rev"
1149 + "\" size=\""
1150 + size
1151 + "\" value=\""
1152 + valor + "\" maxlength=\"" + maxlength + "\"");
1153 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
1154 s.append(" disabled");
1155 s.append("></TD></TR>");
1156 writer.print(s.toString());
1157 } catch (IOException e) {
1158 Logger logger = Logger.getLogger(this.getClass());
1159 logger.error(e);
1160 }
1161 }
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173 public void criaInputTextData(String nome, String label, String valor) {
1174 JspWriter writer = this.page.getOut();
1175 StringBuffer s = new StringBuffer();
1176 try {
1177 s.append("<TR><TD class=\"label\">");
1178 s.append(label);
1179 s.append("</TD>");
1180 s.append("<TD>");
1181 s.append("<input type=\"text\" name=\""
1182 + nome + "rev"
1183 + "\" size=\"11\" value=\""
1184 + valor
1185 + "\" maxlength=\"10\" onkeyup=\"mascaraData(event, this);\"");
1186 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
1187 s.append(" disabled");
1188 s.append("></TD></TR>");
1189 writer.print(s.toString());
1190 } catch (IOException e) {
1191 Logger logger = Logger.getLogger(this.getClass());
1192 logger.error(e);
1193 }
1194 }
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208 public void criaTextArea(String nome, String label, String rows,
1209 String cols, String valor) {
1210 JspWriter writer = this.page.getOut();
1211 StringBuffer s = new StringBuffer();
1212 try {
1213 s.append("<TR><TD class=\"label\">");
1214 s.append(label);
1215 s.append("</TD>");
1216 s.append("<TD>");
1217 s.append("<textarea name=\"" + nome + "rev"+ "\" rows=\"" + rows
1218 + "\" cols=\"" + cols + "\" onkeyup=\"return validaTamanhoLimite(this, 2000);\"");
1219 if (getDesabilitar() != null && getDesabilitar().booleanValue() == true)
1220 s.append(" readonly");
1221 s.append(">");
1222 s.append(valor);
1223 s.append("</textarea>");
1224 s.append("</TD></TR>");
1225 writer.print(s.toString());
1226 } catch (IOException e) {
1227 Logger logger = Logger.getLogger(this.getClass());
1228 logger.error(e);
1229 }
1230 }
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240 public void criaJScriptArea(List areas) {
1241 JspWriter writer = this.page.getOut();
1242 StringBuffer s = new StringBuffer();
1243 AreaAre area;
1244 SubAreaSare subArea;
1245 List lSubAreas = new ArrayList(0);
1246 try {
1247 s.append("\n<script language=\"javascript\">\n");
1248 s.append("aSubArea = new Array(" + (areas.size() + 1) + ");\n");
1249
1250 s.append("for (var i = 0; i < aSubArea.length; ++i) { \n");
1251 s.append(" aSubArea[i] = new Array();\n");
1252 s.append("}\n");
1253 s.append("aSubArea[0][0] = new Option('Selecione uma Área','');\n");
1254
1255 for (int i = 0; i < areas.size(); i++) {
1256 area = (AreaAre) areas.get(i);
1257 s.append("aSubArea["+ (i+1) +"][0] = new Option('');\n");
1258 lSubAreas.clear();
1259
1260 int indiceSubArea = 1;
1261 for (int j = 0; j < lSubAreas.size(); j++) {
1262 subArea = (SubAreaSare) lSubAreas.get(j);
1263 if ("S".equals(subArea.getIndAtivoSare()))
1264 s.append("aSubArea[" + (i+1) + "][" + (indiceSubArea++) + "] = new Option('" + subArea.getNomeSare() + "','" + subArea.getCodSare().toString() +"');\n");
1265 }
1266 }
1267 s.append("</script>\n");
1268 writer.print(s.toString());
1269 } catch (IOException e) {
1270 Logger logger = Logger.getLogger(this.getClass());
1271 logger.error(e);
1272 }
1273 }
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284 public int doEndTag() throws JspException {
1285 return Tag.EVAL_PAGE;
1286 }
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296 public void setPageContext(PageContext arg0) {
1297 this.page = arg0;
1298 }
1299
1300
1301
1302
1303
1304
1305
1306 public void setParent(Tag arg0) {
1307 }
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317 public Tag getParent() {
1318 return null;
1319 }
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329 public PageContext getPage() {
1330 return page;
1331 }
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341 public void setPage(PageContext page) {
1342 this.page = page;
1343 }
1344
1345
1346
1347
1348
1349
1350 public void release() {
1351
1352 }
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362 public ObjetoEstrutura getAtributo() {
1363 return atributo;
1364 }
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374 public void setAtributo(ObjetoEstrutura atributo) {
1375 this.atributo = atributo;
1376 }
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386 public Boolean getDesabilitar() {
1387 return desabilitar;
1388 }
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398 public void setDesabilitar(Boolean desabilitar) {
1399 this.desabilitar = desabilitar;
1400 }
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410 public ItemEstruturarevisaoIettrev getItemEstruturaRevisao() {
1411 return this.itemEstruturaRevisao;
1412 }
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422 public void setItemEstruturaRevisao(ItemEstruturarevisaoIettrev itemEstruturaRevisao) {
1423 this.itemEstruturaRevisao = itemEstruturaRevisao;
1424 }
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434 public SegurancaECAR getSeguranca() {
1435 return seguranca;
1436 }
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446 public void setSeguranca(SegurancaECAR seguranca) {
1447 this.seguranca = seguranca;
1448 }
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458 public Boolean getExibirBotoes() {
1459 return exibirBotoes;
1460 }
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470 public void setExibirBotoes(Boolean exibirBotoes) {
1471 this.exibirBotoes = exibirBotoes;
1472 }
1473 }