Skip to content

Commit

Permalink
added gantt demo
Browse files Browse the repository at this point in the history
  • Loading branch information
oblomov-dev committed Mar 5, 2024
1 parent 11f56a5 commit 2362c1e
Show file tree
Hide file tree
Showing 3 changed files with 282 additions and 33 deletions.
65 changes: 32 additions & 33 deletions src/z2ui5_cl_demo_app_178.clas.abap
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
class Z2UI5_CL_DEMO_APP_178 definition
public
final
create public .
CLASS z2ui5_cl_demo_app_178 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .

public section.
PUBLIC SECTION.

interfaces IF_SERIALIZABLE_OBJECT .
interfaces Z2UI5_IF_APP .
INTERFACES z2ui5_if_app.

types:
BEGIN OF ty_prodh_node_level3,
TYPES:
BEGIN OF ty_prodh_node_level3,
is_selected TYPE abap_bool,
text TYPE string,
prodh TYPE string,
END OF ty_prodh_node_level3 .
types:
BEGIN OF ty_prodh_node_level2,
TYPES:
BEGIN OF ty_prodh_node_level2,
is_selected TYPE abap_bool,
text TYPE string,
prodh TYPE string,
expanded TYPE abap_bool,
nodes TYPE STANDARD TABLE OF ty_prodh_node_level3 WITH DEFAULT KEY,
END OF ty_prodh_node_level2 .
types:
BEGIN OF ty_prodh_node_level1,
TYPES:
BEGIN OF ty_prodh_node_level1,
is_selected TYPE abap_bool,
text TYPE string,
prodh TYPE string,
expanded TYPE abap_bool,
nodes TYPE STANDARD TABLE OF ty_prodh_node_level2 WITH DEFAULT KEY,
END OF ty_prodh_node_level1 .
types:
ty_prodh_nodes TYPE STANDARD TABLE OF ty_prodh_node_level1 WITH DEFAULT KEY .
types:
BEGIN OF ty_prodh_node_level2_ex,
expanded TYPE abap_bool,
TYPES:
ty_prodh_nodes TYPE STANDARD TABLE OF ty_prodh_node_level1 WITH DEFAULT KEY .
TYPES:
BEGIN OF ty_prodh_node_level2_ex,
expanded TYPE abap_bool,
END OF ty_prodh_node_level2_ex .
types:
BEGIN OF ty_prodh_node_level1_ex,
expanded TYPE abap_bool,
nodes TYPE STANDARD TABLE OF ty_prodh_node_level2_ex WITH DEFAULT KEY,
TYPES:
BEGIN OF ty_prodh_node_level1_ex,
expanded TYPE abap_bool,
nodes TYPE STANDARD TABLE OF ty_prodh_node_level2_ex WITH DEFAULT KEY,
END OF ty_prodh_node_level1_ex .
types:
ty_prodh_nodes_ex TYPE STANDARD TABLE OF ty_prodh_node_level1_ex WITH DEFAULT KEY .
TYPES:
ty_prodh_nodes_ex TYPE STANDARD TABLE OF ty_prodh_node_level1_ex WITH DEFAULT KEY .

data PRODH_NODES type TY_PRODH_NODES .
data PRODH_NODES_EX type TY_PRODH_NODES_EX .
data IS_INITIALIZED type ABAP_BOOL .
DATA prodh_nodes TYPE ty_prodh_nodes .
DATA prodh_nodes_ex TYPE ty_prodh_nodes_ex .
DATA is_initialized TYPE abap_bool .

methods UI5_DISPLAY_VIEW .
METHODS ui5_display_view .
PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client.
Expand All @@ -60,10 +59,10 @@ ENDCLASS.



CLASS Z2UI5_CL_DEMO_APP_178 IMPLEMENTATION.
CLASS z2ui5_cl_demo_app_178 IMPLEMENTATION.


METHOD UI5_DISPLAY_POPUP_TREE_SELECT.
METHOD ui5_display_popup_tree_select.

DATA(dialog) = z2ui5_cl_xml_view=>factory_popup(
)->dialog( title = 'Choose Product here...' contentheight = '50%' contentwidth = '50%' ).
Expand Down Expand Up @@ -91,7 +90,7 @@ CLASS Z2UI5_CL_DEMO_APP_178 IMPLEMENTATION.
ENDMETHOD.


METHOD UI5_DISPLAY_VIEW.
METHOD ui5_display_view.

client->_bind_edit( prodh_nodes_ex ).

Expand All @@ -111,7 +110,7 @@ CLASS Z2UI5_CL_DEMO_APP_178 IMPLEMENTATION.
ENDMETHOD.


METHOD UI5_INITIALIZE.
METHOD ui5_initialize.
prodh_nodes =
VALUE #( ( text = 'Machines'
prodh = '00100'
Expand Down Expand Up @@ -151,7 +150,7 @@ CLASS Z2UI5_CL_DEMO_APP_178 IMPLEMENTATION.
ENDMETHOD.


METHOD Z2UI5_IF_APP~MAIN.
METHOD z2ui5_if_app~main.

me->client = client.

Expand Down
234 changes: 234 additions & 0 deletions src/z2ui5_cl_demo_app_179.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
CLASS z2ui5_cl_demo_app_179 DEFINITION
PUBLIC
CREATE PUBLIC .

PUBLIC SECTION.

INTERFACES z2ui5_if_app.

TYPES:
BEGIN OF ty_s_relationships,
id TYPE string,
successor TYPE string,
presuccessor TYPE string,
END OF ty_s_relationships.

TYPES ty_t_relation TYPE STANDARD TABLE OF ty_s_relationships WITH DEFAULT KEY .

TYPES:
BEGIN OF t_subtask5,
id TYPE string,
starttime TYPE string,
endtime TYPE string,
END OF t_subtask5 .
TYPES:
tt_subtask5 TYPE STANDARD TABLE OF t_subtask5 WITH DEFAULT KEY .
TYPES:
BEGIN OF t_task3,
id TYPE string,
starttime TYPE string,
endtime TYPE string,
END OF t_task3 .
TYPES:
BEGIN OF t_children4,
id TYPE string,
text TYPE string,
subtask TYPE tt_subtask5,
relations TYPE ty_t_relation,
END OF t_children4 .
TYPES:
tt_task3 TYPE STANDARD TABLE OF t_task3 WITH DEFAULT KEY .
TYPES:
tt_children4 TYPE STANDARD TABLE OF t_children4 WITH DEFAULT KEY .

TYPES:
BEGIN OF t_children2,
id TYPE string,
text TYPE string,
task TYPE tt_task3,
children TYPE tt_children4,
relationships TYPE ty_t_relation,
END OF t_children2 .
TYPES:
tt_children2 TYPE STANDARD TABLE OF t_children2 WITH DEFAULT KEY .
TYPES:
BEGIN OF t_root6,
children TYPE tt_children2,
END OF t_root6 .
TYPES:
BEGIN OF t_json1,
root TYPE t_root6,
END OF t_json1 .

DATA mt_table TYPE t_root6 .
DATA zoomlevel TYPE i .

PROTECTED SECTION.

DATA client TYPE REF TO z2ui5_if_client .
DATA check_initialized TYPE abap_bool .

METHODS z2ui5_on_init .
METHODS z2ui5_on_event .
METHODS z2ui5_set_data .

PRIVATE SECTION.
ENDCLASS.


CLASS z2ui5_cl_demo_app_179 IMPLEMENTATION.


METHOD z2ui5_if_app~main.
me->client = client.

IF check_initialized = abap_false.
check_initialized = abap_true.

z2ui5_set_data( ).
z2ui5_on_init( ).
RETURN.
ENDIF.

z2ui5_on_event( ).

ENDMETHOD.


METHOD z2ui5_on_event.

CASE client->get( )-event.
WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
ENDCASE.

ENDMETHOD.


METHOD z2ui5_on_init.


DATA(view) = z2ui5_cl_xml_view=>factory( ).

view->_generic_property( VALUE #( n = `core:require` v = `{Helper:'z2ui5/Util'}` ) ).

DATA(page) = view->page( id = `page_main`
title = 'abap2UI5 - Gantt'
navbuttonpress = client->_event( 'BACK' )
shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL )
class = 'sapUiContentPadding' ).

DATA(cont) = page->scroll_container(
* height =
* width =
* vertical =
horizontal = abap_true
* id =
* focusable =
* visible =
).

DATA(tool) = cont->container_toolbar(

Check failure on line 131 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Method importing parameter "FINDBUTTONPRESS" does not exist

https://rules.abaplint.org/check_syntax

Check failure on line 131 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint / abap_cloud_readiness

Method importing parameter "FINDBUTTONPRESS" does not exist

https://rules.abaplint.org/check_syntax
EXPORTING

Check failure on line 132 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

The EXPORTING keyword can be omitted

https://rules.abaplint.org/exporting
showsearchbutton = abap_true
showdisplaytypebutton = abap_true
showlegendbutton = abap_true
showsettingbutton = abap_true
showtimezoomcontrol = abap_true
findbuttonpress = client->_event( val = 'FIRE' )
* stepcountofslider =
* zoomcontroltype =
zoomlevel = client->_bind_edit( zoomlevel )
* RECEIVING
* result =
).


DATA(gantt_container) = cont->gantt_chart_container( ).
DATA(gantt) = gantt_container->gantt_chart_with_table( id = `gantt` shapeselectionmode = `Single` ).

gantt->axis_time_strategy(
)->proportion_zoom_strategy( zoomlevel = client->_bind_edit( zoomlevel )
)->total_horizon(
)->time_horizon( starttime = `20181029000000` endtime = `20181231000000` )->get_parent( )->get_parent(
)->visible_horizon(
)->time_horizon( starttime = `20181029000000` endtime = `20181131000000` )->get_parent( )->get_parent( )->get_parent( )->get_parent(
).
DATA(table) = gantt->gantt_table( )->tree_table( rows = `{path: '` && client->_bind( val = mt_table path = abap_true ) && `', parameters: {arrayNames: ['CHILDREN'],numberOfExpandedLevels: 1}}`
).
DATA(gantt_row_template) = table->tree_columns(
)->tree_column( label = 'Col 1' )->tree_template( )->text( text = `{TEXT}` )->get_parent( )->get_parent( )->get_parent(
* )->tree_column( label = 'Col 1' template = 'text' )->get_parent( )->get_parent(
)->row_settings_template(
).

DATA gantt_rs TYPE REF TO z2ui5_cl_xml_view.
gantt_rs = gantt_row_template->gantt_row_settings( rowid = `{ID}`

Check failure on line 166 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Method importing parameter "RELATIONSHIPS" does not exist

https://rules.abaplint.org/check_syntax

Check failure on line 166 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint / abap_cloud_readiness

Method importing parameter "RELATIONSHIPS" does not exist

https://rules.abaplint.org/check_syntax
shapes1 = `{path: 'TASK', templateShareable:false}`
shapes2 = `{path: 'SUBTASK', templateShareable:false}`
relationships = `{path:'RELATIONSHIPS', templateShareable:false}`
).

gantt_rs->shapes1(

Check failure on line 172 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Method importing parameter "ID" does not exist

https://rules.abaplint.org/check_syntax

Check failure on line 172 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint / abap_cloud_readiness

Method importing parameter "ID" does not exist

https://rules.abaplint.org/check_syntax
)->task( id = 'TSK1' time = `{= Helper.DateCreateObject(${STARTTIME} ) }`
endtime = `{= Helper.DateCreateObject(${ENDTIME} ) }` type = `SummaryExpanded` color = `sapUiAccent5` connectable = abap_true )."->get_parent( )->get_parent(

gantt_rs->shapes2(

Check failure on line 176 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Method importing parameter "ID" does not exist

https://rules.abaplint.org/check_syntax

Check failure on line 176 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint / abap_cloud_readiness

Method importing parameter "ID" does not exist

https://rules.abaplint.org/check_syntax
)->task( id = 'TSK2' time = `{= Helper.DateCreateObject(${STARTTIME} ) }`
endtime = `{= Helper.DateCreateObject(${ENDTIME} ) }`
connectable = abap_true ).




DATA lo_s TYPE REF TO z2ui5_cl_xml_view.
lo_s = gantt_rs->relationships( ).

Check failure on line 185 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Method "relationships" not found, methodCallChain

https://rules.abaplint.org/check_syntax

Check failure on line 185 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint / abap_cloud_readiness

Method "relationships" not found, methodCallChain

https://rules.abaplint.org/check_syntax


* <gnt2:relationships>
* <gnt2:Relationship shapeId="{data>RelationID}"
* predecessor="{data>PredecTaskID}" successor="{data>SuccTaskID}" type="{data>RelationType}" tooltip="{data>RelationType}"
* selectable="true"/>
* </gnt2:relationships>




CALL METHOD lo_s->relationship

Check failure on line 197 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Method or attribute "relationship" not found, MethodSource

https://rules.abaplint.org/check_syntax

Check failure on line 197 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint / abap_cloud_readiness

Method or attribute "relationship" not found, MethodSource

https://rules.abaplint.org/check_syntax
EXPORTING
shapeid = '{ID}'
successor = '{SUCCESSOR}'
predecessor = '{PRESUCCESSOR}'
type = 'StartToFinish'
RECEIVING
result = DATA(lo_rel).

Check failure on line 204 in src/z2ui5_cl_demo_app_179.clas.abap

View check run for this annotation

abaplint / abaplint

Use functional writing style for method calls

https://rules.abaplint.org/functional_writing

* RECEIVING
* result =.



client->view_display( view->stringify( ) ).

ENDMETHOD.


METHOD z2ui5_set_data.


mt_table = VALUE #( children = VALUE #( ( id = `line`
text = `Level 1`
task = VALUE #( ( id = `rectangle1` starttime = `2018-11-01T09:00:00` endtime = `2018-11-27T09:00:00` ) )
relationships = VALUE #( ( id = '34' successor = `chevron1` presuccessor = `chevron2` ) )


children = VALUE #( ( id = `line2` text = `Level 2`
subtask = VALUE #( ( id = `chevron1` starttime = `2018-11-01T09:00:00` endtime = `2018-11-13T09:00:00` )
( id = `chevron2` starttime = `2018-11-15T09:00:00` endtime = `2018-11-27T09:00:00` ) )
relations = VALUE #( ( id = '34' successor = `chevron1` presuccessor = `chevron2` ) )


) ) ) ) ) .

ENDMETHOD.
ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_179.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_DEMO_APP_179</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>gantt II</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 2362c1e

Please sign in to comment.