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

The following examples show how to use org.pentaho.di.ui.core.PropsUI#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: ConfigurationDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public ConfigurationDialog( Shell parent, ExecutionConfiguration configuration, AbstractMeta meta ) {
  super( parent );
  this.parent = parent;
  this.configuration = configuration;
  this.abstractMeta = meta;

  // Fill the parameters, maybe do this in another place?
  Map<String, String> params = configuration.getParams();
  params.clear();
  String[] paramNames = meta.listParameters();
  for ( String name : paramNames ) {
    params.put( name, "" );
  }

  props = PropsUI.getInstance();
}
 
Example 2
Source File: SpoonSlaveDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void addSpoonSlave( SlaveServer slaveServer ) {
  TabSet tabfolder = spoon.tabfolder;

  // See if there is a SpoonSlave for this slaveServer...
  String tabName = spoon.delegates.tabs.makeSlaveTabName( slaveServer );
  TabMapEntry tabMapEntry = spoon.delegates.tabs.findTabMapEntry( tabName, ObjectType.SLAVE_SERVER );
  if ( tabMapEntry == null ) {
    SpoonSlave spoonSlave = new SpoonSlave( tabfolder.getSwtTabset(), SWT.NONE, spoon, slaveServer );
    PropsUI props = PropsUI.getInstance();
    TabItem tabItem = new TabItem( tabfolder, tabName, tabName, props.getSashWeights() );
    tabItem.setToolTipText( "Status of slave server : "
      + slaveServer.getName() + " : " + slaveServer.getServerAndPort() );
    tabItem.setControl( spoonSlave );

    tabMapEntry = new TabMapEntry( tabItem, null, tabName, null, null, spoonSlave, ObjectType.SLAVE_SERVER );
    spoon.delegates.tabs.addTab( tabMapEntry );
  }
  int idx = tabfolder.indexOf( tabMapEntry.getTabItem() );
  tabfolder.setSelected( idx );
}
 
Example 3
Source File: JobHasDescriptionImportRuleComposite.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
  PropsUI props = PropsUI.getInstance();

  composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );
  composite.setLayout( new FillLayout() );

  Label label = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( label );
  label.setText( "Minimum length: " );

  text = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( text );

  return composite;
}
 
Example 4
Source File: JobDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public JobDialog( Shell parent, int style, JobMeta jobMeta, Repository rep ) {
  super( parent, style );
  this.jobMeta = jobMeta;
  this.props = PropsUI.getInstance();
  this.rep = rep;

  this.newDirectory = null;

  directoryChangeAllowed = true;

  logTables = new ArrayList<LogTableInterface>();
  logTableUserInterfaces = new ArrayList<LogTableUserInterface>();
  for ( LogTableInterface logTable : jobMeta.getLogTables() ) {
    logTables.add( (LogTableInterface) logTable.clone() );
  }
}
 
Example 5
Source File: TransDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public TransDialog( Shell parent, int style, TransMeta transMeta, Repository rep ) {
  super( parent, style );
  this.props = PropsUI.getInstance();
  this.transMeta = transMeta;
  this.rep = rep;

  this.newDirectory = null;

  directoryChangeAllowed = true;
  changed = false;

  // Create a copy of the trans log table object
  //
  transLogTable = (TransLogTable) transMeta.getTransLogTable().clone();
  performanceLogTable = (PerformanceLogTable) transMeta.getPerformanceLogTable().clone();
  channelLogTable = (ChannelLogTable) transMeta.getChannelLogTable().clone();
  stepLogTable = (StepLogTable) transMeta.getStepLogTable().clone();
  metricsLogTable = (MetricsLogTable) transMeta.getMetricsLogTable().clone();
}
 
Example 6
Source File: EnterPrintDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public EnterPrintDialog( Shell parent, int nrcols, int nrrows, int scale, double factorX, double factorY,
  Rectangle m, double marginLeft, double marginRigth, double marginTop, double marginBottom, Image image ) {
  super( parent, SWT.NONE );
  props = PropsUI.getInstance();
  this.nrcols = nrcols;
  this.nrrows = nrrows;
  this.scale = scale;
  this.image = image;
  this.factorx = factorX;
  this.factory = factorY;
  this.leftMargin = marginLeft;
  this.rightMargin = marginRigth;
  this.topMargin = marginTop;
  this.bottomMargin = marginBottom;

  page = new Point( m.width, m.height );
}
 
Example 7
Source File: PaloCubeDeleteDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public PaloCubeDeleteDialog( Shell parent, JobEntryInterface jobEntryInt, Repository rep, JobMeta jobMeta ) {
  super( parent, jobEntryInt, rep, jobMeta );
  props = PropsUI.getInstance();
  this.jobEntry = (PaloCubeDelete) jobEntryInt;

  if ( this.jobEntry.getName() == null ) {
    this.jobEntry.setName( jobEntryInt.getName() );
  }

  this.jobMeta = jobMeta;
}
 
Example 8
Source File: WarningDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public WarningDialog(
    final Shell parent, final String title, final String message, final Map<String, Listener> listenerMap ) {
  super( parent );
  this.title = title;
  this.message = message.trim();
  this.listenerMap = listenerMap;
  this.props = PropsUI.getInstance();

}
 
Example 9
Source File: RipDatabaseWizardPage1.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public RipDatabaseWizardPage1( String arg, java.util.List<DatabaseMeta> databases ) {
  super( arg );
  this.props = PropsUI.getInstance();
  this.databases = databases;

  setTitle( "Enter the source and target database" );
  setDescription( "Select the source and target databases." );

  setPageComplete( false );
}
 
Example 10
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new base step dialog.
 *
 * @param parent       the parent shell
 * @param baseStepMeta the associated base step metadata
 * @param transMeta    the associated transformation metadata
 * @param stepname     the step name
 */
public BaseStepDialog( Shell parent, StepMetaInterface baseStepMeta, TransMeta transMeta, String stepname ) {
  super( parent, SWT.NONE );

  this.log = new LogChannel( baseStepMeta );
  this.transMeta = transMeta;
  this.stepname = stepname;
  this.stepMeta = transMeta.findStep( stepname );
  this.baseStepMeta = baseStepMeta;
  this.backupChanged = baseStepMeta.hasChanged();
  this.props = PropsUI.getInstance();
}
 
Example 11
Source File: BaseStepDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new base step dialog.
 *
 * @param parent       the parent shell
 * @param baseStepMeta the associated base step metadata
 * @param transMeta    the associated transformation metadata
 * @param stepname     the step name
 */
public BaseStepDialog( Shell parent, BaseStepMeta baseStepMeta, TransMeta transMeta, String stepname ) {
  super( parent, SWT.NONE );

  this.log = new LogChannel( baseStepMeta );
  this.transMeta = transMeta;
  this.stepname = stepname;
  this.stepMeta = transMeta.findStep( stepname );
  this.baseStepMeta = (StepMetaInterface) baseStepMeta;
  this.backupChanged = baseStepMeta.hasChanged();
  this.props = PropsUI.getInstance();
}
 
Example 12
Source File: JobEntryDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new job entry dialog.
 *
 * @param parent   the parent shell
 * @param jobEntry the job entry interface
 * @param rep      the repository
 * @param jobMeta  the job metadata object
 */
public JobEntryDialog( Shell parent, JobEntryInterface jobEntry, Repository rep, JobMeta jobMeta ) {
  super( parent, SWT.NONE );
  props = PropsUI.getInstance();

  this.jobEntryInt = jobEntry;
  this.rep = rep;
  this.jobMeta = jobMeta;
  this.shell = parent;
}
 
Example 13
Source File: Neo4jPerspective.java    From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 5 votes vote down vote up
public void createTabForNeo4jConnection( final NeoConnection neoConnection ) throws Exception {
  // SpoonPerspectiveManager.getInstance().activatePerspective(getClass());

  final XulTabAndPanel tabAndPanel = createTab();
  PropsUI props = PropsUI.getInstance();

  final Composite comp = (Composite) tabAndPanel.panel.getManagedObject();
  props.setLook( comp );
  comp.setLayout( new FillLayout() );

  Browser browser = new Browser( comp, SWT.NONE );

  VariableSpace space = getVariableSpace();

  String server = space.environmentSubstitute( neoConnection.getServer() );
  String browserPortString = neoConnection.getBrowserPort();
  if ( StringUtils.isEmpty(browserPortString)) {
    browserPortString = "7474";
  }
  String browserPort = space.environmentSubstitute( browserPortString );

  final String browseUrl = "http://" + server + ":"+browserPort+"/browser/";
  LogChannel.GENERAL.logBasic( "Opening Neo4j Browser: "+browseUrl );
  browser.setUrl( browseUrl );

  setNameForTab( tabAndPanel.tab, neoConnection.getName() );
  setActive( true );

  comp.layout();

  // Spoon.getInstance().enableMenus();
}
 
Example 14
Source File: RepositoryBrowserController.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public List<RepositoryFile> getRecentFiles() {
  PropsUI props = PropsUI.getInstance();

  List<RepositoryFile> repositoryFiles = new ArrayList<>();
  IUser userInfo = Spoon.getInstance().rep.getUserInfo();
  String repoAndUser = Spoon.getInstance().rep.getName() + ":" + ( userInfo != null ? userInfo.getLogin() : "" );
  List<LastUsedFile> lastUsedFiles =
    props.getLastUsedRepoFiles().getOrDefault( repoAndUser, Collections.emptyList() );

  Calendar calendar = Calendar.getInstance();
  calendar.add( Calendar.DATE, -30 );
  Date dateBefore = calendar.getTime();

  for ( int i = 0; i < lastUsedFiles.size(); i++ ) {
    LastUsedFile lastUsedFile = lastUsedFiles.get( i );
    if ( lastUsedFile.getLastOpened().before( dateBefore ) ) {
      continue;
    }
    if ( lastUsedFile.getRepositoryName() != null && lastUsedFile.getRepositoryName()
      .equals( Spoon.getInstance().rep.getName() ) ) {
      RepositoryFile repositoryFile = new RepositoryFile();
      final String index = String.valueOf( i );
      repositoryFile.setObjectId( () -> index );
      repositoryFile.setType( lastUsedFile.isTransformation() ? TRANSFORMATION : JOB );
      repositoryFile.setName( lastUsedFile.getFilename() );
      repositoryFile.setPath( lastUsedFile.getDirectory() );
      repositoryFile.setDate( lastUsedFile.getLastOpened() );
      repositoryFile.setRepository( lastUsedFile.getRepositoryName() );
      repositoryFile.setUsername( lastUsedFile.getUsername() );
      repositoryFiles.add( repositoryFile );
    }
  }

  return repositoryFiles;
}
 
Example 15
Source File: StepErrorMetaDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public StepErrorMetaDialog( Shell par, StepErrorMeta stepErrorMeta, TransMeta transMeta,
  List<StepMeta> targetSteps ) {
  super( par, SWT.NONE );
  this.stepErrorMeta = stepErrorMeta.clone();
  this.originalStepErrorMeta = stepErrorMeta;
  this.targetSteps = targetSteps;
  this.transMeta = transMeta;
  props = PropsUI.getInstance();
  ok = false;
}
 
Example 16
Source File: BeamJobConfigDialog.java    From kettle-beam with Apache License 2.0 5 votes vote down vote up
public BeamJobConfigDialog( Shell parent, BeamJobConfig config ) {
  this.parent = parent;
  this.config = config;
  props = PropsUI.getInstance();
  ok = false;

  // Just environment variables right now.
  //
  space = new Variables();
  space.initializeVariablesFrom( null );
}
 
Example 17
Source File: JobHasJobLogConfiguredImportRuleComposite.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public Composite getComposite( Composite parent, ImportRuleInterface importRule ) {
  PropsUI props = PropsUI.getInstance();

  composite = new Composite( parent, SWT.BACKGROUND );
  props.setLook( composite );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = Const.FORM_MARGIN;
  formLayout.marginHeight = Const.FORM_MARGIN;
  composite.setLayout( formLayout );

  // Schema input field...
  //
  Label schemaLabel = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( schemaLabel );
  schemaLabel.setText( "Schema " );
  FormData fdSchemaLabel = new FormData();
  fdSchemaLabel.left = new FormAttachment( 0, 0 );
  fdSchemaLabel.top = new FormAttachment( 0, 0 );
  schemaLabel.setLayoutData( fdSchemaLabel );

  schemaText = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( schemaText );
  FormData fdSchemaText = new FormData();
  fdSchemaText.left = new FormAttachment( schemaLabel, Const.MARGIN );
  fdSchemaText.top = new FormAttachment( 0, 0 );
  fdSchemaText.right = new FormAttachment( schemaLabel, 150 );
  schemaText.setLayoutData( fdSchemaText );

  // Table name input field...
  //
  Label tableLabel = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( tableLabel );
  tableLabel.setText( "Table " );
  FormData fdTableLabel = new FormData();
  fdTableLabel.left = new FormAttachment( schemaText, Const.MARGIN );
  fdTableLabel.top = new FormAttachment( 0, 0 );
  tableLabel.setLayoutData( fdTableLabel );

  tableText = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( tableText );
  FormData fdTableText = new FormData();
  fdTableText.left = new FormAttachment( tableLabel, Const.MARGIN );
  fdTableText.top = new FormAttachment( 0, 0 );
  fdTableText.right = new FormAttachment( tableLabel, 150 );
  tableText.setLayoutData( fdTableText );

  // Connection name input field...
  //
  Label connectionLabel = new Label( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( connectionLabel );
  connectionLabel.setText( "Connection " );
  FormData fdConnectionLabel = new FormData();
  fdConnectionLabel.left = new FormAttachment( tableText, Const.MARGIN );
  fdConnectionLabel.top = new FormAttachment( 0, 0 );
  connectionLabel.setLayoutData( fdConnectionLabel );

  connectionText = new Text( composite, SWT.SINGLE | SWT.BORDER | SWT.LEFT );
  props.setLook( connectionText );
  FormData fdConnectionText = new FormData();
  fdConnectionText.left = new FormAttachment( connectionLabel, Const.MARGIN );
  fdConnectionText.top = new FormAttachment( 0, 0 );
  fdConnectionText.right = new FormAttachment( connectionLabel, 200 );
  connectionText.setLayoutData( fdConnectionText );

  return composite;
}
 
Example 18
Source File: ShowMessageDialog.java    From pentaho-kettle with Apache License 2.0 3 votes vote down vote up
/**
 * Dialog to allow someone to show a text with an icon in front
 *
 * @param parent
 *          The parent shell to use
 * @param flags
 *          the icon to show using SWT flags: SWT.ICON_WARNING, SWT.ICON_ERROR, ... Also SWT.OK, SWT.CANCEL is
 *          allowed.
 * @param buttonTextByFlag
 *          Custom text to display for each button by flag i.e. key: SWT.OK, value: "Custom OK"
 *          Note - controls button order, use an ordered map to maintain button order.
 * @param title
 *          The dialog title
 * @param message
 *          The message to display
 * @param scroll
 *          Set the dialog to a default size and enable scrolling
 */
public ShowMessageDialog( Shell parent, int flags, Map<Integer, String> buttonTextByFlag, String title, String message, boolean scroll  ) {
  super( parent, SWT.NONE );
  this.buttonTextByFlag = buttonTextByFlag;
  this.parent = parent;
  this.flags = flags;
  this.title = title;
  this.message = message;
  this.scroll = scroll;

  props = PropsUI.getInstance();
}
 
Example 19
Source File: RegexEvalHelperDialog.java    From pentaho-kettle with Apache License 2.0 3 votes vote down vote up
/**
 * Dialog to allow someone to test regular expression
 *
 * @param parent
 *          The parent shell to use
 * @param RegexScript
 *          The expression to test
 * @param RegexOptions
 *          Any extended options for the regular expression
 * @param canonicalEqualityFlagSet
 */
public RegexEvalHelperDialog( Shell parent, TransMeta transmeta, String RegexScript, String RegexOptions,
  boolean canonicalEqualityFlagSet ) {
  super( parent, SWT.NONE );
  props = PropsUI.getInstance();
  this.regexscript = RegexScript;
  this.regexoptions = RegexOptions;
  this.transmeta = transmeta;
  this.errorDisplayed = false;
  this.canonicalEqualityFlagSet = canonicalEqualityFlagSet;
}
 
Example 20
Source File: EnterStringDialog.java    From pentaho-kettle with Apache License 2.0 3 votes vote down vote up
/**
 * Constructs with the ability to use environmental variable substitution.
 *
 * @param parent
 *          Parent gui object
 * @param string
 *          The string to display in the dialog
 * @param shellText
 * @param lineText
 * @param allowVariables
 *          Indicates to allow environmental substitution
 * @param transMeta
 *          This object has the has the environmental variables
 */
public EnterStringDialog( Shell parent, String string, String shellText, String lineText,
  boolean allowVariables, TransMeta transMeta ) {
  super( parent, SWT.NONE );
  this.props = PropsUI.getInstance();
  this.string = string;
  this.shellText = shellText;
  this.lineText = lineText;
  this.allowVariables = allowVariables;
  this.transMeta = transMeta;
}