Search in sources :

Example 26 with JsonEvent

use of org.eclipse.scout.rt.ui.html.json.JsonEvent in project scout.rt by eclipse.

the class JsonBrowserFieldTest method testExternalWindowState.

@Test
public void testExternalWindowState() throws JSONException {
    boolean windowState = true;
    Map<String, String> map = new HashMap<>();
    map.put("windowState", Boolean.toString(windowState));
    m_browserField.handleUiEvent(new JsonEvent("xyz", "externalWindowStateChange", new JSONObject(map)));
    Assert.assertNotNull(m_lastExternalWindowState);
    Assert.assertEquals(true, m_lastExternalWindowState);
}
Also used : JSONObject(org.json.JSONObject) HashMap(java.util.HashMap) JsonEvent(org.eclipse.scout.rt.ui.html.json.JsonEvent) Test(org.junit.Test) BaseFormFieldTest(org.eclipse.scout.rt.ui.html.json.form.fields.BaseFormFieldTest)

Example 27 with JsonEvent

use of org.eclipse.scout.rt.ui.html.json.JsonEvent in project scout.rt by eclipse.

the class JsonTableTest method createJsonColumnMovedEvent.

public static JsonEvent createJsonColumnMovedEvent(String columnId, int index) throws JSONException {
    // never used
    String tableId = "x";
    JSONObject data = new JSONObject();
    data.put(JsonTable.PROP_COLUMN_ID, columnId);
    data.put("index", index);
    return new JsonEvent(tableId, JsonTable.EVENT_COLUMN_MOVED, data);
}
Also used : JSONObject(org.json.JSONObject) JsonEvent(org.eclipse.scout.rt.ui.html.json.JsonEvent)

Example 28 with JsonEvent

use of org.eclipse.scout.rt.ui.html.json.JsonEvent in project scout.rt by eclipse.

the class JsonFormTableControlTest method createJsonSelectedEvent.

public static JsonEvent createJsonSelectedEvent(String adapterId, boolean selected) throws JSONException {
    JSONObject data = new JSONObject();
    data.put("selected", selected);
    return new JsonEvent(adapterId, "property", data);
}
Also used : JSONObject(org.json.JSONObject) JsonEvent(org.eclipse.scout.rt.ui.html.json.JsonEvent)

Example 29 with JsonEvent

use of org.eclipse.scout.rt.ui.html.json.JsonEvent in project scout.rt by eclipse.

the class JsonTestUtility method extractEventsFromResponse.

/**
 * @param eventType
 *          Optional. If set only events with the given type will be returned.
 * @param adapterId
 *          Optional. If set only events for the given id will be returned.
 */
public static List<JsonEvent> extractEventsFromResponse(JsonResponse response, String eventType, String adapterId) throws JSONException {
    response.fireProcessBufferedEvents();
    List<JsonEvent> list = new ArrayList<>();
    for (JsonEvent event : response.getEventList()) {
        if ((eventType == null || event.getType().equals(eventType)) && (adapterId == null || event.getTarget().equals(adapterId))) {
            list.add(event);
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) JsonEvent(org.eclipse.scout.rt.ui.html.json.JsonEvent)

Example 30 with JsonEvent

use of org.eclipse.scout.rt.ui.html.json.JsonEvent in project scout.rt by eclipse.

the class JsonTreeTest method createJsonExpansionEvent.

public static JsonEvent createJsonExpansionEvent(String nodeId, boolean expanded) throws JSONException {
    JSONObject data = new JSONObject();
    data.put(JsonTree.PROP_NODE_ID, nodeId);
    data.put("expanded", expanded);
    data.put("expandedLazy", false);
    return new JsonEvent("", JsonTree.EVENT_NODE_EXPANDED, data);
}
Also used : JSONObject(org.json.JSONObject) JsonEvent(org.eclipse.scout.rt.ui.html.json.JsonEvent)

Aggregations

JsonEvent (org.eclipse.scout.rt.ui.html.json.JsonEvent)50 Test (org.junit.Test)38 JSONObject (org.json.JSONObject)20 ITable (org.eclipse.scout.rt.client.ui.basic.table.ITable)16 ArrayList (java.util.ArrayList)12 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)12 ITree (org.eclipse.scout.rt.client.ui.basic.tree.ITree)11 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)11 TableWith3Cols (org.eclipse.scout.rt.ui.html.json.table.fixtures.TableWith3Cols)11 TreeNode (org.eclipse.scout.rt.ui.html.json.tree.fixtures.TreeNode)8 Table (org.eclipse.scout.rt.ui.html.json.table.fixtures.Table)7 JSONArray (org.json.JSONArray)7 ListBoxTable (org.eclipse.scout.rt.ui.html.json.table.fixtures.ListBoxTable)6 ITableRowFilter (org.eclipse.scout.rt.client.ui.basic.table.ITableRowFilter)5 IDesktop (org.eclipse.scout.rt.client.ui.desktop.IDesktop)5 JsonAdapterRegistryTest (org.eclipse.scout.rt.ui.html.json.JsonAdapterRegistryTest)4 FormWithOneField (org.eclipse.scout.rt.ui.html.json.form.fixtures.FormWithOneField)4 List (java.util.List)3 DesktopWithOneOutline (org.eclipse.scout.rt.ui.html.json.desktop.fixtures.DesktopWithOneOutline)3 JsonForm (org.eclipse.scout.rt.ui.html.json.form.JsonForm)3