Example #1
0
 // TODO [rh] is this safe for multiple shells?
 private static void processActivate(final Shell shell) {
   HttpServletRequest request = ContextProvider.getRequest();
   String widgetId = request.getParameter(JSConst.EVENT_WIDGET_ACTIVATED);
   if (widgetId != null) {
     Widget widget = WidgetUtil.find(shell, widgetId);
     if (widget != null) {
       setActiveControl(shell, widget);
     }
   } else {
     String activeControlId = WidgetLCAUtil.readPropertyValue(shell, "activeControl");
     Widget widget = WidgetUtil.find(shell, activeControlId);
     if (widget != null) {
       setActiveControl(shell, widget);
     }
   }
 }
Example #2
0
 private static void processWidgetDefaultSelectedEvent(final Tree tree) {
   HttpServletRequest request = ContextProvider.getRequest();
   String eventName = JSConst.EVENT_WIDGET_DEFAULT_SELECTED;
   if (WidgetLCAUtil.wasEventSent(tree, eventName)) {
     String itemId = request.getParameter(eventName + ".item");
     Item treeItem = (Item) WidgetUtil.find(tree, itemId);
     int eventType = SelectionEvent.WIDGET_DEFAULT_SELECTED;
     SelectionEvent event = new SelectionEvent(tree, treeItem, eventType);
     event.stateMask = EventLCAUtil.readStateMask(JSConst.EVENT_WIDGET_SELECTED_MODIFIER);
     event.processEvent();
   }
 }
Example #3
0
 private static void processWidgetSelectedEvent(final Tree tree) {
   HttpServletRequest request = ContextProvider.getRequest();
   String eventName = JSConst.EVENT_WIDGET_SELECTED;
   if (WidgetLCAUtil.wasEventSent(tree, eventName)) {
     Rectangle bounds = new Rectangle(0, 0, 0, 0);
     String itemId = request.getParameter(eventName + ".item");
     Item treeItem = (Item) WidgetUtil.find(tree, itemId);
     String detailStr = request.getParameter(eventName + ".detail");
     int detail = "check".equals(detailStr) ? SWT.CHECK : SWT.NONE;
     int eventType = SelectionEvent.WIDGET_SELECTED;
     int stateMask = EventLCAUtil.readStateMask(JSConst.EVENT_WIDGET_SELECTED_MODIFIER);
     SelectionEvent event =
         new SelectionEvent(tree, treeItem, eventType, bounds, stateMask, null, true, detail);
     event.processEvent();
   }
 }
Example #4
0
 private static void readSelection(final Tree tree) {
   String value = WidgetLCAUtil.readPropertyValue(tree, "selection");
   if (value != null) {
     String[] values = value.split(",");
     TreeItem[] selectedItems = new TreeItem[values.length];
     boolean validItemFound = false;
     for (int i = 0; i < values.length; i++) {
       selectedItems[i] = (TreeItem) WidgetUtil.find(tree, values[i]);
       if (selectedItems[i] != null) {
         validItemFound = true;
       }
     }
     if (!validItemFound) {
       selectedItems = new TreeItem[0];
     }
     tree.setSelection(selectedItems);
   }
 }