public void readData(final Widget widget) {
    //    HttpServletRequest request = ContextProvider.getRequest();
    //    String parameter = request.getParameter( "JSON" );
    //    if( parameter != null ) {
    //      System.out.println( "#### BEGIN ####");
    //      System.out.println( parameter );
    //      System.out.println( "#### END ####");
    //    }

    Shell shell = (Shell) widget;
    // [if] Preserve the menu bounds before setting the new shell bounds.
    preserveMenuBounds(shell);
    // Important: Order matters, readMode() before readBounds()

    readBounds(shell);
    if (WidgetLCAUtil.wasEventSent(shell, JSConst.EVENT_SHELL_CLOSED)) {
      shell.close();
    }
    processActiveShell(shell);
    processActivate(shell);
    ControlLCAUtil.processMouseEvents(shell);
    ControlLCAUtil.processKeyEvents(shell);
    ControlLCAUtil.processMenuDetect(shell);
    WidgetLCAUtil.processHelp(shell);
  }
 private static void readSelectionEvent(ControlDecorator decorator) {
   if (WidgetLCAUtil.wasEventSent(decorator, JSConst.EVENT_WIDGET_SELECTED)) {
     processSelectionEvent(decorator, SelectionEvent.WIDGET_SELECTED);
   }
   if (WidgetLCAUtil.wasEventSent(decorator, JSConst.EVENT_WIDGET_DEFAULT_SELECTED)) {
     processSelectionEvent(decorator, SelectionEvent.WIDGET_DEFAULT_SELECTED);
   }
 }
 private static void writeText(final Shell shell) throws IOException {
   String text = shell.getText();
   if (WidgetLCAUtil.hasChanged(shell, PROP_TEXT, text, "")) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     text = WidgetLCAUtil.escapeText(text, false);
     //      writer.set( JSConst.QX_FIELD_CAPTION, text );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty(JSConst.QX_FIELD_CAPTION, text);
   }
 }
 public void renderChanges(Widget widget) throws IOException {
   ToolTip toolTip = (ToolTip) widget;
   WidgetLCAUtil.renderCustomVariant(widget);
   WidgetLCAUtil.renderRoundedBorder(widget);
   WidgetLCAUtil.renderBackgroundGradient(widget);
   renderProperty(toolTip, PROP_AUTO_HIDE, toolTip.getAutoHide(), false);
   renderProperty(toolTip, PROP_TEXT, toolTip.getText(), "");
   renderProperty(toolTip, PROP_MESSAGE, toolTip.getMessage(), "");
   renderProperty(toolTip, PROP_LOCATION, getLocation(toolTip), DEFAULT_LOCATION);
   renderProperty(toolTip, PROP_VISIBLE, toolTip.isVisible(), false);
   renderListener(toolTip, PROP_SELECTION_LISTENER, SelectionEvent.hasListener(toolTip), false);
 }
 public void preserveValues(Widget widget) {
   ToolTip toolTip = (ToolTip) widget;
   WidgetLCAUtil.preserveCustomVariant(widget);
   WidgetLCAUtil.preserveRoundedBorder(widget);
   WidgetLCAUtil.preserveBackgroundGradient(widget);
   preserveProperty(toolTip, PROP_AUTO_HIDE, toolTip.getAutoHide());
   preserveProperty(toolTip, PROP_TEXT, toolTip.getText());
   preserveProperty(toolTip, PROP_MESSAGE, toolTip.getMessage());
   preserveProperty(toolTip, PROP_LOCATION, getLocation(toolTip));
   preserveProperty(toolTip, PROP_VISIBLE, toolTip.isVisible());
   preserveListener(toolTip, PROP_SELECTION_LISTENER, SelectionEvent.hasListener(toolTip));
 }
 public void renderInitialization(Widget widget) throws IOException {
   ControlDecorator decorator = (ControlDecorator) widget;
   IClientObject clientObject = ClientObjectFactory.getClientObject(decorator);
   clientObject.create(TYPE);
   clientObject.set("parent", WidgetUtil.getId(decorator.getParent()));
   clientObject.set("style", WidgetLCAUtil.getStyles(decorator, ALLOWED_STYLES));
 }
 public void renderInitialization(Widget widget) throws IOException {
   ToolTip toolTip = (ToolTip) widget;
   IClientObject clientObject = ClientObjectFactory.getClientObject(toolTip);
   clientObject.create(TYPE);
   clientObject.set("parent", WidgetUtil.getId(toolTip.getParent()));
   clientObject.set("style", WidgetLCAUtil.getStyles(toolTip, ALLOWED_STYLES));
 }
 private static void writeClipBounds(final ScrolledComposite composite) throws IOException {
   Rectangle bounds = composite.getBounds();
   if (WidgetLCAUtil.hasChanged(composite, PROP_BOUNDS, bounds, null)) {
     JSWriter writer = JSWriter.getWriterFor(composite);
     writer.set("clipWidth", bounds.width);
     writer.set("clipHeight", bounds.height);
   }
 }
Beispiel #9
0
 private static void updateSelectionListener(final Tree tree) throws IOException {
   Boolean newValue = Boolean.valueOf(SelectionEvent.hasListener(tree));
   String prop = PROP_SELECTION_LISTENERS;
   if (WidgetLCAUtil.hasChanged(tree, prop, newValue, Boolean.FALSE)) {
     JSWriter writer = JSWriter.getWriterFor(tree);
     writer.set("selectionListeners", newValue);
   }
 }
 private static void writeSelectionListener(final ScrolledComposite composite) throws IOException {
   boolean hasListener = hasSelectionListener(composite);
   Boolean newValue = Boolean.valueOf(hasListener);
   String prop = Props.SELECTION_LISTENERS;
   if (WidgetLCAUtil.hasChanged(composite, prop, newValue, Boolean.FALSE)) {
     JSWriter writer = JSWriter.getWriterFor(composite);
     writer.set("hasSelectionListener", newValue);
   }
 }
 private static void writeShowFocusedControl(final ScrolledComposite composite)
     throws IOException {
   Boolean newValue = Boolean.valueOf(composite.getShowFocusedControl());
   String prop = PROP_SHOW_FOCUSED_CONTROL;
   if (WidgetLCAUtil.hasChanged(composite, prop, newValue, Boolean.FALSE)) {
     JSWriter writer = JSWriter.getWriterFor(composite);
     writer.set("showFocusedControl", newValue);
   }
 }
 public void preserveValues(Widget widget) {
   ControlDecorator decorator = (ControlDecorator) widget;
   WidgetLCAUtil.preserveBounds(decorator, decorator.getBounds());
   preserveProperty(decorator, PROP_TEXT, decorator.getText());
   preserveProperty(decorator, PROP_IMAGE, decorator.getImage());
   preserveProperty(decorator, PROP_VISIBLE, decorator.isVisible());
   preserveProperty(decorator, PROP_SHOW_HOVER, decorator.getShowHover());
   preserveListener(decorator, PROP_SELECTION_LISTENER, SelectionEvent.hasListener(decorator));
 }
 /**
  * Respond to selection events, set the value of selectedItem on the widget Java object, and
  * broadcast a SWT.Selection event to any listeners
  */
 public void readData(final Widget widget) {
   if (widget == null) return;
   JITVisualizationWidget visWidget = (JITVisualizationWidget) widget;
   String selectedNode = WidgetLCAUtil.readPropertyValue(visWidget, "selectedNode");
   if (selectedNode != null) {
     visWidget.setData("selectedNode", selectedNode);
     ControlLCAUtil.processSelection(visWidget, null, true);
   }
 }
 public void preserveValues(final Widget widget) {
   JITVisualizationWidget vWidget = (JITVisualizationWidget) widget;
   ControlLCAUtil.preserveValues(vWidget);
   IWidgetAdapter adapter = WidgetUtil.getAdapter(vWidget);
   adapter.preserve(PROP_VISIBLE, String.valueOf(vWidget.isVisible()));
   adapter.preserve(WIDGET_DATA, new JSVar(vWidget.getJSONData()));
   // only needed for custom variants (theming)
   WidgetLCAUtil.preserveCustomVariant(vWidget);
 }
Beispiel #15
0
 private static void writeFullScreen(final Shell shell) throws IOException {
   Object defValue = Boolean.FALSE;
   Boolean newValue = Boolean.valueOf(shell.getFullScreen());
   if (WidgetLCAUtil.hasChanged(shell, PROP_FULLSCREEN, newValue, defValue)) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     //      writer.set( "fullScreen", newValue );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty("fullScreen", newValue);
   }
 }
Beispiel #16
0
 /* (intentionally non-JavaDoc'ed)
  * This method is declared public only to be accessible from DisplayLCA
  */
 public static void writeActiveControl(final Shell shell) throws IOException {
   final Control activeControl = getActiveControl(shell);
   String prop = PROP_ACTIVE_CONTROL;
   if (WidgetLCAUtil.hasChanged(shell, prop, activeControl, null)) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     //      writer.set( "activeControl", new Object[] { activeControl } );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty("activeControl", WidgetUtil.getId(activeControl));
   }
 }
Beispiel #17
0
 private static void writeActiveShell(final Shell shell) throws IOException {
   Shell activeShell = shell.getDisplay().getActiveShell();
   boolean hasChanged = WidgetLCAUtil.hasChanged(shell, PROP_ACTIVE_SHELL, activeShell, null);
   if (shell == activeShell && hasChanged) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     //      writer.set( "active", true );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty("active", true);
   }
 }
Beispiel #18
0
 private void writeAlpha(final Shell shell) throws IOException {
   int alpha = shell.getAlpha();
   if (WidgetLCAUtil.hasChanged(shell, PROP_ALPHA, new Integer(alpha), new Integer(0xFF))) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     float opacity = (alpha & 0xFF) * 1000 / 0xFF / 1000.0f;
     //      writer.set( "opacity", opacity );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty("opacity", opacity);
   }
 }
Beispiel #19
0
 private static void writeMode(final Shell shell) throws IOException {
   Object defValue = null;
   Object newValue = getMode(shell);
   if (WidgetLCAUtil.hasChanged(shell, PROP_MODE, newValue, defValue)) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     //      writer.set( "mode", newValue );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty("mode", newValue);
   }
 }
 public void renderChanges(Widget widget) throws IOException {
   ControlDecorator decorator = (ControlDecorator) widget;
   WidgetLCAUtil.renderBounds(decorator, decorator.getBounds());
   renderProperty(decorator, PROP_TEXT, decorator.getText(), "");
   renderProperty(decorator, PROP_IMAGE, decorator.getImage(), null);
   renderProperty(decorator, PROP_VISIBLE, decorator.isVisible(), false);
   renderProperty(decorator, PROP_SHOW_HOVER, decorator.getShowHover(), true);
   renderListener(
       decorator, PROP_SELECTION_LISTENER, SelectionEvent.hasListener(decorator), false);
 }
Beispiel #21
0
 public void renderChanges(final Widget widget) throws IOException {
   Tree tree = (Tree) widget;
   ControlLCAUtil.writeChanges(tree);
   updateSelectionListener(tree);
   writeHeaderHeight(tree);
   writeHeaderVisible(tree);
   writeColumnOrder(tree);
   writeScrollLeft(tree);
   writeOverflow(tree);
   WidgetLCAUtil.writeCustomVariant(tree);
 }
Beispiel #22
0
 public void readData(final Widget widget) {
   Tree tree = (Tree) widget;
   readSelection(tree);
   readScrollPosition(tree);
   processWidgetSelectedEvent(tree);
   processWidgetDefaultSelectedEvent(tree);
   ControlLCAUtil.processMouseEvents(tree);
   ControlLCAUtil.processKeyEvents(tree);
   ControlLCAUtil.processMenuDetect(tree);
   WidgetLCAUtil.processHelp(tree);
 }
Beispiel #23
0
 private static void writeOpen(final Shell shell) throws IOException {
   // TODO [rst] workaround: qx window should be opened only once.
   Boolean defValue = Boolean.FALSE;
   Boolean actValue = Boolean.valueOf(shell.getVisible());
   if (WidgetLCAUtil.hasChanged(shell, Props.VISIBLE, actValue, defValue) && shell.getVisible()) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     //      writer.call( "open", null );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.call("open");
   }
 }
Beispiel #24
0
 private static void writeMinimumSize(final Shell shell) throws IOException {
   Point newValue = shell.getMinimumSize();
   if (WidgetLCAUtil.hasChanged(shell, PROP_MINIMUM_SIZE, newValue)) {
     //      JSWriter writer = JSWriter.getWriterFor( shell );
     //      writer.set( "minWidth", new Integer( newValue.x ) );
     //      writer.set( "minHeight", new Integer( newValue.y ) );
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     synchronizer.setWidgetProperty("minWidth", newValue.x);
     synchronizer.setWidgetProperty("minHeight", newValue.y);
   }
 }
 public void preserveValues(final Widget widget) {
   ScrolledComposite composite = (ScrolledComposite) widget;
   ControlLCAUtil.preserveValues(composite);
   IWidgetAdapter adapter = WidgetUtil.getAdapter(composite);
   adapter.preserve(PROP_BOUNDS, composite.getBounds());
   adapter.preserve(PROP_OVERFLOW, getOverflow(composite));
   adapter.preserve(PROP_H_BAR_SELECTION, getBarSelection(composite.getHorizontalBar()));
   adapter.preserve(PROP_V_BAR_SELECTION, getBarSelection(composite.getVerticalBar()));
   adapter.preserve(Props.SELECTION_LISTENERS, Boolean.valueOf(hasSelectionListener(composite)));
   adapter.preserve(PROP_SHOW_FOCUSED_CONTROL, Boolean.valueOf(composite.getShowFocusedControl()));
   WidgetLCAUtil.preserveCustomVariant(composite);
 }
Beispiel #26
0
 private static void readScrollPosition(final Tree tree) {
   String left = WidgetLCAUtil.readPropertyValue(tree, "scrollLeft");
   String top = WidgetLCAUtil.readPropertyValue(tree, "scrollTop");
   if (left != null && top != null) {
     Object adapter = tree.getAdapter(ITreeAdapter.class);
     final ITreeAdapter treeAdapter = (ITreeAdapter) adapter;
     final int newScrollLeft = parsePosition(left);
     final int newScrollTop = parsePosition(top);
     final int oldScrollTop = treeAdapter.getScrollTop();
     treeAdapter.setScrollLeft(newScrollLeft);
     treeAdapter.setScrollTop(newScrollTop);
     if (oldScrollTop != newScrollTop) {
       ProcessActionRunner.add(
           new Runnable() {
             public void run() {
               treeAdapter.checkAllData(tree);
             }
           });
     }
   }
 }
Beispiel #27
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();
   }
 }
 public void readData(final Widget widget) {
   ScrolledComposite composite = (ScrolledComposite) widget;
   Point origin = composite.getOrigin();
   String value = WidgetLCAUtil.readPropertyValue(widget, PARAM_H_BAR_SELECTION);
   ScrollBar hScroll = composite.getHorizontalBar();
   if (value != null && hScroll != null) {
     origin.x = Integer.parseInt(value);
     processSelection(hScroll);
   }
   value = WidgetLCAUtil.readPropertyValue(widget, PARAM_V_BAR_SELECTION);
   ScrollBar vScroll = composite.getVerticalBar();
   if (value != null && vScroll != null) {
     origin.y = Integer.parseInt(value);
     processSelection(vScroll);
   }
   composite.setOrigin(origin);
   ControlLCAUtil.processMouseEvents(composite);
   ControlLCAUtil.processKeyEvents(composite);
   ControlLCAUtil.processMenuDetect(composite);
   WidgetLCAUtil.processHelp(composite);
 }
 public void renderChanges(final Widget widget) throws IOException {
   ScrolledComposite composite = (ScrolledComposite) widget;
   ControlLCAUtil.writeChanges(composite);
   writeClipBounds(composite);
   // TODO [rh] initial positioning of the client-side scroll bar does not work
   writeBarSelection(composite);
   // [if] Order is important: writeScrollBars after writeBarSelection
   writeScrollBars(composite);
   writeSelectionListener(composite);
   writeShowFocusedControl(composite);
   WidgetLCAUtil.writeCustomVariant(composite);
 }
Beispiel #30
0
 private static void writeOverflow(final Tree tree) throws IOException {
   boolean hasHChanged =
       WidgetLCAUtil.hasChanged(tree, PROP_HAS_H_SCROLL_BAR, hasHScrollBar(tree), Boolean.TRUE);
   boolean hasVChanged =
       WidgetLCAUtil.hasChanged(tree, PROP_HAS_V_SCROLL_BAR, hasVScrollBar(tree), Boolean.TRUE);
   if (hasHChanged || hasVChanged) {
     boolean scrollX = hasHScrollBar(tree).booleanValue();
     boolean scrollY = hasVScrollBar(tree).booleanValue();
     String overflow;
     if (scrollX && scrollY) {
       overflow = "scroll";
     } else if (scrollX) {
       overflow = "scrollX";
     } else if (scrollY) {
       overflow = "scrollY";
     } else {
       overflow = "hidden";
     }
     JSWriter writer = JSWriter.getWriterFor(tree);
     writer.set("treeOverflow", overflow);
   }
 }