This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new bb9d3ea HOP-1740 Use CLabel to align text vertically in toolbar (#338)
bb9d3ea is described below
commit bb9d3eaa66f832c66a1c9233e6b2bcccdbcd4cad
Author: Nicolas Adment <[email protected]>
AuthorDate: Sat Nov 7 10:50:50 2020 +0100
HOP-1740 Use CLabel to align text vertically in toolbar (#338)
Rename GuiToolbarElement.TOOLBAR_BUTTON -> BUTTON
---
.../core/gui/plugin/toolbar/GuiToolbarElement.java | 2 +-
.../gui/plugin/toolbar/GuiToolbarElementType.java | 2 +-
.../apache/hop/projects/gui/ProjectsGuiPlugin.java | 4 ++--
.../org/apache/hop/testing/gui/TestingGuiPlugin.java | 2 +-
.../apache/hop/ui/core/gui/GuiToolbarWidgets.java | 20 +++++++++++---------
5 files changed, 16 insertions(+), 14 deletions(-)
diff --git
a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java
b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java
index 9355e29..3a21619 100644
---
a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java
+++
b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElement.java
@@ -53,7 +53,7 @@ public @interface GuiToolbarElement {
*
* @return
*/
- GuiToolbarElementType type() default GuiToolbarElementType.TOOLBAR_BUTTON;
+ GuiToolbarElementType type() default GuiToolbarElementType.BUTTON;
/**
* The label of the GUI element: the menu item text and so on.
diff --git
a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementType.java
b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementType.java
index 05a2765..61faf50 100644
---
a/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementType.java
+++
b/core/src/main/java/org/apache/hop/core/gui/plugin/toolbar/GuiToolbarElementType.java
@@ -24,7 +24,7 @@ package org.apache.hop.core.gui.plugin.toolbar;
public enum GuiToolbarElementType {
NONE, // To disable default options
- TOOLBAR_BUTTON,
+ BUTTON,
LABEL,
COMBO,
CHECKBOX,
diff --git
a/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java
b/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java
index 8bee87e..2d399b0 100644
---
a/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java
+++
b/plugins/misc/projects/src/main/java/org/apache/hop/projects/gui/ProjectsGuiPlugin.java
@@ -90,7 +90,7 @@ public class ProjectsGuiPlugin {
root = HopGui.ID_MAIN_TOOLBAR,
id = ID_TOOLBAR_PROJECT_LABEL,
type = GuiToolbarElementType.LABEL,
- label = " Project : ",
+ label = "Project:",
toolTip = "Click here to edit the active project",
separator = true
)
@@ -330,7 +330,7 @@ public class ProjectsGuiPlugin {
root = HopGui.ID_MAIN_TOOLBAR,
id = ID_TOOLBAR_ENVIRONMENT_LABEL,
type = GuiToolbarElementType.LABEL,
- label = " Environment : ",
+ label = "Environment:",
toolTip = "Click here to edit the active environment",
separator = true
)
diff --git
a/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java
b/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java
index b945fae..e1b7687 100755
---
a/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java
+++
b/plugins/misc/testing/src/main/java/org/apache/hop/testing/gui/TestingGuiPlugin.java
@@ -828,7 +828,7 @@ public class TestingGuiPlugin {
root = HopGuiPipelineGraph.GUI_PLUGIN_TOOLBAR_PARENT_ID,
id = ID_TOOLBAR_UNIT_TESTS_LABEL,
type = GuiToolbarElementType.LABEL,
- label = " Unit test :",
+ label = "Unit test:",
toolTip = "Click here to edit the active unit test",
separator = true
)
diff --git a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
index 1096644..7ac467f 100644
--- a/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
+++ b/ui/src/main/java/org/apache/hop/ui/core/gui/GuiToolbarWidgets.java
@@ -22,6 +22,11 @@
package org.apache.hop.ui.core.gui;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.apache.commons.lang.StringUtils;
import org.apache.hop.core.Const;
import org.apache.hop.core.gui.plugin.GuiRegistry;
@@ -33,6 +38,7 @@ import org.apache.hop.ui.core.PropsUi;
import org.apache.hop.ui.hopgui.HopGui;
import org.apache.hop.ui.hopgui.file.IHopFileType;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Button;
@@ -44,11 +50,6 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
/**
* This class contains the widgets for the GUI elements of a GUI Plugin
*/
@@ -112,7 +113,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
// We want to add a separator if the annotation asked for it
// We also want to add a separator in case the toolbar element type isn't
a button
//
- if ( toolbarItem.isAddingSeparator() || toolbarItem.getType() !=
GuiToolbarElementType.TOOLBAR_BUTTON ) {
+ if ( toolbarItem.isAddingSeparator() || toolbarItem.getType() !=
GuiToolbarElementType.BUTTON ) {
new ToolItem( toolBar, SWT.SEPARATOR );
}
@@ -122,7 +123,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
toolbarItem.getType() != GuiToolbarElementType.CHECKBOX &&
StringUtils.isNotEmpty( toolbarItem.getLabel() ) ) {
ToolItem labelSeparator = new ToolItem( toolBar, SWT.SEPARATOR );
- Label label = new Label( parent, SWT.BORDER | SWT.SINGLE | (
toolbarItem.isAlignRight() ? SWT.RIGHT : SWT.LEFT ) );
+ CLabel label = new CLabel( parent, SWT.CENTER | (
toolbarItem.isAlignRight() ? SWT.RIGHT : SWT.LEFT ) );
label.setText( Const.NVL( toolbarItem.getLabel(), "" ) );
label.setToolTipText( Const.NVL( toolbarItem.getToolTip(), "" ) );
label.setBackground( toolBar.getBackground() );
@@ -136,7 +137,8 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
switch ( toolbarItem.getType() ) {
case LABEL:
ToolItem labelSeparator = new ToolItem( toolBar, SWT.SEPARATOR );
- Label label = new Label( parent, SWT.SINGLE | (
toolbarItem.isAlignRight() ? SWT.RIGHT : SWT.LEFT ) );
+
+ CLabel label = new CLabel( parent, SWT.CENTER | (
toolbarItem.isAlignRight() ? SWT.RIGHT : SWT.LEFT ) );
label.setText( Const.NVL( toolbarItem.getLabel(), "" ) );
label.setToolTipText( Const.NVL( toolbarItem.getToolTip(), "" ) );
label.setBackground( toolBar.getBackground() );
@@ -149,7 +151,7 @@ public class GuiToolbarWidgets extends BaseGuiWidgets {
label.addListener( SWT.MouseUp, listener );
break;
- case TOOLBAR_BUTTON:
+ case BUTTON:
ToolItem item = new ToolItem( toolBar, SWT.NONE );
if ( StringUtils.isNotEmpty( toolbarItem.getImage() ) ) {
item.setImage( GuiResource.getInstance().getImage(
toolbarItem.getImage(), toolbarItem.getClassLoader(), ConstUi.SMALL_ICON_SIZE,
ConstUi.SMALL_ICON_SIZE ) );