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 237532 Details for
Bug 421852
Create menu operation does not include parent information
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]
Proposed patch
bug-421852.patch (text/plain), 9.17 KB, created by
Ivan Furnadjiev
on 2013-11-18 11:09:08 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Ivan Furnadjiev
Created:
2013-11-18 11:09:08 EST
Size:
9.17 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/MenuHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/MenuHandler.js >index b238790..359b4c7 100644 >--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/MenuHandler.js >+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/MenuHandler.js >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2011, 2012 EclipseSource and others. >+ * Copyright (c) 2011, 2013 EclipseSource and others. > * 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 >@@ -16,6 +16,9 @@ > // TODO [tb] : split into Menu and MenuBar, or unify parent handling > if( properties.style.indexOf( "BAR" ) != -1 ) { > result = new rwt.widgets.MenuBar(); >+ rwt.remote.HandlerUtil.callWithTarget( properties.parent, function( parent ) { >+ result.setParent( parent ); >+ } ); > } else { > result = new rwt.widgets.Menu(); > } >@@ -28,20 +31,12 @@ > getDestroyableChildren : rwt.remote.HandlerUtil.getDestroyableChildrenFinder(), > > properties : [ >- "parent", > "bounds", > "enabled", > "customVariant" > ], > > propertyHandler : { >- "parent" : function( widget, value ) { >- if( widget.hasState( "rwt_BAR" ) ) { >- rwt.remote.HandlerUtil.callWithTarget( value, function( parent ) { >- widget.setParent( parent ); >- } ); >- } >- }, > "bounds" : function( widget, value ) { > if( widget.hasState( "rwt_BAR" ) ) { > widget.setLeft( value[ 0 ] ); >diff --git a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/menukit/MenuLCA.java b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/menukit/MenuLCA.java >index fdf0761..7d0367e 100644 >--- a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/menukit/MenuLCA.java >+++ b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/menukit/MenuLCA.java >@@ -21,6 +21,7 @@ > import static org.eclipse.rap.rwt.lifecycle.WidgetLCAUtil.renderListener; > import static org.eclipse.rap.rwt.lifecycle.WidgetLCAUtil.renderProperty; > import static org.eclipse.rap.rwt.lifecycle.WidgetLCAUtil.wasEventSent; >+import static org.eclipse.rap.rwt.lifecycle.WidgetUtil.getId; > import static org.eclipse.swt.internal.events.EventLCAUtil.isListening; > > import java.io.IOException; >@@ -34,6 +35,7 @@ > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.internal.widgets.IMenuAdapter; > import org.eclipse.swt.internal.widgets.IShellAdapter; >+import org.eclipse.swt.internal.widgets.Props; > import org.eclipse.swt.widgets.Decorations; > import org.eclipse.swt.widgets.Menu; > import org.eclipse.swt.widgets.MenuItem; >@@ -47,12 +49,13 @@ > "BAR", "DROP_DOWN", "POP_UP", "NO_RADIO_GROUP" > }; > >- private static final String PROP_PARENT = "parent"; > private static final String PROP_ENABLED = "enabled"; > private static final String PROP_SHOW_LISTENER = "Show"; > private static final String PROP_HIDE_LISTENER = "Hide"; > private static final String METHOD_UNHIDE_ITEMS = "unhideItems"; > private static final String METHOD_SHOW_MENU = "showMenu"; >+ >+ private static final Rectangle DEFAULT_BOUNDS = new Rectangle( 0, 0, 0, 0 ); > > @Override > public void preserveValues( Widget widget ) { >@@ -62,9 +65,6 @@ > preserveListener( menu, PROP_HIDE_LISTENER, hasHideListener( menu ) ); > WidgetLCAUtil.preserveCustomVariant( menu ); > WidgetLCAUtil.preserveHelpListener( menu ); >- if( isMenuBar( menu ) ) { >- preserveProperty( menu, PROP_PARENT, getParent( menu ) ); >- } > } > > @Override >@@ -72,6 +72,7 @@ > Menu menu = ( Menu )widget; > RemoteObject remoteObject = createRemoteObject( menu , TYPE ); > remoteObject.setHandler( new MenuOperationHandler( menu ) ); >+ remoteObject.set( "parent", getId( menu.getParent() ) ); > remoteObject.set( "style", createJsonArray( getStyles( menu, ALLOWED_STYLES ) ) ); > } > >@@ -83,9 +84,6 @@ > renderListener( menu, PROP_HIDE_LISTENER, hasHideListener( menu ), false ); > WidgetLCAUtil.renderCustomVariant( menu ); > WidgetLCAUtil.renderListenHelp( menu ); >- if( isMenuBar( menu ) ) { >- renderProperty( menu, PROP_PARENT, getParent( menu ), null ); >- } > renderBounds( menu ); > renderShow( menu ); > renderUnhideItems( menu ); >@@ -98,9 +96,9 @@ > } > > private static void renderBounds( Menu menu ) { >- if( isMenuBar( menu ) && getParent( menu ) != null ) { >+ if( isMenuBar( menu ) ) { > // Bounds are preserved in ShellLCA#preserveMenuBounds >- WidgetLCAUtil.renderBounds( menu, getBounds( menu ) ); >+ renderProperty( menu, Props.BOUNDS, getBounds( menu ), DEFAULT_BOUNDS ); > } > } > >@@ -146,15 +144,14 @@ > > private static Rectangle getBounds( Menu menu ) { > Rectangle result = new Rectangle( 0, 0, 0, 0 ); >- Decorations parent = getParent( menu ); >+ Decorations parent = getBoundingShell( menu ); > if( parent != null ) { >- IShellAdapter shellAdapter = parent.getAdapter( IShellAdapter.class ); >- result = shellAdapter.getMenuBounds(); >+ result = parent.getAdapter( IShellAdapter.class ).getMenuBounds(); > } > return result; > } > >- private static Decorations getParent( Menu menu ) { >+ private static Decorations getBoundingShell( Menu menu ) { > Decorations result = null; > if( menu.getParent().getMenuBar() == menu ) { > result = menu.getParent(); >diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/menukit/MenuLCA_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/menukit/MenuLCA_Test.java >index cc9a48f..e1b660f 100644 >--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/menukit/MenuLCA_Test.java >+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/menukit/MenuLCA_Test.java >@@ -73,33 +73,6 @@ > } > > @Test >- public void testUnassignedMenuBar() throws IOException { >- String shellId = WidgetUtil.getId( shell ); >- Menu menuBar = new Menu( shell, SWT.BAR ); >- Fixture.markInitialized( display ); >- Fixture.markInitialized( menuBar ); >- // Ensure that a menuBar that is not assigned to any shell (via setMenuBar) >- // is rendered but without settings its parent >- lca.renderChanges( menuBar ); >- Message message = Fixture.getProtocolMessage(); >- assertNull( message.findSetOperation( menuBar, "parent" ) ); >- // The contrary: an assigned menuBar has to be rendered with setParent >- Fixture.fakeNewRequest(); >- Fixture.preserveWidgets(); >- shell.setMenuBar( menuBar ); >- lca.renderChanges( menuBar ); >- message = Fixture.getProtocolMessage(); >- assertEquals( shellId, message.findSetProperty( menuBar, "parent" ).asString() ); >- // Un-assigning a menuBar must result in setParent( null ) being rendered >- Fixture.fakeNewRequest(); >- Fixture.preserveWidgets(); >- shell.setMenuBar( null ); >- lca.renderChanges( menuBar ); >- message = Fixture.getProtocolMessage(); >- assertEquals( JsonObject.NULL, message.findSetProperty( menuBar, "parent" ) ); >- } >- >- @Test > public void testRenderBoundsForMenuBar() { > getRemoteObject( shell ).setHandler( new ShellOperationHandler( shell ) ); > Menu menuBar = new Menu( shell, SWT.BAR ); >@@ -205,39 +178,23 @@ > } > > @Test >- public void testRenderInitialParent() throws IOException { >+ public void testRenderParent_bar() throws IOException { > Menu menu = new Menu( shell, SWT.BAR ); > >- lca.render( menu ); >+ lca.renderInitialization( menu ); > > Message message = Fixture.getProtocolMessage(); >- CreateOperation operation = message.findCreateOperation( menu ); >- assertTrue( operation.getPropertyNames().indexOf( "parent" ) == -1 ); >+ assertEquals( getId( shell ), message.findCreateProperty( menu, "parent" ).asString() ); > } > > @Test >- public void testRenderParent() throws IOException { >- Menu menu = new Menu( shell, SWT.BAR ); >+ public void testRenderParent_popup() throws IOException { >+ Menu menu = new Menu( shell, SWT.POP_UP ); > >- shell.setMenuBar( menu ); >- lca.renderChanges( menu ); >+ lca.renderInitialization( menu ); > > Message message = Fixture.getProtocolMessage(); >- assertEquals( getId( shell ), message.findSetProperty( menu, "parent" ).asString() ); >- } >- >- @Test >- public void testRenderParentUnchanged() throws IOException { >- Menu menu = new Menu( shell, SWT.BAR ); >- Fixture.markInitialized( display ); >- Fixture.markInitialized( menu ); >- >- shell.setMenuBar( menu ); >- Fixture.preserveWidgets(); >- lca.renderChanges( menu ); >- >- Message message = Fixture.getProtocolMessage(); >- assertNull( message.findSetOperation( menu, "parent" ) ); >+ assertEquals( getId( shell ), message.findCreateProperty( menu, "parent" ).asString() ); > } > > @Test >@@ -290,7 +247,8 @@ > lca.renderChanges( menu ); > > Message message = Fixture.getProtocolMessage(); >- assertNull( message.findSetOperation( menu, "bounds" ) ); >+ JsonArray bounds = message.findSetProperty( menu, "bounds" ).asArray(); >+ assertEquals( new JsonArray().add( 0 ).add( 0 ).add( 0 ).add( 0 ), bounds ); > } > > @Test
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
Flags:
ivan
:
review?
Actions:
View
|
Diff
Attachments on
bug 421852
: 237532