4174a_for_review.patch
rules/annotations/ocx_conversion.rules 2020-02-25 17:11:49 +0000 | ||
---|---|---|
4 | 4 |
** Module : ocx_conversion.rules |
5 | 5 |
** Abstract : Converts supported OCX objects to 4GL widgets. |
6 | 6 |
** |
7 |
** Copyright (c) 2018-2019, Golden Code Development Corporation.
|
|
7 |
** Copyright (c) 2018-2020, Golden Code Development Corporation.
|
|
8 | 8 |
** |
9 | 9 |
** _#_ _I_ __Date__ _________________________________Description__________________________________ |
10 | 10 |
** 001 HC 20181127 Initial version. |
... | ... | |
28 | 28 |
** Added rules to ignore (eliminate) RELEASE OBJECT statement for known com-handle |
29 | 29 |
** Make noop-com annotation to work with the new rules. |
30 | 30 |
** Fixed indexed properties conversion rules. |
31 |
** 008 SBI 20200225 Added Calendar widget support. |
|
31 | 32 |
*/ |
32 | 33 |
--> |
33 | 34 |
<!-- |
... | ... | |
117 | 118 |
<variable name="map3" type="java.util.Map" /> |
118 | 119 |
<variable name="map4" type="java.util.Map" /> |
119 | 120 |
<variable name="map5" type="java.util.Map" /> |
121 |
<variable name="map6" type="java.util.Map" /> |
|
120 | 122 | |
121 | 123 |
<variable name="ref" type="com.goldencode.ast.AnnotatedAst" /> |
122 | 124 |
<variable name="ref1" type="com.goldencode.ast.Aast" /> |
125 |
<variable name="ref3" type="com.goldencode.ast.Aast" /> |
|
123 | 126 |
<variable name="refl" type="java.util.List" /> |
124 | 127 |
<variable name="it" type="java.util.Iterator" /> |
125 | 128 |
<variable name="parRef" type="com.goldencode.ast.Aast" /> |
... | ... | |
135 | 138 |
<variable name="name" type="java.lang.String" /> |
136 | 139 |
<variable name="name1" type="java.lang.String" /> |
137 | 140 |
<variable name="name2" type="java.lang.String" /> |
141 |
<variable name="name3" type="java.lang.String" /> |
|
138 | 142 | |
139 | 143 |
<variable name="callbacks" type="java.util.List" /> |
140 | 144 |
<variable name="widgetClass" type="java.lang.Class"/> |
... | ... | |
226 | 230 |
<action>widgetKwords.put("HTML-BROWSER", prog.kw_html_bws)</action> |
227 | 231 |
<action>widgetKwords.put("IMAGELIST", prog.kw_il_img)</action> |
228 | 232 |
<action>widgetKwords.put("PROGRESS-BAR", prog.kw_prog_bar)</action> |
233 |
<action>widgetKwords.put("CALENDAR", prog.kw_calendar)</action> |
|
229 | 234 | |
230 | 235 |
<action>widgetClasses = create("java.util.HashMap")</action> |
231 | 236 |
<action>widgetClasses.put("TREELIST", classForName("com.goldencode.p2j.ui.TreeList"))</action> |
... | ... | |
234 | 239 |
<action>widgetClasses.put("HTML-BROWSER", classForName("com.goldencode.p2j.ui.HtmlBrowser"))</action> |
235 | 240 |
<action>widgetClasses.put("IMAGELIST", classForName("com.goldencode.p2j.ui.ImageList"))</action> |
236 | 241 |
<action>widgetClasses.put("PROGRESS-BAR", classForName("com.goldencode.p2j.ui.ProgressBar"))</action> |
242 |
<action>widgetClasses.put("CALENDAR", classForName("com.goldencode.p2j.ui.Calendar"))</action> |
|
237 | 243 | |
238 | 244 |
<!-- fill the method aliases, where the key is the original com method/property name (in lower case), |
239 | 245 |
the rules will prepend is/get/set accordingly to the aliased values so for properties, |
... | ... | |
282 | 288 |
|
283 | 289 |
<!-- PROGRESS-BAR --> |
284 | 290 |
<action>map5 = create("java.util.HashMap")</action> |
285 |
<action>map5.put("mousepointer" , "ProgBarMousePointer")</action>
|
|
286 |
<action>map5.put("refresh" , "progBarRefresh")</action>
|
|
291 |
<action>map5.put("mousepointer" , "MousePointerExt")</action>
|
|
292 |
<action>map5.put("refresh" , "refreshUI")</action>
|
|
287 | 293 |
<action>aliasMap.put("PROGRESS-BAR" , map5)</action> |
288 |
|
|
294 |
|
|
295 |
<!-- Calendar --> |
|
296 |
<action>map6 = create("java.util.HashMap")</action> |
|
297 |
<action>map6.put("value" , "DateTimeValue")</action> |
|
298 |
<action>map6.put("CustomFormat" , "CustomFormat")</action> |
|
299 |
<action>map6.put("font:name" , "FontName")</action> |
|
300 |
<action>map6.put("font:size" , "FontSize")</action> |
|
301 |
<action>map6.put("format" , "FormatStyle")</action> |
|
302 |
<action>aliasMap.put("CALENDAR" , map6)</action> |
|
289 | 303 |
</rule> |
290 | 304 |
</init-rules> |
291 | 305 | |
... | ... | |
406 | 420 |
</rule> |
407 | 421 | |
408 | 422 |
<rule>ocxHandle == null and isConversion |
409 |
<action>ocxHandleKey = copy.text)</action>
|
|
423 |
<action>ocxHandleKey = copy.text</action> |
|
410 | 424 |
<action>ocxHandleKey = ocxHandleKey.toUpperCase()</action> |
411 | 425 |
<action>ocxHandle = ch2th.get(ocxHandleKey)</action> |
412 | 426 |
<action>cache = null</action> |
... | ... | |
428 | 442 |
<rule>ocxHandle != null |
429 | 443 |
<rule>ocxHandle != null and copy.parent.type == prog.com_invocation |
430 | 444 |
<action>printfln("INFO: FWD OCX Extension: convert %s to %s.", ocxHandleKey, ocxHandle)</action> |
431 |
|
|
432 | 445 |
<!-- get legacy node --> |
433 | 446 |
<rule>not isConversion |
434 |
<action>ref2 = copy.parent.nextSibling</action>
|
|
447 |
<action>ref2 = copy.parent.nextSibling</action>
|
|
435 | 448 |
</rule> |
436 | 449 | |
437 | 450 |
<!-- no legacy node, only handle --> |
... | ... | |
447 | 460 |
</rule> |
448 | 461 | |
449 | 462 |
<!-- convert legacy node --> |
463 |
<action>ref2 = execLib("processLegacyNode",copy, ref2, ocxHandle, ocxHandleKey, cache, isConversion)</action> |
|
450 | 464 |
<rule>ref2 != null |
451 |
<action>name = ref2.text</action> |
|
452 | ||
453 |
<!-- get the method/prop alias --> |
|
454 |
<action>ocxType = ch2wtype.get(ocxHandleKey)</action> |
|
455 | ||
456 |
<action>map = aliasMap.get(ocxType)</action> |
|
457 |
<rule>map != null |
|
458 |
<action>name1 = name.toLowerCase()</action> |
|
459 |
<action>name2 = map.get(name1)</action> |
|
460 |
<rule>name2 != null |
|
461 |
<action>name = name2</action> |
|
462 |
</rule> |
|
463 |
<rule>name2 == null |
|
464 |
<!-- check for composed properties like font:name --> |
|
465 |
<action>ref1 = copy.parent.parent.nextSibling</action> |
|
466 |
<rule>ref1 != null and ref1.type == prog.com_property |
|
467 |
<action>name2 = ref1.text.toLowerCase()</action> |
|
468 |
<action>name1 = sprintf("%s:%s", name1, name2)</action> |
|
469 |
<action>name2 = map.get(name1)</action> |
|
470 |
<rule>name2 != null |
|
471 |
<action>ref1 = copy.parent.parent</action> |
|
472 |
<action>ref = copy.parent.parent.parent</action> |
|
473 |
<action>ref1.move(ref.parent, 0)</action> |
|
474 |
<action>ref.remove()</action> |
|
475 |
<action>name = name2</action> |
|
476 |
</rule> |
|
477 |
</rule> |
|
478 |
</rule> |
|
479 |
</rule> |
|
480 | ||
481 |
<action>widgetClass = widgetClasses.get(ocxType)</action> |
|
482 | ||
483 |
<!-- find the root com_invocation --> |
|
484 |
<action>ref = copy.parent</action> |
|
485 |
<action>rootComInvocCpy = ref</action> |
|
486 |
<while>ref.type == prog.com_invocation |
|
487 |
<action>rootComInvocCpy = ref</action> |
|
488 |
<action>ref = ref.parent</action> |
|
489 |
</while> |
|
490 | ||
491 |
<!-- find the java counterpart method --> |
|
492 |
<action>name1 = getLegacyName(widgetClass, name)</action> |
|
493 | ||
494 |
<rule>name1 == null and |
|
495 |
rootComInvocCpy.parent.type == prog.assign and |
|
496 |
rootComInvocCpy.indexPos == 0 |
|
497 |
<!-- for prop assignment --> |
|
498 |
<action>name1 = sprintf("set%s", name)</action> |
|
499 |
<action>name1 = getLegacyName(widgetClass, name1)</action> |
|
500 |
</rule> |
|
501 | ||
502 |
<!-- for prop getter or method invocation --> |
|
503 |
<rule>name1 == null |
|
504 |
<action>name1 = sprintf("get%s", name)</action> |
|
505 |
<action>name1 = getLegacyName(widgetClass, name1)</action> |
|
506 |
</rule> |
|
507 | ||
508 |
<!-- for prop getter or method invocation --> |
|
509 |
<rule>name1 == null |
|
510 |
<action>name1 = sprintf("is%s", name)</action> |
|
511 |
<action>name1 = getLegacyName(widgetClass, name1)</action> |
|
512 |
</rule> |
|
513 | ||
514 |
<rule>name1 == null |
|
515 |
<action>printfln("WARN: FWD OCX Extension: Failed to resolve legacy name for %s. Is %s defined in %s?", name, name, widgetClass)</action> |
|
516 |
<action>copy.putAnnotation("noop-com", true)</action> |
|
517 |
</rule> |
|
518 | ||
519 |
<rule>name1 != null |
|
520 |
<action>reftype1 = -1</action> |
|
521 |
<action>reftype = prog.lookupKeywordToken(name1)</action> |
|
522 |
<rule>reftype == -1 |
|
523 |
<action>printfln("WARN: FWD OCX Extension: Failed to resolve keyword for %s.", name1)</action> |
|
524 |
<action>copy.putAnnotation("noop-com", true)</action> |
|
525 |
<action on="false">reftype1 = lookupAttributeOrMethod(reftype)</action> |
|
526 |
<rule on="false">reftype1 == -1 |
|
527 |
<action>printfln("WARN: FWD OCX Extension: Failed to resolve attribute or method type for %s.", name1)</action> |
|
528 |
<action>copy.putAnnotation("noop-com", true)</action> |
|
529 |
</rule> |
|
530 |
</rule> |
|
531 | ||
532 |
<rule>reftype1 != -1 |
|
533 |
<!-- is this an indexed COM property being assigned? --> |
|
534 |
<action>methPropCpy = rootComInvocCpy.getImmediateChild(createSet(prog.com_method, prog.com_property), null)</action> |
|
535 |
<rule>rootComInvocCpy.parent.type == prog.assign and |
|
536 |
rootComInvocCpy.indexPos == 0 and |
|
537 |
methPropCpy.getImmediateChild(prog.com_parameter, null) != null |
|
538 | ||
539 |
<!-- get the assigning expression and make it a parameter --> |
|
540 |
<action>ref1 = rootComInvocCpy.nextSibling</action> |
|
541 | ||
542 |
<!-- the com parameter will be converted below --> |
|
543 |
<action>ref1.type = prog.com_parameter</action> |
|
544 |
<action>ref1.text = ""</action> |
|
545 |
<action>ref1.move(methPropCpy, -1)</action> |
|
546 |
</rule> |
|
547 | ||
548 |
<!-- set legacy node properties --> |
|
549 |
<action>ref2.type = reftype1</action> |
|
550 |
<action>ref2.text = name1</action> |
|
551 |
<action>ref2.putAnnotation("oldtype", #(long)reftype)</action> |
|
552 | ||
553 |
<!-- lookup for com parameters and replace with parameters --> |
|
554 |
<action>ref1 = ref2.firstChild</action> |
|
555 |
<while>ref1 != null |
|
556 |
<action>ref2 = null</action> |
|
557 |
<rule>ref1.type == prog.com_parameter |
|
558 |
<action>ref1.type = prog.parameter</action> |
|
559 |
<action>ref2 = ref1</action> |
|
560 |
</rule> |
|
561 |
<action>ref1 = ref1.nextSibling</action> |
|
562 | ||
563 |
<!-- check for empty parameter and remove it --> |
|
564 |
<rule>ref2 != null and ref2.numChildren == 0 |
|
565 |
<action>ref2.remove()</action> |
|
566 |
</rule> |
|
567 |
</while> |
|
568 | ||
569 |
<!-- convert var_com_handle into var_handle --> |
|
570 |
<action>copy.type = prog.var_handle</action> |
|
571 |
<action>copy.text = ocxHandle</action> |
|
572 | ||
573 |
<!-- remove second token since is no longer needed --> |
|
574 |
<rule>cache != null |
|
575 |
<action>cache.remove()</action> |
|
576 |
</rule> |
|
577 | ||
578 |
<!-- rearrange nodes and remove unnecessary node --> |
|
579 |
<rule>isConversion == false and copy.parent.parent != null and copy.parent.parent.type == prog.com_invocation |
|
580 |
<action>ref1 = copy.parent</action> |
|
581 |
<action>invoc = copy.parent.parent</action> |
|
582 |
<action>invoc.type = prog.colon</action> |
|
583 |
<action>copy.move(invoc, 0)</action> |
|
584 |
<action>ref1.remove()</action> |
|
585 |
</rule> |
|
586 | ||
587 |
<!-- when is conversion --> |
|
588 |
<rule>isConversion == true and copy.parent != null and copy.parent.type == prog.com_invocation |
|
589 |
<action>invoc = copy.parent</action> |
|
590 |
<action>invoc.type = prog.colon</action> |
|
591 |
</rule> |
|
592 |
</rule> |
|
593 |
</rule> |
|
594 |
</rule> |
|
465 |
<action>execLib("processLegacyNode",copy, ref2, ocxHandle, ocxHandleKey, cache, isConversion)</action> |
|
466 |
</rule> |
|
595 | 467 |
</rule> |
596 | 468 |
</rule> |
597 | 469 |
</rule> |
... | ... | |
898 | 770 |
</post-rules> |
899 | 771 | |
900 | 772 |
<func-library access="private"> |
901 | ||
773 |
<function name="processLegacyNode"> |
|
774 |
<parameter name="copy" type="com.goldencode.ast.Aast" /> |
|
775 |
<parameter name="ref2" type="com.goldencode.ast.Aast" /> |
|
776 |
<parameter name="ocxHandle" type="java.lang.String"/> |
|
777 |
<parameter name="ocxHandleKey" type="java.lang.String"/> |
|
778 |
<parameter name="cache" type="com.goldencode.ast.Aast"/> |
|
779 |
<parameter name="isConversion" type="java.lang.Boolean"/> |
|
780 | ||
781 |
<return name="ref3" type="com.goldencode.ast.Aast"/> |
|
782 | ||
783 |
<variable name="ref1" type="com.goldencode.ast.Aast" /> |
|
784 |
<variable name="name" type="java.lang.String"/> |
|
785 |
<variable name="name1" type="java.lang.String"/> |
|
786 |
<variable name="name2" type="java.lang.String"/> |
|
787 |
<variable name="name3" type="java.lang.String"/> |
|
788 |
<variable name="ocxType" type="java.lang.String" /> |
|
789 |
<variable name="reftype" type="java.lang.Integer"/> |
|
790 |
<variable name="reftype1" type="java.lang.Integer"/> |
|
791 |
<variable name="invoc" type="com.goldencode.ast.Aast"/> |
|
792 |
<variable name="ref" type="com.goldencode.ast.AnnotatedAst" /> |
|
793 |
<variable name="rootComInvocCpy" type="com.goldencode.ast.Aast"/> |
|
794 |
<variable name="methPropCpy" type="com.goldencode.ast.Aast"/> |
|
795 |
<!-- convert legacy node --> |
|
796 |
<rule>ref2 != null |
|
797 |
<action>name = ref2.text</action> |
|
798 |
<!-- get the method/prop alias --> |
|
799 |
<action>ocxType = ch2wtype.get(ocxHandleKey)</action> |
|
800 |
<action>ref3 = ref2.parent.nextSibling</action> |
|
801 |
<action>map = aliasMap.get(ocxType)</action> |
|
802 |
<rule>map != null |
|
803 |
<action>name1 = name.toLowerCase()</action> |
|
804 |
<action>name2 = map.get(name1)</action> |
|
805 |
<rule>name2 != null |
|
806 |
<action>name = name2</action> |
|
807 |
</rule> |
|
808 |
<rule>name2 == null |
|
809 |
<!-- check for composed properties like font:name --> |
|
810 |
<action>ref1 = copy.parent.parent.nextSibling</action> |
|
811 |
<rule>ref1 != null and ref1.type == prog.com_property |
|
812 |
<action>name2 = ref1.text.toLowerCase()</action> |
|
813 |
<action>name1 = sprintf("%s:%s", name1, name2)</action> |
|
814 |
<action>name2 = map.get(name1)</action> |
|
815 |
<rule>name2 != null |
|
816 |
<action>ref1 = copy.parent.parent</action> |
|
817 |
<action>ref = copy.parent.parent.parent</action> |
|
818 |
<action>ref1.move(ref.parent, 0)</action> |
|
819 |
<action>ref.remove()</action> |
|
820 |
<action>name = name2</action> |
|
821 |
</rule> |
|
822 |
</rule> |
|
823 |
</rule> |
|
824 |
</rule> |
|
825 | ||
826 |
<action>widgetClass = widgetClasses.get(ocxType)</action> |
|
827 | ||
828 |
<!-- find the root com_invocation --> |
|
829 |
<action>ref = copy.parent</action> |
|
830 |
<action>rootComInvocCpy = ref</action> |
|
831 |
<while>ref.type == prog.com_invocation |
|
832 |
<action>rootComInvocCpy = ref</action> |
|
833 |
<action>ref = ref.parent</action> |
|
834 |
</while> |
|
835 | ||
836 |
<!-- find the java counterpart method --> |
|
837 |
<action>name1 = getLegacyName(widgetClass, name)</action> |
|
838 |
<rule>name1 == null and |
|
839 |
rootComInvocCpy.parent.type == prog.assign and |
|
840 |
rootComInvocCpy.indexPos == 0 |
|
841 |
<!-- for prop assignment --> |
|
842 |
<action>name1 = sprintf("set%s", name)</action> |
|
843 |
<action>name1 = getLegacyName(widgetClass, name1)</action> |
|
844 |
</rule> |
|
845 | ||
846 |
<!-- for prop getter or method invocation --> |
|
847 |
<rule>name1 == null |
|
848 |
<action>name1 = sprintf("get%s", name)</action> |
|
849 |
<action>name1 = getLegacyName(widgetClass, name1)</action> |
|
850 |
</rule> |
|
851 | ||
852 |
<!-- for prop getter or method invocation --> |
|
853 |
<rule>name1 == null |
|
854 |
<action>name1 = sprintf("is%s", name)</action> |
|
855 |
<action>name1 = getLegacyName(widgetClass, name1)</action> |
|
856 |
</rule> |
|
857 | ||
858 |
<rule>name1 == null |
|
859 |
<action>printfln("WARN: FWD OCX Extension: Failed to resolve legacy name for %s. Is %s defined in %s?", name, name, widgetClass)</action> |
|
860 |
<action>copy.putAnnotation("noop-com", true)</action> |
|
861 |
</rule> |
|
862 | ||
863 |
<rule>name1 != null |
|
864 |
<action>reftype1 = -1</action> |
|
865 |
<action>reftype = prog.lookupKeywordToken(name1)</action> |
|
866 |
<rule>reftype == -1 |
|
867 |
<action>printfln("WARN: FWD OCX Extension: Failed to resolve keyword for %s.", name1)</action> |
|
868 |
<action>copy.putAnnotation("noop-com", true)</action> |
|
869 |
<action on="false">reftype1 = lookupAttributeOrMethod(reftype)</action> |
|
870 |
<rule on="false">reftype1 == -1 |
|
871 |
<action>printfln("WARN: FWD OCX Extension: Failed to resolve attribute or method type for %s.", name1)</action> |
|
872 |
<action>copy.putAnnotation("noop-com", true)</action> |
|
873 |
</rule> |
|
874 |
</rule> |
|
875 | ||
876 |
<rule>reftype1 != -1 |
|
877 |
<!-- is this an indexed COM property being assigned? --> |
|
878 |
<action>methPropCpy = rootComInvocCpy.getImmediateChild(createSet(prog.com_method, prog.com_property), null)</action> |
|
879 |
<rule>rootComInvocCpy.parent.type == prog.assign and |
|
880 |
rootComInvocCpy.indexPos == 0 and |
|
881 |
methPropCpy.getImmediateChild(prog.com_parameter, null) != null |
|
882 | ||
883 |
<!-- get the assigning expression and make it a parameter --> |
|
884 |
<action>ref1 = rootComInvocCpy.nextSibling</action> |
|
885 | ||
886 |
<!-- the com parameter will be converted below --> |
|
887 |
<action>ref1.type = prog.com_parameter</action> |
|
888 |
<action>ref1.text = ""</action> |
|
889 |
<action>ref1.move(methPropCpy, -1)</action> |
|
890 |
</rule> |
|
891 |
<rule>map != null and ref3 != null and ref3.compareWith(methPropCpy, true) |
|
892 |
<action>printfln("hit: %s", ref3.text)</action> |
|
893 |
<action>name3=map.get(ref3.text.toLowerCase())</action> |
|
894 |
<action>printfln("name3= %s", name3)</action> |
|
895 |
<action>methPropCpy.text = name3</action> |
|
896 |
</rule> |
|
897 |
<!-- set legacy node properties --> |
|
898 |
<action>ref2.type = reftype1</action> |
|
899 |
<action>ref2.text = name1</action> |
|
900 |
<action>ref2.putAnnotation("oldtype", #(long)reftype)</action> |
|
901 | ||
902 |
<!-- lookup for com parameters and replace with parameters --> |
|
903 |
<action>ref1 = ref2.firstChild</action> |
|
904 |
<while>ref1 != null |
|
905 |
<action>ref2 = null</action> |
|
906 |
<rule>ref1.type == prog.com_parameter |
|
907 |
<action>ref1.type = prog.parameter</action> |
|
908 |
<action>ref2 = ref1</action> |
|
909 |
</rule> |
|
910 |
<action>ref1 = ref1.nextSibling</action> |
|
911 | ||
912 |
<!-- check for empty parameter and remove it --> |
|
913 |
<rule>ref2 != null and ref2.numChildren == 0 |
|
914 |
<action>ref2.remove()</action> |
|
915 |
</rule> |
|
916 |
</while> |
|
917 | ||
918 |
<!-- convert var_com_handle into var_handle --> |
|
919 |
<action>copy.type = prog.var_handle</action> |
|
920 |
<action>copy.text = ocxHandle</action> |
|
921 | ||
922 |
<!-- remove second token since is no longer needed --> |
|
923 |
<rule>cache != null |
|
924 |
<action>cache.remove()</action> |
|
925 |
</rule> |
|
926 | ||
927 |
<!-- rearrange nodes and remove unnecessary node --> |
|
928 |
<rule>isConversion == false and copy.parent.parent != null and copy.parent.parent.type == prog.com_invocation |
|
929 |
<action>ref1 = copy.parent</action> |
|
930 |
<action>invoc = copy.parent.parent</action> |
|
931 |
<action>invoc.type = prog.colon</action> |
|
932 |
<action>copy.move(invoc, 0)</action> |
|
933 |
<action>ref1.remove()</action> |
|
934 |
</rule> |
|
935 | ||
936 |
<!-- when is conversion --> |
|
937 |
<rule>isConversion == true and copy.parent != null and copy.parent.type == prog.com_invocation |
|
938 |
<action>invoc = copy.parent</action> |
|
939 |
<action>invoc.type = prog.colon</action> |
|
940 |
</rule> |
|
941 |
</rule> |
|
942 |
</rule> |
|
943 |
</rule> |
|
944 |
</function> |
|
902 | 945 |
<!-- Assumes that we are under browse DISPLAY node. Finds the field reference (which defines |
903 | 946 |
the column) with the given schemaname under the DISPLAY node.--> |
904 | 947 |
<function name="doTrigger"> |
rules/convert/expressions.rules 2020-02-25 17:15:52 +0000 | ||
---|---|---|
4 | 4 |
** Module : expressions.rules |
5 | 5 |
** Abstract : converts Progress expression root and wrapping/unwrapping |
6 | 6 |
** |
7 |
** Copyright (c) 2005-2019, Golden Code Development Corporation.
|
|
7 |
** Copyright (c) 2005-2020, Golden Code Development Corporation.
|
|
8 | 8 |
** |
9 | 9 |
** _#_ _I_ __Date__ __JPRM__ ____________________________Description_____________________________ |
10 | 10 |
** 001 GES 20050726 @21855 Good working version which converts Progress |
... | ... | |
212 | 212 |
** parameters to COPY-LOB statement. Data types for such arguments must |
213 | 213 |
** be verified at runtime. |
214 | 214 |
** 085 CA 20190927 Added support for direct Java access from 4GL code. |
215 |
** 086 SBI 20200225 Added Calendar widget support. |
|
215 | 216 |
*/ |
216 | 217 |
--> |
217 | 218 |
rules/convert/methods_attributes.rules 2020-02-25 17:13:50 +0000 | ||
---|---|---|
462 | 462 |
** 215 MAG 20191127 Added TabSet TabIndex property. |
463 | 463 |
** Added TabSet MultiLine property. |
464 | 464 |
** Added TabSet show() method. |
465 |
** 216 SBI 20200225 Added Calendar widget support. |
|
465 | 466 |
*/ |
466 | 467 |
--> |
467 | 468 |
|
... | ... | |
943 | 944 |
<rule>list.put(prog.kw_att_file, execLib("cr_descr", "EmailSender" , "attachFile" , "" , true ))</rule> |
944 | 945 |
<rule>list.put(prog.kw_att_url , execLib("cr_descr", "EmailSender" , "attachURL" , "" , true ))</rule> |
945 | 946 |
<rule>list.put(prog.kw_build_tr, execLib("cr_descr", "TreeFace" , "isBuildingTree" , "setBuildingTree" , true ))</rule> |
947 |
<rule>list.put(prog.kw_calcufmt, execLib("cr_descr", "Calendar" , "getCustomFormat" , "setCustomFormat" , true ))</rule> |
|
948 |
<rule>list.put(prog.kw_calfmtst, execLib("cr_descr", "Calendar" , "getFormatStyle" , "setFormatStyle" , true ))</rule> |
|
946 | 949 |
<rule>list.put(prog.kw_callback, execLib("cr_descr", "FWDTimer" , "getCallback" , "setCallback" , true ))</rule> |
950 |
<rule>list.put(prog.kw_calvalue, execLib("cr_descr", "Calendar" , "getDateTimeValue" , "setDateTimeValue" , true ))</rule> |
|
947 | 951 |
<rule>list.put(prog.kw_cease , execLib("cr_descr", "FWDTimer" , "cease" , null , true ))</rule> |
948 | 952 |
<rule>list.put(prog.kw_clr_all , execLib("cr_descr", "TreeFace" , "clearAll" , null , true ))</rule> |
949 | 953 |
<rule>list.put(prog.kw_clr_attl, execLib("cr_descr", "EmailSender" , "clearAttachmentsList" , "" , true ))</rule> |
... | ... | |
1026 | 1030 |
<rule>list.put(prog.kw_is_c_vis, execLib("cr_descr", "TreeList" , "isColumnVisible" , null , true ))</rule> |
1027 | 1031 |
<rule>list.put(prog.kw_is_msel , execLib("cr_descr", "TreeFace" , "isMultiSelect" , null , true ))</rule> |
1028 | 1032 |
<rule>list.put(prog.kw_is_n_exp, execLib("cr_descr", "TreeFace" , "isNodeExpanded" , null , true ))</rule> |
1033 |
<rule>list.put(prog.kw_msicon, execLib("cr_descr", "WidgetExtension" , "getMouseIcon" , "setMouseIcon" , true ))</rule> |
|
1034 |
<rule>list.put(prog.kw_mspntnum, execLib("cr_descr", "WidgetExtension" , "getMousePointerNum" , "setMousePointerNum" , true ))</rule> |
|
1029 | 1035 |
<rule>list.put(prog.kw_m_d_i_p, execLib("cr_descr", "TreeList" , "moveDownInParent" , null , true ))</rule> |
1030 | 1036 |
<rule>list.put(prog.kw_m_u_i_p, execLib("cr_descr", "TreeList" , "moveUpInParent" , null , true ))</rule> |
1031 | 1037 |
<rule>list.put(prog.kw_n_height, execLib("cr_descr", "TreeFace" , "getNodeHeight" , "setNodeHeight" , true ))</rule> |
... | ... | |
1058 | 1064 |
<rule>list.put(prog.kw_pb_enabl, execLib("cr_descr", "ProgressBar" , "isEnabled" , "setEnabled" , true ))</rule> |
1059 | 1065 |
<rule>list.put(prog.kw_pb_max, execLib("cr_descr", "ProgressBar" , "getMax" , "setMax" , true ))</rule> |
1060 | 1066 |
<rule>list.put(prog.kw_pb_min, execLib("cr_descr", "ProgressBar" , "getMin" , "setMin" , true ))</rule> |
1061 |
<rule>list.put(prog.kw_pb_msico, execLib("cr_descr", "ProgressBar" , "getMouseIcon" , "setMouseIcon" , true ))</rule> |
|
1062 |
<rule>list.put(prog.kw_pb_mspnt, execLib("cr_descr", "ProgressBar" , "getProgBarMousePointer" , "setProgBarMousePointer" , true ))</rule> |
|
1063 | 1067 |
<rule>list.put(prog.kw_pb_orien, execLib("cr_descr", "ProgressBar" , "getOrientation" , "setOrientation" , true ))</rule> |
1064 |
<rule>list.put(prog.kw_pb_rfrsh, execLib("cr_descr", "ProgressBar" , "progBarRefresh" , null , true ))</rule> |
|
1065 | 1068 |
<rule>list.put(prog.kw_pb_scrol, execLib("cr_descr", "ProgressBar" , "getScrolling" , "setScrolling" , true ))</rule> |
1066 | 1069 |
<rule>list.put(prog.kw_pb_value, execLib("cr_descr", "ProgressBar" , "getValue" , "setValue" , true ))</rule> |
1067 | 1070 |
<rule>list.put(prog.kw_rem_noco, execLib("cr_descr", "TreeFace" , "getRemoveNodeOnCollapse", "setRemoveNodeOnCollapse", true ))</rule> |
... | ... | |
1069 | 1072 |
<rule>list.put(prog.kw_report, execLib("cr_descr", "FwdReport" , "getReport" , "setReport" , true ))</rule> |
1070 | 1073 |
<rule>list.put(prog.kw_res_base, execLib("cr_descr", "HtmlBrowser" , "getResourceBase" , "setResourceBase" , true ))</rule> |
1071 | 1074 |
<rule>list.put(prog.kw_resort, execLib("cr_descr", "TreeList" , "resort" , null , true ))</rule> |
1075 |
<rule>list.put(prog.kw_rfrsh_ui, execLib("cr_descr", "WidgetExtension" , "refreshUI" , null , true ))</rule> |
|
1072 | 1076 |
<rule>list.put(prog.kw_rpt_csv, execLib("cr_descr", "FwdReport" , "exportReportCsv" , null , true ))</rule> |
1073 | 1077 |
<rule>list.put(prog.kw_rpt_dsgn, execLib("cr_descr", "FwdReport" , "getReportDesign" , "setReportDesign" , true ))</rule> |
1074 | 1078 |
<rule>list.put(prog.kw_rpt_html, execLib("cr_descr", "FwdReport" , "exportReportHtml" , null , true ))</rule> |
rules/convert/ui_statements.rules 2020-02-24 18:12:00 +0000 | ||
---|---|---|
968 | 968 |
<action>explicitw = "DialogBox"</action> |
969 | 969 |
</rule> |
970 | 970 |
<rule>explicitw == null and |
971 |
(downPath("KW_CALENDAR") or evalLib("match_widget_type", "calendar")) |
|
972 |
<action>explicitw = "Calendar"</action> |
|
973 |
</rule> |
|
974 |
<rule>explicitw == null and |
|
971 | 975 |
(downPath("KW_EDITOR") or evalLib("match_widget_type", "editor")) |
972 | 976 |
<action>explicitw = "Editor"</action> |
973 | 977 |
</rule> |
rules/gaps/expressions.rules 2020-02-24 19:29:54 +0000 | ||
---|---|---|
1739 | 1739 |
|
1740 | 1740 |
<rule>widAndQual.put(prog.kw_as , rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
1741 | 1741 |
<rule>widAndQual.put(prog.kw_browse , rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
1742 |
<rule>widAndQual.put(prog.kw_calendar , rw.cvt_lvl_partial | rw.rt_lvl_partial)</rule> |
|
1742 | 1743 |
<rule>widAndQual.put(prog.kw_tabset , rw.cvt_lvl_partial | rw.rt_lvl_partial)</rule> |
1743 | 1744 |
<rule>widAndQual.put(prog.kw_img_list , rw.cvt_lvl_partial | rw.rt_lvl_partial)</rule> |
1744 | 1745 |
<rule>widAndQual.put(prog.kw_treelist , rw.cvt_lvl_full | rw.rt_lvl_partial)</rule> |
... | ... | |
2032 | 2033 |
<rule>map.put(prog.kw_pb_appea, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2033 | 2034 |
<rule>map.put(prog.kw_pb_brsty, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2034 | 2035 |
<rule>map.put(prog.kw_pb_enabl, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2035 |
<rule>map.put(prog.kw_pb_msico, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
|
2036 |
<rule>map.put(prog.kw_pb_mspnt, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
|
2036 |
<rule>map.put(prog.kw_msicon, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
|
2037 |
<rule>map.put(prog.kw_mspntnum, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
|
2037 | 2038 |
<rule>map.put(prog.kw_pb_max, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2038 | 2039 |
<rule>map.put(prog.kw_pb_min, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2039 | 2040 |
<rule>map.put(prog.kw_pb_orien, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2040 |
<rule>map.put(prog.kw_pb_rfrsh, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
|
2041 |
<rule>map.put(prog.kw_rfrsh_ui, rw.cvt_lvl_full | rw.rt_lvl_full)</rule>
|
|
2041 | 2042 |
<rule>map.put(prog.kw_pb_scrol, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2042 | 2043 |
<rule>map.put(prog.kw_pb_value, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
2043 | 2044 |
<rule>map.put(prog.kw_ole_drag, rw.cvt_lvl_full | rw.rt_lvl_full)</rule> |
src/com/goldencode/p2j/uast/progress.g 2020-02-25 17:19:38 +0000 | ||
---|---|---|
2086 | 2086 |
** 382 MAG 20191127 Added TabSet TabIndex property. |
2087 | 2087 |
** Added TabSet MULTILINE property. |
2088 | 2088 |
** Added TabSet show() method. |
2089 |
*/ |
|
2089 |
** 384 SBI 20200225 Added Calendar widget support. |
|
2090 |
*/ |
|
2090 | 2091 | |
2091 | 2092 |
/* |
2092 | 2093 |
** This program is free software: you can redistribute it and/or modify |
... | ... | |
4320 | 4321 |
KW_MOV_2_B; |
4321 | 4322 |
KW_MOV_2_T; |
4322 | 4323 |
KW_MOV_2EOF; |
4324 |
KW_MSICON; // FWD extension, not real 4GL! WidgetExtension:MOUSE-ICON |
|
4325 |
KW_MSPNTNUM; // FWD extension, not real 4GL! WidgetExtension:MOUSE-POINTER-NUM |
|
4323 | 4326 |
KW_MTIME; |
4324 | 4327 |
KW_MULT_CMP; |
4325 | 4328 |
KW_MULTIPLE; |
... | ... | |
4599 | 4602 |
KW_RET_2SD; |
4600 | 4603 |
KW_RETURNS; |
4601 | 4604 |
KW_REV_FROM; |
4605 |
KW_RFRSH_UI; // FWD extension, not real 4GL! WidgetExtension:REFRESH-UI |
|
4602 | 4606 |
KW_RGB_VAL; |
4603 | 4607 |
KW_RIGHT; |
4604 | 4608 |
KW_RIGHT_AL; |
... | ... | |
5183 | 5187 |
KW_IL_OVER; |
5184 | 5188 |
KW_IL_UMASK; |
5185 | 5189 |
KW_ADD_IMG; // end IMAGELIST |
5186 |
KW_MS_CLICK; // begin PROGESS-BAR |
|
5190 |
KW_MS_CLICK; // begin PROGRESS-BAR
|
|
5187 | 5191 |
KW_MS_DOWN; |
5188 | 5192 |
KW_MS_MOVE; |
5189 | 5193 |
KW_MS_UP; |
... | ... | |
5214 | 5218 |
KW_PB_MIN; |
5215 | 5219 |
KW_PB_MAX; |
5216 | 5220 |
KW_PB_VALUE; |
5217 |
KW_PB_RFRSH; |
|
5218 | 5221 |
KW_PB_SCROL; |
5219 |
KW_PB_MSPNT; |
|
5220 |
KW_PB_MSICO; |
|
5221 |
KW_COM_DATA; // end PROGESS-BAR |
|
5222 |
KW_COM_DATA; // end PROGRESS-BAR |
|
5223 |
KW_CALBGCLR; // CALENDAR:CalendarBackColor |
|
5224 |
KW_CALFGCLR; // CALENDAR:CalendarForeColor |
|
5225 |
KW_CALTITBG; // CALENDAR:TitleBackColor |
|
5226 |
KW_CALTITFG; // CALENDAR:TitleForeColor |
|
5227 |
KW_CALTRLFG; // CALENDAR:TrailingForeColor |
|
5228 |
KW_CALENDAR; // CALENDAR |
|
5229 |
KW_CALCUFMT; // CALENDAR:CustomFormat |
|
5230 |
KW_CALFMTST; // CALENDAR:FormatStyle |
|
5231 |
KW_CALVALUE; // CALENDAR:DateTimeValue |
|
5222 | 5232 |
END_FWD_EXTENSION; |
5223 | 5233 |
END_UNRESERVED; |
5224 | 5234 |
BEGIN_CALLGRAPH; |
... | ... | |
8069 | 8079 |
attrsAndMethods.put( KW_BYTES_R , ATTR_INT ); |
8070 | 8080 |
attrsAndMethods.put( KW_BYTES_W , ATTR_INT ); |
8071 | 8081 |
attrsAndMethods.put( KW_CACHE, ATTR_INT ); |
8082 |
attrsAndMethods.put( KW_CALBGCLR, ATTR_INT ); // FWD CALENDAR extension, not real 4GL |
|
8083 |
attrsAndMethods.put( KW_CALCUFMT, ATTR_CHAR ); // FWD CALENDAR:CustomFormat extension, not real 4GL |
|
8084 |
attrsAndMethods.put( KW_CALFGCLR, ATTR_INT ); // FWD CALENDAR extension, not real 4GL |
|
8085 |
attrsAndMethods.put( KW_CALFMTST, ATTR_INT ); // FWD CALENDAR:FormatStyle extension, not real 4GL |
|
8086 |
attrsAndMethods.put( KW_CALVALUE, ATTR_CHAR ); // FWD CALENDAR:DateTimeValue extension, not real 4GL |
|
8072 | 8087 |
attrsAndMethods.put( KW_CALL_NAM, ATTR_CHAR ); |
8073 | 8088 |
attrsAndMethods.put( KW_CALL_TYP, ATTR_INT ); |
8074 | 8089 |
attrsAndMethods.put( KW_CALLBACK, ATTR_CHAR ); // FWD TIMER extension |
8090 |
attrsAndMethods.put( KW_CALTITBG, ATTR_INT ); // FWD CALENDAR extension, not real 4GL |
|
8091 |
attrsAndMethods.put( KW_CALTITFG, ATTR_INT ); // FWD CALENDAR extension, not real 4GL |
|
8092 |
attrsAndMethods.put( KW_CALTRLFG, ATTR_INT ); // FWD CALENDAR extension, not real 4GL |
|
8075 | 8093 |
attrsAndMethods.put( KW_CANC_BRK, METH_LOGICAL ); |
8076 | 8094 |
attrsAndMethods.put( KW_CANCEL_B, ATTR_HANDLE ); |
8077 | 8095 |
attrsAndMethods.put( KW_CANCEL_R, METH_LOGICAL ); |
... | ... | |
8662 | 8680 |
attrsAndMethods.put( KW_MIN_VAL , ATTR_INT ); |
8663 | 8681 |
attrsAndMethods.put( KW_MIN_W_C , ATTR_DEC ); |
8664 | 8682 |
attrsAndMethods.put( KW_MIN_W_P , ATTR_INT ); |
8683 |
attrsAndMethods.put( KW_MSICON, ATTR_CHAR ); // FWD extension, not real 4GL |
|
8665 | 8684 |
attrsAndMethods.put( KW_MSG_AREA, ATTR_LOGICAL ); |
8666 | 8685 |
attrsAndMethods.put( KW_MSG_AFNT, ATTR_INT ); |
8686 |
attrsAndMethods.put( KW_MSPNTNUM, ATTR_INT ); // FWD extension, not real 4GL |
|
8667 | 8687 |
attrsAndMethods.put( KW_MNEMON, ATTR_INT ); // FWD extension, not real 4GL! |
8668 | 8688 |
attrsAndMethods.put( KW_MODIFIED, ATTR_LOGICAL ); |
8669 | 8689 |
attrsAndMethods.put( KW_MOU_PTR , ATTR_CHAR ); |
... | ... | |
8786 | 8806 |
attrsAndMethods.put( KW_PB_ENABL, ATTR_LOGICAL ); // FWD PROGRESS-BAR extension, not real 4GL |
8787 | 8807 |
attrsAndMethods.put( KW_PB_MAX, ATTR_DEC ); // FWD PROGRESS-BAR extension, not real 4GL |
8788 | 8808 |
attrsAndMethods.put( KW_PB_MIN, ATTR_DEC ); // FWD PROGRESS-BAR extension, not real 4GL |
8789 |
attrsAndMethods.put( KW_PB_MSICO, ATTR_CHAR ); // FWD PROGRESS-BAR extension, not real 4GL |
|
8790 |
attrsAndMethods.put( KW_PB_MSPNT, ATTR_INT ); // FWD PROGRESS-BAR extension, not real 4GL |
|
8791 | 8809 |
attrsAndMethods.put( KW_PB_ORIEN, ATTR_INT ); // FWD PROGRESS-BAR extension, not real 4GL |
8792 |
attrsAndMethods.put( KW_PB_RFRSH, METH_VOID ); // FWD PROGRESS-BAR extension, not real 4GL |
|
8793 | 8810 |
attrsAndMethods.put( KW_PB_SCROL, ATTR_INT ); // FWD PROGRESS-BAR extension, not real 4GL |
8794 | 8811 |
attrsAndMethods.put( KW_PB_VALUE, ATTR_DEC ); // FWD PROGRESS-BAR extension, not real 4GL |
8795 | 8812 |
attrsAndMethods.put( KW_PREF_DS , ATTR_LOGICAL ); |
... | ... | |
8871 | 8888 |
attrsAndMethods.put( KW_REPOS_2R, METH_LOGICAL ); |
8872 | 8889 |
attrsAndMethods.put( KW_REPOS_2I, METH_LOGICAL ); |
8873 | 8890 |
attrsAndMethods.put( KW_REQ_INFO, ATTR_CLASS ); |
8891 |
attrsAndMethods.put( KW_RFRSH_UI, METH_VOID ); // FWD extension, not real 4GL |
|
8874 | 8892 |
attrsAndMethods.put( KW_RSP_INFO, ATTR_CLASS ); |
8875 | 8893 |
attrsAndMethods.put( KW_RES_BASE, ATTR_CHAR ); // FWD extension, not real 4GL |
8876 | 8894 |
attrsAndMethods.put( KW_RESET , METH_LOGICAL ); |
... | ... | |
24472 | 24490 |
| KW_COMBO_BX { is_widget = true; } |
24473 | 24491 |
| KW_CNTRL_FR { is_widget = true; } |
24474 | 24492 |
| KW_DIALOG { is_widget = true; } |
24493 |
| KW_CALENDAR { is_widget = true; } |
|
24475 | 24494 |
| KW_EDITOR { is_widget = true; } |
24476 | 24495 |
| KW_FILL_IN { is_widget = true; } |
24477 | 24496 |
| KW_FRAME { is_widget = true; } |
... | ... | |
33137 | 33156 |
new Keyword("bytes-written" , 0, KW_BYTES_W , false), |
33138 | 33157 |
new Keyword("cache" , 0, KW_CACHE , false), |
33139 | 33158 |
new Keyword("cache-size" , 0, KW_CACHE_SZ, false), |
33159 |
new Keyword("calendar" , 0, KW_CALENDAR, false), // FWD CALENDAR extension, not a real 4GL keyword |
|
33160 |
new Keyword("CalendarBackColor" , 0, KW_CALBGCLR, false), // FWD CALENDAR extension |
|
33161 |
new Keyword("CalendarForeColor" , 0, KW_CALFGCLR, false), // FWD CALENDAR extension |
|
33140 | 33162 |
new Keyword("call" , 0, KW_CALL , true ), |
33141 | 33163 |
new Keyword("call-name" , 0, KW_CALL_NAM, false), |
33142 | 33164 |
new Keyword("call-type" , 0, KW_CALL_TYP, false), |
... | ... | |
33323 | 33345 |
new Keyword("cursor-offset" , 0, KW_CUR_OFF , false), |
33324 | 33346 |
new Keyword("cursor-right" , 0, KW_CUR_RGHT, false), // missing in keyword index, found elsewhere in lang ref |
33325 | 33347 |
new Keyword("cursor-up" , 0, KW_CUR_UP , false), // missing in keyword index, found elsewhere in lang ref |
33348 |
new Keyword("CustomFormat" , 0, KW_CALCUFMT, false), // CALENDAR:CustomFormat extension |
|
33326 | 33349 |
new Keyword("cut" , 0, KW_CUT , false), // missing in keyword index, found in prog handbook as a key function |
33327 | 33350 |
new Keyword("data-bind" , 0, KW_DATA_BND, false), |
33328 | 33351 |
new Keyword("data-entry-return" , 14, KW_DATA_E_R, false), |
... | ... | |
33338 | 33361 |
new Keyword("dataset-handle" , 0, KW_DSET_HND, true ), |
33339 | 33362 |
new Keyword("date" , 0, KW_DATE , false), |
33340 | 33363 |
new Keyword("datetime" , 0, KW_DATETIME, false), // missing from keyword index and UNTESTED at this time |
33364 |
new Keyword("DateTimeValue" , 0, KW_CALVALUE, false), // CALENDAR:VALUE extension |
|
33341 | 33365 |
new Keyword("datetime-tz" , 0, KW_DATE_TZ , false), // missing from keyword index and UNTESTED at this time |
33342 | 33366 |
new Keyword("date-format" , 6, KW_DATE_FMT, false), |
33343 | 33367 |
new Keyword("date-separator" , 0, KW_DATE_SEP, false), // FWD extension, not a real 4GL keyword |
... | ... | |
33645 | 33669 |
new Keyword("form-long-input" , 0, KW_FORM_LIN, false), |
33646 | 33670 |
new Keyword("format" , 4, KW_FORMAT , true ), // handles "separate keyword" form too |
33647 | 33671 |
new Keyword("format-datetime" , 0, KW_FMT_DT , false), // not a real keyword, but is normally defined in the PSC webspeed 4GL code |
33672 |
new Keyword("FormatStyle" , 0, KW_CALFMTST, false), // FWD extension for CALENDAR:FormatStyle, not a real 4GL keyword |
|
33648 | 33673 |
new Keyword("formatted" , 8, KW_FORMATTE, false), |
33649 | 33674 |
new Keyword("forward-only" , 0, KW_FWD_ONLY, false), // missing from keyword index and UNTESTED at this time |
33650 | 33675 |
new Keyword("forwards" , 7, KW_FORWARD , false), // handles "separate keyword" forward too |
... | ... | |
34384 | 34409 |
new Keyword("object" , 0, KW_OBJECT , false), |
34385 | 34410 |
new Keyword("octet-length" , 0, KW_OCT_LEN , false), |
34386 | 34411 |
new Keyword("ocx-mouse-button" , 0, KW_OCX_MBTN, false), // FWD extension, not a real 4GL keyword |
34412 |
new Keyword("mouse-icon" , 0, KW_MSICON, false), // FWD WidgetExtension extension, not a real 4GL keyword |
|
34413 |
new Keyword("mouse-pointer-num" , 0, KW_MSPNTNUM, false), // FWD WidgetExtension extension, not a real 4GL keyword |
|
34387 | 34414 |
new Keyword("ocx-mouse-shift" , 0, KW_OCX_MSHT, false), // FWD extension, not a real 4GL keyword |
34388 | 34415 |
new Keyword("ocx-mouse-x" , 0, KW_OCX_MSX , false), // FWD extension, not a real 4GL keyword |
34389 | 34416 |
new Keyword("ocx-mouse-y" , 0, KW_OCX_MSY , false), // FWD extension, not a real 4GL keyword |
... | ... | |
34547 | 34574 |
new Keyword("pb-appearance" , 0, KW_PB_APPEA, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34548 | 34575 |
new Keyword("pb-border-style" , 0, KW_PB_BRSTY, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34549 | 34576 |
new Keyword("pb-enabled" , 0, KW_PB_ENABL, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34550 |
new Keyword("pb-mouse-icon" , 0, KW_PB_MSICO, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
|
34551 |
new Keyword("pb-mouse-pointer" , 0, KW_PB_MSPNT, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
|
34552 | 34577 |
new Keyword("pb-max" , 0, KW_PB_MAX , false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34553 | 34578 |
new Keyword("pb-min" , 0, KW_PB_MIN , false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34554 | 34579 |
new Keyword("pb-orientation" , 0, KW_PB_ORIEN, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34555 |
new Keyword("pb-refresh" , 0, KW_PB_RFRSH, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
|
34556 | 34580 |
new Keyword("pb-scrolling" , 0, KW_PB_SCROL, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34557 | 34581 |
new Keyword("pb-value" , 0, KW_PB_VALUE, false), // FWD PROGRESS-BAR extension, not a real 4GL keyword |
34558 | 34582 |
new Keyword("progress-source" , 10, KW_PROG_SRC, false), |
... | ... | |
34622 | 34646 |
new Keyword("refresh" , 0, KW_REFRESH , false), |
34623 | 34647 |
new Keyword("refresh-audit-policy" , 0, KW_REFR_A_P, false), |
34624 | 34648 |
new Keyword("refreshable" , 0, KW_REFRABLE, false), |
34649 |
new Keyword("refresh-ui" , 0, KW_RFRSH_UI, false), // FWD WidgetExtension extension, not a real 4GL keyword |
|
34625 | 34650 |
new Keyword("register-domain" , 0, KW_REG_DMN , false), |
34626 | 34651 |
new Keyword("reject-changes" , 0, KW_REJ_CHGS, false), // missing from keyword index and UNTESTED at this time |
34627 | 34652 |
new Keyword("reject-row-changes" , 0, KW_REJ_RCHG, false), // missing from keyword index and UNTESTED at this time |
... | ... | |
35083 | 35108 |
new Keyword("ttcodepage" , 0, KW_TTCP , false), // missing from keyword index and UNTESTED at this time |
35084 | 35109 |
new Keyword("type" , 0, KW_TYPE , false), |
35085 | 35110 |
new Keyword("type-of" , 0, KW_TYPE_OF , false), |
35111 |
new Keyword("TitleBackColor" , 0, KW_CALTITBG, false), // CALENDAR:TitleBackColor |
|
35112 |
new Keyword("TitleForeColor" , 0, KW_CALTITFG, false), // CALENDAR:TitleForeColor |
|
35113 |
new Keyword("TrailingForeColor" , 0, KW_CALTRLFG, false), // CALENDAR:TrailingForeColor |
|
35086 | 35114 |
new Keyword("unbox" , 6, KW_UNBOX , false), |
35087 | 35115 |
new Keyword("unbuffered" , 6, KW_UNBUF , false), |
35088 | 35116 |
new Keyword("undo" , 0, KW_UNDO , true ), |
src/com/goldencode/p2j/ui/Calendar.java 2020-02-25 16:18:50 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : Calendar.java |
|
3 |
** Abstract : Calendar widget interface. |
|
4 |
** |
|
5 |
** Copyright (c) 2020, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- --------------------------------Description----------------------------------- |
|
8 |
** 001 SBI 20200114 Created initial version. |
|
9 |
*/ |
|
10 | ||
11 |
/* |
|
12 |
** This program is free software: you can redistribute it and/or modify |
|
13 |
** it under the terms of the GNU Affero General Public License as |
|
14 |
** published by the Free Software Foundation, either version 3 of the |
|
15 |
** License, or (at your option) any later version. |
|
16 |
** |
|
17 |
** This program is distributed in the hope that it will be useful, |
|
18 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 |
** GNU Affero General Public License for more details. |
|
21 |
** |
|
22 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
23 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
24 |
** |
|
25 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
26 |
** |
|
27 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
28 |
** terms apply to the works covered under the License. These additional terms |
|
29 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
30 |
** Affero GPL version 3 and may not be removed by you. |
|
31 |
** |
|
32 |
** 0. Attribution Requirement. |
|
33 |
** |
|
34 |
** You must preserve all legal notices or author attributions in the covered |
|
35 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
36 |
** work. You may not remove from the covered work any author or developer |
|
37 |
** credit already included within the covered work. |
|
38 |
** |
|
39 |
** 1. No License To Use Trademarks. |
|
40 |
** |
|
41 |
** This license does not grant any license or rights to use the trademarks |
|
42 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
43 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
44 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
45 |
** publicity purposes without written authorization. |
|
46 |
** |
|
47 |
** 2. No Misrepresentation of Affiliation. |
|
48 |
** |
|
49 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
50 |
** |
|
51 |
** You may not represent yourself for publicity purposes as associated with |
|
52 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
53 |
** the covered work, without written authorization. |
|
54 |
** |
|
55 |
** 3. No Misrepresentation of Source or Origin. |
|
56 |
** |
|
57 |
** You may not represent the covered work as solely your work. All modified |
|
58 |
** versions of the covered work must be marked in a reasonable way to make it |
|
59 |
** clear that the modified work is not originating from Golden Code Development |
|
60 |
** Corporation or FWD. All modified versions must contain the notices of |
|
61 |
** attribution required in this license. |
|
62 |
*/ |
|
63 | ||
64 |
package com.goldencode.p2j.ui; |
|
65 | ||
66 |
import com.goldencode.p2j.util.*; |
|
67 | ||
68 | ||
69 |
/** |
|
70 |
* Defines exported methods and constants for the calendar widget. |
|
71 |
*/ |
|
72 |
@LegacyResource(resource = LegacyResource.CALENDAR) |
|
73 |
public interface Calendar |
|
74 |
extends WrappedResource, |
|
75 |
ComData, |
|
76 |
OcxMouse, |
|
77 |
OcxDragDrop, |
|
78 |
CommonWidget, |
|
79 |
CustomFont, |
|
80 |
Enabled, |
|
81 |
WidgetExtension |
|
82 |
{ |
|
83 |
/** |
|
84 |
* Returns the current date time value as a character value. |
|
85 |
* |
|
86 |
* @return The current date time value as a character value |
|
87 |
*/ |
|
88 |
@LegacyAttribute(name = "DateTimeValue") |
|
89 |
public character getDateTimeValue(); |
|
90 |
|
|
91 |
/** |
|
92 |
* Sets the current date value. |
|
93 |
* |
|
94 |
* @param value |
|
95 |
* The new current date value |
|
96 |
*/ |
|
97 |
@LegacyAttribute(name = "DateTimeValue", setter = true) |
|
98 |
public void setDateTimeValue(date value); |
|
99 | ||
100 |
/** |
|
101 |
* Sets the current date and time value. |
|
102 |
* |
|
103 |
* @param value |
|
104 |
* The new current date and time value |
|
105 |
*/ |
|
106 |
@LegacyAttribute(name = "DateTimeValue", setter = true) |
|
107 |
public void setDateTimeValue(datetime value); |
|
108 | ||
109 |
/** |
|
110 |
* Sets the current date and time value as a character value. |
|
111 |
* |
|
112 |
* @param value |
|
113 |
* The new current date and time value as a character value |
|
114 |
*/ |
|
115 |
@LegacyAttribute(name = "DateTimeValue", setter = true) |
|
116 |
public void setDateTimeValue(character value); |
|
117 | ||
118 |
/** |
|
119 |
* Sets the current date and time value representing by a string. |
|
120 |
* |
|
121 |
* @param value |
|
122 |
* The new current date and time value representing by a string |
|
123 |
*/ |
|
124 |
@LegacyAttribute(name = "DateTimeValue", setter = true) |
|
125 |
public void setDateTimeValue(String value); |
|
126 | ||
127 |
/** |
|
128 |
* Determines whether dates and times are displayed using standard or custom formatting. |
|
129 |
* |
|
130 |
* @return The date and time display format style constant. |
|
131 |
*/ |
|
132 |
@LegacyAttribute(name = "FormatStyle") |
|
133 |
integer getFormatStyle(); |
|
134 |
|
|
135 |
/** |
|
136 |
* Determines whether dates and times are displayed using standard or custom formatting. |
|
137 |
* |
|
138 |
* @param formatStyle |
|
139 |
* The date and time display format style constant. |
|
140 |
*/ |
|
141 |
@LegacyAttribute(name = "FormatStyle", setter = true) |
|
142 |
void setFormatStyle(integer formatStyle); |
|
143 |
|
|
144 |
/** |
|
145 |
* Returns the background color used to display the month portion of the dropdown calendar. |
|
146 |
* |
|
147 |
* @return The background color for the dropdown calendar given by the BGR encoding |
|
148 |
*/ |
|
149 |
@LegacyAttribute(name = "CalendarBackColor") |
|
150 |
integer getCalendarBackColor(); |
|
151 |
|
|
152 |
/** |
|
153 |
* Sets the background color used to display the month portion of the dropdown calendar. |
|
154 |
* |
|
155 |
* @param calendarBackColor |
|
156 |
* The background color for the dropdown calendar given by the BGR encoding |
|
157 |
*/ |
|
158 |
@LegacyAttribute(name = "CalendarBackColor", setter = true) |
|
159 |
void setCalendarBackColor(integer calendarBackColor); |
|
160 |
|
|
161 |
/** |
|
162 |
* Returns the foreground color used to display text in the month portion of the dropdown calendar. |
|
163 |
* |
|
164 |
* @return The foreground color for the dropdown calendar given by the BGR encoding |
|
165 |
*/ |
|
166 |
@LegacyAttribute(name = "CalendarForeColor") |
|
167 |
integer getCalendarForeColor(); |
|
168 |
|
|
169 |
/** |
|
170 |
* Sets the foreground color used to display text in the month portion of the dropdown calendar. |
|
171 |
* |
|
172 |
* @param calendarForeColor |
|
173 |
* The foreground color for the dropdown calendar given by the BGR encoding |
|
174 |
*/ |
|
175 |
@LegacyAttribute(name = "CalendarForeColor", setter = true) |
|
176 |
void setCalendarForeColor(integer calendarForeColor); |
|
177 |
|
|
178 |
/** |
|
179 |
* Returns the background color used to display the title portion of the dropdown calendar. |
|
180 |
* |
|
181 |
* @return The background color for the title portion of the dropdown calendar given by |
|
182 |
* the BGR encoding. |
|
183 |
*/ |
|
184 |
@LegacyAttribute(name = "TitleBackColor") |
|
185 |
integer getCalendarTitleBackColor(); |
|
186 |
|
|
187 |
/** |
|
188 |
* Sets the background color used to display the title portion of the dropdown calendar. |
|
189 |
* |
|
190 |
* @param titleBackColor |
|
191 |
* The background color for the title portion of the dropdown calendar given by |
|
192 |
* the BGR encoding. |
|
193 |
*/ |
|
194 |
@LegacyAttribute(name = "TitleBackColor", setter = true) |
|
195 |
void setCalendarTitleBackColor(integer titleBackColor); |
|
196 |
|
|
197 |
/** |
|
198 |
* Returns the foreground color used to display the title portion of the dropdown calendar. |
|
199 |
* |
|
200 |
* @return The foreground color for the title portion of the dropdown calendar given by |
|
201 |
* the BGR encoding. |
|
202 |
*/ |
|
203 |
@LegacyAttribute(name = "TitleForeColor") |
|
204 |
integer getCalendarTitleForeColor(); |
|
205 |
|
|
206 |
/** |
|
207 |
* Sets the foreground color used to display the title portion of the dropdown calendar. |
|
208 |
* |
|
209 |
* @param titleForeColor |
|
210 |
* The foreground color for the title portion of the dropdown calendar given by |
|
211 |
* the BGR encoding. |
|
212 |
*/ |
|
213 |
@LegacyAttribute(name = "TitleForeColor", setter = true) |
|
214 |
void setCalendarTitleForeColor(integer titleForeColor); |
|
215 |
|
|
216 |
/** |
|
217 |
* Returns the foreground color used to display the days at the beginning and end of |
|
218 |
* the dropdown calendar that are from previous and following months. |
|
219 |
* |
|
220 |
* @return The foreground color for the previous and following months of |
|
221 |
* the dropdown calendar given by the BGR encoding. |
|
222 |
*/ |
|
223 |
@LegacyAttribute(name = "TrailingForeColor") |
|
224 |
integer getCalendarTrailingForeColor(); |
|
225 |
|
|
226 |
/** |
|
227 |
* Sets the foreground color used to display the days at the beginning and end of the dropdown |
|
228 |
* calendar that are from previous and following months. |
|
229 |
* |
|
230 |
* @param trailingForeColor |
|
231 |
* The foreground color for the previous and following months of |
|
232 |
* the dropdown calendar given by the BGR encoding. |
|
233 |
*/ |
|
234 |
@LegacyAttribute(name = "TrailingForeColor", setter = true) |
|
235 |
void setCalendarTrailingForeColor(integer trailingForeColor); |
|
236 |
|
|
237 |
/** |
|
238 |
* Returns whether the control displays a checkbox to the left of the date. When unchecked, |
|
239 |
* no date is selected. |
|
240 |
* |
|
241 |
* @return True if it displays a checkbox to the left of the date, otherwise false. |
|
242 |
*/ |
|
243 |
@LegacyAttribute(name = "CheckBox") |
|
244 |
logical isCheckBox(); |
|
245 |
|
|
246 |
/** |
|
247 |
* Sets whether the control displays a checkbox to the left of the date. When unchecked, |
|
248 |
* no date is selected. |
|
249 |
* |
|
250 |
* @param enabledCheckBox |
|
251 |
* The logical value indicating a checkbox is displayed or not. |
|
252 |
*/ |
|
253 |
@LegacyAttribute(name = "CheckBox", setter = true) |
|
254 |
void setCheckBox(logical enabledCheckBox); |
|
255 |
|
|
256 |
/** |
|
257 |
* Returns the custom format string used to format the date and/or time displayed |
|
258 |
* in the control. |
|
259 |
* |
|
260 |
* @return The custom format string |
|
261 |
*/ |
|
262 |
@LegacyAttribute(name = "CustomFormat") |
|
263 |
character getCustomFormat(); |
|
264 |
|
|
265 |
/** |
|
266 |
* Sets the custom format string used to format the date and/or time displayed in the control. |
|
267 |
* |
|
268 |
* @param customFormat |
|
269 |
* The custom format string |
|
270 |
*/ |
|
271 |
@LegacyAttribute(name = "CustomFormat", setter = true) |
|
272 |
void setCustomFormat(character customFormat); |
|
273 |
|
|
274 |
/** |
|
275 |
* Sets the custom format string used to format the date and/or time displayed in the control. |
|
276 |
* |
|
277 |
* @param customFormat |
|
278 |
* The custom format string |
|
279 |
*/ |
|
280 |
@LegacyAttribute(name = "CustomFormat", setter = true) |
|
281 |
void setCustomFormat(String customFormat); |
|
282 |
|
|
283 |
/** |
|
284 |
* Returns the day number [1-31] for the current date. |
|
285 |
* |
|
286 |
* @return The day number for the current date |
|
287 |
*/ |
|
288 |
integer getDay(); |
|
289 |
|
|
290 |
/** |
|
291 |
* Sets the day number [1-31] for the current date. |
|
292 |
* |
|
293 |
* @param day |
|
294 |
* The day number for the current date |
|
295 |
*/ |
|
296 |
void setDay(integer day); |
|
297 |
|
|
298 |
/** |
|
299 |
* Returns the day of the week [0-6] for the current date. |
|
300 |
* |
|
301 |
* @return The day of the week for the current date |
|
302 |
*/ |
|
303 |
integer getDayOfWeek(); |
|
304 |
|
|
305 |
/** |
|
306 |
* Sets the day of the week [0-6] for the current date. |
|
307 |
* |
|
308 |
* @param dayOfWeek |
|
309 |
* The day of the week for the current date |
|
310 |
*/ |
|
311 |
void setDayOfWeek(integer dayOfWeek); |
|
312 |
|
|
313 |
/** |
|
314 |
* Returns the hour number [0-23] for the current time. |
|
315 |
* |
|
316 |
* @return The hour number for the current time |
|
317 |
*/ |
|
318 |
integer getHour(); |
|
319 |
|
|
320 |
/** |
|
321 |
* Sets the hour number [0-23] for the current time. |
|
322 |
* |
|
323 |
* @param hour |
|
324 |
* The hour number for the current time |
|
325 |
*/ |
|
326 |
void setHour(integer hour); |
|
327 |
|
|
328 |
/** |
|
329 |
* Returns the latest date that can be displayed or accepted by the control. |
|
330 |
* |
|
331 |
* @return The latest date that can be displayed or accepted by this control |
|
332 |
*/ |
|
333 |
date getMaxDate(); |
|
334 |
|
|
335 |
/** |
|
336 |
* Sets the latest date that can be displayed or accepted by the control. |
|
337 |
* |
|
338 |
* @param dateMaxDate |
|
339 |
* The new latest date |
|
340 |
*/ |
|
341 |
void setMaxDate(date dateMaxDate); |
|
342 |
|
|
343 |
/** |
|
344 |
* Returns the earliest date that can be displayed or accepted by the control. |
|
345 |
* |
|
346 |
* @return The earliest date |
|
347 |
*/ |
|
348 |
date getMinDate(); |
|
349 |
|
|
350 |
/** |
|
351 |
* Sets the earliest date that can be displayed or accepted by the control. |
|
352 |
* |
|
353 |
* @param dateMinDate |
|
354 |
* The new earliest date |
|
355 |
*/ |
|
356 |
void setMinDate(date dateMinDate); |
|
357 |
|
|
358 |
/** |
|
359 |
* Returns the minute number [0-59] for the current time. |
|
360 |
* |
|
361 |
* @return The minute number for the current time |
|
362 |
*/ |
|
363 |
integer getMinute(); |
|
364 |
|
|
365 |
/** |
|
366 |
* Sets the minute number [0-59] for the current time. |
|
367 |
* |
|
368 |
* @param minute |
|
369 |
* The minute number for the current time |
|
370 |
*/ |
|
371 |
void setMinute(integer minute); |
|
372 |
|
|
373 |
/** |
|
374 |
* Returns the month number [1-12] for the current date. |
|
375 |
* |
|
376 |
* @return The month number for the current date |
|
377 |
*/ |
|
378 |
integer getMonth(); |
|
379 |
|
|
380 |
/** |
|
381 |
* Sets the month number [1-12] for the current date. |
|
382 |
* |
|
383 |
* @param month |
|
384 |
* The month number for the current date |
|
385 |
*/ |
|
386 |
void setMonth(integer month); |
|
387 |
|
|
388 |
/** |
|
389 |
* Returns the second number [0-59] for the current time. |
|
390 |
* |
|
391 |
* @return The second number for the current time |
|
392 |
*/ |
|
393 |
integer getSecond(); |
|
394 |
|
|
395 |
/** |
|
396 |
* Sets the second number [0-59] for the current time. |
|
397 |
* |
|
398 |
* @param second |
|
399 |
* The second number for the current time |
|
400 |
*/ |
|
401 |
void setSecond(integer second); |
|
402 |
|
|
403 |
/** |
|
404 |
* Returns a value that determines whether an updown (spin) button is used to modify dates |
|
405 |
* instead of a dropdown calendar. |
|
406 |
* |
|
407 |
* @return True value if the updown spin button is used to modify dates instead of a dropdown |
|
408 |
* calendar, otherwise false value. |
|
409 |
*/ |
|
410 |
@LegacyAttribute(name = "UpDown") |
|
411 |
logical isUpDown(); |
|
412 | ||
413 |
/** |
|
414 |
* Sets a value that determines whether an updown (spin) buttons are used to modify dates |
|
415 |
* instead of a dropdown calendar. |
|
416 |
* |
|
417 |
* @param upDown |
|
418 |
* The logical value indicating if the up and down buttons are used to modify dates |
|
419 |
*/ |
|
420 |
@LegacyAttribute(name = "UpDown", setter = true) |
|
421 |
void setUpDown(logical upDown); |
|
422 |
|
|
423 |
/** |
|
424 |
* Returns the year for the current date. |
|
425 |
* |
|
426 |
* @return The year for the current date |
|
427 |
*/ |
|
428 |
integer getYear(); |
|
429 |
|
|
430 |
/** |
|
431 |
* Sets the year for the current date. |
|
432 |
* |
|
433 |
* @param year |
|
434 |
* The year for the current date |
|
435 |
*/ |
|
436 |
void setYear(integer year); |
|
437 |
} |
src/com/goldencode/p2j/ui/CalendarConfig.java 2020-02-25 12:56:55 +0000 | ||
---|---|---|
1 |
/* |
|
2 |
** Module : CalendarConfig.java |
|
3 |
** Abstract : The calendar widget configuration settings. |
|
4 |
** |
|
5 |
** Copyright (c) 2020, Golden Code Development Corporation. |
|
6 |
** |
|
7 |
** -#- -I- --Date-- --------------------------------Description----------------------------------- |
|
8 |
** 001 SBI 20200114 Created initial version. |
|
9 |
*/ |
|
10 | ||
11 |
/* |
|
12 |
** This program is free software: you can redistribute it and/or modify |
|
13 |
** it under the terms of the GNU Affero General Public License as |
|
14 |
** published by the Free Software Foundation, either version 3 of the |
|
15 |
** License, or (at your option) any later version. |
|
16 |
** |
|
17 |
** This program is distributed in the hope that it will be useful, |
|
18 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 |
** GNU Affero General Public License for more details. |
|
21 |
** |
|
22 |
** You may find a copy of the GNU Affero GPL version 3 at the following |
|
23 |
** location: https://www.gnu.org/licenses/agpl-3.0.en.html |
|
24 |
** |
|
25 |
** Additional terms under GNU Affero GPL version 3 section 7: |
|
26 |
** |
|
27 |
** Under Section 7 of the GNU Affero GPL version 3, the following additional |
|
28 |
** terms apply to the works covered under the License. These additional terms |
|
29 |
** are non-permissive additional terms allowed under Section 7 of the GNU |
|
30 |
** Affero GPL version 3 and may not be removed by you. |
|
31 |
** |
|
32 |
** 0. Attribution Requirement. |
|
33 |
** |
|
34 |
** You must preserve all legal notices or author attributions in the covered |
|
35 |
** work or Appropriate Legal Notices displayed by works containing the covered |
|
36 |
** work. You may not remove from the covered work any author or developer |
|
37 |
** credit already included within the covered work. |
|
38 |
** |
|
39 |
** 1. No License To Use Trademarks. |
|
40 |
** |
|
41 |
** This license does not grant any license or rights to use the trademarks |
|
42 |
** Golden Code, FWD, any Golden Code or FWD logo, or any other trademarks |
|
43 |
** of Golden Code Development Corporation. You are not authorized to use the |
|
44 |
** name Golden Code, FWD, or the names of any author or contributor, for |
|
45 |
** publicity purposes without written authorization. |
|
46 |
** |
|
47 |
** 2. No Misrepresentation of Affiliation. |
|
48 |
** |
|
49 |
** You may not represent yourself as Golden Code Development Corporation or FWD. |
|
50 |
** |
|
51 |
** You may not represent yourself for publicity purposes as associated with |
|
52 |
** Golden Code Development Corporation, FWD, or any author or contributor to |
|
53 |
** the covered work, without written authorization. |
|
54 |
** |
|
55 |
** 3. No Misrepresentation of Source or Origin. |
|
56 |
** |
|
57 |
** You may not represent the covered work as solely your work. All modified |
|
58 |
** versions of the covered work must be marked in a reasonable way to make it |
|
59 |
** clear that the modified work is not originating from Golden Code Development |
|
60 |
** Corporation or FWD. All modified versions must contain the notices of |
|
61 |
** attribution required in this license. |
|
62 |
*/ |
|
63 | ||
64 |
package com.goldencode.p2j.ui; |
|
65 | ||
66 |
import java.io.*; |
|
67 |
import java.text.*; |
|
68 |
import java.time.format.*; |
|
69 |
import java.time.temporal.*; |
|
70 |
import java.util.*; |
|
71 | ||
72 |
import com.goldencode.p2j.util.*; |
|
73 | ||
74 | ||
75 | ||
76 |
/** |
|
77 |
* Represents the calendar settings. |
|
78 |
*/ |
|
79 |
public class CalendarConfig |
|
80 |
extends WidgetConfigExt |
|
81 |
{ |
|
82 |
/** |
|
83 |
* Displays the date in long format. The default format string for this style is defined by |
|
84 |
* the current locale settings, which produces output like "Saturday, February 1, 2020". |
|
85 |
*/ |
|
86 |
public static final int DTS_LONGDATEFORMAT = 0; |
|
87 |
|
|
88 |
/** |
|
89 |
* Displays the date in short format. The default format string for this style is defined by |
|
90 |
* the current locale settings, which produces output like "02/01/20". |
|
91 |
*/ |
|
92 |
public static final int DTS_SHORTDATEFORMAT = 1; |
|
93 |
|
|
94 |
/** |
|
95 |
* Displays the time. The default format string for this style is defined by the current locale |
|
96 |
* settings, which produces output like "10:29:00 AM". |
|
97 |
*/ |
|
98 |
public static final int DTS_TIMEFORMAT = 2; |
|
99 |
|
|
100 |
/** |
|
101 |
* Displays date and time using the format string specified in the 'CustomFormat' property. |
|
102 |
*/ |
|
103 |
public static final int DTS_CUSTOMFORMAT = 3; |
|
104 |
|
|
105 |
/** |
|
106 |
* The format style constant, it can be one of DTS_LONGDATEFORMAT, DTS_SHORTDATEFORMAT, |
|
107 |
* DTS_TIMEFORMAT, DTS_CUSTOMFORMAT. |
|
108 |
*/ |
|
109 |
public int formatStyle; |
|
110 |
|
|
111 |
/** Holds the current date time format.*/ |
|
112 |
public String customFormat; |
|
113 |
|
|
114 |
/** Holds the current date or time value as a string value in the ISO-8601 calendar system. */ |
|
115 |
public String dateTimeValue; |
|
116 |
|
|
117 |
/** Holds the day number from 1 to 31. */ |
|
118 |
public int day; |
|
119 |
|
|
120 |
/** Holds the month number from 1 to 12. */ |
|
121 |
public int month; |
|
122 |
|
|
123 |
/** Holds the year number. */ |
|
124 |
public int year; |
|
125 |
|
|
126 |
/** Holds the day of week number from 0 to 6 */ |
|
127 |
public int dayOfWeek; |
|
128 |
|
|
129 |
/** Holds the hour number from 0 to 23. */ |
|
130 |
public int hour; |
|
131 |
|
|
132 |
/** Holds the minute number from 0 to 59. */ |
|
133 |
public int minute; |
|
134 |
|
|
135 |
/** Holds the second number from 0 to 59. */ |
|
136 |
public int second; |
|
137 |
|
|
138 |
/** Holds the latest possible date */ |
|
139 |
public date latestDate; |
|
140 |
|
|
141 |
/** Holds the earliest possible date */ |
|
142 |
public date earliestDate; |
|
143 |
|
|
144 |
/** The background color for the dropdown calendar given by the BGR encoding */ |
|
145 |
public int bodyBackgroundColor; |
|
146 |
|
|
147 |
/** The foreground color for the dropdown calendar given by the BGR encoding */ |
|
148 |
public int bodyForegroundColor; |
|
149 |
|
|
150 |
/** |
|
151 |
* The background color for the title portion of the dropdown calendar |
|
152 |
* given by the BGR encoding. |
|
153 |
*/ |
|
154 |
public int titleBackgroundColor; |
|
155 |
|
|
156 |
/** |
|
157 |
* The foreground color for the title portion of the dropdown calendar |
|
158 |
* given by the BGR encoding. |
|
159 |
*/ |
|
160 |
public int titleForegroundColor; |
|
161 |
|
|
162 |
/** |
|
163 |
* The foreground color for the previous and following months of |
|
164 |
* the dropdown calendar given by the BGR encoding |
|
165 |
*/ |
|
166 |
public int trailingForegroundColor; |
|
167 |
|
|
168 |
/** True if a checkbox to the left of the date must be displayed, otherwise false */ |
|
169 |
public boolean checkBox; |
|
170 |
|
|
171 |
/** Its value indicates if the up and down buttons are used to modify dates or not*/ |
|
172 |
public boolean upDown; |
|
173 |
|
|
174 |
/** Represents an index of the selected field of the date/time content */ |
|
175 |
public int selectedFieldIndex; |
|
176 |
|
|
177 |
/** |
|
178 |
* Converts the control format style to the pair of date and time legacy format style used |
|
179 |
* by java time api. If for the date format style element or for the time format style element |
|
180 |
* there doesn't exist a such correspondent legacy format style used by java time api, |
|
181 |
* then this element holds a null value. |
|
182 |
* |
|
183 |
* @param formatStyle |
|
184 |
* The format style constant provided for the calendar widget |
|
185 |
* |
|
186 |
* @return The array of the date and time legacy format styles used by java time api. |
|
187 |
*/ |
|
188 |
public static final FormatStyle[] toDateTimeStyles(int formatStyle) |
|
189 |
{ |
|
190 |
FormatStyle[] legacyStyles = new FormatStyle[2]; |
|
191 |
|
|
192 |
switch(formatStyle) |
|
193 |
{ |
|
194 |
case DTS_LONGDATEFORMAT: |
|
195 |
legacyStyles[0] = FormatStyle.FULL; |
|
196 |
break; |
|
197 |
case DTS_SHORTDATEFORMAT: |
|
198 |
legacyStyles[0] = FormatStyle.SHORT; |
|
199 |
break; |
|
200 |
case DTS_TIMEFORMAT: |
|
201 |
legacyStyles[1] = FormatStyle.SHORT; |
|
202 |
break; |
|
203 |
default: |
|
204 |
} |
|
205 |
|
|
206 |
return legacyStyles; |
|
207 |
} |
|
208 |
|
|
209 |
/** |
|
210 |
* Tests if the given format style is one of the predefined localized system date and time |
|
211 |
* formats to display dates as full or short form styles or to display times in a short form. |
|
212 |
* |
|
213 |
* @param formatStyle |
|
214 |
* The given format style |
|
215 |
* |
|
216 |
* @return true if the given format style is one of the predefined formats, otherwise false. |
|
217 |
*/ |
|
218 |
public static final boolean isLocalizedFormat(int formatStyle) |
|
219 |
{ |
|
220 |
return formatStyle != DTS_CUSTOMFORMAT; |
|
221 |
} |
|
222 |
|
|
223 |
/** |
|
224 |
* The default constructor. |
|
225 |
*/ |
|
226 |
public CalendarConfig() |
|
227 |
{ |
|
228 |
selectedFieldIndex = 0; |
|
229 |
} |
|
230 |
|
|
231 |
/** |
|
232 |
* Creates this instance using the given identifier. |
|
233 |
* |
|
234 |
* @param id |
|
235 |
* The widget identifier |
|
236 |
*/ |
|
237 |
public CalendarConfig(int id) |
|
238 |
{ |
|
239 |
super(id); |
|
240 |
selectedFieldIndex = 0; |
|
241 |
} |
|
242 |
|
|
243 |
/** |
|
244 |
* Creates this instance using the given identifier. |
|
245 |
* |
|
246 |
* @param id |
|
247 |
* The widget identifier |
|
248 |
*/ |
|
249 |
public CalendarConfig(WidgetId id) |
|
250 |
{ |
|
251 |
super(id); |
|
252 |
selectedFieldIndex = 0; |
|
253 |
} |
|
254 |
|
|
255 |
/** |
|
256 |
* Set new values from the provided configuration instance. |
|
257 |
* |
|
258 |
* @param config |
|
259 |
* The instance from which to take values. |
|
260 |
*/ |
|
261 |
@Override |
|
262 |
public void applyConfig(WidgetConfig config) |
|
263 |
{ |
|
264 |
super.applyConfig(config); |
|
265 |
|
|
266 |
CalendarConfig cfg = (CalendarConfig) config; |
|
267 |
|
|
268 |
formatStyle = cfg.formatStyle; |
|
269 |
customFormat = cfg.customFormat; |
|
270 |
dateTimeValue = cfg.dateTimeValue; |
|
271 |
|
|
272 |
day = cfg.day; |
|
273 |
month = cfg.month; |
|
274 |
year = cfg.year; |
|
275 |
|
|
276 |
dayOfWeek = cfg.dayOfWeek; |
|
277 |
|
|
278 |
hour = cfg.hour; |
|
279 |
minute = cfg.minute; |
|
280 |
second = cfg.second; |
|
281 |
|
|
282 |
latestDate = cfg.latestDate; |
|
283 |
earliestDate = cfg.earliestDate; |
|
284 |
|
|
285 |
bodyBackgroundColor = cfg.bodyBackgroundColor; |
|
286 |
bodyForegroundColor = cfg.bodyForegroundColor; |
|
287 |
titleBackgroundColor = cfg.titleBackgroundColor; |
|
288 |
titleForegroundColor = cfg.titleForegroundColor; |
|
289 |
trailingForegroundColor = cfg.trailingForegroundColor; |
|
290 |
|
|
291 |
checkBox = cfg.checkBox; |
|
292 |
upDown = cfg.upDown; |
|
293 |
|
|
294 |
selectedFieldIndex = cfg.selectedFieldIndex; |
|
295 |
} |
|
296 |
|
|
297 |
/** |
|
298 |
* Replacement for the default object reading method. The latest |
|
299 |
* state is read from the input source. The parent's state is |
|
300 |
* read first. |
|
301 |
* |
|
302 |
* @param in |
|
303 |
* The input source from which fields will be restored. |
|
304 |
* |
|
305 |
* @throws IOException |
|
306 |
* In case of I/O errors. |
|
307 |
* @throws ClassNotFoundException |
|
308 |
* If payload can't be instantiated. |
|
309 |
*/ |
|
310 |
@Override |
|
311 |
public void readExternal(ObjectInput in) |
|
312 |
throws IOException, |
|
313 |
ClassNotFoundException |