Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 286073 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/swt/internal/widgets/displaykit/QooxdooResourcesUtil.java (+3 lines)
Lines 143-148 Link Here
143
    = "org/eclipse/swt/widgets/Slider.js";
143
    = "org/eclipse/swt/widgets/Slider.js";
144
  private static final String RADIOBUTTONUTIL_JS
144
  private static final String RADIOBUTTONUTIL_JS
145
  = "org/eclipse/rwt/RadioButtonUtil.js";
145
  = "org/eclipse/rwt/RadioButtonUtil.js";
146
  private static final String BUTTONUTIL_JS
147
  = "org/eclipse/swt/ButtonUtil.js";
146
  private static final String LINK_JS
148
  private static final String LINK_JS
147
    = "org/eclipse/swt/widgets/Link.js";
149
    = "org/eclipse/swt/widgets/Link.js";
148
  private static final String HTMLUTIL_JS
150
  private static final String HTMLUTIL_JS
Lines 233-238 Link Here
233
      register( EXPAND_ITEM_JS, compress );
235
      register( EXPAND_ITEM_JS, compress );
234
      register( SLIDER_JS, compress );
236
      register( SLIDER_JS, compress );
235
      register( RADIOBUTTONUTIL_JS, compress );
237
      register( RADIOBUTTONUTIL_JS, compress );
238
      register( BUTTONUTIL_JS, compress );
236
      register( LINK_JS, compress );
239
      register( LINK_JS, compress );
237
      register( HTMLUTIL_JS, compress );
240
      register( HTMLUTIL_JS, compress );
238
      register( MULTICELLWIDGET, compress );
241
      register( MULTICELLWIDGET, compress );
(-)js/org/eclipse/swt/ButtonUtil.js (+109 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
10
 *     EclipseSource - ongoing development
11
 ******************************************************************************/
12
13
14
/**
15
 * This class contains static functions for radio buttons and check boxes.
16
 */
17
qx.Class.define( "org.eclipse.swt.ButtonUtil", {
18
19
  statics : {
20
21
    setLabelMode : function( button ) {
22
      // Note: called directly after creating the menuItem instance, therefore
23
      // it is not necessary to check getLabelObject and/or preserve its label
24
      button.setLabel( "(empty)" );
25
      button.getLabelObject().setMode( "html" );
26
      button.getLabelObject().setAppearance( "label-graytext" );
27
      button.setLabel( "" );
28
    },
29
30
    /**
31
     * Registers the given button at the RadioManager of the first sibling
32
     * radio button. If there is not sibing radio button, a new RadioManager
33
     * is created.
34
     */
35
    registerRadioButton : function( button ) {
36
      var radioManager = null;
37
      var parent = button.getParent();
38
      var siblings = parent.getChildren();
39
      for( var i = 0; radioManager == null && i < siblings.length; i++ ) {
40
        if(    siblings[ i ] != button
41
            && siblings[ i ].classname == button.classname )
42
        {
43
          radioManager = siblings[ i ].getManager();
44
        }
45
      }
46
      if( radioManager == null ) {
47
        radioManager = new qx.ui.selection.RadioManager();
48
      }
49
      radioManager.add( button );
50
    },
51
52
    /**
53
     * Removes the given button from its RadioManager and disposes of the
54
     * RadioManager if there are no more radio buttons that use this
55
     * RadioManager.
56
     */
57
    unregisterRadioButton : function( button ) {
58
      var radioManager = button.getManager();
59
      if( radioManager != null ) {
60
        radioManager.remove( button );
61
        if( radioManager.getItems().length == 0 ) {
62
          radioManager.dispose();
63
        }
64
      }
65
    },
66
67
    radioSelected : function( evt ) {
68
      var radioManager = evt.getTarget();
69
      var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
70
      var req = org.eclipse.swt.Request.getInstance();
71
      var radioButtons = radioManager.getItems();
72
      for( var i=0; i<radioButtons.length; i++ ) {
73
        var selected = radioButtons[ i ] == radioManager.getSelected();
74
        var id = widgetManager.findIdByWidget( radioButtons[ i ] );
75
        req.addParameter( id + ".selection", selected );
76
      }
77
    },
78
79
    radioSelectedAction : function( evt ) {
80
      if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
81
        org.eclipse.swt.ButtonUtil.radioSelected( evt );
82
        var radioManager = evt.getTarget();
83
        var radio = radioManager.getSelected();
84
        if( radio != null ) {
85
          var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
86
          var id = widgetManager.findIdByWidget( radio );
87
          org.eclipse.swt.EventUtil.doWidgetSelected( id, 0, 0, 0, 0 );
88
        }
89
      }
90
    },
91
92
    /* Called when a TOGGLE button is executed */
93
    onToggleExecute : function( evt ) {
94
      if( !org_eclipse_rap_rwt_EventUtil_suspend ) {
95
        var button = evt.getTarget();
96
        var checked = !button.hasState( "checked" );
97
        if( checked ) {
98
          button.addState( "checked" );
99
        } else {
100
          button.removeState( "checked" );
101
        }
102
        var widgetManager = org.eclipse.swt.WidgetManager.getInstance();
103
        var id = widgetManager.findIdByWidget( button );
104
        var req = org.eclipse.swt.Request.getInstance();
105
        req.addParameter( id + ".selection", checked );
106
      }
107
    }
108
  }
109
});

Return to bug 286073