org.pentaho.di.ui.core.PropsUI Java Examples
The following examples show how to use
org.pentaho.di.ui.core.PropsUI.
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: PreviewRowsDialogTest.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Test public void getDataForRow() throws Exception { RowMetaInterface rowMetaInterface = Mockito.mock( RowMetaInterface.class ); Mockito.when( rowMetaInterface.size() ).thenReturn( 3 ); Mockito.when( rowMetaInterface.getValueMeta( Mockito.anyInt() ) ).thenReturn( Mockito.mock( ValueMetaInterface.class ) ); Field propsField = Props.class.getDeclaredField( "props" ); propsField.setAccessible( true ); propsField.set( PropsUI.class, Mockito.mock( PropsUI.class ) ); PreviewRowsDialog previewRowsDialog = new PreviewRowsDialog( Mockito.mock( Shell.class ), Mockito.mock( VariableSpace.class ), SWT.None, "test", rowMetaInterface, Collections.emptyList() ); //run without NPE int actualResult = previewRowsDialog.getDataForRow( Mockito.mock( TableItem.class ), null ); Assert.assertEquals( 0, actualResult ); }
Example #2
Source File: ConfigurationDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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 #3
Source File: RepositoryBrowserController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public JSONArray storeRecentSearch( String recentSearch ) { JSONArray recentSearches = getRecentSearches(); try { if ( recentSearch == null || recentSearches.contains( recentSearch ) ) { return recentSearches; } recentSearches.add( recentSearch ); if ( recentSearches.size() > 5 ) { recentSearches.remove( 0 ); } PropsUI props = PropsUI.getInstance(); String jsonValue = props.getRecentSearches(); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = jsonValue != null ? (JSONObject) jsonParser.parse( jsonValue ) : new JSONObject(); jsonObject.put( getLogin(), recentSearches ); props.setRecentSearches( jsonObject.toJSONString() ); } catch ( Exception e ) { e.printStackTrace(); } return recentSearches; }
Example #4
Source File: EditRowsDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public EditRowsDialog( Shell parent, int style, String title, String message, RowMetaInterface rowMeta, List<Object[]> rowBuffer ) { this.title = title; this.message = message; this.rowBuffer = rowBuffer; this.rowMeta = rowMeta; this.parentShell = parent; this.style = ( style != SWT.None ) ? style : this.style; props = PropsUI.getInstance(); bounds = null; hscroll = -1; vscroll = -1; title = null; message = null; this.log = LogChannel.GENERAL; }
Example #5
Source File: StarModelerPerspective.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override public boolean open(Node transNode, String fname, boolean importfile) { try { String xml = KettleVFS.getTextFileContent(fname, Const.XML_ENCODING); Domain domain = new SerializationService().deserializeDomain(xml); StarDomain starDomain = new StarDomain(); starDomain.setDomain(domain); starDomain.setFilename(fname); createTabForDomain(starDomain); PropsUI.getInstance().addLastFile(LastUsedFile.FILE_TYPE_SCHEMA, fname, null, false, null); Spoon.getInstance().addMenuLast(); return true; } catch(Exception e) { new ErrorDialog(Spoon.getInstance().getShell(), "Error", "There was an error opening model from file '"+fname+"'", e); } return false; }
Example #6
Source File: JobHasDescriptionImportRuleComposite.java From pentaho-kettle with Apache License 2.0 | 6 votes |
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 #7
Source File: ImportRulesDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public static void main( String[] args ) throws Exception { Display display = new Display(); KettleEnvironment.init(); PropsUI.init( display, PropsUI.TYPE_PROPERTIES_SPOON ); Shell shell = new Shell( display ); ImportRules importRules = new ImportRules(); importRules.loadXML( XMLHandler.getSubNode( XMLHandler.loadXMLFile( "bin/import-rules.xml" ), ImportRules.XML_TAG ) ); ImportRulesDialog dialog = new ImportRulesDialog( shell, importRules ); if ( dialog.open() ) { for ( ImportRuleInterface rule : importRules.getRules() ) { System.out.println( " - " + rule.toString() ); } } }
Example #8
Source File: RepositoryBrowserController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public boolean updateRecentFiles( String oldPath, String newPath ) { try { Collection<List<LastUsedFile>> lastUsedRepoFiles = PropsUI.getInstance().getLastUsedRepoFiles().values(); for ( List<LastUsedFile> lastUsedFiles : lastUsedRepoFiles ) { for ( int i = 0; i < lastUsedFiles.size(); i++ ) { if ( ( lastUsedFiles.get( i ).getDirectory() + "/" ).startsWith( oldPath + "/" ) ) { if ( lastUsedFiles.get( i ).getDirectory().length() == oldPath.length() ) { lastUsedFiles.get( i ).setDirectory( newPath ); } else { String prefix = newPath.substring( 0, newPath.lastIndexOf( "/" ) ) + "/"; String newFolder = newPath.substring( newPath.lastIndexOf( "/" ) + 1 ); String suffix = lastUsedFiles.get( i ).getDirectory().substring( oldPath.length() ); lastUsedFiles.get( i ).setDirectory( prefix + newFolder + suffix ); } } } } } catch ( Exception e ) { return false; } return true; }
Example #9
Source File: JobEntryJobDialogTest.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Before public void setUp() { mockStatic( PropsUI.class ); when( PropsUI.getInstance() ).thenReturn( mock( PropsUI.class ) ); LoggingRegistry logging = mock( LoggingRegistry.class ); doReturn( null ).when( logging ).registerLoggingSource( anyObject() ); mockStatic( LoggingRegistry.class ); when( LoggingRegistry.getInstance() ).thenReturn( logging ); dialog = spy( new JobEntryJobDialog( mock( Shell.class ), job, mock( Repository.class ), mock( JobMeta.class ) ) ); doReturn( "My Job" ).when( dialog ).getName(); doNothing().when( dialog ).getInfo( job ); doNothing().when( dialog ).getData(); doNothing().when( dialog ).dispose(); }
Example #10
Source File: BaseStepXulDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public BaseStepXulDialog( String xulFile, Shell parent, BaseStepMeta baseStepMeta, TransMeta transMeta, String stepname ) { super( xulFile, parent, baseStepMeta, transMeta, stepname ); this.backupChanged = baseStepMeta.hasChanged(); this.props = PropsUI.getInstance(); try { initializeXul(); } catch ( Exception e ) { e.printStackTrace(); log.logError( "Error initializing (" + stepname + ") step dialog", e ); throw new IllegalStateException( "Cannot load dialog due to error in initialization", e ); } }
Example #11
Source File: SWTGC.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) { int swt = SWT.NORMAL; if ( fontBold ) { swt = SWT.BOLD; } if ( fontItalic ) { swt = swt | SWT.ITALIC; } Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt ); int index = fonts.indexOf( font ); if ( index < 0 ) { fonts.add( font ); } else { font.dispose(); font = fonts.get( index ); } gc.setFont( font ); }
Example #12
Source File: KettleDatabaseRepositoryDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public KettleDatabaseRepositoryDialog( Shell parent, int style, RepositoryMeta repositoryMeta, RepositoriesMeta repositoriesMeta ) { this.display = parent.getDisplay(); this.props = PropsUI.getInstance(); this.input = (KettleDatabaseRepositoryMeta) repositoryMeta; this.repositories = repositoriesMeta; this.masterRepositoriesMeta = repositoriesMeta.clone(); this.masterRepositoryName = repositoryMeta.getName(); shell = new Shell( parent, style | SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL | SWT.SHEET ); shell.setText( BaseMessages.getString( PKG, "RepositoryDialog.Dialog.Main.Title" ) ); }
Example #13
Source File: LabeledControl.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * Creates a series of LabeledControls, managing vertical layout between each. * * @param prevControl The swt control above the series of LabeledControls * @param labelTexts The list of label texts, required to be one text per control. * @param controls The set of controls in the series * @param controlWidths The widths of each control in the series. * @param props PropsUI to apply. */ public Series( Composite parent, Control prevControl, List<String> labelTexts, List<Control> controls, List<Integer> controlWidths, PropsUI props ) { Preconditions.checkState( labelTexts.size() == controls.size() && labelTexts.size() == controlWidths.size() ); this.prevControl = prevControl; this.parent = parent; labeledControlSequence = IntStream.range( 0, labelTexts.size() ) .mapToObj( i -> new LabeledControl( parent, labelTexts.get( i ), controls.get( i ), controlWidths.get( i ), props ) ) .collect( Collectors.toList() ); lookup = labeledControlSequence.stream().collect( Collectors.toMap( LabeledControl::control, lc -> lc ) ); layout(); }
Example #14
Source File: RepositoryBrowserController.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private boolean renameRecent( String id, String type, String name ) { RepositoryObject repositoryObject = null; try { repositoryObject = getRepository().getObjectInformation( () -> id, ( type.equals( TRANSFORMATION ) ? RepositoryObjectType.TRANSFORMATION : RepositoryObjectType.JOB ) ); } catch ( Exception e ) { return false; } if ( repositoryObject != null ) { Collection<List<LastUsedFile>> lastUsedRepoFiles = PropsUI.getInstance().getLastUsedRepoFiles().values(); for ( List<LastUsedFile> lastUsedFiles : lastUsedRepoFiles ) { for ( LastUsedFile lastUsedFile : lastUsedFiles ) { if ( lastUsedFile.getDirectory().equals( repositoryObject.getRepositoryDirectory().getPath() ) && lastUsedFile .getFilename().equals( repositoryObject.getName() ) ) { lastUsedFile.setFilename( name ); return true; } } } } return true; }
Example #15
Source File: StarModelDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
public StarModelDialog(Shell parent, LogicalModel logicalModel, String locale) { super(parent, SWT.DIALOG_TRIM); this.logicalModel = logicalModel; this.props = PropsUI.getInstance(); this.locale = locale; List<LogicalTable> factTables = ConceptUtil.findLogicalTables(logicalModel, TableType.FACT); if (factTables.isEmpty()) { this.factTable = new LogicalTable(); this.factTable.setId(UUID.randomUUID().toString()); this.factTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), TableType.FACT); logicalModel.addLogicalTable(this.factTable); } else { this.factTable = factTables.get(0); } }
Example #16
Source File: GraphModelDialog.java From knowbi-pentaho-pdi-neo4j-output with Apache License 2.0 | 6 votes |
public GraphModelDialog( Shell parent, GraphModel graphModel, RowMetaInterface inputRowMeta ) { super( parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.CLOSE ); this.inputRowMeta = inputRowMeta; props = PropsUI.getInstance(); ok = false; // We will only replace at OK // this.originalGraphModel = graphModel; // We will change graphModel, copy it first // this.graphModel = new GraphModel( graphModel ); mouseDownPoint = new Point( -1, -1 ); }
Example #17
Source File: ClusterSchemaDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public ClusterSchemaDialog( Shell par, ClusterSchema clusterSchema, Collection<ClusterSchema> existingSchemas, List<SlaveServer> slaveServers ) { super( par, SWT.NONE ); this.clusterSchema = clusterSchema.clone(); this.originalSchema = clusterSchema; this.existingSchemas = existingSchemas; this.slaveServers = slaveServers; props = PropsUI.getInstance(); ok = false; }
Example #18
Source File: WarningDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
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 #19
Source File: RipDatabaseWizardPage1.java From pentaho-kettle with Apache License 2.0 | 5 votes |
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 #20
Source File: StepFieldsDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public StepFieldsDialog( Shell parent, VariableSpace space, int style, String stepname, RowMetaInterface input ) { super( parent, style ); this.stepname = stepname; this.input = input; this.variables = space; props = PropsUI.getInstance(); shellText = BaseMessages.getString( PKG, "StepFieldsDialog.Title" ); originText = BaseMessages.getString( PKG, "StepFieldsDialog.Name.Label" ); showEditButton = true; }
Example #21
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public Image getTransformationImage( Device device, int x, int y, float magnificationFactor ) { GCInterface gc = new SWTGC( device, new Point( x, y ), iconsize ); int gridSize = PropsUI.getInstance().isShowCanvasGridEnabled() ? PropsUI.getInstance().getCanvasGridSize() : 1; TransPainter transPainter = new TransPainter( gc, transMeta, new Point( x, y ), new SwtScrollBar( hori ), new SwtScrollBar( vert ), candidate, drop_candidate, selectionRegion, areaOwners, mouseOverSteps, PropsUI.getInstance().getIconSize(), PropsUI.getInstance().getLineWidth(), gridSize, PropsUI.getInstance().getShadowSize(), PropsUI.getInstance() .isAntiAliasingEnabled(), PropsUI.getInstance().getNoteFont().getName(), PropsUI.getInstance() .getNoteFont().getHeight(), trans, PropsUI.getInstance().isIndicateSlowTransStepsEnabled() ); transPainter.setMagnification( magnificationFactor ); transPainter.setStepLogMap( stepLogMap ); transPainter.setStartHopStep( startHopStep ); transPainter.setEndHopLocation( endHopLocation ); transPainter.setNoInputStep( noInputStep ); transPainter.setEndHopStep( endHopStep ); transPainter.setCandidateHopType( candidateHopType ); transPainter.setStartErrorHopStep( startErrorHopStep ); transPainter.setShowTargetStreamsStep( showTargetStreamsStep ); transPainter.buildTransformationImage(); Image img = (Image) gc.getImage(); gc.dispose(); return img; }
Example #22
Source File: CreateDatabaseWizardPageODBC.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public CreateDatabaseWizardPageODBC( String arg, PropsUI props, DatabaseMeta info ) { super( arg ); this.props = props; this.info = info; setTitle( BaseMessages.getString( PKG, "CreateDatabaseWizardPageODBC.DialogTitle" ) ); setDescription( BaseMessages.getString( PKG, "CreateDatabaseWizardPageODBC.DialogMessage" ) ); setPageComplete( false ); }
Example #23
Source File: SWTDirectGC.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private Color getColor( int r, int g, int b ) { Color color = new Color( PropsUI.getDisplay(), new RGB( r, g, b ) ); int index = colors.indexOf( color ); if ( index < 0 ) { colors.add( color ); } else { color.dispose(); color = colors.get( index ); } return color; }
Example #24
Source File: RipDatabaseWizardPage2.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public RipDatabaseWizardPage2( String arg ) { super( arg ); this.props = PropsUI.getInstance(); selection = new Hashtable<Integer, String>(); setTitle( "Select the tables" ); setDescription( "Select the tables to rip from the source database" ); }
Example #25
Source File: ShowHelpDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public ShowHelpDialog( Shell parent, String dialogTitle, String url, String header ) { super( parent, SWT.NONE ); props = PropsUI.getInstance(); this.dialogTitle = BaseMessages.getString( PKG, "Spoon.Documentation.Pentaho.Title" ); this.url = url; try { this.homeURL = new URL( DOC_URL ).toString(); } catch ( MalformedURLException e ) { } }
Example #26
Source File: TextFileImportWizardPage2.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public TextFileImportWizardPage2( String arg, PropsUI props, java.util.List<String> rows, Vector<TextFileInputFieldInterface> fields ) { super( arg ); this.props = props; this.rows = rows; this.fields = fields; setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage2.DialogTitle" ) ); setDescription( "Give a name to the fields in this text file" ); }
Example #27
Source File: SalesforceInputDialogTest.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@BeforeClass public static void hackPropsUi() throws Exception { Field props = getPropsField(); if ( props == null ) { throw new IllegalStateException( "Cannot find 'props' field in " + Props.class.getName() ); } Object value = FieldUtils.readStaticField( props, true ); if ( value == null ) { PropsUI mock = mock( PropsUI.class ); FieldUtils.writeStaticField( props, mock, true ); changedPropsUi = true; } else { changedPropsUi = false; } }
Example #28
Source File: CreateDatabaseWizardPageSAPR3.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public CreateDatabaseWizardPageSAPR3( String arg, PropsUI props, DatabaseMeta info ) { super( arg ); this.props = props; this.info = info; setTitle( BaseMessages.getString( PKG, "CreateDatabaseWizardPageSAPR3.DialogTitle" ) ); setDescription( BaseMessages.getString( PKG, "CreateDatabaseWizardPageSAPR3.DialogMessage" ) ); setPageComplete( false ); }
Example #29
Source File: TextFileImportWizardPage1.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public TextFileImportWizardPage1( String arg, PropsUI props, List<String> rows, Vector<TextFileInputFieldInterface> fields ) { super( arg ); this.props = props; this.rows = rows; this.fields = fields; setTitle( BaseMessages.getString( PKG, "TextFileImportWizardPage1.DialogTitle" ) ); setDescription( BaseMessages.getString( PKG, "TextFileImportWizardPage1.DialogMessage" ) ); }
Example #30
Source File: CreateDatabaseWizardPageOCI.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public CreateDatabaseWizardPageOCI( String arg, PropsUI props, DatabaseMeta info ) { super( arg ); this.props = props; this.info = info; setTitle( BaseMessages.getString( PKG, "CreateDatabaseWizardPageOCI.DialogTitle" ) ); setDescription( BaseMessages.getString( PKG, "CreateDatabaseWizardPageOCI.DialogMessage" ) ); setPageComplete( false ); }