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