Пример #1
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);
   }
 }
Пример #5
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);
   }
 }
Пример #6
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);
   }
 }
Пример #7
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));
   }
 }
Пример #8
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);
   }
 }
Пример #9
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);
   }
 }
Пример #10
0
 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);
   }
 }
Пример #11
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);
   }
 }
Пример #12
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");
   }
 }
Пример #13
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);
   }
 }
Пример #14
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);
     }
   }
 }
Пример #15
0
 private static void writeCloseListener(final Shell shell) throws IOException {
   //    JSWriter writer = JSWriter.getWriterFor( shell );
   Boolean newValue = Boolean.valueOf(ShellEvent.hasListener(shell));
   Boolean defValue = Boolean.FALSE;
   //    writer.set( PROP_SHELL_LISTENER, "hasShellListener", newValue, defValue );
   boolean hasChanged = WidgetLCAUtil.hasChanged(shell, PROP_SHELL_LISTENER, newValue, defValue);
   if (hasChanged) {
     IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
     if (newValue.booleanValue()) {
       synchronizer.addListener("closelistener");
     } else {
       synchronizer.removeListener("closelistener");
     }
   }
 }
Пример #16
0
 private static void writeImage(final Shell shell) throws IOException {
   if ((shell.getStyle() & SWT.TITLE) != 0) {
     Image image = shell.getImage();
     if (image == null) {
       Image[] defaultImages = shell.getImages();
       if (defaultImages.length > 0) {
         image = defaultImages[0];
       }
     }
     if (WidgetLCAUtil.hasChanged(shell, PROP_IMAGE, image, null)) {
       //        JSWriter writer = JSWriter.getWriterFor( shell );
       //        writer.set( JSConst.QX_FIELD_ICON,
       //                    ResourceFactory.getImagePath( image ) );
       IWidgetSynchronizer synchronizer =
           WidgetSynchronizerFactory.getSynchronizerForWidget(shell);
       synchronizer.setWidgetProperty(JSConst.QX_FIELD_ICON, ResourceFactory.getImagePath(image));
     }
   }
 }