public void renderInitialization(final Widget widget) throws IOException {
   JITVisualizationWidget vWidget = (JITVisualizationWidget) widget;
   JSWriter writer = JSWriter.getWriterFor(vWidget);
   writer.newWidget(getWidgetType().getName(), getInitializationParameters(vWidget).toArray());
   writer.set("appearance", "composite");
   writer.set("overflow", "hidden");
   ControlLCAUtil.writeStyleFlags((Control) widget);
 }
Ejemplo n.º 2
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 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);
   }
 }
 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);
   }
 }
 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 writeBarSelection(final ScrolledComposite composite) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(composite);
   Integer hBarSelection = getBarSelection(composite.getHorizontalBar());
   if (hBarSelection != null) {
     writer.set(PROP_H_BAR_SELECTION, "hBarSelection", hBarSelection, ZERO);
   }
   Integer vBarSelection = getBarSelection(composite.getVerticalBar());
   if (vBarSelection != null) {
     writer.set(PROP_V_BAR_SELECTION, "vBarSelection", vBarSelection, ZERO);
   }
 }
Ejemplo n.º 7
0
 private void writeColumnOrder(final Tree tree) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(tree);
   int[] values = tree.getColumnOrder();
   if (values.length > 0) {
     Integer[] newValue = new Integer[values.length];
     for (int i = 0; i < values.length; i++) {
       newValue[i] = new Integer(values[i]);
     }
     if (WidgetLCAUtil.hasChanged(tree, PROP_COLUMN_ORDER, newValue, new Integer[] {})) {
       writer.set(PROP_COLUMN_ORDER, "columnOrder", newValue, null);
     }
   }
 }
Ejemplo n.º 8
0
 public void renderInitialization(final Widget widget) throws IOException {
   Tree tree = (Tree) widget;
   JSWriter writer = JSWriter.getWriterFor(tree);
   StringBuffer style = new StringBuffer();
   if ((tree.getStyle() & SWT.MULTI) != 0) {
     style.append("multi|");
   }
   if ((tree.getStyle() & SWT.CHECK) != 0) {
     style.append("check|");
   }
   if ((tree.getStyle() & SWT.VIRTUAL) != 0) {
     style.append("virtual|");
   }
   writer.newWidget("org.eclipse.swt.widgets.Tree", new Object[] {style.toString()});
   ControlLCAUtil.writeStyleFlags(tree);
 }
  public void renderChanges(final Widget widget) throws IOException {
    JITVisualizationWidget vWidget = (JITVisualizationWidget) widget;
    JSWriter writer = JSWriter.getWriterFor(vWidget);
    writer.set(PROP_VISIBLE, PROP_VISIBLE, String.valueOf(vWidget.isVisible()));
    // We compare the JSON text directly because JSVar does not override Object.equals();
    IWidgetAdapter adapter = WidgetUtil.getAdapter(vWidget);
    JSVar oldValue = (JSVar) adapter.getPreserved(WIDGET_DATA);
    String jsonData = vWidget.getJSONData();
    if (jsonData != null && (oldValue == null || !jsonData.equals(oldValue.toString()))) {
      writer.set(WIDGET_DATA, WIDGET_DATA, new JSVar(jsonData));
    }
    ControlLCAUtil.writeChanges(vWidget);

    WidgetCommandQueue cmdQueue = (WidgetCommandQueue) vWidget.getAdapter(WidgetCommandQueue.class);
    if (cmdQueue != null) {
      while (cmdQueue.peek() != null) {
        Object[] functionCall = (Object[]) cmdQueue.poll();
        writer.call((String) functionCall[0], (Object[]) functionCall[1]);
      }
    }
  }
Ejemplo n.º 10
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);
   }
 }
Ejemplo n.º 11
0
 private void writeScrollLeft(final Tree tree) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(tree);
   Integer newValue = getScrollLeft(tree);
   writer.set(PROP_SCROLL_LEFT, "scrollLeft", newValue, DEFAULT_SCROLL_LEFT);
 }
Ejemplo n.º 12
0
 private static void writeHeaderVisible(final Tree tree) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(tree);
   Boolean newValue = Boolean.valueOf(tree.getHeaderVisible());
   writer.set(PROP_HEADER_VISIBLE, "headerVisible", newValue, Boolean.FALSE);
 }
Ejemplo n.º 13
0
 private static void writeHeaderHeight(final Tree tree) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(tree);
   Integer newValue = new Integer(tree.getHeaderHeight());
   writer.set(PROP_HEADER_HEIGHT, "headerHeight", newValue, null);
 }
 public void renderDispose(final Widget widget) throws IOException {
   ScrolledComposite composite = (ScrolledComposite) widget;
   JSWriter writer = JSWriter.getWriterFor(composite);
   writer.dispose();
 }
 public void renderInitialization(final Widget widget) throws IOException {
   ScrolledComposite scrolledComposite = (ScrolledComposite) widget;
   JSWriter writer = JSWriter.getWriterFor(scrolledComposite);
   writer.newWidget(QX_TYPE);
   ControlLCAUtil.writeStyleFlags(scrolledComposite);
 }
Ejemplo n.º 16
0
 public void renderDispose(final Widget widget) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(widget);
   writer.dispose();
 }
 private static void writeScrollBars(final ScrolledComposite composite) throws IOException {
   String overflow = getOverflow(composite);
   JSWriter writer = JSWriter.getWriterFor(composite);
   writer.set(PROP_OVERFLOW, "overflow", overflow, null);
 }