Posted: Mon Nov 05, 2007 3:17 pm Post subject: Demo: GFW: A hierarchy graphic (4 in splitter, Drag&Drop
Code:
REPORT GFW_DEMO_HIER2 .
***********************************************************************
* This is a program to demonstrate the functionality of the
* Graphical Framework (GFW).
* This is not a programming example. If you want to learn how to
* use the GFW in your own programs please take a closer look at our
* programming examples (with prefix GFW_PROG_).
***********************************************************************
*-----------------------------------------------------------------------
* IMPORTANT technical hint:
* In this example the "auto_link" feature of the hierarchy graphic
* proxy is not used. Therefore the data container is filled with links
* in addition to nodes.
* It's easier to use auto_link (see method constructor of
* cl_gui_gp_hier) and of course greatly improves performance
* (half as many objects in data container).
* Nevertheless this example shows the more complex way of filling the
* data container for the hierarchy proxy.
*-----------------------------------------------------------------------
* texts for example programs of GFW
INCLUDE GFW_PROG_TEXT.
* data container (DC)
INCLUDE GFW_DC_HIER.
CLASS CL_GUI_CFW DEFINITION LOAD.
CLASS CL_GFW_MUX DEFINITION LOAD.
DATA: OK_CODE TYPE SY-UCOMM,
DOCU_ID TYPE DOKHL-ID,
DOCU_LANGU TYPE DOKHL-LANGU,
DOCU_OBJECT TYPE DOKHL-OBJECT,
FIRSTCALL TYPE I,
DC_INST TYPE REF TO LCL_DC_HIER,
DC_MANAGE TYPE REF TO IF_DC_MANAGEMENT,
MY_ID_AT_DC TYPE I,
RETVAL TYPE SYMSGNO,
GP1 TYPE REF TO CL_GUI_GP_HIER,
GP2 TYPE REF TO CL_GUI_GP_HIER,
GP3 TYPE REF TO CL_GUI_GP_HIER,
GP4 TYPE REF TO CL_GUI_GP_HIER,
EVTCODE_LIST TYPE CNTL_SIMPLE_EVENTS,
SIMPLE_EVENT type CNTL_SIMPLE_EVENT,
FILTER_LIST TYPE GFW_FILTER_LIST,
CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
SPLITTER TYPE REF TO CL_GUI_EASY_SPLITTER_CONTAINER,
NESTED TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
NESTED_AREA1 type ref to cl_gui_container,
NESTED_AREA2 type ref to cl_gui_container,
NESTED_AREA3 type ref to cl_gui_container,
ITEM_LIST TYPE GFW_ITEM_ATTRIB_LIST,
item_name type gfw_item_attrib,
drag_behavior_list type gfw_behavior_list,
drop_behavior_list type gfw_behavior_list,
cu_person type ref to cl_cu_point,
cu_department type ref to cl_cu_point
.
class lcl_appl_dragdrop_object definition.
public section.
data: object_list type gfw_proxy_obj_data_list.
endclass.
class lcl_appl_dragdrop_object implementation.
endclass.
* main class needed to catch gui events
CLASS LCL_MAIN DEFINITION.
PUBLIC SECTION.
METHODS: ON_CLOSED FOR EVENT IF_GRAPHIC_PROXY~GRAPHIC_CLOSED
OF CL_GUI_GP_HIER IMPORTING EVENT,
ON_DBLCLK FOR EVENT
IF_GRAPHIC_PROXY~GRAPHIC_MOUSE_DBLCLK_LEFT
OF CL_GUI_GP_HIER IMPORTING EVENT,
* event handler for drag&drop
ON_FLAVOR_REQUESTED FOR EVENT
obj_FLAVOR_REQUESTED OF if_evt_dragdrop
IMPORTING PROXY_OBJ_DATA drag_drop_object,
ON_DRAGGED FOR EVENT
obj_dragged OF if_evt_dragdrop
IMPORTING PROXY_OBJ_DATA_LIST drag_drop_object,
ON_DROPPED FOR EVENT
obj_dropped OF if_evt_dragdrop
IMPORTING PROXY_OBJ_DATA drag_drop_object,
ON_DROP_COMPLETED FOR EVENT
obj_DROP_COMPLETED OF if_evt_dragdrop
IMPORTING PROXY_OBJ_DATA_LIST drag_drop_object.
PRIVATE SECTION.
DATA: GFW_RETVAL TYPE SYMSGNO.
METHODS: RESET_FILTER
IMPORTING FROM TYPE I TO TYPE I,
SET_FILTER
IMPORTING TO TYPE I OBJID TYPE GFWDCHIER-OBJID.
ENDCLASS.
CLASS LCL_MAIN IMPLEMENTATION.
METHOD ON_CLOSED.
GFW_RETVAL = CL_GFW=>OK.
* clear all objects
IF NOT CUSTOM_CONTAINER IS INITIAL.
call method CUSTOM_CONTAINER->free.
ENDIF.
IF GFW_RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = GFW_RETVAL.
ELSE. "// optional
CLEAR GP1. CLEAR GP2. CLEAR GP3. CLEAR GP4.
CLEAR DC_MANAGE. CLEAR DC_INST.
ENDIF.
LEAVE PROGRAM.
ENDMETHOD. "//on_closed
METHOD ON_DBLCLK.
DATA: EVT_PARAMETER TYPE GFW_EVTPARAM, OBJID TYPE GFWDCHIER-OBJID.
GFW_RETVAL = CL_GFW=>OK.
READ TABLE EVENT-EVTPARAM_LIST INTO EVT_PARAMETER
WITH KEY NAME = IF_GRAPHIC_PROXY=>CO_EVTPARAM_RC.
IF SY-SUBRC = 0 OR SY-SUBRC = 2.
* error occurred in event handling
GFW_RETVAL = EVT_PARAMETER-VALUE.
ELSE.
* get OBJID for DC
READ TABLE EVENT-EVTPARAM_LIST INTO EVT_PARAMETER
WITH KEY NAME = IF_GRAPHIC_PROXY=>CO_EVTPARAM_OBJID.
IF SY-SUBRC <> 0 AND SY-SUBRC <2>E_GP_GRAPH_OBJID.
ENDIF.
ENDIF.
IF GFW_RETVAL = CL_GFW=>OK.
* reset object filter from 2 to 1
CALL METHOD RESET_FILTER EXPORTING FROM = 2 TO = 1.
ENDIF.
IF GFW_RETVAL = CL_GFW=>OK.
* set object filter from 1 to 2 for EVT_PARAMETER-VALUE and its
* children
OBJID = EVT_PARAMETER-VALUE.
CALL METHOD SET_FILTER EXPORTING TO = 2 OBJID = OBJID.
ENDIF.
IF GFW_RETVAL = CL_GFW=>OK AND NOT DC_MANAGE IS INITIAL.
* data changes are ok -> distribute them to all graphics
CALL METHOD DC_MANAGE->DISTRIBUTE_CHANGES
IMPORTING RETVAL = GFW_RETVAL.
ENDIF.
IF GFW_RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = GFW_RETVAL.
ENDIF.
ENDMETHOD. "//on dblclk
method ON_FLAVOR_REQUESTED.
* nothing to do because there's only 1 flavor in this demo program
ENDMETHOD.
method ON_DRAGGED.
* IMPORTING PROXY_OBJ_DATA_LIST dragdrop_object,
*
* write proxy data to dragdrop_object (encapsulated in a class)
* (there's no special application data necessary to identify data object
* because it's a modus-internal drag&drop and all participants are
* registered to the same data container in this demo program)
data: appl_data type ref to lcl_appl_dragdrop_object.
create object appl_data.
appl_data->object_list = proxy_obj_data_list.
drag_drop_object->object = appl_data.
endmethod. "//on_dragged
method ON_DROPPED.
* IMPORTING PROXY_OBJ_DATA dragdrop_object
DATA: proxy_object type ref to cl_gfw_object,
appl_data type ref to lcl_appl_dragdrop_object,
DEST_OBJID TYPE GFWDCHIER-OBJID,
SRC_OBJID TYPE GFWDCHIER-OBJID,
LINK_OBJID TYPE GFWDCHIER-OBJID,
MODE TYPE I,
VALUE_COUNTER TYPE I.
GFW_RETVAL = CL_GFW=>OK.
* GFW always serves
* PROXY_OBJ_DATA for the target/destination node
* dragdrop_object->object for the list of source nodes
proxy_object ?= proxy_obj_data.
DEST_OBJID = proxy_object->objid.
appl_data ?= drag_drop_object->object.
** move all src nodes (set filter of node itself and its link to parent)
loop at appl_data->object_list into proxy_object.
src_objid = proxy_object->objid.
* set obj filter to 3 for src_objid and its children
CALL METHOD DC_MANAGE->SET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_VALUE = SRC_OBJID
ATTRIBUTE = 'FILTER'
FIELD_VALUE = 3
IMPORTING RETVAL = GFW_RETVAL.
CALL METHOD set_filter EXPORTING to = 3 objid = src_objid.
IF GFW_RETVAL = CL_GFW=>OK.
* set filter (and PRED) of parent link of src_obj to 3 (objid)
VALUE_COUNTER = 1.
CALL METHOD DC_MANAGE->GET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_ATTRIBUTE = 'SUCC' "#EC NOTEXT
KEY_VALUE = SRC_OBJID
ATTRIBUTE = 'OBJID' "#EC NOTEXT
IMPORTING MODE = MODE
FIELD_VALUE = LINK_OBJID
RETVAL = GFW_RETVAL
CHANGING VALUE_COUNTER = VALUE_COUNTER.
IF GFW_RETVAL <CL_GFW>I_DC_SET_OF_VAL AND
GFW_RETVAL <CL_GFW>OK.
GFW_RETVAL = CL_GFW=>OK.
EXIT. "// no link found (src_obj = root) => ready
ELSE.
* set filter of link itself
CALL METHOD DC_MANAGE->SET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_VALUE = LINK_OBJID
ATTRIBUTE = 'FILTER'
FIELD_VALUE = 3
IMPORTING RETVAL = GFW_RETVAL.
IF GFW_RETVAL = CL_GFW=>OK.
CALL METHOD DC_MANAGE->SET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_VALUE = LINK_OBJID
ATTRIBUTE = 'PRED'
FIELD_VALUE = DEST_OBJID
IMPORTING RETVAL = GFW_RETVAL.
ENDIF.
ENDIF.
ENDIF.
endloop.
IF GFW_RETVAL = CL_GFW=>OK AND NOT DC_MANAGE IS INITIAL.
* data changes are ok -> distribute them to all graphics
CALL METHOD DC_MANAGE->DISTRIBUTE_CHANGES
IMPORTING RETVAL = GFW_RETVAL.
ENDIF.
IF GFW_RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = GFW_RETVAL.
ENDIF.
endmethod. "//on_Dropped
method ON_DROP_COMPLETED.
* IMPORTING PROXY_OBJ_DATA_LIST dragdrop_object
* nothing to do because everything is done in the method ON_DROPPED.
endmethod.
METHOD RESET_FILTER.
* IMPORTING from TYPE i to TYPE i
DATA: MODE TYPE I, OBJID TYPE GFWDCHIER-OBJID, VALUE_COUNTER TYPE I,
SET_RETVAL TYPE SYMSGNO.
IF DC_MANAGE IS INITIAL.
GFW_RETVAL = CL_GFW=>ERR.
EXIT.
ENDIF.
GFW_RETVAL = CL_GFW=>OK. VALUE_COUNTER = 1.
DO. "//scan data container
CALL METHOD DC_MANAGE->GET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_ATTRIBUTE = 'FILTER'
KEY_VALUE = FROM
ATTRIBUTE = 'OBJID'
IMPORTING MODE = MODE
FIELD_VALUE = OBJID
RETVAL = GFW_RETVAL
CHANGING VALUE_COUNTER = VALUE_COUNTER.
IF GFW_RETVAL = CL_GFW=>I_DC_SET_OF_VAL OR GFW_RETVAL = CL_GFW=>OK.
CALL METHOD DC_MANAGE->SET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_VALUE = OBJID
ATTRIBUTE = 'FILTER'
FIELD_VALUE = TO
IMPORTING RETVAL = SET_RETVAL. "//ignore ret
ENDIF.
IF GFW_RETVAL = CL_GFW=>I_DC_SET_OF_VAL.
* don't change value_counter (the old 1st object has been changed so
* the old 2nd object is now the 1st object found)
CONTINUE.
ELSE.
"// error occurred or ready (not found or set)
EXIT.
ENDIF.
ENDDO.
GFW_RETVAL = CL_GFW=>OK.
ENDMETHOD. "//reset_filter
METHOD SET_FILTER.
* IMPORTING to TYPE i objid TYPE gfwdchier-objid
DATA: MODE TYPE I, NEXT_OBJID TYPE GFWDCHIER-OBJID,
LINK_OBJID TYPE GFWDCHIER-OBJID,
VALUE_COUNTER TYPE I, TMP_COUNTER TYPE I.
IF DC_MANAGE IS INITIAL.
GFW_RETVAL = CL_GFW=>ERR.
EXIT.
ENDIF.
GFW_RETVAL = CL_GFW=>OK.
* set filter of given node (objid)
CALL METHOD DC_MANAGE->SET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_VALUE = OBJID
ATTRIBUTE = 'FILTER'
FIELD_VALUE = TO
IMPORTING RETVAL = GFW_RETVAL.
IF GFW_RETVAL <CL_GFW>OK.
EXIT.
ENDIF.
* look for objects (links) where pred = given node
VALUE_COUNTER = 1.
DO.
CALL METHOD DC_MANAGE->GET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_ATTRIBUTE = 'PRED'
KEY_VALUE = OBJID
ATTRIBUTE = 'OBJID'
IMPORTING MODE = MODE
FIELD_VALUE = LINK_OBJID
RETVAL = GFW_RETVAL
CHANGING VALUE_COUNTER = VALUE_COUNTER.
IF GFW_RETVAL <CL_GFW>I_DC_SET_OF_VAL AND
GFW_RETVAL <CL_GFW>OK.
GFW_RETVAL = CL_GFW=>OK.
EXIT. "// no links found => ready
ELSE.
* set filter of link itself
CALL METHOD DC_MANAGE->SET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_VALUE = LINK_OBJID
ATTRIBUTE = 'FILTER'
FIELD_VALUE = TO
IMPORTING RETVAL = GFW_RETVAL.
IF GFW_RETVAL <CL_GFW>OK.
EXIT.
ENDIF.
* set filter of succ-node of link
TMP_COUNTER = 1.
CALL METHOD DC_MANAGE->GET_VALUE
EXPORTING ID = MY_ID_AT_DC
KEY_ATTRIBUTE = 'OBJID'
KEY_VALUE = LINK_OBJID
ATTRIBUTE = 'SUCC'
IMPORTING MODE = MODE
FIELD_VALUE = NEXT_OBJID
RETVAL = GFW_RETVAL
CHANGING VALUE_COUNTER = TMP_COUNTER.
IF GFW_RETVAL <CL_GFW>OK.
GFW_RETVAL = CL_GFW=>OK.
EXIT. "//ready (it's an error (link without succ) but ignore it)
ENDIF.
CALL METHOD SET_FILTER EXPORTING TO = TO OBJID = NEXT_OBJID.
IF GFW_RETVAL <CL_GFW>OK.
EXIT. "//error -> return
ENDIF.
ENDIF. "//else. set filter of link itself
VALUE_COUNTER = VALUE_COUNTER + 1.
ENDDO.
ENDMETHOD. "//set_filter
ENDCLASS. "//lcl_main
DATA: MAIN TYPE REF TO LCL_MAIN.
* macros to call set_obj_values or set_obj_tab
DATA use_set_obj_tab type gfw_boolean value gfw_true.
DEFINE ADD_OBJ.
if use_set_obj_tab = gfw_true.
append &1 to &2.
else.
CALL METHOD DC_INST->SET_OBJ_VALUES EXPORTING ID = MY_ID_AT_DC
OBJ = &1
IMPORTING RETVAL = RETVAL.
IF RETVAL <CL_GFW>OK. EXIT. ENDIF.
endif.
END-OF-DEFINITION.
START-OF-SELECTION.
CREATE OBJECT MAIN.
DATA: PROD_GP1 TYPE TGPN-PRODUKT VALUE CL_GUI_GP_HIER=>CO_PROD_SAPTREE,
PROD_GP2 TYPE TGPN-PRODUKT VALUE CL_GUI_GP_HIER=>CO_PROD_SAPTREE,
PROD_GP3 TYPE TGPN-PRODUKT VALUE CL_GUI_GP_HIER=>CO_PROD_SAPTREE,
PROD_GP4 TYPE TGPN-PRODUKT VALUE CL_GUI_GP_HIER=>CO_PROD_SAPOCX.
* PROD_GP4 TYPE TGPN-PRODUKT VALUE CL_GUI_GP_HIER=>CO_PROD_SAPTREE.
refresh item_list. clear item_name.
item_name-no = 1.
item_name-name = 'NODE_TEXT0'.
insert item_name into table item_list.
* USAGE allowed in SAP internal test reports, only
include applg_auto_test_init.
CALL SCREEN 100.
* USAGE allowed in SAP internal test reports, only
include applg_auto_test_form.
*&---------------------------------------------------------------------*
*& Module PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PBO_0100 OUTPUT.
SET PF-STATUS '100'.
RETVAL = CL_GFW=>OK.
IF FIRSTCALL IS INITIAL.
* create container in which to place 1st splitter
* (place it in the custom control named CONTAINER
* defined using screenpainter in dynpro 100)
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'CONTAINER'. "use uppercase letters!
" there will be a RABAX here if any error occurred while creating
" the container
* create splitter with 2 rows for other splitter and bottom graphic
CREATE OBJECT splitter
EXPORTING
PARENT = CUSTOM_CONTAINER
orientation = 0.
" there will be a RABAX here if any error occurred while creating
" the container
* create, initialize and fill data container
CREATE OBJECT DC_INST.
DC_MANAGE = DC_INST.
CALL METHOD DC_MANAGE->INIT IMPORTING ID = MY_ID_AT_DC
RETVAL = RETVAL.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
CLEAR DC_INST.
CLEAR DC_MANAGE.
ELSE. "// dc_manage init ok
PERFORM FILL_DC CHANGING RETVAL.
perform fill_behavior_list.
perform create_cu_objects.
IF RETVAL = CL_GFW=>OK. "// gp1
* create, initialize and activate graphics proxy 1
CREATE OBJECT GP1.
REFRESH FILTER_LIST.
INSERT 1 INTO TABLE FILTER_LIST.
INSERT 2 INTO TABLE FILTER_LIST.
REFRESH EVTCODE_LIST.
clear simple_event.
simple_event-appl_event = 'X'.
simple_event-EVENTID =
IF_GRAPHIC_PROXY=>CO_EVT_MOUSE_DBLCLK_LEFT.
APPEND simple_event TO EVTCODE_LIST.
CALL METHOD GP1->IF_GRAPHIC_PROXY~INIT
EXPORTING PARENT = NESTED_AREA1
DC = DC_INST
PROD_ID = PROD_GP1
* force_prod = gfw_true
EVTCODE_LIST = EVTCODE_LIST
FILTER_LIST = FILTER_LIST
IMPORTING RETVAL = RETVAL.
IF RETVAL = CL_GFW=>OK.
* set DC attributes
CALL METHOD GP1->SET_DC_NAMES
EXPORTING
OBJ_ID = 'OBJID'
FILTER = 'FILTER'
OBJTYPE = 'OBJTYPE'
PRED = 'PRED'
SUCC = 'SUCC'
OBJREF_ID = 'CU_REFOBJ'
STATUS = 'STATUS_OBJ'
ITEM_LIST = ITEM_LIST
IMPORTING RETVAL = RETVAL.
ENDIF. "// set dc attributes
if retval = cl_gfw=>ok.
call method gp1->IF_GRAPHIC_PROXY~set_behavior_list
exporting behavior_list = drag_behavior_list
importing retval = retval.
set handler MAIN->on_dragged for gp1.
set handler MAIN->on_drop_completed for gp1.
endif.
if retval = cl_gfw=>ok and not cu_person is initial.
call method GP1->if_graphic_proxy~add_cu_bundle
exporting port = if_graphic_proxy=>co_port_chart
key = CO_GFW_PROG_PERSON "#EC NOTEXT
BUNDLE = cu_person
importing retval = retval.
endif.
if retval = cl_gfw=>ok and not cu_department is initial.
call method GP1->if_graphic_proxy~add_cu_bundle
exporting port = if_graphic_proxy=>co_port_chart
key = CO_GFW_PROG_DEPT
BUNDLE = cu_department
importing retval = retval.
endif.
IF RETVAL = CL_GFW=>OK.
CALL METHOD GP1->IF_GRAPHIC_PROXY~ACTIVATE
IMPORTING RETVAL = RETVAL.
ENDIF.
ENDIF. "//create/init gp1
IF RETVAL = CL_GFW=>OK. "// gp2
* create, initialize and activate graphics proxy 2
CREATE OBJECT GP2.
REFRESH FILTER_LIST.
INSERT 2 INTO TABLE FILTER_LIST.
REFRESH EVTCODE_LIST.
CALL METHOD GP2->IF_GRAPHIC_PROXY~INIT
EXPORTING PARENT = NESTED_AREA2
DC = DC_INST
PROD_ID = PROD_GP2
* force_prod = gfw_true
EVTCODE_LIST = EVTCODE_LIST
FILTER_LIST = FILTER_LIST
IMPORTING RETVAL = RETVAL.
IF RETVAL = CL_GFW=>OK.
* set DC attributes
CALL METHOD GP2->SET_DC_NAMES
EXPORTING
OBJ_ID = 'OBJID'
FILTER = 'FILTER'
OBJTYPE = 'OBJTYPE'
PRED = 'PRED'
SUCC = 'SUCC'
OBJREF_ID = 'CU_REFOBJ'
STATUS = 'STATUS_OBJ'
ITEM_LIST = ITEM_LIST
IMPORTING RETVAL = RETVAL.
ENDIF. "// set dc attributes
if retval = cl_gfw=>ok.
call method gp2->IF_GRAPHIC_PROXY~set_behavior_list
exporting behavior_list = drag_behavior_list
importing retval = retval.
set handler MAIN->on_dragged for gp2.
set handler MAIN->on_drop_completed for gp2.
endif.
if retval = cl_gfw=>ok and not cu_person is initial.
call method GP2->if_graphic_proxy~add_cu_bundle
exporting port = if_graphic_proxy=>co_port_chart
key = CO_GFW_PROG_PERSON
BUNDLE = cu_person
importing retval = retval.
endif.
if retval = cl_gfw=>ok and not cu_department is initial.
call method GP2->if_graphic_proxy~add_cu_bundle
exporting port = if_graphic_proxy=>co_port_chart
key = CO_GFW_PROG_DEPT
BUNDLE = cu_department
importing retval = retval.
endif.
IF RETVAL = CL_GFW=>OK.
CALL METHOD GP2->IF_GRAPHIC_PROXY~ACTIVATE
IMPORTING RETVAL = RETVAL.
ENDIF.
ENDIF. "//create/init gp1
IF RETVAL = CL_GFW=>OK. "// gp3
* create, initialize and activate graphics proxy 3
CREATE OBJECT GP3.
REFRESH FILTER_LIST.
INSERT 3 INTO TABLE FILTER_LIST.
REFRESH EVTCODE_LIST.
clear simple_event.
simple_event-appl_event = 'X'.
simple_event-EVENTID = IF_GRAPHIC_PROXY=>CO_EVT_DROPPED.
APPEND simple_event TO EVTCODE_LIST.
CALL METHOD GP3->IF_GRAPHIC_PROXY~INIT
EXPORTING PARENT = NESTED_AREA3
DC = DC_INST
PROD_ID = PROD_GP3
* force_prod = gfw_true
EVTCODE_LIST = EVTCODE_LIST
FILTER_LIST = FILTER_LIST
IMPORTING RETVAL = RETVAL.
IF RETVAL = CL_GFW=>OK.
* set DC attributes
CALL METHOD GP3->SET_DC_NAMES
EXPORTING
OBJ_ID = 'OBJID'
FILTER = 'FILTER'
OBJTYPE = 'OBJTYPE'
PRED = 'PRED'
SUCC = 'SUCC'
OBJREF_ID = 'CU_REFOBJ'
STATUS = 'STATUS_OBJ'
ITEM_LIST = ITEM_LIST
IMPORTING RETVAL = RETVAL.
ENDIF. "// set dc attributes
if retval = cl_gfw=>ok.
call method gp3->IF_GRAPHIC_PROXY~set_behavior_list
exporting behavior_list = drop_behavior_list
importing retval = retval.
set handler MAIN->on_dropped for gp3.
set handler MAIN->on_flavor_requested for gp3.
endif.
if retval = cl_gfw=>ok and not cu_person is initial.
call method GP3->if_graphic_proxy~add_cu_bundle
exporting port = if_graphic_proxy=>co_port_chart
key = CO_GFW_PROG_PERSON
BUNDLE = cu_person
importing retval = retval.
endif.
if retval = cl_gfw=>ok and not cu_department is initial.
call method GP3->if_graphic_proxy~add_cu_bundle
exporting port = if_graphic_proxy=>co_port_chart
key = CO_GFW_PROG_DEPT
BUNDLE = cu_department
importing retval = retval.
endif.
IF RETVAL = CL_GFW=>OK.
CALL METHOD GP3->IF_GRAPHIC_PROXY~ACTIVATE
IMPORTING RETVAL = RETVAL.
ENDIF.
ENDIF. "//create/init gp3
IF RETVAL = CL_GFW=>OK. "// gp4
* create, initialize and activate graphics proxy 4
CREATE OBJECT GP4.
REFRESH FILTER_LIST.
INSERT 1 INTO TABLE FILTER_LIST.
INSERT 2 INTO TABLE FILTER_LIST.
INSERT 3 INTO TABLE FILTER_LIST.
REFRESH EVTCODE_LIST.
CALL METHOD GP4->IF_GRAPHIC_PROXY~INIT
EXPORTING PARENT = splitter->BOTTOM_RIGHT_CONTAINER
"SPLITTER_AREA2
DC = DC_INST
PROD_ID = PROD_GP4
* force_prod = gfw_true
EVTCODE_LIST = EVTCODE_LIST
FILTER_LIST = FILTER_LIST
IMPORTING RETVAL = RETVAL.
IF RETVAL = CL_GFW=>OK.
* set DC attributes
CALL METHOD GP4->SET_DC_NAMES
EXPORTING
OBJ_ID = 'OBJID'
FILTER = 'FILTER'
OBJTYPE = 'OBJTYPE'
PRED = 'PRED'
SUCC = 'SUCC'
OBJREF_ID = 'CU_REFOBJ'
ITEM_LIST = ITEM_LIST
IMPORTING RETVAL = RETVAL.
ENDIF. "// set dc attributes
IF RETVAL = CL_GFW=>OK.
CALL METHOD GP4->IF_GRAPHIC_PROXY~ACTIVATE
IMPORTING RETVAL = RETVAL.
ENDIF.
ENDIF. "//create/init gp4
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
ENDIF.
ENDIF. "//dc_manage init ok
FIRSTCALL = 1.
ENDIF.
* set gui event handlers
SET HANDLER MAIN->ON_CLOSED FOR GP1.
SET HANDLER MAIN->ON_CLOSED FOR GP2.
SET HANDLER MAIN->ON_CLOSED FOR GP3.
SET HANDLER MAIN->ON_CLOSED FOR GP4.
SET HANDLER MAIN->ON_DBLCLK FOR GP1.
* just for testing network graphic
SET HANDLER MAIN->ON_DBLCLK FOR GP4.
* **** distribute changes (to all subscribed graphic proxies)
IF NOT DC_MANAGE IS INITIAL.
CALL METHOD DC_MANAGE->DISTRIBUTE_CHANGES
IMPORTING RETVAL = RETVAL.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
ENDIF.
ENDIF.
* **** activate mux (handling of external graphics and interactions)
CALL METHOD CL_GFW_MUX=>ACTIVATE IMPORTING RETVAL = RETVAL.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
ENDIF.
* USAGE allowed in SAP internal test reports, only
perform auto_test_pbo USING 'EXIT'.
ENDMODULE. " PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PAI_0100 INPUT.
OK_CODE = SY-UCOMM.
* activate event analysis of object-oriented Control Framework
CALL METHOD CL_GUI_CFW=>DISPATCH.
* handle other events
CASE OK_CODE.
WHEN 'BACK'.
IF NOT CUSTOM_CONTAINER IS INITIAL.
call method CUSTOM_CONTAINER->free.
ENDIF.
LEAVE PROGRAM.
WHEN 'EXIT'.
IF NOT CUSTOM_CONTAINER IS INITIAL.
call method CUSTOM_CONTAINER->free.
ENDIF.
LEAVE PROGRAM.
WHEN 'DOCU'.
DOCU_ID = 'RE'. DOCU_LANGU = SY-LANGU.
DOCU_OBJECT = 'GFW_DEMO_HIER2'.
* display program documentation
CALL FUNCTION 'DOCU_CALL'
EXPORTING
DISPL = 'X' "//show mode
DISPL_MODE = '2' "//prepare like F1-help
ID = DOCU_ID
LANGU = DOCU_LANGU
OBJECT = DOCU_OBJECT.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*&---------------------------------------------------------------------*
*& Form FILL_DC
*&---------------------------------------------------------------------*
* text
*
* loffc/24th Nov. 1999:
* macros ADD_OBJ and ADD_OBJTAB may call Set_obj_Values or the new
* method Set_Obj_Tab (see flag before macro definition).
* result of test: performance is much better with Set_Obj_Tab for
* more than 30 nodes
*
*----------------------------------------------------------------------*
* --> p1 text
* <p2>E_GP_DCHANDLE.
EXIT.
ENDIF.
RETVAL = CL_GFW=>OK.
* expand department folder
create object status.
status->if_gfw_status_hier~expanded = gfw_true.
* !! sort nodes: first filter 3 then 1 because of moving things using
* drag and drop:
* tree control is not able to insert a node with parent relation if
* the parent node does not (yet) exist.
* NODES
CLEAR OBJ.
OBJ-OBJTYPE = 'n'. "#EC NOTEXT
OBJ-PRED = SPACE.
OBJ-SUCC = SPACE.
OBJ-PCLUSTER = SPACE.
OBJ-DATA = 0.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.