Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add variable icon to TabItem in Run Pipeline/Workflow dialog #2471 #2472

Merged
merged 1 commit into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ public abstract class BaseDialog extends Dialog {
public static final int MEDIUM_SMALL_FIELD = 150;
public static final int SMALL_FIELD = 50;
public static final int SHELL_WIDTH_OFFSET = 16;
@Deprecated
public static final int VAR_ICON_WIDTH =
GuiResource.getInstance().getImageVariable().getBounds().width;
GuiResource.getInstance().getImageVariableMini().getBounds().width;
@Deprecated
public static final int VAR_ICON_HEIGHT =
GuiResource.getInstance().getImageVariable().getBounds().height;
GuiResource.getInstance().getImageVariableMini().getBounds().height;

protected Map<String, Listener> buttons = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
Expand All @@ -62,7 +61,6 @@ public abstract class ConfigurationDialog extends Dialog {
protected TableView wVariables;
protected boolean retval;
protected Shell shell;
protected PropsUi props;
protected Label wlLogLevel;
protected Group gDetails;
protected CCombo wLogLevel;
Expand All @@ -72,7 +70,6 @@ public abstract class ConfigurationDialog extends Dialog {
protected Control wRunConfigurationControl;

private TableView wParams;
private Display display;
private Shell parent;
private Button wOk;
protected FormData fdDetails;
Expand All @@ -99,8 +96,7 @@ public ConfigurationDialog(
params.put(name, "");
}

props = PropsUi.getInstance();
margin = props.getMargin();
margin = PropsUi.getMargin();
}

protected void getInfoVariables() {
Expand Down Expand Up @@ -152,7 +148,7 @@ protected void ok() {
}

private void dispose() {
props.setScreen(new WindowProperty(shell));
PropsUi.getInstance().setScreen(new WindowProperty(shell));
shell.dispose();
}

Expand Down Expand Up @@ -202,7 +198,6 @@ public void setConfiguration(IExecutionConfiguration configuration) {
}

protected void mainLayout(String shellTitle, Image img) {
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
PropsUi.setLook(shell);
shell.setImage(img);
Expand Down Expand Up @@ -289,7 +284,7 @@ protected void parametersSectionLayout(Class<?> PKG, String prefix) {
nrParams,
false,
null,
props,
PropsUi.getInstance(),
false, null, false, false);
FormData fdParams = new FormData();
fdParams.top = new FormAttachment(0, 0);
Expand All @@ -304,6 +299,7 @@ protected void parametersSectionLayout(Class<?> PKG, String prefix) {
CTabItem tbtmVariables = new CTabItem(tabFolder, SWT.NONE);
tbtmVariables.setFont(GuiResource.getInstance().getFontDefault());
tbtmVariables.setText(BaseMessages.getString(PKG, prefix + ".Variables.Label"));
tbtmVariables.setImage(GuiResource.getInstance().getImageVariable());

Composite variablesComposite = new Composite(tabFolder, SWT.NONE);
PropsUi.setLook(variablesComposite);
Expand Down Expand Up @@ -334,7 +330,7 @@ protected void parametersSectionLayout(Class<?> PKG, String prefix) {
nrVariables,
false,
null,
props,
PropsUi.getInstance(),
false, null, true, false);

FormData fdVariables = new FormData();
Expand Down
6 changes: 5 additions & 1 deletion ui/src/main/java/org/apache/hop/ui/core/gui/GuiResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,13 @@ private Image getZoomedImaged(
* @return the imageVariable
*/
public Image getImageVariable() {
return getZoomedImaged(imageVariable, display, 10, 10);
return getZoomedImaged(imageVariable, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
}

public Image getImageVariableMini() {
return getZoomedImaged(imageVariable, display, 10, 10);
}

public Image getImagePipeline() {
return getZoomedImaged(
imagePipeline, display, ConstUi.SMALL_ICON_SIZE, ConstUi.SMALL_ICON_SIZE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public ComboVar(
// Add the variable $ image on the top right of the control
//
Label wlImage = new Label(this, SWT.NONE);
wlImage.setImage(GuiResource.getInstance().getImageVariable());
wlImage.setImage(GuiResource.getInstance().getImageVariableMini());
wlImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
FormData fdlImage = new FormData();
fdlImage.top = new FormAttachment(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public StyledTextComp(
// Special layout for variables decorator
if (varsSensitive) {
textWidget.addKeyListener(new ControlSpaceKeyAdapter(variables, textWidget));
image = GuiResource.getInstance().getImageVariable();
image = GuiResource.getInstance().getImageVariableMini();
if (variableIconOnTop) {
final Label wIcon = new Label(this, SWT.RIGHT);
PropsUi.setLook(wIcon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected void initialize(
//
Label wImage = new Label(this, SWT.NONE);
PropsUi.setLook(wImage);
wImage.setImage(GuiResource.getInstance().getImageVariable());
wImage.setImage(GuiResource.getInstance().getImageVariableMini());
wImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
FormData fdlImage = new FormData();
fdlImage.top = new FormAttachment(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected void initialize(
// Add the variable $ image on the top right of the control
//
Label wlImage = new Label(this, SWT.NONE);
wlImage.setImage(GuiResource.getInstance().getImageVariable());
wlImage.setImage(GuiResource.getInstance().getImageVariableMini());
wlImage.setToolTipText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
FormData fdlImage = new FormData();
fdlImage.top = new FormAttachment(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ protected void optionsSectionControls() {
wStartAction.setToolTipText(
BaseMessages.getString(PKG, "WorkflowExecutionConfigurationDialog.StartCopy.Tooltip"));
PropsUi.setLook(wStartAction);
FormData fdStartJobCombo = new FormData();
fdStartJobCombo.top = new FormAttachment(wlStartAction, 0, SWT.CENTER);
fdStartJobCombo.left = new FormAttachment(wlStartAction, props.getMargin());
fdStartJobCombo.right = new FormAttachment(100, 0);
wStartAction.setLayoutData(fdStartJobCombo);
FormData fdStartActionAction = new FormData();
fdStartActionAction.top = new FormAttachment(wlStartAction, 0, SWT.CENTER);
fdStartActionAction.left = new FormAttachment(wlStartAction, PropsUi.getMargin());
fdStartActionAction.right = new FormAttachment(100, 0);
wStartAction.setLayoutData(fdStartActionAction);

WorkflowMeta workflowMeta = (WorkflowMeta) super.abstractMeta;

Expand Down