Skip to content

Commit

Permalink
remove the default styles when create new report, now it's handled by
Browse files Browse the repository at this point in the history
the default theme.
  • Loading branch information
zhiqiangqian committed Jun 26, 2014
1 parent 0d04a83 commit 35ca663
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 35 deletions.
Expand Up @@ -3301,28 +3301,62 @@ public static LibraryHandle getDefaultLibraryHandle( )
*/
public static void setDefaultTheme( DesignElementHandle elementHandle )
{
// System.out.println(elementHandle.getDefn( ).getName( ));
if ( elementHandle instanceof ReportItemHandle
// We dont' set the report item theme now, it will inherit from report
// level theme.
// if ( elementHandle instanceof ReportItemHandle
// && hasDefaultLibrary( elementHandle.getModuleHandle( ) ) )
// {
// ReportItemHandle reportItemHandle = (ReportItemHandle) elementHandle;
// PropertyHandle propertyHandle = reportItemHandle.getPropertyHandle(
// ReportItemHandle.THEME_PROP );
// List list = propertyHandle.getReferenceableElementList( );
// String preFileName = getDefultLibraryFileName( );
// for ( int i = 0; i < list.size( ); i++ )
// {
// ReportItemThemeHandle itemHandle = (ReportItemThemeHandle) list.get(
// i );
// if ( itemHandle.getQualifiedName( ).startsWith( preFileName ) )
// {
// try
// {
// if ( propertyHandle.getValue( ) == null )
// propertyHandle.setValue( itemHandle.getQualifiedName( ) );
// break;
// }
// catch ( SemanticException e )
// {
// // do nothing
// }
// }
// }
// }

// for report design we set the report level theme to the first one from
// default library if applicable
if ( elementHandle instanceof ReportDesignHandle
&& hasDefaultLibrary( elementHandle.getModuleHandle( ) ) )
{
ReportItemHandle reportItemHandle = (ReportItemHandle) elementHandle;
PropertyHandle propertyHandle = reportItemHandle.getPropertyHandle( ReportItemHandle.THEME_PROP );
List list = propertyHandle.getReferenceableElementList( );
String preFileName = getDefultLibraryFileName( );
for ( int i = 0; i < list.size( ); i++ )
ReportDesignHandle designHandle = (ReportDesignHandle) elementHandle;
PropertyHandle propertyHandle = designHandle.getPropertyHandle( ModuleHandle.THEME_PROP );
if ( propertyHandle.getValue( ) == null )
{
ReportItemThemeHandle itemHandle = (ReportItemThemeHandle) list.get( i );
if ( itemHandle.getQualifiedName( ).startsWith( preFileName ) )
List list = propertyHandle.getReferenceableElementList( );
String preFileName = getDefultLibraryFileName( );
for ( int i = 0; i < list.size( ); i++ )
{
try
ThemeHandle itemHandle = (ThemeHandle) list.get( i );
if ( itemHandle.getQualifiedName( )
.startsWith( preFileName ) )
{
if ( propertyHandle.getValue( ) == null )
try
{
propertyHandle.setValue( itemHandle.getQualifiedName( ) );
break;
}
catch ( SemanticException e )
{
// do nothing
break;
}
catch ( SemanticException e )
{
// do nothing
}
}
}
}
Expand Down
Expand Up @@ -4,12 +4,6 @@
<html-property name="description">WizardTemplateChoicePage.message.BlankReport</html-property>
<text-property name="displayName">WizardTemplateChoicePage.title.BlankReport</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<styles>
<style name="report" id="4">
<property name="fontFamily">sans-serif</property>
<property name="fontSize">10pt</property>
</style>
</styles>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
Expand Down
Expand Up @@ -38,7 +38,9 @@ public class CrosstabItemFactory extends ReportItemFactory implements
/*
* (non-Javadoc)
*
* @see org.eclipse.birt.report.model.api.extension.ReportItemFactory#getMessages()
* @see
* org.eclipse.birt.report.model.api.extension.ReportItemFactory#getMessages
* ()
*/
public IMessages getMessages( )
{
Expand All @@ -48,7 +50,9 @@ public IMessages getMessages( )
/*
* (non-Javadoc)
*
* @see org.eclipse.birt.report.model.api.extension.ReportItemFactory#newReportItem(org.eclipse.birt.report.model.api.DesignElementHandle)
* @see
* org.eclipse.birt.report.model.api.extension.ReportItemFactory#newReportItem
* (org.eclipse.birt.report.model.api.DesignElementHandle)
*/
public IReportItem newReportItem( DesignElementHandle extendedItemHandle )
{
Expand Down Expand Up @@ -81,8 +85,9 @@ public IReportItem newReportItem( DesignElementHandle extendedItemHandle )
/*
* (non-Javadoc)
*
* @see org.eclipse.birt.report.model.api.extension.IMessages#getMessage(java.lang.String,
* java.util.Locale)
* @see
* org.eclipse.birt.report.model.api.extension.IMessages#getMessage(java
* .lang.String, java.util.Locale)
*/
public String getMessage( String key, Locale locale )
{
Expand All @@ -92,8 +97,9 @@ public String getMessage( String key, Locale locale )
/*
* (non-Javadoc)
*
* @see org.eclipse.birt.report.model.api.extension.IMessages#getMessage(java.lang.String,
* com.ibm.icu.util.ULocale)
* @see
* org.eclipse.birt.report.model.api.extension.IMessages#getMessage(java
* .lang.String, com.ibm.icu.util.ULocale)
*/
public String getMessage( String key, ULocale locale )
{
Expand All @@ -102,13 +108,14 @@ public String getMessage( String key, ULocale locale )

public IStyleDeclaration[] getFactoryStyles( String extensionName )
{
if ( CROSSTAB_EXTENSION_NAME.equals( extensionName ) )
{
return new IStyleDeclaration[]{
new CrosstabFactoryStyle( CROSSTAB_SELECTOR ),
new CrosstabFactoryStyle( CROSSTAB_CELL_SELECTOR )
};
}
// we dont' return the factory styles now, it'll be handled by theme
// if ( CROSSTAB_EXTENSION_NAME.equals( extensionName ) )
// {
// return new IStyleDeclaration[]{
// new CrosstabFactoryStyle( CROSSTAB_SELECTOR ),
// new CrosstabFactoryStyle( CROSSTAB_CELL_SELECTOR )
// };
// }

return null;
}
Expand Down

0 comments on commit 35ca663

Please sign in to comment.