use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class MissingPipelineDialog method open.
@Override
public String open() {
PropsUi props = PropsUi.getInstance();
Display display = shellParent.getDisplay();
shell = new Shell(shellParent, SWT.DIALOG_TRIM | SWT.CLOSE | SWT.ICON | SWT.APPLICATION_MODAL);
props.setLook(shell);
shell.setImage(GuiResource.getInstance().getImageHopUi());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginLeft = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setText(BaseMessages.getString(PKG, "MissingPipelineDialog.MissingPlugins"));
shell.setLayout(formLayout);
Label image = new Label(shell, SWT.NONE);
props.setLook(image);
Image icon = display.getSystemImage(SWT.ICON_QUESTION);
image.setImage(icon);
FormData imageData = new FormData();
imageData.left = new FormAttachment(0, 5);
imageData.right = new FormAttachment(11, 0);
imageData.top = new FormAttachment(0, 10);
image.setLayoutData(imageData);
Label error = new Label(shell, SWT.WRAP);
props.setLook(error);
error.setText(getErrorMessage(missingPipeline, mode));
FormData errorData = new FormData();
errorData.left = new FormAttachment(image, 5);
errorData.right = new FormAttachment(100, -5);
errorData.top = new FormAttachment(0, 10);
error.setLayoutData(errorData);
Label separator = new Label(shell, SWT.WRAP);
props.setLook(separator);
FormData separatorData = new FormData();
separatorData.top = new FormAttachment(error, 10);
separator.setLayoutData(separatorData);
Button closeButton = new Button(shell, SWT.PUSH);
props.setLook(closeButton);
FormData fdClose = new FormData();
fdClose.right = new FormAttachment(98);
fdClose.top = new FormAttachment(separator);
closeButton.setLayoutData(fdClose);
closeButton.setText(BaseMessages.getString(PKG, "MissingPipelineDialog.Close"));
closeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
cancel();
}
});
FormData fdSearch = new FormData();
if (this.mode == MISSING_PIPELINE_TRANSFORMS) {
Button openButton = new Button(shell, SWT.PUSH);
props.setLook(openButton);
FormData fdOpen = new FormData();
fdOpen.right = new FormAttachment(closeButton, -5);
fdOpen.bottom = new FormAttachment(closeButton, 0, SWT.BOTTOM);
openButton.setLayoutData(fdOpen);
openButton.setText(BaseMessages.getString(PKG, "MissingPipelineDialog.OpenFile"));
openButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ok();
}
});
fdSearch.right = new FormAttachment(openButton, -5);
fdSearch.bottom = new FormAttachment(openButton, 0, SWT.BOTTOM);
} else {
fdSearch.right = new FormAttachment(closeButton, -5);
fdSearch.bottom = new FormAttachment(closeButton, 0, SWT.BOTTOM);
}
Button searchButton = new Button(shell, SWT.PUSH);
props.setLook(searchButton);
searchButton.setText(BaseMessages.getString(PKG, "MissingPipelineDialog.SearchMarketplace"));
searchButton.setLayoutData(fdSearch);
searchButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
try {
shell.dispose();
// HopGui.getInstance().openMarketplace(); TODO: implement marketplace
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return transformResult;
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class HopServerEditor method createServiceTab.
private void createServiceTab() {
PropsUi props = PropsUi.getInstance();
HopServer hopServer = getMetadata();
// ////////////////////////
// START OF DB TAB ///
// ////////////////////////
CTabItem wServiceTab = new CTabItem(wTabFolder, SWT.NONE);
wServiceTab.setText(BaseMessages.getString(PKG, "HopServerDialog.USER_TAB_SERVICE"));
Composite wServiceComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wServiceComp);
FormLayout genLayout = new FormLayout();
genLayout.marginWidth = Const.FORM_MARGIN;
genLayout.marginHeight = Const.FORM_MARGIN;
wServiceComp.setLayout(genLayout);
// What's the hostname
Label wlHostname = new Label(wServiceComp, SWT.RIGHT);
props.setLook(wlHostname);
wlHostname.setText(BaseMessages.getString(PKG, "HopServerDialog.HostIP.Label"));
FormData fdlHostname = new FormData();
fdlHostname.top = new FormAttachment(0, margin * 2);
// First one in the left top corner
fdlHostname.left = new FormAttachment(0, 0);
fdlHostname.right = new FormAttachment(middle, -margin);
wlHostname.setLayoutData(fdlHostname);
wHostname = new TextVar(manager.getVariables(), wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wHostname);
FormData fdHostname = new FormData();
fdHostname.top = new FormAttachment(wName, margin * 2);
// To the right of the label
fdHostname.left = new FormAttachment(middle, 0);
fdHostname.right = new FormAttachment(95, 0);
wHostname.setLayoutData(fdHostname);
// What's the service URL?
Label wlPort = new Label(wServiceComp, SWT.RIGHT);
props.setLook(wlPort);
wlPort.setText(BaseMessages.getString(PKG, "HopServerDialog.Port.Label"));
FormData fdlPort = new FormData();
fdlPort.top = new FormAttachment(wHostname, margin);
// First one in the left top corner
fdlPort.left = new FormAttachment(0, 0);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(manager.getVariables(), wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
FormData fdPort = new FormData();
fdPort.top = new FormAttachment(wHostname, margin);
// To the right of the label
fdPort.left = new FormAttachment(middle, 0);
fdPort.right = new FormAttachment(95, 0);
wPort.setLayoutData(fdPort);
// webapp name (optional)
Label wlWebAppName = new Label(wServiceComp, SWT.RIGHT);
wlWebAppName.setText(BaseMessages.getString(PKG, "HopServerDialog.WebAppName.Label"));
props.setLook(wlWebAppName);
FormData fdlWebAppName = new FormData();
fdlWebAppName.top = new FormAttachment(wPort, margin);
fdlWebAppName.left = new FormAttachment(0, 0);
fdlWebAppName.right = new FormAttachment(middle, -margin);
wlWebAppName.setLayoutData(fdlWebAppName);
wWebAppName = new TextVar(manager.getVariables(), wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wWebAppName);
FormData fdWebAppName = new FormData();
fdWebAppName.top = new FormAttachment(wPort, margin);
fdWebAppName.left = new FormAttachment(middle, 0);
fdWebAppName.right = new FormAttachment(95, 0);
wWebAppName.setLayoutData(fdWebAppName);
// Username
Label wlUsername = new Label(wServiceComp, SWT.RIGHT);
wlUsername.setText(BaseMessages.getString(PKG, "HopServerDialog.UserName.Label"));
props.setLook(wlUsername);
FormData fdlUsername = new FormData();
fdlUsername.top = new FormAttachment(wWebAppName, margin);
fdlUsername.left = new FormAttachment(0, 0);
fdlUsername.right = new FormAttachment(middle, -margin);
wlUsername.setLayoutData(fdlUsername);
wUsername = new TextVar(manager.getVariables(), wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUsername);
FormData fdUsername = new FormData();
fdUsername.top = new FormAttachment(wWebAppName, margin);
fdUsername.left = new FormAttachment(middle, 0);
fdUsername.right = new FormAttachment(95, 0);
wUsername.setLayoutData(fdUsername);
// Password
Label wlPassword = new Label(wServiceComp, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "HopServerDialog.Password.Label"));
props.setLook(wlPassword);
FormData fdlPassword = new FormData();
fdlPassword.top = new FormAttachment(wUsername, margin);
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(manager.getVariables(), wServiceComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
FormData fdPassword = new FormData();
fdPassword.top = new FormAttachment(wUsername, margin);
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.right = new FormAttachment(95, 0);
wPassword.setLayoutData(fdPassword);
// Https
Label wlSSL = new Label(wServiceComp, SWT.RIGHT);
wlSSL.setText(BaseMessages.getString(PKG, "HopServerDialog.UseSsl.Label"));
props.setLook(wlSSL);
FormData fd = new FormData();
fd.top = new FormAttachment(wPassword, margin);
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
wlSSL.setLayoutData(fd);
wlSSL.setVisible(true);
wSSL = new Button(wServiceComp, SWT.CHECK);
props.setLook(wSSL);
FormData bfd = new FormData();
bfd.top = new FormAttachment(wlSSL, 0, SWT.CENTER);
bfd.left = new FormAttachment(middle, 0);
bfd.right = new FormAttachment(95, 0);
wSSL.setLayoutData(bfd);
wSSL.setVisible(true);
FormData fdServiceComp = new FormData();
fdServiceComp.left = new FormAttachment(0, 0);
fdServiceComp.top = new FormAttachment(0, 0);
fdServiceComp.right = new FormAttachment(100, 0);
fdServiceComp.bottom = new FormAttachment(100, 0);
wServiceComp.setLayoutData(fdServiceComp);
wServiceComp.layout();
wServiceTab.setControl(wServiceComp);
// ///////////////////////////////////////////////////////////
// / END OF GEN TAB
// ///////////////////////////////////////////////////////////
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class TextVar method initialize.
protected void initialize(IVariables variables, Composite composite, int flags, String toolTipText, IGetCaretPosition getCaretPositionInterface, IInsertText insertTextInterface, SelectionListener selectionListener) {
this.toolTipText = toolTipText;
this.getCaretPositionInterface = getCaretPositionInterface;
this.insertTextInterface = insertTextInterface;
this.variables = variables;
PropsUi props = PropsUi.getInstance();
props.setLook(this);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
formLayout.marginTop = 0;
formLayout.marginBottom = 0;
this.setLayout(formLayout);
// Add the variable $ image on the top right of the control
//
Label wImage = new Label(this, SWT.NONE);
props.setLook(wImage);
wImage.setImage(GuiResource.getInstance().getImageVariable());
wImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
FormData fdlImage = new FormData();
fdlImage.top = new FormAttachment(0, 0);
fdlImage.right = new FormAttachment(100, 0);
wImage.setLayoutData(fdlImage);
// add a text field on it...
wText = new Text(this, flags);
FormData fdText = new FormData();
fdText.top = new FormAttachment(0, 0);
fdText.left = new FormAttachment(0, 0);
fdText.right = new FormAttachment(wImage, 0);
fdText.bottom = new FormAttachment(100, 0);
wText.setLayoutData(fdText);
modifyListenerTooltipText = getModifyListenerTooltipText(wText);
wText.addModifyListener(modifyListenerTooltipText);
controlSpaceKeyAdapter = new ControlSpaceKeyAdapter(variables, wText, getCaretPositionInterface, insertTextInterface);
wText.addKeyListener(controlSpaceKeyAdapter);
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class BaseTransformDialog method setSize.
public static void setSize(Shell shell, int prefWidth, int prefHeight) {
PropsUi props = PropsUi.getInstance();
WindowProperty winprop = props.getScreen(shell.getText());
if (winprop != null) {
winprop.setShell(shell, prefWidth, prefHeight);
} else {
shell.layout();
winprop = new WindowProperty(shell.getText(), false, 0, 0, prefWidth, prefHeight);
winprop.setShell(shell);
// Now, as this is the first time it gets opened, try to put it in the middle of the screen...
Rectangle shellBounds = shell.getBounds();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if (shell.getParent() != null) {
monitor = shell.getParent().getMonitor();
}
Rectangle monitorClientArea = monitor.getClientArea();
int middleX = monitorClientArea.x + (monitorClientArea.width - shellBounds.width) / 2;
int middleY = monitorClientArea.y + (monitorClientArea.height - shellBounds.height) / 2;
shell.setLocation(middleX, middleY);
}
}
use of org.apache.hop.ui.core.PropsUi in project hop by apache.
the class BaseTransformDialog method setSize.
/**
* Sets the size of this dialog with respect to the given parameters.
*
* @param shell the shell
* @param minWidth the minimum width
* @param minHeight the minimum height
* @param packIt true to pack the dialog components, false otherwise
*/
public static void setSize(Shell shell, int minWidth, int minHeight, boolean packIt) {
PropsUi props = PropsUi.getInstance();
WindowProperty winprop = props.getScreen(shell.getText());
if (winprop != null) {
winprop.setShell(shell, minWidth, minHeight);
} else {
if (packIt) {
shell.pack();
} else {
shell.layout();
}
// OK, sometimes this produces dialogs that are waay too big.
// Try to limit this a bit, m'kay?
// Use the same algorithm by cheating :-)
//
winprop = new WindowProperty(shell);
winprop.setShell(shell, minWidth, minHeight);
// Now, as this is the first time it gets opened, try to put it in the middle of the screen...
Rectangle shellBounds = shell.getBounds();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if (shell.getParent() != null) {
monitor = shell.getParent().getMonitor();
}
Rectangle monitorClientArea = monitor.getClientArea();
int middleX = monitorClientArea.x + (monitorClientArea.width - shellBounds.width) / 2;
int middleY = monitorClientArea.y + (monitorClientArea.height - shellBounds.height) / 2;
shell.setLocation(middleX, middleY);
}
}
Aggregations