Example #1
0
 private static void preserveMenuBounds(final Shell shell) {
   Object adapter = shell.getAdapter(IShellAdapter.class);
   IShellAdapter shellAdapter = (IShellAdapter) adapter;
   Rectangle menuBounds = shellAdapter.getMenuBounds();
   IWidgetAdapter widgetAdapter = WidgetUtil.getAdapter(shell);
   widgetAdapter.preserve(PROP_SHELL_MENU_BOUNDS, menuBounds);
 }
Example #2
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 #3
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));
   }
 }
Example #4
0
 public void preserveValues(final Widget widget) {
   ControlLCAUtil.preserveValues((Control) widget);
   Shell shell = (Shell) widget;
   IWidgetAdapter adapter = WidgetUtil.getAdapter(shell);
   adapter.preserve(PROP_ACTIVE_CONTROL, getActiveControl(shell));
   adapter.preserve(PROP_ACTIVE_SHELL, shell.getDisplay().getActiveShell());
   adapter.preserve(PROP_TEXT, shell.getText());
   adapter.preserve(PROP_IMAGE, shell.getImage());
   adapter.preserve(PROP_ALPHA, new Integer(shell.getAlpha()));
   adapter.preserve(PROP_MODE, getMode(shell));
   adapter.preserve(PROP_FULLSCREEN, Boolean.valueOf(shell.getFullScreen()));
   adapter.preserve(PROP_SHELL_LISTENER, Boolean.valueOf(ShellEvent.hasListener(shell)));
   adapter.preserve(PROP_SHELL_MENU, shell.getMenuBar());
   adapter.preserve(PROP_MINIMUM_SIZE, shell.getMinimumSize());
   WidgetLCAUtil.preserveCustomVariant(shell);
 }
Example #5
0
  public void renderInitialization(final Widget widget) throws IOException {
    IWidgetSynchronizer synchronizer = WidgetSynchronizerFactory.getSynchronizerForWidget(widget);
    List styleList = new ArrayList();
    int style = widget.getStyle();
    if ((style & SWT.BORDER) != 0) {
      styleList.add("BORDER");
    }
    if ((style & MODAL) != 0) {
      styleList.add("MODAL");
    }
    if ((style & SWT.ON_TOP) != 0) {
      styleList.add("ON_TOP");
    }
    if ((style & SWT.TITLE) != 0) {
      styleList.add("TITLE");
    }
    if ((style & SWT.TOOL) != 0) {
      styleList.add("TOOL");
    }
    if ((style & SWT.SHEET) != 0) {
      styleList.add("SHEET");
    }
    if ((style & SWT.MIN) != 0) {
      styleList.add("MIN");
    }
    if ((style & SWT.MAX) != 0) {
      styleList.add("MAX");
    }
    if ((style & SWT.CLOSE) != 0) {
      styleList.add("CLOSE");
    }
    if ((style & SWT.RESIZE) != 0) {
      styleList.add("RESIZE");
    }
    String[] styles = new String[styleList.size()];
    styleList.toArray(styles);
    Composite parent = ((Shell) widget).getParent();
    if (parent instanceof Shell) {
      String parentId = WidgetUtil.getId(parent);
      synchronizer.newWidget(styles, new Object[] {parentId});
    }
    synchronizer.newWidget(styles);

    // old
    //    JSWriter writer = JSWriter.getWriterFor( widget );
    //    Shell shell = ( Shell )widget;
    //    writer.newWidget( QX_TYPE );
    //    ControlLCAUtil.writeStyleFlags( shell );
    //    if( ( style & MODAL ) != 0 ) {
    //      writer.call( "addState", new Object[] { "rwt_APPLICATION_MODAL" } );
    //    }
    //    if( ( style & SWT.ON_TOP ) != 0 ) {
    //      writer.call( "addState", new Object[] { "rwt_ON_TOP" } );
    //    }
    //    if( ( style & SWT.TITLE ) != 0 ) {
    //      writer.call( "addState", new Object[]{ "rwt_TITLE" } );
    //    }
    //    if( ( style & SWT.TOOL ) != 0 ) {
    //      writer.call( "addState", new Object[]{ "rwt_TOOL" } );
    //    }
    //    if( ( style & SWT.SHEET ) != 0 ) {
    //      writer.call( "addState", new Object[]{ "rwt_SHEET" } );
    //    }
    //    writer.set( "showMinimize", ( style & SWT.MIN ) != 0 );
    //    writer.set( "allowMinimize", ( style & SWT.MIN ) != 0 );
    //    writer.set( "showMaximize", ( style & SWT.MAX ) != 0 );
    //    writer.set( "allowMaximize", ( style & SWT.MAX ) != 0 );
    //    writer.set( "showClose", ( style & SWT.CLOSE ) != 0 );
    //    writer.set( "allowClose", ( style & SWT.CLOSE ) != 0 );
    //    Boolean resizable = Boolean.valueOf( ( style & SWT.RESIZE ) != 0 );
    //    writer.set( "resizable",
    //                new Object[] { resizable, resizable, resizable, resizable } );
    //    if( parent instanceof Shell ) {
    //      writer.set( "parentShell", parent );
    //    }
    //    writer.call( "initialize", null );
  }