org.pentaho.di.ui.core.gui.GUIResource Java Examples

The following examples show how to use org.pentaho.di.ui.core.gui.GUIResource. 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: PaloCellInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public static void showPaloLibWarningDialog( Shell shell ) {
  PropsUI props = PropsUI.getInstance();

  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle(
        shell,
        BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.DialogMessage", Const.CR )
          + Const.CR,
        MessageDialog.WARNING,
        new String[]{ BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option1" ) },
        0,
        BaseMessages.getString( PKG, "PaloCellInputDialog.PaloLibWarningDialog.Option2" ),
        "N".equalsIgnoreCase( props.getCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, "Y" )
        )
      );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_PALO_LIB_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }
}
 
Example #2
Source File: UserDefinedJavaClassHighlight.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
void initializeColors() {
  // Display display = Display.getDefault();
  colors = new Color[] { GUIResource.getInstance().getColor( 0, 0, 0 ), // black
    GUIResource.getInstance().getColor( 63, 127, 95 ), // red
    GUIResource.getInstance().getColor( 0, 0, 192 ), // green
    GUIResource.getInstance().getColor( 127, 0, 85 ), // blue
    GUIResource.getInstance().getColor( 255, 102, 0 ) // Kettle Functions / Orange
  };
  tokenColors = new int[MAXIMUM_TOKEN];
  tokenColors[WORD] = 0;
  tokenColors[WHITE] = 0;
  tokenColors[KEY] = 3;
  tokenColors[COMMENT] = 1;
  tokenColors[STRING] = 2;
  tokenColors[OTHER] = 0;
  tokenColors[NUMBER] = 0;
  tokenColors[FUNCTIONS] = 4;
}
 
Example #3
Source File: JobEntriesFolderProvider.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void refresh( AbstractMeta meta, TreeNode treeNode, String filter ) {
  JobMeta jobMeta = (JobMeta) meta;
  for ( int i = 0; i < jobMeta.nrJobEntries(); i++ ) {
    JobEntryCopy jobEntry = jobMeta.getJobEntry( i );

    if ( !filterMatch( jobEntry.getName(), filter ) && !filterMatch( jobEntry.getDescription(), filter ) ) {
      continue;
    }

    Image icon;
    if ( jobEntry.isStart() ) {
      icon = GUIResource.getInstance().getImageStartMedium();
    } else if ( jobEntry.isDummy() ) {
      icon = GUIResource.getInstance().getImageDummyMedium();
    } else {
      String key = jobEntry.getEntry().getPluginId();
      icon = GUIResource.getInstance().getImagesJobentriesSmall().get( key );
    }

    createTreeNode( treeNode, jobEntry.getName(), icon );
  }
}
 
Example #4
Source File: EnterOptionsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Setting the layout of an <i>Edit</i> option button. Either a button image is set - if existing - or a text.
 *
 * @param button
 *          The button
 */
private FormData layoutEditOptionButton( Button button ) {
  FormData fd = new FormData();
  Image editButton = GUIResource.getInstance().getEditOptionButton();
  if ( editButton != null ) {
    button.setImage( editButton );
    button.setBackground( GUIResource.getInstance().getColorWhite() );
    fd.width = editButton.getBounds().width + 20;
    fd.height = editButton.getBounds().height;
  } else {
    button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit" ) );
  }

  button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit.Tooltip" ) );
  return fd;
}
 
Example #5
Source File: ScriptHighlight.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
void initializeColors() {
  // Display display = Display.getDefault();
  colors = new Color[] { GUIResource.getInstance().getColor( 0, 0, 0 ), // black
    GUIResource.getInstance().getColor( 63, 127, 95 ), // red
    GUIResource.getInstance().getColor( 0, 0, 192 ), // green
    GUIResource.getInstance().getColor( 127, 0, 85 ), // blue
    GUIResource.getInstance().getColor( 255, 102, 0 ) // Kettle Functions / Orange
  };
  tokenColors = new int[MAXIMUM_TOKEN];
  tokenColors[WORD] = 0;
  tokenColors[WHITE] = 0;
  tokenColors[KEY] = 3;
  tokenColors[COMMENT] = 1;
  tokenColors[STRING] = 2;
  tokenColors[OTHER] = 0;
  tokenColors[NUMBER] = 0;
  tokenColors[FUNCTIONS] = 4;
}
 
Example #6
Source File: JobGraph.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected void drawRect( GC gc, Rectangle rect ) {
  if ( rect == null ) {
    return;
  }

  gc.setLineStyle( SWT.LINE_DASHDOT );
  gc.setLineWidth( 1 );
  gc.setForeground( GUIResource.getInstance().getColorDarkGray() );
  // PDI-2619: SWT on Windows doesn't cater for negative rect.width/height so handle here.
  Point s = new Point( rect.x + offset.x, rect.y + offset.y );
  if ( rect.width < 0 ) {
    s.x = s.x + rect.width;
  }
  if ( rect.height < 0 ) {
    s.y = s.y + rect.height;
  }
  gc.drawRoundRectangle( s.x, s.y, Math.abs( rect.width ), Math.abs( rect.height ), 3, 3 );
  gc.setLineStyle( SWT.LINE_SOLID );
}
 
Example #7
Source File: MultiMergeJoinDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void ok() {
  if ( Utils.isEmpty( wStepname.getText() ) ) {
    return;
  }
  getMeta( joinMeta );
  // Show a warning (optional)
  if ( "Y".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) ) {
    MessageDialogWithToggle md =
      new MessageDialogWithToggle( shell,
        BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.DialogTitle" ),
        null,
        BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.DialogMessage", Const.CR ) + Const.CR,
        MessageDialog.WARNING,
        new String[] { BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.Option1" ) },
        0,
        BaseMessages.getString( PKG, "MultiMergeJoinDialog.InputNeedSort.Option2" ),
        "N".equalsIgnoreCase( props.getCustomParameter( STRING_SORT_WARNING_PARAMETER, "Y" ) ) );
    MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
    md.open();
    props.setCustomParameter( STRING_SORT_WARNING_PARAMETER, md.getToggleState() ? "N" : "Y" );
    props.saveProps();
  }
  stepname = wStepname.getText(); // return value
  dispose();
}
 
Example #8
Source File: TransExecutionConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public boolean open() {

    mainLayout( PKG, "TransExecutionConfigurationDialog", GUIResource.getInstance().getImageTransGraph() );
    runConfigurationSectionLayout( PKG, "TransExecutionConfigurationDialog" );
    optionsSectionLayout( PKG, "TransExecutionConfigurationDialog" );
    parametersSectionLayout( PKG, "TransExecutionConfigurationDialog" );

    String docUrl =
        Const.getDocUrl( BaseMessages.getString( Spoon.class, "Spoon.TransExecutionConfigurationDialog.Help" ) );
    String docTitle = BaseMessages.getString( PKG, "TransExecutionConfigurationDialog.docTitle" );
    String docHeader = BaseMessages.getString( PKG, "TransExecutionConfigurationDialog.docHeader" );
    buttonsSectionLayout( PKG, "TransExecutionConfigurationDialog", docTitle, docUrl, docHeader );

    getData();
    openDialog();
    return retval;
  }
 
Example #9
Source File: JobGraph.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void addAllTabs() {

    CTabItem tabItemSelection = null;
    if ( extraViewTabFolder != null && !extraViewTabFolder.isDisposed() ) {
      tabItemSelection = extraViewTabFolder.getSelection();
    }

    jobHistoryDelegate.addJobHistory();
    jobLogDelegate.addJobLog();
    jobGridDelegate.addJobGrid();
    jobMetricsDelegate.addJobMetrics();

    if ( tabItemSelection != null ) {
      extraViewTabFolder.setSelection( tabItemSelection );
    } else {
      extraViewTabFolder.setSelection( jobGridDelegate.getJobGridTab() );
    }

    XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById( "job-show-results" );
    button.setTooltiptext( BaseMessages.getString( PKG, "Spoon.Tooltip.HideExecutionResults" ) );
    ToolItem swtToolItem = (ToolItem) button.getManagedObject();
    swtToolItem.setImage( GUIResource.getInstance().getImageHideResults() );
  }
 
Example #10
Source File: RepositoryDirectoryUI.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private static void createTreeItem( TreeItem parent, RepositoryElementMetaInterface repositoryObject ) {
  TreeItem tiObject = new TreeItem( parent, SWT.NONE );
  tiObject.setData( repositoryObject );
  if ( repositoryObject.getObjectType() == RepositoryObjectType.TRANSFORMATION ) {
    tiObject.setImage( GUIResource.getInstance().getImageTransRepo() );
  } else if ( repositoryObject.getObjectType() == RepositoryObjectType.JOB ) {
    tiObject.setImage( GUIResource.getInstance().getImageJobRepo() );
  }

  SimpleDateFormat simpleDateFormat = new SimpleDateFormat( DATE_FORMAT );
  tiObject.setText( 0, Const.NVL( repositoryObject.getName(), "" ) );
  tiObject.setText( 1, Const.NVL( repositoryObject.getObjectType().getTypeDescription(), "" ).toUpperCase() );
  tiObject.setText( 2, Const.NVL( repositoryObject.getModifiedUser(), "" ) );
  tiObject.setText( 3, repositoryObject.getModifiedDate() != null ? simpleDateFormat
    .format( repositoryObject.getModifiedDate() ) : "" );
  tiObject.setText( 4, Const.NVL( repositoryObject.getDescription(), "" ) );

  if ( repositoryObject.isDeleted() ) {
    tiObject.setForeground( GUIResource.getInstance().getColorRed() );
  }
}
 
Example #11
Source File: BaseDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a {@link org.eclipse.swt.events.SelectionAdapter} that is used to "submit" the dialog.
 */
private Display prepareLayout() {

  // Prep the parent shell and the dialog shell
  final Shell parent = getParent();
  final Display display = parent.getDisplay();

  shell = new Shell( parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET );
  shell.setImage( GUIResource.getInstance().getImageSpoon() );
  props.setLook( shell );
  // Detect X or ALT-F4 or something that kills this window...
  shell.addShellListener( new ShellAdapter() {
    @Override
    public void shellClosed( ShellEvent e ) {
      dispose();
    }
  } );

  final FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = MARGIN_SIZE;
  formLayout.marginHeight = MARGIN_SIZE;

  shell.setLayout( formLayout );
  shell.setText( this.title );
  return display;
}
 
Example #12
Source File: EnterOptionsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Setting the layout of a <i>Reset</i> option button. Either a button image is set - if existing - or a text.
 *
 * @param button
 *          The button
 */
private FormData layoutResetOptionButton( Button button ) {
  FormData fd = new FormData();
  Image editButton = GUIResource.getInstance().getResetOptionButton();
  if ( editButton != null ) {
    button.setImage( editButton );
    button.setBackground( GUIResource.getInstance().getColorWhite() );
    fd.width = editButton.getBounds().width + 20;
    fd.height = editButton.getBounds().height;
  } else {
    button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Reset" ) );
  }

  button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Reset.Tooltip" ) );
  return fd;
}
 
Example #13
Source File: SWTDirectGC.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public SWTDirectGC( GC gc, Point area, int iconsize ) {
  this.gc = gc;
  this.area = area;
  this.iconsize = iconsize;
  this.images = GUIResource.getInstance().getImagesSteps();

  this.colors = new ArrayList<Color>();
  this.fonts = new ArrayList<Font>();

  this.background = GUIResource.getInstance().getColorGraph();
  this.black = GUIResource.getInstance().getColorBlack();
  this.white = GUIResource.getInstance().getColorWhite();
  this.red = GUIResource.getInstance().getColorRed();
  this.yellow = GUIResource.getInstance().getColorYellow();
  this.orange = GUIResource.getInstance().getColorOrange();
  this.green = GUIResource.getInstance().getColorGreen();
  this.blue = GUIResource.getInstance().getColorBlue();
  this.magenta = GUIResource.getInstance().getColorMagenta();
  this.gray = GUIResource.getInstance().getColorGray();
  this.lightGray = GUIResource.getInstance().getColorLightGray();
  this.darkGray = GUIResource.getInstance().getColorDarkGray();
  this.lightBlue = GUIResource.getInstance().getColorLightBlue();
  this.crystal = GUIResource.getInstance().getColorCrystalTextPentaho();
  this.hopDefault = GUIResource.getInstance().getColorHopDefault();
  this.hopOK = GUIResource.getInstance().getColorHopOK();
}
 
Example #14
Source File: RepositoryImportProgressDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public boolean jobOverwritePrompt( JobMeta jobMeta ) {
  MessageDialogWithToggle md =
    new MessageDialogWithToggle(
      shell, BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteJob.Title" ), null, BaseMessages
        .getString( PKG, "RepositoryImportDialog.OverwriteJob.Message", jobMeta.getName() ),
      MessageDialog.QUESTION, new String[] {
        BaseMessages.getString( PKG, "System.Button.Yes" ),
        BaseMessages.getString( PKG, "System.Button.No" ) },
      1,
      BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ),
      !askOverwrite );
  MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
  int answer = md.open();
  askOverwrite = !md.getToggleState();

  return ( answer & 0xFF ) == 0;
}
 
Example #15
Source File: RepositoryImportProgressDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public boolean transOverwritePrompt( TransMeta transMeta ) {
  MessageDialogWithToggle md = new MessageDialogWithToggle( shell,
    BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteTrans.Title" ),
    null,
    BaseMessages.getString( PKG, "RepositoryImportDialog.OverwriteTrans.Message", transMeta.getName() ),
    MessageDialog.QUESTION, new String[] {
      BaseMessages.getString( PKG, "System.Button.Yes" ),
      BaseMessages.getString( PKG, "System.Button.No" ) },
    1,
    BaseMessages.getString( PKG, "RepositoryImportDialog.DontAskAgain.Label" ), !askOverwrite );
  MessageDialogWithToggle.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
  int answer = md.open();

  askOverwrite = !md.getToggleState();

  return ( answer & 0xFF ) == 0;
}
 
Example #16
Source File: SQLValuesHighlight.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
void initializeColors() {
  // Display display = Display.getDefault();
  colors = new Color[] { GUIResource.getInstance().getColor( 0, 0, 0 ), // black
    GUIResource.getInstance().getColor( 255, 0, 0 ), // red
    GUIResource.getInstance().getColor( 63, 127, 95 ), // green
    GUIResource.getInstance().getColor( 0, 0, 255 ), // blue
    GUIResource.getInstance().getColor( 255, 0, 255 ) // SQL Functions / Rose

  };
  tokenColors = new int[MAXIMUM_TOKEN];
  tokenColors[WORD] = 0;
  tokenColors[WHITE] = 0;
  tokenColors[KEY] = 3;
  tokenColors[COMMENT] = 2;
  tokenColors[STRING] = 1;
  tokenColors[OTHER] = 0;
  tokenColors[NUMBER] = 0;
  tokenColors[FUNCTIONS] = 4;
}
 
Example #17
Source File: SWTGC.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void drawStepIcon( int x, int y, StepMeta stepMeta, float magnification ) {
  String steptype = stepMeta.getStepID();
  Image im = null;
  if ( stepMeta.isMissing() ) {
    im = GUIResource.getInstance().getImageMissing();
  } else if ( stepMeta.isDeprecated() ) {
    im = GUIResource.getInstance().getImageDeprecated();
  } else {
    im =
        images.get( steptype ).getAsBitmapForSize( gc.getDevice(), Math.round( iconsize * magnification ),
            Math.round( iconsize * magnification ) );
  }
  if ( im != null ) { // Draw the icon!
    org.eclipse.swt.graphics.Rectangle bounds = im.getBounds();
    gc.drawImage( im, 0, 0, bounds.width, bounds.height, x, y, iconsize, iconsize );
  }
}
 
Example #18
Source File: CPythonScriptExecutorDialog.java    From pentaho-cpython-plugin with Apache License 2.0 6 votes vote down vote up
protected void checkWidgets() {
  wtvScriptLocation.setEnabled( wbLoadScriptFile.getSelection() );
  wstcScriptEditor.setEnabled( !wbLoadScriptFile.getSelection() );
  if ( wbLoadScriptFile.getSelection() ) {
    wtvScriptLocation.setEditable( true );
    wstcScriptEditor.getStyledText().setBackground( GUIResource.getInstance().getColorDemoGray() );
  } else {
    wtvScriptLocation.setEditable( false );
    wstcScriptEditor.getStyledText().setBackground( GUIResource.getInstance().getColorWhite() );
  }
  wbScriptBrowse.setEnabled( wbLoadScriptFile.getSelection() );

  String currVars = wtvPyVarsToGet.getText();
  if ( !Const.isEmpty( currVars ) ) {
    List<String> varList = stringToList( currVars );
    wbGetFields.setEnabled( varList.size() == 1 );
    wbIncludeRowIndex.setEnabled( varList.size() == 1 );
  }
}
 
Example #19
Source File: SpoonEEJobDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Override
public void addJobGraph( JobMeta jobMeta ) {
  super.addJobGraph( jobMeta );
  TabMapEntry tabEntry = spoon.delegates.tabs.findTabMapEntry( jobMeta );
  if ( tabEntry != null ) {
    TabItem tabItem = tabEntry.getTabItem();
    try {
      if ( ( service != null ) && ( jobMeta.getObjectId() != null )
          && ( service.getJobLock( jobMeta.getObjectId() ) != null ) ) {
        tabItem.setImage( GUIResource.getInstance().getImageLocked() );
      }
    } catch ( Exception e ) {
      throw new RuntimeException( e );
    }
  }
}
 
Example #20
Source File: SWTGC.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public SWTGC( Device device, Point area, int iconsize ) {
  this.image = new Image( device, area.x, area.y );
  this.gc = new GC( image );
  this.images = GUIResource.getInstance().getImagesSteps();
  this.iconsize = iconsize;
  this.area = area;

  this.colors = new ArrayList<Color>();
  this.fonts = new ArrayList<Font>();

  this.background = GUIResource.getInstance().getColorGraph();
  this.black = GUIResource.getInstance().getColorBlack();
  this.white = GUIResource.getInstance().getColorWhite();
  this.red = GUIResource.getInstance().getColorRed();
  this.yellow = GUIResource.getInstance().getColorYellow();
  this.orange = GUIResource.getInstance().getColorOrange();
  this.green = GUIResource.getInstance().getColorGreen();
  this.blue = GUIResource.getInstance().getColorBlue();
  this.magenta = GUIResource.getInstance().getColorMagenta();
  this.gray = GUIResource.getInstance().getColorGray();
  this.lightGray = GUIResource.getInstance().getColorLightGray();
  this.darkGray = GUIResource.getInstance().getColorDarkGray();
  this.lightBlue = GUIResource.getInstance().getColorLightBlue();
  this.crystal = GUIResource.getInstance().getColorCrystalTextPentaho();
  this.hopDefault = GUIResource.getInstance().getColorHopDefault();
  this.hopOK = GUIResource.getInstance().getColorHopOK();
  this.deprecated = GUIResource.getInstance().getColorDeprecated();
}
 
Example #21
Source File: RunConfigurationViewTreeExtension.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void refreshTree( SelectionTreeExtension selectionTreeExtension ) {
  TreeItem tiRootName = selectionTreeExtension.getTiRootName();
  GUIResource guiResource = selectionTreeExtension.getGuiResource();

  TreeItem tiEETitle = createTreeItem( tiRootName, TREE_LABEL, guiResource.getImageFolder(), 0 );

  for ( RunConfiguration runConfiguration : runConfigurationDelegate.load() ) {
    String imageFile = runConfiguration.isReadOnly() ? "images/run_tree_disabled.svg" : "images/run_tree.svg";
    createTreeItem( tiEETitle, runConfiguration.getName(), getRunConfigurationImage( guiResource, imageFile ), -1,
      runConfiguration.isReadOnly() );
  }
}
 
Example #22
Source File: SWTGC.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void drawJobEntryIcon( int x, int y, JobEntryCopy jobEntryCopy, float magnification ) {
  if ( jobEntryCopy == null ) {
    return; // Don't draw anything
  }

  SwtUniversalImage swtImage = null;

  int w = Math.round( iconsize * magnification );
  int h = Math.round( iconsize * magnification );

  if ( jobEntryCopy.isSpecial() ) {
    if ( jobEntryCopy.isStart() ) {
      swtImage = GUIResource.getInstance().getSwtImageStart();
    }
    if ( jobEntryCopy.isDummy() ) {
      swtImage = GUIResource.getInstance().getSwtImageDummy();
    }
  } else {
    String configId = jobEntryCopy.getEntry().getPluginId();
    if ( configId != null ) {
      swtImage = GUIResource.getInstance().getImagesJobentries().get( configId );
    }
  }
  if ( jobEntryCopy.isMissing() ) {
    swtImage = GUIResource.getInstance().getSwtImageMissing();
  }
  if ( swtImage == null ) {
    return;
  }

  Image image = swtImage.getAsBitmapForSize( gc.getDevice(), w, h );

  org.eclipse.swt.graphics.Rectangle bounds = image.getBounds();
  gc.drawImage( image, 0, 0, bounds.width, bounds.height, x, y, iconsize, iconsize );
}
 
Example #23
Source File: SWTGC.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void setFont( EFont font ) {
  switch ( font ) {
    case GRAPH:
      gc.setFont( GUIResource.getInstance().getFontGraph() );
      break;
    case NOTE:
      gc.setFont( GUIResource.getInstance().getFontNote() );
      break;
    case SMALL:
      gc.setFont( GUIResource.getInstance().getFontSmall() );
      break;
    default:
      break;
  }
}
 
Example #24
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
static MessageDialog getFieldsChoiceDialog( Shell shell, int existingFields, int newFields ) {
  MessageDialog messageDialog =
    new MessageDialog( shell,
      BaseMessages.getString( PKG, "BaseStepDialog.GetFieldsChoice.Title" ), // "Warning!"
      null,
      BaseMessages.getString( PKG, "BaseStepDialog.GetFieldsChoice.Message", "" + existingFields, "" + newFields ),
      MessageDialog.WARNING, new String[] {
      BaseMessages.getString( PKG, "BaseStepDialog.AddNew" ),
      BaseMessages.getString( PKG, "BaseStepDialog.Add" ),
      BaseMessages.getString( PKG, "BaseStepDialog.ClearAndAdd" ),
      BaseMessages.getString( PKG, "BaseStepDialog.Cancel" ), }, 0 );
  MessageDialog.setDefaultImage( GUIResource.getInstance().getImageSpoon() );
  return messageDialog;
}
 
Example #25
Source File: ClustersFolderProvider.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 ) {
  TransMeta transMeta = (TransMeta) meta;
  for ( ClusterSchema clusterSchema : transMeta.getClusterSchemas() ) {
    if ( !filterMatch( clusterSchema.getName(), filter ) ) {
      continue;
    }
    TreeNode childTreeNode = createTreeNode( treeNode, clusterSchema.toString(), guiResource.getImageClusterMedium() );
    if ( clusterSchema.isShared() ) {
      childTreeNode.setFont( GUIResource.getInstance().getFontBold() );
    }
  }
}
 
Example #26
Source File: PropsUI.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static void setTableItemLook( TableItem item, Display disp ) {
  if ( !Const.getOS().startsWith( "Windows" ) ) {
    return;
  }

  Color background = GUIResource.getInstance().getColorBackground();
  if ( background != null ) {
    item.setBackground( background );
  }
}
 
Example #27
Source File: CommonStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected Image getImage() {
  final PluginInterface plugin =
    PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  final String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(),
      ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE );
  }
  return null;
}
 
Example #28
Source File: MQTTProducerDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private Image getImage() {
  PluginInterface plugin =
    PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
  String id = plugin.getIds()[ 0 ];
  if ( id != null ) {
    return GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize( shell.getDisplay(),
      ConstUI.LARGE_ICON_SIZE, ConstUI.LARGE_ICON_SIZE );
  }
  return null;
}
 
Example #29
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void setShellImage( Shell shell ) {
  if ( stepMeta != null ) {
    PluginInterface plugin =
      PluginRegistry.getInstance().getPlugin( StepPluginType.class, stepMeta.getStepMetaInterface() );
    createHelpButton( shell, stepMeta, plugin );
    String id = plugin.getIds()[ 0 ];
    if ( id != null ) {
      shell.setImage( GUIResource.getInstance().getImagesSteps().get( id ).getAsBitmapForSize(
        shell.getDisplay(), ConstUI.ICON_SIZE, ConstUI.ICON_SIZE ) );
    }
  }
}
 
Example #30
Source File: TransGridDelegate.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void showHideSelected() {
  showSelectedSteps = !showSelectedSteps;

  SwtToolbarbutton onlySelectedButton = (SwtToolbarbutton) toolbar.getElementById( "show-selected" );
  if ( onlySelectedButton != null ) {
    onlySelectedButton.setSelected( showSelectedSteps );
    if ( showSelectedSteps ) {
      onlySelectedButton.setImage( GUIResource.getInstance().getImageShowSelected() );
    } else {
      onlySelectedButton.setImage( GUIResource.getInstance().getImageShowAll() );
    }
  }
}