Skip to content

Commit

Permalink
[BACKLOG-2157] Improved image fallback handling, updated busy/no_image
Browse files Browse the repository at this point in the history
  • Loading branch information
mdamour1976 committed Apr 23, 2015
1 parent 31e1649 commit d861931
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 129 deletions.
1 change: 1 addition & 0 deletions assembly/package-res/ui/laf.properties
Expand Up @@ -23,6 +23,7 @@ ArrowIcon_image=ui/images/arrow.svg
User_image=ui/images/user.svg User_image=ui/images/user.svg
Profil_image=ui/images/profil.svg Profil_image=ui/images/profil.svg
FolderConnections_image=ui/images/folder_connection.svg FolderConnections_image=ui/images/folder_connection.svg
Folder_image=ui/images/folder.svg
Table_image=ui/images/table.svg Table_image=ui/images/table.svg
Preview_image=ui/images/preview.svg Preview_image=ui/images/preview.svg
Schema_image=ui/images/schema.svg Schema_image=ui/images/schema.svg
Expand Down
8 changes: 4 additions & 4 deletions assembly/package-res/ui/spoon.xul
Expand Up @@ -26,11 +26,11 @@




<menupopup id="new-file-popup"> <menupopup id="new-file-popup">
<menuitem label="${Spoon.Menubar.File.NewJob}" command="spoon.newJobFile()" image="${ChefIcon_image}"/> <menuitem label="${Spoon.Menubar.File.NewJob}" command="spoon.newJobFile()" image="images/chefgraph.svg"/>
<menuitem id="menubar-new-trans" label="${Spoon.Menubar.File.NewTrans}" command="spoon.newTransFile()" image="${SpoonIcon_image}"/> <menuitem id="menubar-new-trans" label="${Spoon.Menubar.File.NewTrans}" command="spoon.newTransFile()" image="images/spoongraph.svg"/>
<menuseparator /> <menuseparator />
<menuitem label="${Spoon.Menubar.File.NewDatabaseConn}" command="spoon.newConnection()" image="${CNC_image}"/> <menuitem label="${Spoon.Menubar.File.NewDatabaseConn}" command="spoon.newConnection()" image="images/CNC.svg"/>
<menuitem label="${Spoon.Menubar.File.NewSlave}" command="spoon.newSlaveServer()" image="${Slave_image}"/> <menuitem label="${Spoon.Menubar.File.NewSlave}" command="spoon.newSlaveServer()" image="images/slave.svg"/>
</menupopup> </menupopup>


<deck flex="1" id="canvas-deck"> <deck flex="1" id="canvas-deck">
Expand Down
Binary file modified ui/package-res/ui/images/busy.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 10 additions & 25 deletions ui/package-res/ui/images/busy.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ui/package-res/ui/images/no_image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 17 additions & 33 deletions ui/package-res/ui/images/no_image.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
98 changes: 49 additions & 49 deletions ui/src/org/pentaho/di/ui/core/gui/GUIResource.java
Expand Up @@ -58,7 +58,6 @@
import org.pentaho.di.core.plugins.PluginRegistry; import org.pentaho.di.core.plugins.PluginRegistry;
import org.pentaho.di.core.plugins.PluginTypeListener; import org.pentaho.di.core.plugins.PluginTypeListener;
import org.pentaho.di.core.plugins.StepPluginType; import org.pentaho.di.core.plugins.StepPluginType;
import org.pentaho.di.core.svg.SvgSupport;
import org.pentaho.di.laf.BasePropertyHandler; import org.pentaho.di.laf.BasePropertyHandler;
import org.pentaho.di.ui.core.ConstUI; import org.pentaho.di.ui.core.ConstUI;
import org.pentaho.di.ui.core.PropsUI; import org.pentaho.di.ui.core.PropsUI;
Expand Down Expand Up @@ -161,9 +160,9 @@ public class GUIResource {


private Map<String, Image> imagesJobentriesSmall; private Map<String, Image> imagesJobentriesSmall;


private Image imageHop; private SwtUniversalImage imageHop;


private Image imageDisabledHop; private SwtUniversalImage imageDisabledHop;


private SwtUniversalImage imageConnection; private SwtUniversalImage imageConnection;


Expand Down Expand Up @@ -698,15 +697,12 @@ private void loadStepImages() {
ClassLoader classLoader = registry.getClassLoader( steps.get( i ) ); ClassLoader classLoader = registry.getClassLoader( steps.get( i ) );
image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename ); image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename );
} catch ( Throwable t ) { } catch ( Throwable t ) {
log.logError( "Unable to find required step image file or image format not supported (e.g. interlaced) [" log.logError( "Error occurred loading image [" + filename + "] for plugin " + steps.get( i ), t );
+ filename + "] for plugin " + steps.get( i ), t ); } finally {
Image img = new Image( display, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); if ( image == null ) {
GC gc = new GC( img ); log.logError( "Unable to load image file [" + filename + "] for plugin " + steps.get( i ) );
gc.drawRectangle( 0, 0, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); image = SwtSvgImageUtil.getMissingImage( display );
gc.drawLine( 0, 0, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); }
gc.drawLine( ConstUI.ICON_SIZE, 0, 0, ConstUI.ICON_SIZE );
gc.dispose();
image = new SwtUniversalImageBitmap( img );
} }


// Calculate the smaller version of the image @ 16x16... // Calculate the smaller version of the image @ 16x16...
Expand Down Expand Up @@ -781,7 +777,9 @@ private Image loadAsResource( Display display, String location, int size ) {


private void loadCommonImages() { private void loadCommonImages() {
// "ui/images/HOP.png" // "ui/images/HOP.png"
imageHop = loadAsResource( display, BasePropertyHandler.getProperty( "HOP_image" ), ConstUI.SMALL_ICON_SIZE ); imageHop = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "HOP_image" ) );

imageDisabledHop = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "Disabled_HOP_image" ) );


// "ui/images/CNC.png" // "ui/images/CNC.png"
imageConnection = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "CNC_image" ) ); imageConnection = SwtSvgImageUtil.getImageAsResource( display, BasePropertyHandler.getProperty( "CNC_image" ) );
Expand All @@ -793,9 +791,6 @@ private void loadCommonImages() {
// "ui/images/Add.png" // "ui/images/Add.png"
imageAdd = loadAsResource( display, BasePropertyHandler.getProperty( "Add_image" ), ConstUI.SMALL_ICON_SIZE ); imageAdd = loadAsResource( display, BasePropertyHandler.getProperty( "Add_image" ), ConstUI.SMALL_ICON_SIZE );


imageDisabledHop =
loadAsResource( display, BasePropertyHandler.getProperty( "Disabled_HOP_image" ), ConstUI.SMALL_ICON_SIZE );

// "ui/images/table.png" // "ui/images/table.png"
imageTable = loadAsResource( display, BasePropertyHandler.getProperty( "Table_image" ), ConstUI.SMALL_ICON_SIZE ); imageTable = loadAsResource( display, BasePropertyHandler.getProperty( "Table_image" ), ConstUI.SMALL_ICON_SIZE );


Expand Down Expand Up @@ -1079,32 +1074,27 @@ private void loadCommonImages() {


imageEmpty16x16 = new Image( display, 16, 16 ); imageEmpty16x16 = new Image( display, 16, 16 );


imageTransGraph = imageTransGraph = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), SvgSupport BasePropertyHandler.getProperty( "SpoonIcon_image" ) );
.toSvgName( BasePropertyHandler.getProperty( "SpoonIcon_image" ) ) ); imageJobGraph = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
imageJobGraph = BasePropertyHandler.getProperty( "ChefIcon_image" ) );
SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), SvgSupport
.toSvgName( BasePropertyHandler.getProperty( "ChefIcon_image" ) ) );


imageTransTree = imageTransTree = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), SvgSupport BasePropertyHandler.getProperty( "Trans_tree_image" ) );
.toSvgName( BasePropertyHandler.getProperty( "Trans_tree_image" ) ) ); imageJobTree = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
imageJobTree = BasePropertyHandler.getProperty( "Job_tree_image" ) );
SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), SvgSupport
.toSvgName( BasePropertyHandler.getProperty( "Job_tree_image" ) ) );


// "ui/images/kettle_logo_small.png" // "ui/images/kettle_logo_small.png"
imageLogoSmall = imageLogoSmall = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), SvgSupport BasePropertyHandler.getProperty( "Logo_sml_image" ) );
.toSvgName( BasePropertyHandler.getProperty( "Logo_sml_image" ) ) );


// "ui/images/arrow.png" // "ui/images/arrow.png"
imageArrow = imageArrow = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), SvgSupport BasePropertyHandler.getProperty( "ArrowIcon_image" ) );
.toSvgName( BasePropertyHandler.getProperty( "ArrowIcon_image" ) ) );


// "ui/images/folder.png" // "ui/images/folder.png"
imageFolder = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(), ( "ui/images/folder.svg" ) ); imageFolder = SwtSvgImageUtil.getUniversalImage( display, getClass().getClassLoader(),
BasePropertyHandler.getProperty( "Folder_image" ) );


// Makes transparent images "on the fly" // Makes transparent images "on the fly"
// //
Expand Down Expand Up @@ -1185,17 +1175,13 @@ private void loadJobEntryImages() {
ClassLoader classLoader = registry.getClassLoader( plugin ); ClassLoader classLoader = registry.getClassLoader( plugin );
image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename ); image = SwtSvgImageUtil.getUniversalImage( display, classLoader, filename );
} catch ( Throwable t ) { } catch ( Throwable t ) {
log.logError( "Unable to find required job entry image file [" + filename + "] for id [" + plugin.getIds()[0] log.logError( "Error occurred loading image [" + filename + "] for plugin " + plugin.getIds()[0], t );
+ "] : " + t.toString() ); } finally {
Image img = new Image( display, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); if ( image == null ) {
GC gc = new GC( img ); log.logError( "Unable to load image [" + filename + "] for plugin " + plugin.getIds()[0] );
gc.drawRectangle( 0, 0, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); image = SwtSvgImageUtil.getMissingImage( display );
gc.drawLine( 0, 0, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ); }
gc.drawLine( ConstUI.ICON_SIZE, 0, 0, ConstUI.ICON_SIZE );
gc.dispose();
image = new SwtUniversalImageBitmap( img );
} }

// Calculate the smaller version of the image @ 16x16... // Calculate the smaller version of the image @ 16x16...
// Perhaps we should make this configurable? // Perhaps we should make this configurable?
// //
Expand Down Expand Up @@ -1515,7 +1501,7 @@ public Image getImageCredits() {
* @return Returns the imageDummy. * @return Returns the imageDummy.
*/ */
public Image getImageDummy() { public Image getImageDummy() {
return imageDummy.getAsBitmapForSize( display, 32, 32 ); return imageDummy.getAsBitmapForSize( display, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE );
} }


public SwtUniversalImage getSwtImageDummy() { public SwtUniversalImage getSwtImageDummy() {
Expand All @@ -1526,14 +1512,28 @@ public SwtUniversalImage getSwtImageDummy() {
* @return Returns the imageHop. * @return Returns the imageHop.
*/ */
public Image getImageHop() { public Image getImageHop() {
return imageHop; return imageHop.getAsBitmapForSize( display, ConstUI.SMALL_ICON_SIZE, ConstUI.SMALL_ICON_SIZE );
} }


/** /**
* @return Returns the imageDisabledHop. * @return Returns the imageDisabledHop.
*/ */
public Image getImageDisabledHop() { public Image getImageDisabledHop() {
return imageDisabledHop; return imageDisabledHop.getAsBitmapForSize( display, ConstUI.SMALL_ICON_SIZE, ConstUI.SMALL_ICON_SIZE );
}

/**
* @return Returns the imageHop.
*/
public Image getImageHopTree() {
return imageHop.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE );
}

/**
* @return Returns the imageDisabledHop.
*/
public Image getImageDisabledHopTree() {
return imageDisabledHop.getAsBitmapForSize( display, ConstUI.MEDIUM_ICON_SIZE, ConstUI.MEDIUM_ICON_SIZE );
} }


/** /**
Expand Down Expand Up @@ -1575,7 +1575,7 @@ public Map<String, Image> getImagesStepsSmall() {
* @return Returns the imageStart. * @return Returns the imageStart.
*/ */
public Image getImageStart() { public Image getImageStart() {
return imageStart.getAsBitmapForSize( display, 32, 32 ); return imageStart.getAsBitmapForSize( display, ConstUI.ICON_SIZE, ConstUI.ICON_SIZE );
} }


public SwtUniversalImage getSwtImageStart() { public SwtUniversalImage getSwtImageStart() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/org/pentaho/di/ui/spoon/Spoon.java
Expand Up @@ -6343,7 +6343,7 @@ private void refreshStepsSubtree( TreeItem tiRootName, TransMeta meta, GUIResour
continue; continue;
} }


Image icon = hopMeta.isEnabled() ? guiResource.getImageHop() : guiResource.getImageDisabledHop(); Image icon = hopMeta.isEnabled() ? guiResource.getImageHopTree() : guiResource.getImageDisabledHopTree();
createTreeItem( tiHopTitle, hopMeta.toString(), icon ); createTreeItem( tiHopTitle, hopMeta.toString(), icon );
} }
} }
Expand Down

0 comments on commit d861931

Please sign in to comment.