use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class DataSetEditor method createControl.
@Override
public void createControl(Composite parent) {
PropsUi props = PropsUi.getInstance();
int margin = Const.MARGIN;
// The name of the group...
//
Label wIcon = new Label(parent, SWT.RIGHT);
wIcon.setImage(getImage());
FormData fdlicon = new FormData();
fdlicon.top = new FormAttachment(0, 0);
fdlicon.right = new FormAttachment(100, 0);
wIcon.setLayoutData(fdlicon);
props.setLook(wIcon);
// What's the name
Label wlName = new Label(parent, SWT.RIGHT);
props.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "DataSetDialog.Name.Label"));
FormData fdlName = new FormData();
fdlName.top = new FormAttachment(0, 0);
fdlName.left = new FormAttachment(0, 0);
wlName.setLayoutData(fdlName);
wName = new Text(parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
FormData fdName = new FormData();
fdName.top = new FormAttachment(wlName, 5);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(wIcon, -5);
wName.setLayoutData(fdName);
Label spacer = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdSpacer = new FormData();
fdSpacer.left = new FormAttachment(0, 0);
fdSpacer.top = new FormAttachment(wName, 15);
fdSpacer.right = new FormAttachment(100, 0);
spacer.setLayoutData(fdSpacer);
// The description of the group...
//
Label wlDescription = new Label(parent, SWT.LEFT);
props.setLook(wlDescription);
wlDescription.setText(BaseMessages.getString(PKG, "DataSetDialog.Description.Label"));
FormData fdlDescription = new FormData();
fdlDescription.top = new FormAttachment(spacer, margin);
fdlDescription.left = new FormAttachment(0, 0);
fdlDescription.right = new FormAttachment(100, 0);
wlDescription.setLayoutData(fdlDescription);
wDescription = new Text(parent, SWT.MULTI | SWT.LEFT | SWT.V_SCROLL | SWT.BORDER);
props.setLook(wDescription);
FormData fdDescription = new FormData();
fdDescription.height = 50;
fdDescription.top = new FormAttachment(wlDescription, margin);
fdDescription.left = new FormAttachment(0, 0);
fdDescription.right = new FormAttachment(100, 0);
wDescription.setLayoutData(fdDescription);
// The folder containing the set...
//
Label wlFolderName = new Label(parent, SWT.LEFT);
props.setLook(wlFolderName);
wlFolderName.setText(BaseMessages.getString(PKG, "DataSetDialog.FolderName.Label"));
FormData fdlFolderName = new FormData();
fdlFolderName.top = new FormAttachment(wDescription, margin);
fdlFolderName.left = new FormAttachment(0, 0);
fdlFolderName.right = new FormAttachment(100, 0);
wlFolderName.setLayoutData(fdlFolderName);
wFolderName = new TextVar(manager.getVariables(), parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFolderName);
FormData fdFolderName = new FormData();
fdFolderName.top = new FormAttachment(wlFolderName, margin);
fdFolderName.left = new FormAttachment(0, 0);
fdFolderName.right = new FormAttachment(100, 0);
wFolderName.setLayoutData(fdFolderName);
// The table storing the set...
//
Label wlBaseFilename = new Label(parent, SWT.LEFT);
props.setLook(wlBaseFilename);
wlBaseFilename.setText(BaseMessages.getString(PKG, "DataSetDialog.BaseFilename.Label"));
FormData fdlBaseFilename = new FormData();
fdlBaseFilename.top = new FormAttachment(wFolderName, margin);
fdlBaseFilename.left = new FormAttachment(0, 0);
fdlBaseFilename.right = new FormAttachment(100, 0);
wlBaseFilename.setLayoutData(fdlBaseFilename);
wBaseFilename = new Text(parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBaseFilename);
FormData fdBaseFilename = new FormData();
fdBaseFilename.top = new FormAttachment(wlBaseFilename, margin);
fdBaseFilename.left = new FormAttachment(0, 0);
fdBaseFilename.right = new FormAttachment(100, 0);
wBaseFilename.setLayoutData(fdBaseFilename);
// The field mapping from the input to the data set...
//
Label wlFieldMapping = new Label(parent, SWT.NONE);
wlFieldMapping.setText(BaseMessages.getString(PKG, "DataSetDialog.FieldMapping.Label"));
props.setLook(wlFieldMapping);
FormData fdlUpIns = new FormData();
fdlUpIns.left = new FormAttachment(0, 0);
fdlUpIns.top = new FormAttachment(wBaseFilename, margin * 2);
wlFieldMapping.setLayoutData(fdlUpIns);
// the field mapping grid in between
//
ColumnInfo[] columns = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "DataSetDialog.ColumnInfo.FieldName"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "DataSetDialog.ColumnInfo.FieldType"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getAllValueMetaNames(), false), new ColumnInfo(BaseMessages.getString(PKG, "DataSetDialog.ColumnInfo.FieldFormat"), ColumnInfo.COLUMN_TYPE_FORMAT, 2), new ColumnInfo(BaseMessages.getString(PKG, "DataSetDialog.ColumnInfo.FieldLength"), ColumnInfo.COLUMN_TYPE_TEXT, true, false), new ColumnInfo(BaseMessages.getString(PKG, "DataSetDialog.ColumnInfo.FieldPrecision"), ColumnInfo.COLUMN_TYPE_TEXT, true, false), new ColumnInfo(BaseMessages.getString(PKG, "DataSetDialog.ColumnInfo.Comment"), ColumnInfo.COLUMN_TYPE_TEXT, false, false) };
wFieldMapping = new TableView(new Variables(), parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, columns, getMetadata().getFields().size(), null, props);
FormData fdFieldMapping = new FormData();
fdFieldMapping.left = new FormAttachment(0, 0);
fdFieldMapping.top = new FormAttachment(wlFieldMapping, margin);
fdFieldMapping.right = new FormAttachment(100, 0);
fdFieldMapping.bottom = new FormAttachment(100, -2 * margin);
wFieldMapping.setLayoutData(fdFieldMapping);
this.setWidgetsContent();
// Add listener to detect change after loading data
ModifyListener lsMod = e -> setChanged();
wName.addModifyListener(lsMod);
wDescription.addModifyListener(lsMod);
wFolderName.addModifyListener(lsMod);
wBaseFilename.addModifyListener(lsMod);
wFieldMapping.addModifyListener(lsMod);
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class HopNeo4jPerspective method initialize.
@Override
public void initialize(HopGui hopGui, Composite parent) {
this.hopGui = hopGui;
this.parent = parent;
PropsUi props = PropsUi.getInstance();
int size = (int) Math.round((double) ConstUi.SMALL_ICON_SIZE * props.getZoomFactor());
Image neo4jImage = SwtSvgImageUtil.getImage(hopGui.getDisplay(), this.getClass().getClassLoader(), "neo4j_logo.svg", size, size);
Image lineageImage = SwtSvgImageUtil.getImage(hopGui.getDisplay(), this.getClass().getClassLoader(), "lineage.svg", size, size);
errorLineBackground = new Color(hopGui.getDisplay(), 201, 232, 251);
composite = new Composite(parent, SWT.NONE);
props.setLook(composite);
FormLayout layout = new FormLayout();
layout.marginLeft = props.getMargin();
layout.marginTop = props.getMargin();
layout.marginLeft = props.getMargin();
layout.marginBottom = props.getMargin();
composite.setLayout(layout);
FormData formData = new FormData();
formData.left = new FormAttachment(0, 0);
formData.top = new FormAttachment(0, 0);
formData.right = new FormAttachment(100, 0);
formData.bottom = new FormAttachment(100, 0);
composite.setLayoutData(formData);
int margin = (int) (props.getMargin() * props.getZoomFactor());
// Add a simple label to test
//
Label wlInfo = new Label(composite, SWT.LEFT);
props.setLook(wlInfo);
wlInfo.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Shell.Title"));
wlInfo.setFont(GuiResource.getInstance().getFontBold());
FormData fdInfo = new FormData();
fdInfo.left = new FormAttachment(0, 0);
fdInfo.right = new FormAttachment(100, 0);
fdInfo.top = new FormAttachment(0, 0);
wlInfo.setLayoutData(fdInfo);
Control lastControl = wlInfo;
Label wlSep1 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
props.setLook(wlSep1);
FormData fdlSep1 = new FormData();
fdlSep1.left = new FormAttachment(0, 0);
fdlSep1.right = new FormAttachment(100, 0);
fdlSep1.top = new FormAttachment(lastControl, margin);
wlSep1.setLayoutData(fdlSep1);
lastControl = wlSep1;
Label wlUsedConnection = new Label(composite, SWT.LEFT);
props.setLook(wlUsedConnection);
wlUsedConnection.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Neo4J.Logging.Path.Label"));
FormData fdlLoggingConnection = new FormData();
fdlLoggingConnection.left = new FormAttachment(0, 0);
fdlLoggingConnection.top = new FormAttachment(lastControl, margin);
wlUsedConnection.setLayoutData(fdlLoggingConnection);
wUsedConnection = new Text(composite, SWT.SINGLE | SWT.BORDER);
wUsedConnection.setEditable(false);
props.setLook(wUsedConnection);
wUsedConnection.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Neo4J.Logging.Path.Label"));
wUsedConnection.setFont(GuiResource.getInstance().getFontBold());
FormData fdLoggingConnection = new FormData();
fdLoggingConnection.left = new FormAttachment(wlUsedConnection, margin);
fdLoggingConnection.right = new FormAttachment(50, 0);
fdLoggingConnection.top = new FormAttachment(lastControl, margin);
wUsedConnection.setLayoutData(fdLoggingConnection);
lastControl = wUsedConnection;
// The search query
//
Label wlExecutions = new Label(composite, SWT.LEFT);
props.setLook(wlExecutions);
wlExecutions.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.PipelineActionName.Label"));
FormData fdlExecutions = new FormData();
fdlExecutions.left = new FormAttachment(0, 0);
fdlExecutions.top = new FormAttachment(lastControl, margin);
wlExecutions.setLayoutData(fdlExecutions);
lastControl = wlExecutions;
wExecutions = new Combo(composite, SWT.BORDER | SWT.SINGLE);
props.setLook(wExecutions);
wExecutions.setFont(GuiResource.getInstance().getFontBold());
FormData fdSearchString = new FormData();
fdSearchString.left = new FormAttachment(0, 0);
fdSearchString.top = new FormAttachment(lastControl, margin);
fdSearchString.right = new FormAttachment(50, 0);
wExecutions.setLayoutData(fdSearchString);
wExecutions.addListener(SWT.DefaultSelection, this::search);
wExecutions.addListener(SWT.Selection, this::search);
Label wlAmount = new Label(composite, SWT.LEFT);
props.setLook(wlAmount);
wlAmount.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.ShowLast.Label"));
FormData fdlAmount = new FormData();
fdlAmount.left = new FormAttachment(wExecutions, 2 * margin);
fdlAmount.top = new FormAttachment(lastControl, margin);
wlAmount.setLayoutData(fdlAmount);
wAmount = new Combo(composite, SWT.BORDER | SWT.SINGLE);
props.setLook(wAmount);
wAmount.setItems("50", "100", "250", "500", "1000");
wAmount.setText("50");
FormData fdAmount = new FormData();
fdAmount.left = new FormAttachment(wlAmount, margin);
fdAmount.top = new FormAttachment(lastControl, margin);
fdAmount.width = (int) (200 * props.getZoomFactor());
wAmount.setLayoutData(fdAmount);
wAmount.addListener(SWT.DefaultSelection, this::search);
wAmount.addListener(SWT.Selection, this::search);
wOnlyRoot = new Button(composite, SWT.CHECK);
wOnlyRoot.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.OnlyRoot.Label"));
// default is to limit the amount of entries
wOnlyRoot.setSelection(true);
props.setLook(wOnlyRoot);
FormData fdOnlyRoot = new FormData();
fdOnlyRoot.left = new FormAttachment(wAmount, margin);
fdOnlyRoot.top = new FormAttachment(lastControl, margin);
wOnlyRoot.setLayoutData(fdOnlyRoot);
wOnlyRoot.addListener(SWT.Selection, this::search);
lastControl = wExecutions;
Button wbSearch = new Button(composite, SWT.PUSH);
props.setLook(wbSearch);
wbSearch.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Search.Button"));
FormData fdbSearch = new FormData();
fdbSearch.left = new FormAttachment(0, 0);
fdbSearch.top = new FormAttachment(lastControl, margin);
wbSearch.setLayoutData(fdbSearch);
wbSearch.addListener(SWT.Selection, this::search);
lastControl = wExecutions;
Button wbOpen = new Button(composite, SWT.PUSH);
props.setLook(wbOpen);
wbOpen.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Open.Button"));
FormData fdbOpen = new FormData();
fdbOpen.left = new FormAttachment(50, 0);
fdbOpen.bottom = new FormAttachment(100, -margin);
wbOpen.setLayoutData(fdbOpen);
wbOpen.addListener(SWT.Selection, this::open);
SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
props.setLook(sashForm);
FormData fdSashForm = new FormData();
fdSashForm.left = new FormAttachment(0, 0);
fdSashForm.top = new FormAttachment(wbSearch, margin);
fdSashForm.right = new FormAttachment(100, 0);
fdSashForm.bottom = new FormAttachment(wbOpen, -margin);
sashForm.setLayoutData(fdSashForm);
// A table with the execution history results...
//
ColumnInfo[] resultsColumns = { new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.ID.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Name.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Type.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Read.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Written.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Input.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Output.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Rejected.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Errors.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Date.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Column.Duration.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
wResults = new TableView(hopGui.getVariables(), sashForm, SWT.V_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.BORDER, resultsColumns, 0, null, props);
props.setLook(wResults);
wResults.setReadonly(true);
FormData fdResults = new FormData();
fdResults.left = new FormAttachment(0, 0);
fdResults.right = new FormAttachment(100, 0);
fdResults.top = new FormAttachment(0, 0);
fdResults.bottom = new FormAttachment(100, 0);
wResults.setLayoutData(fdResults);
wResults.table.addListener(SWT.DefaultSelection, this::open);
wResults.table.addListener(SWT.Selection, this::analyze);
tabFolder = new CTabFolder(sashForm, SWT.MULTI | SWT.BORDER);
props.setLook(tabFolder, Props.WIDGET_STYLE_TAB);
FormData fdLabel = new FormData();
fdLabel.left = new FormAttachment(0, 0);
fdLabel.right = new FormAttachment(100, 0);
fdLabel.top = new FormAttachment(0, 0);
fdLabel.bottom = new FormAttachment(100, 0);
tabFolder.setLayoutData(fdLabel);
CTabItem loggingTab = new CTabItem(tabFolder, SWT.NONE);
loggingTab.setImage(GuiResource.getInstance().getImageShowLog());
loggingTab.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Logging.Tab"));
wLogging = new Text(tabFolder, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
props.setLook(wLogging);
wLogging.setFont(GuiResource.getInstance().getFontFixed());
loggingTab.setControl(wLogging);
CTabItem lineageTab = new CTabItem(tabFolder, SWT.NONE);
lineageTab.setImage(lineageImage);
lineageTab.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.PathError.Tab"));
wTree = new Tree(tabFolder, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
props.setLook(wTree);
wTree.setHeaderVisible(true);
lineageTab.setControl(wTree);
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("#");
column.setWidth((int) (50 * props.getZoomFactor()));
}
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("id");
column.setWidth((int) (250 * props.getZoomFactor()));
}
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("Name");
column.setWidth((int) (300 * props.getZoomFactor()));
}
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("Type");
column.setWidth((int) (100 * props.getZoomFactor()));
}
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("errors");
column.setWidth((int) (50 * props.getZoomFactor()));
}
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("date");
column.setWidth((int) (200 * props.getZoomFactor()));
}
{
TreeColumn column = new TreeColumn(wTree, SWT.LEFT);
column.setText("duration");
column.setWidth((int) (150 * props.getZoomFactor()));
}
CTabItem cypherTab = new CTabItem(tabFolder, SWT.NONE);
cypherTab.setText(BaseMessages.getString(PKG, "Neo4jPerspectiveDialog.Cypher.Tab"));
cypherTab.setImage(neo4jImage);
wCypher = new Text(tabFolder, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
props.setLook(wCypher);
wCypher.setFont(GuiResource.getInstance().getFontFixed());
cypherTab.setControl(wCypher);
tabFolder.setSelection(0);
sashForm.setWeights(new int[] { 30, 70 });
defaultTabFont = lineageTab.getFont();
wTree.addListener(SWT.DefaultSelection, this::openItem);
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class NeoConnectionEditor method createControl.
@Override
public void createControl(Composite composite) {
PropsUi props = PropsUi.getInstance();
int middle = props.getMiddlePct();
int margin = Const.MARGIN + 2;
IVariables variables = getHopGui().getVariables();
// The name
Label wlName = new Label(composite, SWT.RIGHT);
props.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "NeoConnectionEditor.Name.Label"));
FormData fdlName = new FormData();
fdlName.top = new FormAttachment(0, margin);
// First one in the left top corner
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
wlName.setLayoutData(fdlName);
wName = new Text(composite, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
FormData fdName = new FormData();
fdName.top = new FormAttachment(wlName, 0, SWT.CENTER);
// To the right of the label
fdName.left = new FormAttachment(middle, 0);
fdName.right = new FormAttachment(95, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(composite, SWT.BORDER);
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.top = new FormAttachment(wName, 2 * margin);
fdTabFolder.bottom = new FormAttachment(100, -2 * margin);
wTabFolder.setLayoutData(fdTabFolder);
addBasicTab(props, variables, middle, margin);
addProtocolTab(props, variables, middle, margin);
addAdvancedTab(props, variables, middle, margin);
addUrlsTab(props, variables);
// Always select the basic tab
wTabFolder.setSelection(0);
setWidgetsContent();
enableFields();
clearChanged();
// Add modify listeners to all controls.
// This will inform the Metadata perspective in the Hop GUI that this object was modified and
// needs to be saved.
//
Control[] controls = { wName, wAutomatic, wServer, wDatabaseName, wVersion4, wDatabasePort, wBrowserPort, wPolicy, wUsername, wRouting, wEncryption, wTrustAllCertificates, wConnectionLivenessCheckTimeout, wMaxConnectionLifetime, wMaxConnectionPoolSize, wConnectionAcquisitionTimeout, wConnectionTimeout, wMaxTransactionRetryTime };
for (Control control : controls) {
control.addListener(SWT.Modify, e -> setChanged());
control.addListener(SWT.Selection, e -> setChanged());
}
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class GoogleAuthorizationDialog method createDialog.
private void createDialog(String title, String url, int options, Image logo) {
Shell parent = getParent();
display = parent.getDisplay();
dialog = new Shell(parent, options);
dialog.setText(title);
dialog.setImage(logo);
PropsUi props = PropsUi.getInstance();
props.setLook(dialog);
dialog.setSize(width, height);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
dialog.setLayout(formLayout);
try {
Label helpButton = new Label(dialog, SWT.NONE);
helpButton.setImage(new Image(display, GoogleAuthorizationDialog.class.getResourceAsStream("/images/help.png")));
FormData helpButtonFormData = new FormData();
helpButtonFormData.left = new FormAttachment(0, 15);
helpButtonFormData.bottom = new FormAttachment(100, -24);
helpButton.setLayoutData(helpButtonFormData);
Text helpLabel = new Text(dialog, SWT.NONE);
helpLabel.setText("Help");
helpLabel.setEditable(false);
props.setLook(helpLabel);
helpLabel.setFont(new Font(display, "Open Sans Regular", 11, SWT.NORMAL));
helpLabel.setForeground(new Color(display, props.contrastColor(0, 94, 170)));
FormData helpLabelFormData = new FormData();
helpLabelFormData.left = new FormAttachment(0, 40);
helpLabelFormData.bottom = new FormAttachment(100, -27);
helpLabel.setLayoutData(helpLabelFormData);
helpLabel.addListener(SWT.MouseUp, event -> {
});
helpLabel.addListener(SWT.MouseEnter, event -> {
helpLabel.setForeground(new Color(display, PropsUi.getInstance().contrastColor(0, 0, 0)));
helpLabel.setCursor(new Cursor(display, SWT.CURSOR_HAND));
});
helpLabel.addListener(SWT.MouseExit, event -> helpLabel.setForeground(new Color(display, props.contrastColor(0, 94, 170))));
Label cancelButton = new Label(dialog, SWT.NONE);
Image closeImage = SwtSvgImageUtil.getImage(display, getClass().getClassLoader(), "/ui/images/close.svg", ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
cancelButton.setImage(closeImage);
FormData cancelButtonFormData = new FormData();
cancelButtonFormData.right = new FormAttachment(100, -15);
cancelButtonFormData.bottom = new FormAttachment(100, -15);
cancelButton.setLayoutData(cancelButtonFormData);
cancelButton.addListener(SWT.MouseUp, event -> {
browser.dispose();
dialog.close();
dialog.dispose();
});
cancelButton.addListener(SWT.MouseEnter, new Listener() {
@Override
public void handleEvent(Event event) {
Image closeImage = SwtSvgImageUtil.getImage(display, getClass().getClassLoader(), "/ui/images/close.svg", ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
cancelButton.setImage(new Image(display, GoogleAuthorizationDialog.class.getResourceAsStream("/images/close-button-hover.png")));
cancelButton.setCursor(new Cursor(display, SWT.CURSOR_HAND));
}
});
cancelButton.addListener(SWT.MouseExit, event -> cancelButton.setImage(new Image(display, GoogleAuthorizationDialog.class.getResourceAsStream("/images/close-button.png"))));
Label separator = new Label(dialog, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData separatorFormData = new FormData();
separatorFormData.left = new FormAttachment(0, 15);
separatorFormData.right = new FormAttachment(100, -15);
separatorFormData.bottom = new FormAttachment(cancelButton, -15);
separator.setLayoutData(separatorFormData);
browser = new Browser(dialog, SWT.NONE);
browser.setUrl(url);
FormData browserFormData = new FormData();
browserFormData.top = new FormAttachment(0, 5);
browserFormData.bottom = new FormAttachment(separator, -5);
browserFormData.left = new FormAttachment(0, 5);
browserFormData.right = new FormAttachment(100, -5);
browser.setLayoutData(browserFormData);
browser.addCloseWindowListener(event -> {
Browser browser = (Browser) event.widget;
Shell shell = browser.getShell();
shell.close();
});
} catch (Exception e) {
MessageBox messageBox = new MessageBox(dialog, SWT.ICON_ERROR | SWT.OK);
messageBox.setMessage("Browser cannot be initialized.");
messageBox.setText("Exit");
messageBox.open();
}
setPosition();
dialog.open();
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class MongoDbConnectionEditor method createControl.
@Override
public void createControl(Composite parent) {
this.parent = parent;
PropsUi props = PropsUi.getInstance();
int margin = props.getMargin();
int middle = props.getMiddlePct();
// Name...
//
Label wlName = new Label(parent, SWT.RIGHT);
props.setLook(wlName);
wlName.setText("MongoDB Connection name");
FormData fdlName = new FormData();
fdlName.top = new FormAttachment(0, margin * 2);
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
wlName.setLayoutData(fdlName);
wName = new Text(parent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
FormData fdName = new FormData();
fdName.top = new FormAttachment(wlName, 0, SWT.CENTER);
fdName.left = new FormAttachment(middle, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// Rest of the widgets...
//
widgets = new GuiCompositeWidgets(manager.getVariables());
widgets.createCompositeWidgets(getMetadata(), null, parent, PARENT_WIDGET_ID, wName);
// Set content on the widgets...
//
setWidgetsContent();
// Add changed listeners
wName.addListener(SWT.Modify, e -> setChanged());
widgets.setWidgetsListener(new GuiCompositeWidgetsAdapter() {
@Override
public void widgetModified(GuiCompositeWidgets compositeWidgets, Control changedWidget, String widgetId) {
setChanged();
}
});
}
Aggregations