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 140405 Details for
Bug 281131
ThemeCssProperty consumes too much memory
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
clipboard.txt (text/plain), 18.73 KB, created by
Ralf Sternberg
on 2009-06-29 12:45:00 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Ralf Sternberg
Created:
2009-06-29 12:45:00 EDT
Size:
18.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/rwt/internal/theme/ThemeCssElement.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/ThemeCssElement.java,v >retrieving revision 1.1 >diff -u -r1.1 ThemeCssElement.java >--- src/org/eclipse/rwt/internal/theme/ThemeCssElement.java 2 Sep 2008 23:38:34 -0000 1.1 >+++ src/org/eclipse/rwt/internal/theme/ThemeCssElement.java 29 Jun 2009 16:43:32 -0000 >@@ -18,8 +18,6 @@ > > private final String name; > >- private String description; >- > private Collection properties; > > private Collection styles; >@@ -37,41 +35,33 @@ > return name; > } > >- public String getDescription() { >- return description; >- } >- >- public IThemeCssProperty[] getProperties() { >- IThemeCssProperty[] result = new IThemeCssProperty[ properties.size() ]; >+ public String[] getProperties() { >+ String[] result = new String[ properties.size() ]; > properties.toArray( result ); > return result; > } > >- public IThemeCssAttribute[] getStyles() { >- IThemeCssAttribute[] result = new IThemeCssAttribute[ styles.size() ]; >+ public String[] getStyles() { >+ String[] result = new String[ styles.size() ]; > styles.toArray( result ); > return result; > } > >- public IThemeCssAttribute[] getStates() { >- IThemeCssAttribute[] result = new IThemeCssAttribute[ states.size() ]; >+ public String[] getStates() { >+ String[] result = new String[ states.size() ]; > states.toArray( result ); > return result; > } > >- public void setDescription( final String description ) { >- this.description = description; >- } >- >- public void addProperty( final IThemeCssProperty property ) { >+ public void addProperty( final String property ) { > properties.add( property ); > } > >- public void addStyle( final IThemeCssAttribute style ) { >+ public void addStyle( final String style ) { > styles.add( style ); > } > >- public void addState( final IThemeCssAttribute state ) { >+ public void addState( final String state ) { > states.add( state ); > } > } >Index: src/org/eclipse/rwt/internal/theme/ThemeCssValuesMap.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/ThemeCssValuesMap.java,v >retrieving revision 1.5 >diff -u -r1.5 ThemeCssValuesMap.java >--- src/org/eclipse/rwt/internal/theme/ThemeCssValuesMap.java 4 Jun 2009 11:48:51 -0000 1.5 >+++ src/org/eclipse/rwt/internal/theme/ThemeCssValuesMap.java 29 Jun 2009 16:43:32 -0000 >@@ -33,10 +33,9 @@ > final StyleSheet styleSheet ) > { > String elementName = element.getName(); >- IThemeCssProperty[] properties = element.getProperties(); >+ String[] properties = element.getProperties(); > for( int i = 0; i < properties.length; i++ ) { >- IThemeCssProperty property = properties[ i ]; >- String propertyName = property.getName(); >+ String propertyName = properties[ i ]; > ConditionalValue[] values = styleSheet.getValues( elementName, > propertyName ); > ConditionalValue[] filteredValues = filterValues( values, element ); >@@ -100,13 +99,11 @@ > return passed; > } > >- private static boolean contains( final IThemeCssAttribute[] attributes, >- final String name ) >+ private static boolean contains( final String[] elements, final String string ) > { > boolean result = false; >- for( int i = 0; i < attributes.length && !result; i++ ) { >- IThemeCssAttribute themeCssAttribute = attributes[ i ]; >- if( name.equals( themeCssAttribute.getName() ) ) { >+ for( int i = 0; i < elements.length && !result; i++ ) { >+ if( string.equals( elements[ i ] ) ) { > result = true; > } > } >Index: src/org/eclipse/rwt/internal/theme/ThemeCssProperty.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/theme/ThemeCssProperty.java >diff -N src/org/eclipse/rwt/internal/theme/ThemeCssProperty.java >--- src/org/eclipse/rwt/internal/theme/ThemeCssProperty.java 9 Oct 2008 09:03:44 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,46 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.theme; >- >- >-/** >- * A property in a theme definition file (*.theme.xml). >- */ >-public class ThemeCssProperty implements IThemeCssProperty { >- >- private final String name; >- private final String type; >- private String description; >- >- public ThemeCssProperty( final String name, final String type ) { >- if( name == null || type == null ) { >- throw new NullPointerException( "null argument" ); >- } >- this.name = name; >- this.type = type; >- } >- >- public String getName() { >- return name; >- } >- >- public String getType() { >- return type; >- } >- >- public String getDescription() { >- return description; >- } >- >- public void setDescription( final String description ) { >- this.description = description; >- } >-} >Index: src/org/eclipse/rwt/internal/theme/IThemeCssAttribute.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/theme/IThemeCssAttribute.java >diff -N src/org/eclipse/rwt/internal/theme/IThemeCssAttribute.java >--- src/org/eclipse/rwt/internal/theme/IThemeCssAttribute.java 2 Sep 2008 23:38:34 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,23 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.rwt.internal.theme; >- >- >-/** >- * A state or a style that can be applied to an {@link IThemeCssElement}. >- */ >-public interface IThemeCssAttribute { >- >- public abstract String getName(); >- >- public abstract String getDescription(); >-} >Index: src/org/eclipse/rwt/internal/theme/IThemeCssElement.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/IThemeCssElement.java,v >retrieving revision 1.1 >diff -u -r1.1 IThemeCssElement.java >--- src/org/eclipse/rwt/internal/theme/IThemeCssElement.java 2 Sep 2008 23:38:34 -0000 1.1 >+++ src/org/eclipse/rwt/internal/theme/IThemeCssElement.java 29 Jun 2009 16:43:32 -0000 >@@ -20,11 +20,9 @@ > > public abstract String getName(); > >- public abstract String getDescription(); >+ public abstract String[] getProperties(); > >- public abstract IThemeCssProperty[] getProperties(); >+ public abstract String[] getStyles(); > >- public abstract IThemeCssAttribute[] getStyles(); >- >- public abstract IThemeCssAttribute[] getStates(); >+ public abstract String[] getStates(); > } >Index: src/org/eclipse/rwt/internal/theme/IThemeCssProperty.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/theme/IThemeCssProperty.java >diff -N src/org/eclipse/rwt/internal/theme/IThemeCssProperty.java >--- src/org/eclipse/rwt/internal/theme/IThemeCssProperty.java 9 Oct 2008 09:03:44 -0000 1.2 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,25 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >- >-package org.eclipse.rwt.internal.theme; >- >- >-/** >- * A themeable property of an {@link IThemeCssElement}. >- */ >-public interface IThemeCssProperty { >- >- public abstract String getName(); >- >- public abstract String getType(); >- >- public abstract String getDescription(); >-} >Index: src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader.java,v >retrieving revision 1.17 >diff -u -r1.17 ThemeDefinitionReader.java >--- src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader.java 4 Jun 2009 11:48:51 -0000 1.17 >+++ src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader.java 29 Jun 2009 16:43:32 -0000 >@@ -42,10 +42,6 @@ > > private static final String ATTR_NAME = "name"; > >- private static final String ATTR_TYPE = "type"; >- >- private static final String ATTR_DESCRIPTION = "description"; >- > public static final String TYPE_BOOLEAN = "boolean"; > > public static final String TYPE_BORDER = "border"; >@@ -128,8 +124,6 @@ > String name = getAttributeValue( node, ATTR_NAME ); > ThemeCssElement themeElement = new ThemeCssElement( name ); > cssElements.add( themeElement ); >- String description = getElementOrAttributeValue( node, ATTR_DESCRIPTION ); >- themeElement.setDescription( description ); > NodeList childNodes = node.getChildNodes(); > for( int i = 0; i < childNodes.getLength(); i++ ) { > Node childNode = childNodes.item( i ); >@@ -137,57 +131,16 @@ > if( ELEM_ELEMENT.equals( childNode.getNodeName() ) ) { > readElement( childNode ); > } else if( ELEM_PROPERTY.equals( childNode.getNodeName() ) ) { >- themeElement.addProperty( readProperty( childNode ) ); >+ themeElement.addProperty( getAttributeValue( childNode, ATTR_NAME ) ); > } else if( ELEM_STYLE.equals( childNode.getNodeName() ) ) { >- themeElement.addStyle( readStateOrStyle( childNode ) ); >+ themeElement.addStyle( getAttributeValue( childNode, ATTR_NAME ) ); > } else if( ELEM_STATE.equals( childNode.getNodeName() ) ) { >- themeElement.addState( readStateOrStyle( childNode ) ); >+ themeElement.addState( getAttributeValue( childNode, ATTR_NAME ) ); > } > } > } > } > >- private IThemeCssProperty readProperty( final Node node ) { >- String name = getAttributeValue( node, ATTR_NAME ); >- String type = getAttributeValue( node, ATTR_TYPE ); >- if( type == null ) { >- if( "padding".equals( name ) || "margin".equals( name ) ) { >- type = TYPE_BOXDIMENSIONS; >- } else if( "color".equals( name ) || "background-color".equals( name ) ) { >- type = TYPE_COLOR; >- } else if( "font".equals( name ) ) { >- type = TYPE_FONT; >- } else if( "border".equals( name ) ) { >- type = TYPE_BORDER; >- } else if( "spacing".equals( name ) >- || "width".equals( name ) >- || "height".equals( name ) ) >- { >- type = TYPE_DIMENSION; >- } else if( "background-image".equals( name ) ) { >- type = TYPE_IMAGE; >- } else { >- throw new IllegalArgumentException( "type unknown for property " + name ); >- } >- } >- ThemeCssProperty result = new ThemeCssProperty( name, type ); >- String description = getElementOrAttributeValue( node, ATTR_DESCRIPTION ); >- if( description != null ) { >- result.setDescription( description ); >- } >- return result; >- } >- >- private IThemeCssAttribute readStateOrStyle( final Node node ) { >- String name = getAttributeValue( node, ATTR_NAME ); >- ThemeCssAttribute result = new ThemeCssAttribute( name ); >- String description = getElementOrAttributeValue( node, ATTR_DESCRIPTION ); >- if( description != null ) { >- result.setDescription( description ); >- } >- return result; >- } >- > private Document parseThemeDefinition( final InputStream is ) > throws SAXException, IOException > { >@@ -227,25 +180,6 @@ > builder.setErrorHandler( new ThemeDefinitionErrorHandler() ); > return builder.parse( is ); > } >- >- private static String getElementOrAttributeValue( final Node node, >- final String name ) >- { >- String result = null; >- NodeList childNodes = node.getChildNodes(); >- int length = childNodes.getLength(); >- for( int i = 0; i < length && result == null; i++ ) { >- Node child = childNodes.item( i ); >- if( name.equals( child.getNodeName() ) ) { >- Node text = child.getFirstChild(); >- result = text.toString().trim(); >- } >- } >- if( result == null ) { >- result = getAttributeValue( node, name ); >- } >- return result; >- } > > private static String getAttributeValue( final Node node, final String name ) > { >Index: src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java,v >retrieving revision 1.1 >diff -u -r1.1 ThemeStoreWriter.java >--- src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java 15 Feb 2009 19:59:23 -0000 1.1 >+++ src/org/eclipse/rwt/internal/theme/ThemeStoreWriter.java 29 Jun 2009 16:43:32 -0000 >@@ -116,11 +116,10 @@ > IThemeCssElement element = elements[ i ]; > String elementName = element.getName(); > JsonObject elementObj = new JsonObject(); >- IThemeCssProperty[] properties = element.getProperties(); >+ String[] properties = element.getProperties(); > for( int j = 0; j < properties.length; j++ ) { >- IThemeCssProperty property = properties[ j ]; >+ String propertyName = properties[ j ]; > JsonArray valuesArray = new JsonArray(); >- String propertyName = property.getName(); > ConditionalValue[] values > = valuesMap.getValues( elementName, propertyName ); > for( int k = 0; k < values.length; k++ ) { >@@ -130,7 +129,7 @@ > array.append( Theme.createCssKey( conditionalValue.value ) ); > valuesArray.append( array ); > } >- elementObj.append( property.getName(), valuesArray ); >+ elementObj.append( propertyName, valuesArray ); > } > mainObject.append( elementName, elementObj ); > } >Index: src/org/eclipse/rwt/internal/theme/ThemeCssAttribute.java >=================================================================== >RCS file: src/org/eclipse/rwt/internal/theme/ThemeCssAttribute.java >diff -N src/org/eclipse/rwt/internal/theme/ThemeCssAttribute.java >--- src/org/eclipse/rwt/internal/theme/ThemeCssAttribute.java 2 Sep 2008 23:38:34 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,34 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2008 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: >- * Innoopract Informationssysteme GmbH - initial API and implementation >- ******************************************************************************/ >-package org.eclipse.rwt.internal.theme; >- >- >-public class ThemeCssAttribute implements IThemeCssAttribute { >- >- private final String name; >- private String description; >- >- public ThemeCssAttribute( final String name ) { >- this.name = name; >- } >- >- public String getName() { >- return name; >- } >- >- public String getDescription() { >- return description; >- } >- >- public void setDescription( final String description ) { >- this.description = description; >- } >-} >Index: src/org/eclipse/rwt/internal/theme/WidgetMatcher.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt/org.eclipse.rap.rwt/src/org/eclipse/rwt/internal/theme/WidgetMatcher.java,v >retrieving revision 1.6 >diff -u -r1.6 WidgetMatcher.java >--- src/org/eclipse/rwt/internal/theme/WidgetMatcher.java 4 Jun 2009 11:48:51 -0000 1.6 >+++ src/org/eclipse/rwt/internal/theme/WidgetMatcher.java 29 Jun 2009 16:43:32 -0000 >@@ -16,7 +16,6 @@ > > import org.eclipse.rwt.internal.theme.css.ConditionalValue; > import org.eclipse.rwt.lifecycle.WidgetUtil; >-import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Widget; > > >#P org.eclipse.rap.rwt.test >Index: src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader_Test.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.rap/runtime.rwt.test/org.eclipse.rap.rwt.test/src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader_Test.java,v >retrieving revision 1.9 >diff -u -r1.9 ThemeDefinitionReader_Test.java >--- src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader_Test.java 4 Jun 2009 11:49:01 -0000 1.9 >+++ src/org/eclipse/rwt/internal/theme/ThemeDefinitionReader_Test.java 29 Jun 2009 16:43:34 -0000 >@@ -39,19 +39,18 @@ > assertNotNull( elements ); > assertTrue( elements.length > 0 ); > assertEquals( "Button", elements[ 0 ].getName() ); >- assertNotNull( elements[ 0 ].getDescription() ); >- IThemeCssProperty[] properties = elements[ 0 ].getProperties(); >+ String[] properties = elements[ 0 ].getProperties(); > assertNotNull( properties ); > assertTrue( properties.length > 0 ); >- IThemeCssAttribute[] styles = elements[ 0 ].getStyles(); >+ assertEquals( "color", properties[ 0 ] ); >+ String[] styles = elements[ 0 ].getStyles(); > assertNotNull( styles ); > assertTrue( styles.length > 0 ); >- IThemeCssAttribute[] states = elements[ 0 ].getStates(); >+ assertEquals( "PUSH", styles[ 0 ] ); >+ String[] states = elements[ 0 ].getStates(); > assertNotNull( states ); > assertTrue( states.length > 0 ); >- assertTrue( properties.length > 0 ); >- assertEquals( "color", properties[ 0 ].getName() ); >- assertNotNull( properties[ 0 ].getDescription() ); >+ assertEquals( "hover", states[ 0 ] ); > } > > public void testNestedElements() throws Exception {
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 281131
:
139794
| 140405