package handlers; // RUI Handler import com.ibm.egl.rui.infobus.InfoBus; import com.ibm.egl.rui.widgets.Button; import com.ibm.egl.rui.widgets.DataGrid; import com.ibm.egl.rui.widgets.DataGridColumn; import com.ibm.egl.rui.widgets.Div; import egl.ui.rui.Event; // // handler firstHandlerUsingLibrary type RUIhandler {initialUI = [ ui ],onConstructionFunction = start, title="firsthandler"} ui Div{ children = [ dataGrid,myButton ] }; dataGrid DataGrid{ height = 304, showScrollbar = true, columns = [ new DataGridColumn{name = "field1", displayName = "Column 1 Header", width=50}, new DataGridColumn{name = "field2", displayName = "Column 2 Header", width=50} ], showCheckBoxes = true//, //checkboxListeners = [checkboxListener] }; checkedrows string[0]; myButton Button{ text = "Send", onClick ::= click }; data Dictionary[0]; // To help EGL to find the right imports for Libraries you can specify them using the 'use' statement. // Libraries use ParametersLib; function start() //data Dictionary[0]; for (i int from 1 to 5) data.appendElement(new Dictionary { field1 = "Row "+ i + ", Column 1", field2 = "Row " + i + ", Column 2"}); end datagrid.data = data as any[]; end function click(e Event in) myfunction(data); // No need to remove and append child, just specify the new child. However in a real application I would create // a Main Handler that is in charge of displaying the ui of the firstHandler or the secondHandler. // ui.removeChild(dataGrid); // ui.appendChild(new secondhandler{}.dataGrid); ui.children = [new secondhandlerUsingLibrary{}.dataGrid]; end function myfunction(array Dictionary[] in) // Here you send the infobus message, but rather you put the data in a Library part. A library part is like a ruihandler // but you do not have to instantiate it to use it. So there is always only one instance of a Library part. // infobus.publish("LISTEN",array); ParametersLib.array = array; end end