Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 148880 Details for
Bug 290234
[Theming] Make focus appearance themeable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Custom frame for buttons
CustomFocusIndicator.txt (text/plain), 10.75 KB, created by
Tim Buschtoens
on 2009-10-06 09:16:00 EDT
(
hide
)
Description:
Custom frame for buttons
Filename:
MIME Type:
Creator:
Tim Buschtoens
Created:
2009-10-06 09:16:00 EDT
Size:
10.75 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.qx.build >Index: source/class/qx/ui/core/Widget.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/releng/org.eclipse.rap.qx.build/source/class/qx/ui/core/Widget.js,v >retrieving revision 1.5 >diff -u -r1.5 Widget.js >--- source/class/qx/ui/core/Widget.js 8 Sep 2009 10:11:57 -0000 1.5 >+++ source/class/qx/ui/core/Widget.js 6 Oct 2009 13:06:39 -0000 >@@ -69,6 +69,7 @@ > { > this._generateHtmlId(); > } >+ this.initHideFocus(); > }, > > >@@ -1659,7 +1660,7 @@ > hideFocus : > { > check : "Boolean", >- init : false, >+ init : true, > apply : "_applyHideFocus", > themeable : true > }, >#P org.eclipse.rap.rwt.q07 >Index: js/org/eclipse/rwt/widgets/Button.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/widgets/Button.js,v >retrieving revision 1.6 >diff -u -r1.6 Button.js >--- js/org/eclipse/rwt/widgets/Button.js 4 Oct 2009 10:09:59 -0000 1.6 >+++ js/org/eclipse/rwt/widgets/Button.js 6 Oct 2009 13:06:46 -0000 >@@ -25,7 +25,9 @@ > case "radio": > this.setAppearance( "radio-button" ); > } >- this.initTabIndex(); >+ this.initTabIndex(); >+ this.addEventListener( "focus", this._onFocus ); >+ this.addEventListener( "blur", this._onBlur ); > }, > > properties : { >@@ -35,5 +37,53 @@ > init : -1 > } > >+ }, >+ >+ members : { >+ >+ //overwritten >+ _beforeRenderLayout : function( changes ) { >+ if( this.hasState( "focused" ) ) { >+ var focusIndicator = org.eclipse.rwt.FocusIndicator.getInstance(); >+ focusIndicator.update( this, this._getFocusIndicatorBounds() ); >+ } >+ }, >+ >+ _onFocus : function( event ) { >+ var focusIndicator = org.eclipse.rwt.FocusIndicator.getInstance(); >+ focusIndicator.show( this, this._getFocusIndicatorBounds() ); >+ }, >+ >+ _onBlur : function( event ) { >+ var focusIndicator = org.eclipse.rwt.FocusIndicator.getInstance(); >+ focusIndicator.hide( this ); >+ }, >+ >+ _getFocusIndicatorBounds : function() { >+ var result = null; >+ if( this.isCreated() ) { >+ if( ( this.hasState( "radio" ) || this.hasState( "check" ) ) >+ && ( this.getCellNode( 2 ) != null ) >+ ) { >+ var node = this.getCellNode( 2 ); >+ var left = parseInt( node.style.left ) - 2; >+ var top = parseInt( node.style.top ) - 2; >+ var width = parseInt( node.style.width ) + 6; >+ var height = parseInt( node.style.height ) + 6; >+ result = [ left, top, width, height ]; >+ } else { >+ var node = this._getTargetNode(); >+ var left = 2; >+ var top = 2; >+ var width = parseInt( node.style.width ) - 4; >+ var height = parseInt( node.style.height ) - 4; >+ result = [ left, top, width, height ]; >+ } >+ } else { >+ result = [ 0, 0, 0, 0 ]; >+ } >+ return result; >+ } >+ > } > } ); >\ No newline at end of file >Index: src/org/eclipse/swt/internal/widgets/displaykit/QooxdooResourcesUtil.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt.q07/src/org/eclipse/swt/internal/widgets/displaykit/QooxdooResourcesUtil.java,v >retrieving revision 1.26 >diff -u -r1.26 QooxdooResourcesUtil.java >--- src/org/eclipse/swt/internal/widgets/displaykit/QooxdooResourcesUtil.java 25 Sep 2009 14:42:57 -0000 1.26 >+++ src/org/eclipse/swt/internal/widgets/displaykit/QooxdooResourcesUtil.java 6 Oct 2009 13:06:46 -0000 >@@ -169,6 +169,8 @@ > = "org/eclipse/swt/theme/ThemeStore.js"; > private static final String THEME_BORDERS_BASE > = "org/eclipse/swt/theme/BordersBase.js"; >+ private static final String FOCUS_INDICATOR >+ = "org/eclipse/rwt/FocusIndicator.js"; > > private QooxdooResourcesUtil() { > // prevent intance creation >@@ -264,6 +266,7 @@ > register( THEME_BORDERS_BASE, compress ); > register( THEME_STORE, compress ); > register( THEME_VALUES, compress ); >+ register( FOCUS_INDICATOR, compress ); > > // register contributions > registerContributions(); >Index: js/org/eclipse/rwt/FocusIndicator.js >=================================================================== >RCS file: js/org/eclipse/rwt/FocusIndicator.js >diff -N js/org/eclipse/rwt/FocusIndicator.js >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ js/org/eclipse/rwt/FocusIndicator.js 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,74 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 Innoopract Informationssysteme GmbH. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * EclipseSource - ongoing development >+ ******************************************************************************/ >+ >+qx.Class.define( "org.eclipse.rwt.FocusIndicator", { >+ type : "singleton", >+ extend : qx.core.Object, >+ >+ construct : function() { >+ this.base( arguments ); >+ this._frame = document.createElement( "div" ); >+ this._borderWidth = 1; >+ this._frame.setAttribute( "id", "focusIndicator" ); >+ this._frame.style.position = "absolute"; >+ this._frame.style.zIndex = "1000000"; >+ this._frame.style.backgroundColor = "transparent"; >+ this._frame.style.fontSize = 0; >+ this._frame.style.lineHeight = 0; >+ this._frame.style.border = this._borderWidth + "px dotted gray"; >+ this._parentNode = null; >+ this._currentWidget = null; >+ }, >+ >+ members : { >+ >+ show : function( widget, bounds ) { >+ this._hide(); >+ this._currentWidget = widget; >+ if( widget.isCreated() ) { >+ this._parentNode = widget._getTargetNode(); >+ this.update( widget, bounds ); >+ } >+ // TODO [tb] : handle not yet created widgets (?) >+ }, >+ >+ update : function( widget, bounds ) { >+ // Note : bounds are given as array [ left, top, width, height ] >+ if( widget == this._currentWidget ) { >+ if( this._frame.parentNode != this._parentNode ) { >+ this._parentNode.appendChild( this._frame ); >+ } >+ this._frame.style.left = bounds[ 0 ] + "px"; >+ this._frame.style.top = bounds[ 1 ] + "px"; >+ this._frame.style.width >+ = ( bounds[ 2 ] - this._borderWidth * 2 ) + "px"; >+ this._frame.style.height >+ = ( bounds[ 3 ] - this._borderWidth * 2 ) + "px"; >+ } >+ }, >+ >+ hide : function( widget ) { >+ if( widget == this._currentWidget ) { >+ this._hide(); >+ this._currentWidget = null; >+ } >+ }, >+ >+ _hide : function() { >+ if( this._frame.parentNode != null ) { >+ this._frame.parentNode.removeChild( this._frame ); >+ } >+ this._parentNode = null; >+ } >+ >+ } >+} ); >+ >#P org.eclipse.rap.rwt.q07.jstest >Index: js/org/eclipse/rwt/test/tests/ButtonTest.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.q07.jstest/js/org/eclipse/rwt/test/tests/ButtonTest.js,v >retrieving revision 1.1 >diff -u -r1.1 ButtonTest.js >--- js/org/eclipse/rwt/test/tests/ButtonTest.js 27 Aug 2009 15:35:40 -0000 1.1 >+++ js/org/eclipse/rwt/test/tests/ButtonTest.js 6 Oct 2009 13:06:49 -0000 >@@ -17,6 +17,37 @@ > }, > > members : { >+ >+ testFocusIndicator : function() { >+ var hasFocusIndicator = function( widget ) { >+ var node = widget._getTargetNode(); >+ var result = false; >+ for( var i = 0; i < node.childNodes.length; i++ ) { >+ if( node.childNodes[ i ].getAttribute( "id") == "focusIndicator" ) { >+ result = true; >+ } >+ } >+ return result; >+ } >+ var button = new org.eclipse.rwt.widgets.Button( "push" ); >+ this._currentButton = button; >+ button.addToDocument(); >+ qx.ui.core.Widget.flushGlobalQueues(); >+ assertFalse( button.hasState( "focus" ) ); >+ assertFalse( hasFocusIndicator( button ) ); >+ button.focus(); >+ qx.ui.core.Widget.flushGlobalQueues(); >+ assertTrue( hasFocusIndicator( button ) ); >+ button.setImage( "test.jpg" ); >+ qx.ui.core.Widget.flushGlobalQueues(); >+ assertTrue( hasFocusIndicator( button ) ); >+ button.blur(); >+ qx.ui.core.Widget.flushGlobalQueues(); >+ assertFalse( hasFocusIndicator( button ) ); >+ button.destroy(); >+ qx.ui.core.Widget.flushGlobalQueues(); >+ }, >+ > testParent : function() { > var button = new org.eclipse.rwt.widgets.Button( "push" ); > this._currentButton = button; >@@ -33,7 +64,7 @@ > button.getCellNode( 2 ).parentNode > ); > button.setParent( null ); >- button.dispose(); >+ button.destroy(); > qx.ui.core.Widget.flushGlobalQueues(); > }, > >@@ -45,7 +76,7 @@ > qx.ui.core.Widget.flushGlobalQueues(); > assertEquals( "Hello World!", button.getCellNode( 2 ).innerHTML ); > button.setParent( null ); >- button.dispose(); >+ button.destroy(); > qx.ui.core.Widget.flushGlobalQueues(); > }, > >@@ -59,7 +90,7 @@ > this.testUtil.getCssBackgroundImage( button.getCellNode( 1 ) ).search( "test.jpg" ) != -1 > ); > button.setParent( null ); >- button.dispose(); >+ button.destroy(); > qx.ui.core.Widget.flushGlobalQueues(); > }, > >Index: js/resource/Includes.js >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.q07.jstest/js/resource/Includes.js,v >retrieving revision 1.7 >diff -u -r1.7 Includes.js >--- js/resource/Includes.js 24 Sep 2009 09:50:48 -0000 1.7 >+++ js/resource/Includes.js 6 Oct 2009 13:06:49 -0000 >@@ -70,6 +70,7 @@ > <script src="../org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/RadioButtonUtil.js" type="text/javascript"></script>\ > <script src="../org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/GfxMixin.js" type="text/javascript"></script>\ > <script src="../org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/RoundedBorder.js" type="text/javascript"></script>\ >+<script src="../org.eclipse.rap.rwt.q07/js/org/eclipse/rwt/FocusIndicator.js" type="text/javascript"></script>\ > \ > <!-- rwt.test -->\ > <script src="./js/org/eclipse/rwt/test/fixture/RAPRequestPatch.js" type="text/javascript"></script>\
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 290234
:
148406
|
148880
|
148882
|
150614
|
150716
|
150717