use of org.pentaho.di.ui.core.PropsUI in project pentaho-kettle by pentaho.
the class RepositoryOpenSaveExtensionPoint method callExtensionPoint.
@Override
public void callExtensionPoint(LogChannelInterface logChannelInterface, Object o) throws KettleException {
FileDialogOperation fileDialogOperation = (FileDialogOperation) o;
PropsUI propsUI = propsUISupplier.get();
String startingDir = null;
if (fileDialogOperation.getRepository() == null) {
String username = getRepository().getUserInfo() != null ? getRepository().getUserInfo().getLogin() : "";
String repoAndUser = getRepository().getName() + ":" + username;
List<LastUsedFile> lastUsedFileList = propsUI.getLastUsedRepoFiles().getOrDefault(repoAndUser, Collections.emptyList());
startingDir = getStartingDir(fileDialogOperation, lastUsedFileList);
} else {
startingDir = fileDialogOperation.getStartDir();
}
RepositoryOpenSaveDialog repositoryOpenSaveDialog = new RepositoryOpenSaveDialog(spoonSupplier.get().getShell(), WIDTH, HEIGHT);
repositoryOpenSaveDialog.open(fileDialogOperation.getRepository(), startingDir, fileDialogOperation.getCommand(), fileDialogOperation.getTitle(), fileDialogOperation.getFilter(), fileDialogOperation.getOrigin(), fileDialogOperation.getFilename(), fileDialogOperation.getFileType());
if (!Utils.isEmpty(repositoryOpenSaveDialog.getObjectName())) {
RepositoryObject repositoryObject = new RepositoryObject();
repositoryObject.setObjectId(repositoryOpenSaveDialog::getObjectId);
repositoryObject.setName(repositoryOpenSaveDialog.getObjectName());
repositoryObject.setRepositoryDirectory(getRepository().findDirectory(repositoryOpenSaveDialog.getObjectDirectory()));
repositoryObject.setObjectType(repositoryOpenSaveDialog.getObjectType().equals(TRANSFORMATION) ? RepositoryObjectType.TRANSFORMATION : RepositoryObjectType.JOB);
fileDialogOperation.setRepositoryObject(repositoryObject);
}
}
use of org.pentaho.di.ui.core.PropsUI in project pentaho-kettle by pentaho.
the class JobHasDescriptionImportRuleComposite method getComposite.
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;
}
use of org.pentaho.di.ui.core.PropsUI in project pentaho-kettle by pentaho.
the class TransformationHasTransLogConfiguredImportRuleComposite method getComposite.
public Composite getComposite(Composite parent, ImportRuleInterface importRule) {
PropsUI props = PropsUI.getInstance();
composite = new Composite(parent, SWT.NONE);
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;
}
use of org.pentaho.di.ui.core.PropsUI in project pentaho-kettle by pentaho.
the class StarModelerPerspective method addModelsGroupToDomainTab.
private Control addModelsGroupToDomainTab(final StarDomain starDomain, final XulTabAndPanel tabAndPanel, Composite parentComposite) {
PropsUI props = PropsUI.getInstance();
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Add a group for the logical stars
//
final Group logicalGroup = new Group(parentComposite, SWT.SHADOW_NONE);
props.setLook(logicalGroup);
logicalGroup.setText(BaseMessages.getString(PKG, "StarModelerPerspective.LogicalGroup.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginLeft = 10;
groupLayout.marginRight = 10;
groupLayout.marginTop = 10;
groupLayout.marginBottom = 10;
groupLayout.spacing = margin;
logicalGroup.setLayout(groupLayout);
FormData fdLogicalGroup = new FormData();
fdLogicalGroup.top = new FormAttachment(0, 0);
fdLogicalGroup.left = new FormAttachment(0, 0);
fdLogicalGroup.right = new FormAttachment(100, 0);
logicalGroup.setLayoutData(fdLogicalGroup);
// Add a line to edit the name of the logical domain
//
Label nameLabel = new Label(logicalGroup, SWT.RIGHT);
props.setLook(nameLabel);
nameLabel.setText(BaseMessages.getString(PKG, "StarModelerPerspective.DomainName.Label"));
FormData fdNameLabel = new FormData();
fdNameLabel.left = new FormAttachment(0, 0);
fdNameLabel.right = new FormAttachment(middle, 0);
fdNameLabel.top = new FormAttachment(0, 0);
nameLabel.setLayoutData(fdNameLabel);
final Text nameText = new Text(logicalGroup, SWT.BORDER | SWT.SINGLE);
props.setLook(nameText);
nameText.setText(Const.NVL(starDomain.getDomain().getName(defaultLocale), ""));
FormData fdNameText = new FormData();
fdNameText.left = new FormAttachment(middle, margin);
fdNameText.right = new FormAttachment(100, 0);
fdNameText.top = new FormAttachment(0, 0);
nameText.setLayoutData(fdNameText);
nameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
starDomain.getDomain().setName(new LocalizedString(defaultLocale, nameText.getText()));
setNameForTab(tabAndPanel.tab, starDomain.getDomain().getName(defaultLocale));
}
});
Control lastControl = nameText;
// Add a line to edit the name of the logical domain
//
Label descriptionLabel = new Label(logicalGroup, SWT.RIGHT);
props.setLook(descriptionLabel);
descriptionLabel.setText(BaseMessages.getString(PKG, "StarModelerPerspective.DomainDescription.Label"));
FormData fdDescriptionLabel = new FormData();
fdDescriptionLabel.left = new FormAttachment(0, 0);
fdDescriptionLabel.right = new FormAttachment(middle, 0);
fdDescriptionLabel.top = new FormAttachment(lastControl, margin);
descriptionLabel.setLayoutData(fdDescriptionLabel);
final Text descriptionText = new Text(logicalGroup, SWT.BORDER | SWT.SINGLE);
props.setLook(descriptionText);
descriptionText.setText(Const.NVL(starDomain.getDomain().getDescription(defaultLocale), ""));
FormData fdDescriptionText = new FormData();
fdDescriptionText.left = new FormAttachment(middle, 5);
fdDescriptionText.right = new FormAttachment(100, 0);
fdDescriptionText.top = new FormAttachment(lastControl, margin);
descriptionText.setLayoutData(fdDescriptionText);
descriptionText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
starDomain.getDomain().setDescription(new LocalizedString(defaultLocale, descriptionText.getText()));
}
});
lastControl = descriptionText;
// Then we'll add a table view of all the models and their descriptions
//
Label modelsLabel = new Label(logicalGroup, SWT.RIGHT);
props.setLook(modelsLabel);
modelsLabel.setText(BaseMessages.getString(PKG, "StarModelerPerspective.DomainModels.Label"));
FormData fdModelsLabel = new FormData();
fdModelsLabel.left = new FormAttachment(0, 0);
fdModelsLabel.right = new FormAttachment(middle, 0);
fdModelsLabel.top = new FormAttachment(lastControl, margin);
modelsLabel.setLayoutData(fdModelsLabel);
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "StarModelerPerspective.ModelName.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "StarModelerPerspective.ModelDescription.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
final TableView modelsList = new TableView(new Variables(), logicalGroup, SWT.BORDER, colinf, 1, null, props);
modelsList.setReadonly(true);
modelsList.table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
if (modelsList.getSelectionIndex() < 0)
return;
TableItem item = modelsList.table.getSelection()[0];
String name = item.getText(1);
if (editModel(logicalGroup.getShell(), starDomain, defaultLocale, name)) {
refreshModelsList(starDomain, modelsList);
}
}
});
refreshModelsList(starDomain, modelsList);
FormData fdModelsList = new FormData();
fdModelsList.top = new FormAttachment(lastControl, margin);
fdModelsList.bottom = new FormAttachment(lastControl, 250);
fdModelsList.left = new FormAttachment(middle, margin);
fdModelsList.right = new FormAttachment(100, 0);
modelsList.setLayoutData(fdModelsList);
lastControl = modelsList;
// A few buttons to edit the list
//
Button newModelButton = new Button(logicalGroup, SWT.PUSH);
newModelButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.NewModel"));
FormData fdNewModelButton = new FormData();
fdNewModelButton.top = new FormAttachment(lastControl, margin);
fdNewModelButton.left = new FormAttachment(middle, margin);
newModelButton.setLayoutData(fdNewModelButton);
newModelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (newModel(logicalGroup.getShell(), starDomain)) {
refreshModelsList(starDomain, modelsList);
}
}
});
Button editModelButton = new Button(logicalGroup, SWT.PUSH);
editModelButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.EditModel"));
FormData fdEditModelButton = new FormData();
fdEditModelButton.top = new FormAttachment(lastControl, margin);
fdEditModelButton.left = new FormAttachment(newModelButton, margin);
editModelButton.setLayoutData(fdEditModelButton);
editModelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (modelsList.getSelectionIndex() < 0)
return;
TableItem item = modelsList.table.getSelection()[0];
String name = item.getText(1);
if (editModel(logicalGroup.getShell(), starDomain, defaultLocale, name)) {
refreshModelsList(starDomain, modelsList);
}
}
});
Button delModelButton = new Button(logicalGroup, SWT.PUSH);
delModelButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.DeleteModel"));
FormData fdDelModelButton = new FormData();
fdDelModelButton.top = new FormAttachment(lastControl, margin);
fdDelModelButton.left = new FormAttachment(editModelButton, margin);
delModelButton.setLayoutData(fdDelModelButton);
delModelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (modelsList.getSelectionIndex() < 0)
return;
TableItem item = modelsList.table.getSelection()[0];
String name = item.getText(1);
if (deleteModel(logicalGroup.getShell(), starDomain, defaultLocale, name)) {
refreshModelsList(starDomain, modelsList);
}
}
});
return logicalGroup;
}
use of org.pentaho.di.ui.core.PropsUI in project pentaho-kettle by pentaho.
the class StarModelerPerspective method addPhysicalGroupToDomainTab.
private Control addPhysicalGroupToDomainTab(final StarDomain starDomain, final XulTabAndPanel tabAndPanel, final Composite parentComposite, Control lastControl) {
PropsUI props = PropsUI.getInstance();
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// And now for the physical hints
//
final Group physicalGroup = new Group(parentComposite, SWT.SHADOW_NONE);
props.setLook(physicalGroup);
physicalGroup.setText(BaseMessages.getString(PKG, "StarModelerPerspective.PhysicalGroup.Label"));
FormLayout phGroupLayout = new FormLayout();
phGroupLayout.marginLeft = 10;
phGroupLayout.marginRight = 10;
phGroupLayout.marginTop = 10;
phGroupLayout.marginBottom = 10;
phGroupLayout.spacing = margin;
physicalGroup.setLayout(phGroupLayout);
FormData fdPhysicalGroup = new FormData();
fdPhysicalGroup.top = new FormAttachment(lastControl, 2 * margin);
fdPhysicalGroup.left = new FormAttachment(0, 0);
fdPhysicalGroup.right = new FormAttachment(100, 0);
physicalGroup.setLayoutData(fdPhysicalGroup);
lastControl = physicalGroup;
// The target database (optional)
//
final List<DatabaseMeta> sharedDatabases = SharedDatabaseUtil.getDatabaseMetaList(Spoon.getInstance().metaStore);
String[] databaseNames = SharedDatabaseUtil.getSortedDatabaseNames(sharedDatabases);
Label targetDatabaseLabel = new Label(physicalGroup, SWT.RIGHT);
props.setLook(targetDatabaseLabel);
targetDatabaseLabel.setText(BaseMessages.getString(PKG, "StarModelerPerspective.TargetDatabase.Label"));
FormData fdTargetDatabaseLabel = new FormData();
fdTargetDatabaseLabel.left = new FormAttachment(0, 0);
fdTargetDatabaseLabel.right = new FormAttachment(middle, 0);
fdTargetDatabaseLabel.top = new FormAttachment(0, 0);
targetDatabaseLabel.setLayoutData(fdTargetDatabaseLabel);
final Button newDatabaseButton = new Button(physicalGroup, SWT.PUSH);
newDatabaseButton.setText(BaseMessages.getString("System.Button.New"));
FormData fdNewDatabaseButton = new FormData();
fdNewDatabaseButton.right = new FormAttachment(100, 0);
fdNewDatabaseButton.top = new FormAttachment(0, 0);
newDatabaseButton.setLayoutData(fdNewDatabaseButton);
final CCombo targetDatabase = new CCombo(physicalGroup, SWT.BORDER | SWT.SINGLE);
targetDatabase.setItems(databaseNames);
props.setLook(targetDatabase);
String targetDb = ConceptUtil.getString(starDomain.getDomain(), DefaultIDs.DOMAIN_TARGET_DATABASE);
targetDatabase.setText(Const.NVL(targetDb, ""));
FormData fdTargetDatabase = new FormData();
fdTargetDatabase.left = new FormAttachment(middle, 5);
fdTargetDatabase.right = new FormAttachment(newDatabaseButton, -margin);
fdTargetDatabase.top = new FormAttachment(lastControl, margin);
targetDatabase.setLayoutData(fdTargetDatabase);
targetDatabase.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
starDomain.getDomain().setProperty(DefaultIDs.DOMAIN_TARGET_DATABASE, targetDatabase.getText());
}
});
lastControl = targetDatabase;
newDatabaseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
createSharedDatabase(targetDatabase);
}
});
// put some utility buttons at the bottom too...
//
Button sqlJobButton = new Button(physicalGroup, SWT.PUSH);
sqlJobButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.GenerateSQLJob"));
sqlJobButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
generateSqlJobButton(starDomain);
}
});
Button domainJobButton = new Button(physicalGroup, SWT.PUSH);
domainJobButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.GenerateDomainJob"));
domainJobButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
generateDomainJobButton(starDomain);
}
});
Button physicalModelButton = new Button(physicalGroup, SWT.PUSH);
physicalModelButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.GeneratePhysicalModel"));
physicalModelButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
generatePhysicalModelButton(starDomain);
}
});
Button mondrianSchemaButton = new Button(physicalGroup, SWT.PUSH);
mondrianSchemaButton.setText(BaseMessages.getString(PKG, "StarModelerPerspective.Button.GenerateMondrianSchema"));
mondrianSchemaButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
generateMondrialSchemaButton(starDomain);
}
});
BaseStepDialog.positionBottomButtons(physicalGroup, new Button[] { sqlJobButton, domainJobButton, physicalModelButton, mondrianSchemaButton }, margin, lastControl);
return physicalGroup;
}
Aggregations