Java Code Examples for org.pentaho.di.ui.core.gui.GUIResource#getInstance()

The following examples show how to use org.pentaho.di.ui.core.gui.GUIResource#getInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropsUI.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the properties: load from disk.
 *
 * @param d The Display
 * @param t The type of properties file.
 */
public static void init( Display d, int t ) {
  if ( props == null ) {
    display = d;
    props = new PropsUI( t );

    // Also init the colors and fonts to use...
    GUIResource.getInstance();
  } else {
    throw new RuntimeException( "The Properties systems settings are already initialised!" );
  }
}
 
Example 2
Source File: PropsUI.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the properties: load from disk.
 *
 * @param d        The Display
 * @param filename the filename to use
 */
public static void init( Display d, String filename ) {
  if ( props == null ) {
    display = d;
    props = new PropsUI( filename );

    // Also init the colors and fonts to use...
    GUIResource.getInstance();
  } else {
    throw new RuntimeException( "The properties systems settings are already initialised!" );
  }
}
 
Example 3
Source File: RunConfigurationFolderProvider.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void refresh( AbstractMeta meta, TreeNode treeNode, String filter ) {
  GUIResource guiResource = GUIResource.getInstance();
  for ( RunConfiguration runConfiguration : runConfigurationDelegate.load() ) {
    if ( !filterMatch( runConfiguration.getName(), filter ) ) {
      continue;
    }
    String imageFile = runConfiguration.isReadOnly() ? "images/run_tree_disabled.svg" : "images/run_tree.svg";
    TreeNode childTreeNode = createChildTreeNode( treeNode, runConfiguration.getName(), getRunConfigurationImage(
            guiResource, imageFile ) );
    if ( runConfiguration.isReadOnly() ) {
      childTreeNode.setForeground( getDisabledColor() );
    }
  }
}
 
Example 4
Source File: TransDebugDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void refreshStepList() {
  GUIResource resource = GUIResource.getInstance();

  // Add the list of steps...
  //
  int maxIconSize = 0;
  int indexSelected = -1;
  wSteps.table.removeAll();
  for ( int i = 0; i < transDebugMeta.getTransMeta().getSteps().size(); i++ ) {
    StepMeta stepMeta = transDebugMeta.getTransMeta().getStep( i );
    TableItem item = new TableItem( wSteps.table, SWT.NONE );
    Image image =
      resource.getImagesSteps().get( stepMeta.getStepID() ).getAsBitmapForSize( display, ConstUI.ICON_SIZE,
        ConstUI.ICON_SIZE );
    item.setImage( 0, image );
    item.setText( 0, "" );
    item.setText( 1, stepMeta.getName() );

    if ( image.getBounds().width > maxIconSize ) {
      maxIconSize = image.getBounds().width;
    }

    StepDebugMeta stepDebugMeta = stepDebugMetaMap.get( stepMeta );
    if ( stepDebugMeta != null ) {
      // We have debugging information so we mark the row
      //
      item.setBackground( resource.getColorLightPentaho() );
      if ( indexSelected < 0 ) {
        indexSelected = i;
      }
    }
  }

  wSteps.removeEmptyRows();
  wSteps.optWidth( false );
  wSteps.table.getColumn( 0 ).setWidth( maxIconSize + 10 );
  wSteps.table.getColumn( 0 ).setAlignment( SWT.CENTER );

  // OK, select the first used step debug line...
  //
  if ( indexSelected >= 0 ) {
    wSteps.table.setSelection( indexSelected );
    showStepDebugInformation();
  }
}
 
Example 5
Source File: ClustersFolderProvider.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public ClustersFolderProvider() {
  this( GUIResource.getInstance() );
}
 
Example 6
Source File: PartitionsFolderProvider.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public PartitionsFolderProvider() {
  this( GUIResource.getInstance(), Spoon.getInstance() );
}
 
Example 7
Source File: SlavesFolderProvider.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public SlavesFolderProvider() {
  this( GUIResource.getInstance() );
}
 
Example 8
Source File: HopsFolderProvider.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public HopsFolderProvider() {
  this( GUIResource.getInstance() );
}
 
Example 9
Source File: DBConnectionFolderProvider.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public DBConnectionFolderProvider() {
  this( GUIResource.getInstance(), Spoon.getInstance() );
}
 
Example 10
Source File: TreeManager.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public TreeManager( Tree tree ) {
  this( tree, GUIResource.getInstance() );
}
 
Example 11
Source File: PropsUI.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void setLook( final Control control, int style ) {
  if ( this.isOSLookShown() && style != WIDGET_STYLE_FIXED ) {
    return;
  }

  final GUIResource gui = GUIResource.getInstance();
  Font font = null;
  Color background = null;

  switch ( style ) {
    case WIDGET_STYLE_DEFAULT:
      background = gui.getColorBackground();
      if ( control instanceof Group && OS.indexOf( "mac" ) > -1 ) {
        control.addPaintListener( new PaintListener() {
          @Override
          public void paintControl( PaintEvent paintEvent ) {
            paintEvent.gc.setBackground( gui.getColorBackground() );
            paintEvent.gc.fillRectangle( 2, 0, control.getBounds().width - 8, control.getBounds().height - 20 );
          }
        } );
      }
      font = null; // GUIResource.getInstance().getFontDefault();
      break;
    case WIDGET_STYLE_FIXED:
      if ( !this.isOSLookShown() ) {
        background = gui.getColorBackground();
      }
      font = gui.getFontFixed();
      break;
    case WIDGET_STYLE_TABLE:
      background = gui.getColorBackground();
      font = null; // gui.getFontGrid();
      break;
    case WIDGET_STYLE_NOTEPAD:
      background = gui.getColorBackground();
      font = gui.getFontNote();
      break;
    case WIDGET_STYLE_GRAPH:
      background = gui.getColorBackground();
      font = gui.getFontGraph();
      break;
    case WIDGET_STYLE_TOOLBAR:
      background = GUIResource.getInstance().getColorDemoGray();
      break;
    case WIDGET_STYLE_TAB:
      background = GUIResource.getInstance().getColorWhite();
      CTabFolder tabFolder = (CTabFolder) control;
      tabFolder.setSimple( false );
      tabFolder.setBorderVisible( true );
      // need to make a copy of the tab selection background color to get around PDI-13940
      Color c = GUIResource.getInstance().getColorTab();
      Color tabColor = new Color( c.getDevice(), c.getRed(), c.getGreen(), c.getBlue() );
      tabFolder.setSelectionBackground( tabColor );
      break;
    default:
      background = gui.getColorBackground();
      font = null; // gui.getFontDefault();
      break;
  }

  if ( font != null && !font.isDisposed() ) {
    control.setFont( font );
  }

  if ( background != null && !background.isDisposed() ) {
    if ( control instanceof Button ) {
      Button b = (Button) control;
      if ( ( b.getStyle() & SWT.PUSH ) != 0 ) {
        return;
      }
    }
    control.setBackground( background );
  }
}