From 83f01ae956a08f58c8de8e58a4bd6fd2aa1dcd1f Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 20 Jul 2020 10:30:45 +0800 Subject: [PATCH 01/13] =?UTF-8?q?REPORT-35699=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9=E5=AF=B9=E6=8A=A5=E8=A1=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E4=BA=A7=E7=94=9F=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/gui/GUICoreUtils.java | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 586047f5ae..3723c775f5 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -387,31 +387,35 @@ public final class GUICoreUtils { * @param y y坐标 */ public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) { - if (popup == null) {// check null. - return; - } - - Point point = new Point(x, y); - SwingUtilities.convertPointToScreen(point, parentComponent); - - Dimension size = popup.getPreferredSize(); - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); - - int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth()); - - // peter:调整X的高度. - if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) { - x += (showOnScreenX - point.x - size.width); - } - - // peter:调整y高度. - if (point.y + size.height > screen.height && size.height < screen.height) { - y -= size.height; - } - - popup.show(parentComponent, x, y); - } + if (popup == null) {// check null. + return; + } + + Point point = new Point(x, y); + SwingUtilities.convertPointToScreen(point, parentComponent); + + Dimension size = popup.getPreferredSize(); + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); + //父元素右边界的坐标 + int parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth(); + //设计器右边界的坐标 + Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds(); + int designerRightBorderPosition = rectangle.x + rectangle.width; + rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds(); + designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width); + // peter:调整X的高度. + if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) { + x += (parentComponentRightBorderPosition - point.x - size.width); + } + + // peter:调整y高度. + if (point.y + size.height > screen.height && size.height < screen.height) { + y -= size.height; + } + + popup.show(parentComponent, x, y); + } /** * Set enabled.
From fe878c0ffa375a812629dd6970dfd4e5d2bb3c92 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 20 Jul 2020 10:38:27 +0800 Subject: [PATCH 02/13] =?UTF-8?q?REPORT-35699=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9=E5=AF=B9=E6=8A=A5=E8=A1=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E4=BA=A7=E7=94=9F=E5=BD=B1=E5=93=8D=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/utils/gui/GUICoreUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 3723c775f5..9f5c7fbaa9 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -27,6 +27,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorSelectBox; From 42e9b6320e14e824f34017a5175f1fc9c28f5b72 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 20 Jul 2020 10:30:45 +0800 Subject: [PATCH 03/13] =?UTF-8?q?REPORT-35699=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9=E5=AF=B9=E6=8A=A5=E8=A1=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E4=BA=A7=E7=94=9F=E5=BD=B1=E5=93=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/gui/GUICoreUtils.java | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 586047f5ae..3723c775f5 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -387,31 +387,35 @@ public final class GUICoreUtils { * @param y y坐标 */ public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) { - if (popup == null) {// check null. - return; - } - - Point point = new Point(x, y); - SwingUtilities.convertPointToScreen(point, parentComponent); - - Dimension size = popup.getPreferredSize(); - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); - - int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth()); - - // peter:调整X的高度. - if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) { - x += (showOnScreenX - point.x - size.width); - } - - // peter:调整y高度. - if (point.y + size.height > screen.height && size.height < screen.height) { - y -= size.height; - } - - popup.show(parentComponent, x, y); - } + if (popup == null) {// check null. + return; + } + + Point point = new Point(x, y); + SwingUtilities.convertPointToScreen(point, parentComponent); + + Dimension size = popup.getPreferredSize(); + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); + //父元素右边界的坐标 + int parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth(); + //设计器右边界的坐标 + Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds(); + int designerRightBorderPosition = rectangle.x + rectangle.width; + rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds(); + designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width); + // peter:调整X的高度. + if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) { + x += (parentComponentRightBorderPosition - point.x - size.width); + } + + // peter:调整y高度. + if (point.y + size.height > screen.height && size.height < screen.height) { + y -= size.height; + } + + popup.show(parentComponent, x, y); + } /** * Set enabled.
From 57c22fe43b56ae478d357c29417b79b51303b0f8 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Mon, 20 Jul 2020 10:38:27 +0800 Subject: [PATCH 04/13] =?UTF-8?q?REPORT-35699=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E4=BF=AE=E6=94=B9=E5=AF=B9=E6=8A=A5=E8=A1=A8=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E4=BA=A7=E7=94=9F=E5=BD=B1=E5=93=8D=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/utils/gui/GUICoreUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 3723c775f5..9f5c7fbaa9 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -27,6 +27,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorSelectBox; From 90c2aaeee80819e2652ff0a9d8a4cb802edf4ea9 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 20 Jul 2020 18:47:07 +0800 Subject: [PATCH 05/13] =?UTF-8?q?REPORT-35455=20=20=E8=B5=B6=E8=BF=99?= =?UTF-8?q?=E4=B8=80=E6=B3=A2=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/BasicTableDataTreePane.java | 11 +++- .../fr/design/data/BasicTableDataUtils.java | 17 ++++++ .../data/datapane/TableDataTreePane.java | 53 +++++++++++-------- .../design/data/BasicTableDataUtilsTest.java | 27 +++++++++- .../fr/design/designer/creator/XCreator.java | 16 +++--- .../mainframe/FormCreatorDropTarget.java | 2 +- 6 files changed, 92 insertions(+), 34 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index e8bc8e39ab..5ba801ca89 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -446,7 +446,16 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp * @param srcName 数据集来源(比如报表块,就是报表块的名称) * @param tableDataSource 数据集 */ + public Map addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) { + return new HashMap<>(0); + } + public Map addTableData(String srcName, TableDataSource tableDataSource) { - return new HashMap<>(0); + return addTableData(srcName, tableDataSource, false); + } + + public void removeTableData(String sourceName) { + } + } diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java index 27724450bb..57c7e23a13 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataUtils.java @@ -1,5 +1,6 @@ package com.fr.design.data; +import com.fr.data.TableDataSource; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.i18n.Toolkit; import com.fr.stable.StringUtils; @@ -10,6 +11,7 @@ import com.fr.stable.StringUtils; * Created by hades on 2020/4/27 */ public abstract class BasicTableDataUtils { + private static final String SEPARATOR = "-"; private static final int LEN = 2; @@ -33,4 +35,19 @@ public abstract class BasicTableDataUtils { } return false; } + + public static String getTableDataName(boolean isCover, TableDataSource tds, String tdName, String srcName, boolean isDsNameRepeaded) { + if (isCover) { + return srcName + SEPARATOR + tdName; + } + if (tds.getTableData(tdName) != null || isDsNameRepeaded) {//如果有同名的就拼上来源名称 + tdName = srcName + SEPARATOR + tdName; + } + int i = 0; + while (tds.getTableData(tdName) != null) { + i++;//如果拼上名字后依然已经存在就加编号 + tdName += i; + } + return tdName; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 531e128484..a2cc5b7d28 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -9,6 +9,7 @@ import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.BasicTableDataTreePane; +import com.fr.design.data.BasicTableDataUtils; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; @@ -59,7 +60,7 @@ import java.util.Map; public class TableDataTreePane extends BasicTableDataTreePane { private static TableDataTreePane singleton = new TableDataTreePane(); - + public static final int PLUGIN_LISTENER_PRIORITY = 1; public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter tc) { @@ -96,10 +97,10 @@ public class TableDataTreePane extends BasicTableDataTreePane { addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); createAddMenuDef(); - + // 创建插件监听 createPluginListener(); - + editAction = new EditAction(); removeAction = new RemoveAction(); previewTableDataAction = new PreviewTableDataAction(dataTree); @@ -139,27 +140,27 @@ public class TableDataTreePane extends BasicTableDataTreePane { new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); checkButtonEnabled(); } - + private void createPluginListener() { - + //菜单栏监听 GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { - + @Override public void on(PluginEvent event) { - + addMenuDef.clearShortCuts(); createAddMenuDef(); } }, new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(PluginModule.ExtraDesign); } }); - + //监听数据集插件 GeneralContext.listenPluginRunningChanged(new PluginEventListener() { @Override @@ -188,8 +189,8 @@ public class TableDataTreePane extends BasicTableDataTreePane { } }); } - - + + protected void checkButtonEnabled() { super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); } @@ -339,10 +340,11 @@ public class TableDataTreePane extends BasicTableDataTreePane { /** * 合并数据集 - * @param srcName 数据集来源(比如报表块,就是报表块的名称) + * + * @param srcName 数据集来源(比如报表块,就是报表块的名称) * @param tableDataSource 数据集 */ - public Map addTableData(String srcName, TableDataSource tableDataSource) { + public Map addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) { Map tdNameMap = new HashMap<>(); allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); @@ -352,14 +354,8 @@ public class TableDataTreePane extends BasicTableDataTreePane { String tdName = (String) tdIterator.next(); String oldName = tdName; TableData td = tableDataSource.getTableData(tdName); - if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称 - tdName = srcName + tdName; - } - int i = 0; - while (tds.getTableData(tdName) != null) { - i++;//如果拼上名字后依然已经存在就加编号 - tdName += i; - } + boolean isDsNameRepeaded = isDsNameRepeaded(tdName); + tdName = BasicTableDataUtils.getTableDataName(isCover, tds, tdName, srcName, isDsNameRepeaded); tds.putTableData(tdName, td); if (!ComparatorUtils.equals(oldName, tdName)) { tdNameMap.put(oldName, tdName); @@ -367,8 +363,19 @@ public class TableDataTreePane extends BasicTableDataTreePane { } tc.parameterChanged(); dataTree.refresh(); - return Collections.unmodifiableMap(tdNameMap); + return Collections.unmodifiableMap(tdNameMap); } + + @Override + public void removeTableData(String sourceName) { + TableDataSource tds = tc.getBook(); + tds.removeTableData(sourceName); + dataTree.refresh(); + } + + + + public void addDataPane(final AbstractTableDataPane uPanel, String paneName) { final NamePane nPanel = uPanel.asNamePane(); nPanel.setObjectName(paneName); diff --git a/designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java b/designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java index acd47a3c11..7391924ac2 100644 --- a/designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java +++ b/designer-base/src/test/java/com/fr/design/data/BasicTableDataUtilsTest.java @@ -1,6 +1,9 @@ package com.fr.design.data; +import com.fr.base.TableData; +import com.fr.data.TableDataSource; import junit.framework.TestCase; +import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Test; @@ -41,4 +44,26 @@ public class BasicTableDataUtilsTest extends TestCase { Assert.assertFalse(result12); } -} \ No newline at end of file + + @Test + public void testGetTableDataName() { + TableDataSource source = EasyMock.mock(TableDataSource.class); + TableData tableData = EasyMock.mock(TableData.class); + EasyMock.expect(source.getTableData("ds1")).andReturn(tableData).anyTimes(); + EasyMock.expect(source.getTableData("test-ds1")).andReturn(tableData).anyTimes(); + EasyMock.expect(source.getTableData("test-ds11")).andReturn(null).anyTimes(); + EasyMock.replay(source, tableData); + Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(true, source, "ds1", "test", false)); + Assert.assertEquals("test-ds11", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", false)); + + source = EasyMock.mock(TableDataSource.class); + EasyMock.expect(source.getTableData("ds1")).andReturn(null).anyTimes(); + EasyMock.expect(source.getTableData("test-ds1")).andReturn(null).anyTimes(); + EasyMock.replay(source); + Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(true, source, "ds1", "test", false)); + Assert.assertEquals("ds1", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", false)); + Assert.assertEquals("test-ds1", BasicTableDataUtils.getTableDataName(false, source, "ds1", "test", true)); + + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index f4554069e3..dcb6938836 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -298,7 +298,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo @Override public JComponent createToolPane(BaseJForm jform, FormDesigner formEditor) { if (!DesignerMode.isAuthorityEditing()) { - if (isDedicateContainer()) { + if (isDedicateContainer() && this.getComponentCount() > 0) { // 图表块和报表块由于控件树处不显示,但对应的属性表要显示,此处处理下 XCreator child = ((XLayoutContainer) this).getXCreator(0); return child.createToolPane(jform, formEditor); @@ -408,7 +408,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public Component getParentShow(){ return this.getParent(); } - + /** * 重置组件的名称 * @@ -418,18 +418,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void resetCreatorName(String name) { toData().setWidgetName(name); } - + /** * 遍历所有命名相关的组件到集合中 * * @param xCreators 集合 */ public void traversalNameRelatedXCreators(Set xCreators) { - + xCreators.add(this); int componentCount = getComponentCount(); for (int i = 0; i < componentCount; i++) { - + Component component = getComponent(i); if (component instanceof XCreator) { XCreator xCreator = (XCreator) component; @@ -439,7 +439,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } } - + /** * 重置组件的可见性 * @@ -448,7 +448,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void resetVisible(boolean visible) { toData().setVisible(visible); } - + /** * 返回编辑的子组件,scale为其内部组件 * @return 组件 @@ -804,4 +804,4 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo return false; } -} \ No newline at end of file +} diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 06cb19d0ae..e13748719b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -105,7 +105,7 @@ public class FormCreatorDropTarget extends DropTarget { SharableEditorProvider sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); SharableWidgetProvider bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); if (sharableEditor != null && bindInfo != null) { - Map tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource()); + Map tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource(), true); //合并数据集之后,可能会有数据集名称变化,做一下联动 //共享的组件拿的时候都是克隆的,这边改拖拽中克隆的对象而非新克隆对象,上面这个新克隆的对象只是为了拿数据集 for (Map.Entry entry : tdNameMap.entrySet()) { From 0debb703223cacd46f5894e3583d8c39de77b087 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 20 Jul 2020 18:50:16 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E6=97=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/beans/models/SelectionModel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java index 1209310f66..a930deb231 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java @@ -306,12 +306,12 @@ public class SelectionModel { // 清除被选中的组件 selection.reset(); } + designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED); + setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent()); - setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent()); // 触发事件 - designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED); designer.repaint(); } } From fbd5c6668283ae022168059c8d46a261aa08d501 Mon Sep 17 00:00:00 2001 From: pengda Date: Mon, 20 Jul 2020 19:20:34 +0800 Subject: [PATCH 07/13] =?UTF-8?q?REPORT-34907=20linux=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8-=E7=BA=B8=E5=BC=A0=E8=83=8C=E6=99=AF-=E6=B8=90?= =?UTF-8?q?=E5=8F=98=E8=89=B2=EF=BC=8C=E5=8F=B3=E8=BE=B9=E7=9A=84=E6=B8=B8?= =?UTF-8?q?=E6=A0=87=E4=B8=8D=E8=83=BD=E6=8B=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/style/background/gradient/GradientBar.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java index efeffa4e49..46d1b9165b 100644 --- a/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer-base/src/main/java/com/fr/design/style/background/gradient/GradientBar.java @@ -11,6 +11,7 @@ import com.fr.design.style.color.ColorSelectDialog; import com.fr.design.style.color.ColorSelectable; import com.fr.stable.AssistUtils; +import com.fr.stable.os.OperatingSystem; import javax.swing.JComponent; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab protected void addMouseDragListener() { this.addMouseMotionListener(new MouseAdapter() { public void mouseDragged(MouseEvent e) { - + int oldIndex = index; for (int i = 0; i < list.size(); i++) { if (list.get(i).contains(e.getX(), e.getY())) { index = i; break; } } - + if(OperatingSystem.isLinux() && AssistUtils.equals(oldIndex,index)){ + if(Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())){ + index = 1; + }else{ + index = 0; + } + } boolean x = e.getX() <= max && e.getX() >= min; if (x && e.getY() < MAX_VERTICAL) { list.get(index).setX(e.getX()); From deee0ab65fe104e3cce7be960279441c44641377 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 21 Jul 2020 10:50:04 +0800 Subject: [PATCH 08/13] REPORT-34996 && REPORT-34636 --- .../java/com/fr/design/actions/UpdateAction.java | 8 +++++++- .../com/fr/design/os/impl/UpdateDialogAction.java | 12 +++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index b0803635c9..4fd7e6c42b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -17,6 +17,7 @@ import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.design.menu.ShortCut; import com.fr.design.selection.SelectionListener; import com.fr.general.ComparatorUtils; +import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; import com.fr.stable.pinyin.PinyinFormat; import com.fr.stable.pinyin.PinyinHelper; @@ -562,7 +563,12 @@ public abstract class UpdateAction extends ShortCut implements Action { for (int i = 0; i < component.getTabCount(); i++) { String title = component.getTitleAt(i); handleSearchText(separator, text, pinyin, shortPinyin, title); - Component tabComponent = component.getComponentAt(i); + Component tabComponent = null; + try { + tabComponent = component.getComponentAt(i); + } catch (Exception ignore) { + FineLoggerFactory.getLogger().info("AlphaFine index tabPane end"); + } if (tabComponent instanceof JPanel) { getComponentTexts((JPanel) tabComponent, separator, text, pinyin, shortPinyin); } else if (tabComponent instanceof JTabbedPane) { diff --git a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java index 64f8f21120..f71493cd6b 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/UpdateDialogAction.java @@ -2,8 +2,6 @@ package com.fr.design.os.impl; import com.fr.design.mainframe.DesignerContext; import com.fr.design.update.ui.dialog.UpdateMainDialog; -import com.fr.design.utils.DesignUtils; -import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.OSBasedAction; /** @@ -12,14 +10,10 @@ import com.fr.stable.os.support.OSBasedAction; * @date 2019/10/9 */ public class UpdateDialogAction implements OSBasedAction { - private static String UPDATE_ROUTE = "#management/backup"; + @Override public void execute(Object... objects) { - if(!OperatingSystem.isLinux()) { - UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); - dialog.showDialog(); - }else{ - DesignUtils.visitEnvServerByParameters( UPDATE_ROUTE,null,null); - } + UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); + dialog.showDialog(); } } From 39fd9ae7e71b41facc712c8e06c4feb39efd4946 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 21 Jul 2020 11:57:38 +0800 Subject: [PATCH 09/13] =?UTF-8?q?REPORT-35692=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96-=E9=A1=B5=E9=9D=A2=E8=AE=BE=E7=BD=AE-=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=94=B9=E4=B8=BAINCH=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/report/UnitFieldPane.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java b/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java index 6da8957b26..c6a86de53d 100644 --- a/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java @@ -52,9 +52,9 @@ public class UnitFieldPane extends JPanel { this.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM")); } - //ajust the heigt of unitLabel. - Dimension unitDimension = new Dimension(this.getPreferredSize().width, - preferredHeight); + //自适应label宽度 + int width = this.getFontMetrics(this.getFont()).stringWidth(this.getText()); + Dimension unitDimension = new Dimension(width, preferredHeight); this.setMinimumSize(unitDimension); this.setMinimumSize(unitDimension); this.setSize(unitDimension); @@ -62,7 +62,8 @@ public class UnitFieldPane extends JPanel { } } - public UnitFieldPane(int unitType) { + public + UnitFieldPane(int unitType) { this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.unitType = unitType; From b30e6623d6de54430fd8a21c029299c330fad6d5 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 21 Jul 2020 11:59:56 +0800 Subject: [PATCH 10/13] =?UTF-8?q?REPORT-35692=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96-=E9=A1=B5=E9=9D=A2=E8=AE=BE=E7=BD=AE-=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=94=B9=E4=B8=BAINCH=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8=20=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/report/UnitFieldPane.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java b/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java index c6a86de53d..9ad44562f3 100644 --- a/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java @@ -62,8 +62,7 @@ public class UnitFieldPane extends JPanel { } } - public - UnitFieldPane(int unitType) { + public UnitFieldPane(int unitType) { this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.unitType = unitType; From 304a522cfb4f379d2a522a52e9c539a69c9bca19 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 21 Jul 2020 12:24:45 +0800 Subject: [PATCH 11/13] =?UTF-8?q?REPORT-35692=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96-=E9=A1=B5=E9=9D=A2=E8=AE=BE=E7=BD=AE-=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=94=B9=E4=B8=BAINCH=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8=20=E6=92=A4=E9=94=80=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/gui/GUICoreUtils.java | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 9f5c7fbaa9..586047f5ae 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -27,7 +27,6 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.DesignerContext; import com.fr.design.style.color.ColorCell; import com.fr.design.style.color.ColorFactory; import com.fr.design.style.color.ColorSelectBox; @@ -388,35 +387,31 @@ public final class GUICoreUtils { * @param y y坐标 */ public static void showPopupMenu(JPopupMenu popup, Component parentComponent, int x, int y) { - if (popup == null) {// check null. - return; - } - - Point point = new Point(x, y); - SwingUtilities.convertPointToScreen(point, parentComponent); - - Dimension size = popup.getPreferredSize(); - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); - //父元素右边界的坐标 - int parentComponentRightBorderPosition = parentComponent.getLocationOnScreen().x + parentComponent.getWidth(); - //设计器右边界的坐标 - Rectangle rectangle = DesignerContext.getDesignerFrame().getBounds(); - int designerRightBorderPosition = rectangle.x + rectangle.width; - rectangle = SwingUtilities.getWindowAncestor(parentComponent).getBounds(); - designerRightBorderPosition = Math.max(designerRightBorderPosition, rectangle.x + rectangle.width); - // peter:调整X的高度. - if (point.x + size.width > designerRightBorderPosition && size.width < designerRightBorderPosition) { - x += (parentComponentRightBorderPosition - point.x - size.width); - } - - // peter:调整y高度. - if (point.y + size.height > screen.height && size.height < screen.height) { - y -= size.height; - } - - popup.show(parentComponent, x, y); - } + if (popup == null) {// check null. + return; + } + + Point point = new Point(x, y); + SwingUtilities.convertPointToScreen(point, parentComponent); + + Dimension size = popup.getPreferredSize(); + Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + screen.setSize(screen.getSize().width, screen.height - HEIGHT_GAP); + + int showOnScreenX = Math.min(screen.width, parentComponent.getLocationOnScreen().x + parentComponent.getWidth()); + + // peter:调整X的高度. + if (point.x + size.width > showOnScreenX && size.width < showOnScreenX) { + x += (showOnScreenX - point.x - size.width); + } + + // peter:调整y高度. + if (point.y + size.height > screen.height && size.height < screen.height) { + y -= size.height; + } + + popup.show(parentComponent, x, y); + } /** * Set enabled.
From 23a94b9371a68a360c33d87d0a683c8f6dbfb4c5 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 21 Jul 2020 12:43:27 +0800 Subject: [PATCH 12/13] =?UTF-8?q?REPORT-34878=20&&=20REPORT-34936=20=20lin?= =?UTF-8?q?ux=E4=B8=8B=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7=E5=92=8C?= =?UTF-8?q?=E8=B6=85=E9=93=BE=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 4 ++ .../gui/controlpane/UIListControlPane.java | 4 ++ .../design/os/impl/PopupDialogSaveAction.java | 39 +++++++++++++++++++ .../java/com/fr/grid/GridMouseAdapter.java | 7 +++- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 747dbe32f0..04427b3378 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -9,12 +9,14 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ShortCut; +import com.fr.design.os.impl.PopupDialogSaveAction; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.invoke.Reflect; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSSupportCenter; import javax.swing.BorderFactory; import javax.swing.JComponent; @@ -273,6 +275,8 @@ abstract class UIControlPane extends JControlPane { } saveSettings(); setVisible(false); + PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); + saveAction.unregister(); } private void initListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java index 0dec124219..786eb2d305 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java @@ -7,9 +7,11 @@ import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.os.impl.PopupDialogSaveAction; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; +import com.fr.stable.os.support.OSSupportCenter; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -216,6 +218,8 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon ((PopupEditDialog)popupEditDialog).setTitle(getSelectedName()); } popupEditDialog.setVisible(true); + PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); + osBasedAction.execute(this, popupEditDialog); } } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java new file mode 100644 index 0000000000..019ee3d97e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java @@ -0,0 +1,39 @@ +package com.fr.design.os.impl; + +import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; + +import java.awt.*; + +/** + * linux下超链弹窗等保存问题 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/7/21 + */ +public class PopupDialogSaveAction implements OSBasedAction { + + private UIListControlPane currentControlPane; + private Window popupDialog; + + @Override + public void execute(Object... objects) { + boolean canSave = OperatingSystem.isLinux() && popupDialog != null && popupDialog.isVisible() && currentControlPane != null; + if (canSave) { + currentControlPane.saveSettings(); + } + } + + public void register(UIListControlPane currentControlPane, Window popupDialog) { + this.currentControlPane = currentControlPane; + this.popupDialog = popupDialog; + } + + public void unregister() { + this.currentControlPane = null; + this.popupDialog = null; + } + +} diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index ae230a5319..86ed09161b 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -10,7 +10,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JSliderPane; -import com.fr.design.present.CellWriteAttrPane; +import com.fr.design.os.impl.PopupDialogSaveAction; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; @@ -26,6 +26,7 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ArrayUtils; import com.fr.stable.ColumnRow; import com.fr.stable.StringUtils; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.unit.FU; import javax.swing.*; @@ -93,7 +94,9 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { grid.requestFocus(); } - + // linux下 点击单元格时 失焦之前立即触发保存 + PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); + saveAction.execute(); if (SwingUtilities.isRightMouseButton(evt)) { doWithRightButtonPressed(); } else { From 8eda3e745d6421b3101164517b30ba2309ebd914 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 21 Jul 2020 14:49:52 +0800 Subject: [PATCH 13/13] =?UTF-8?q?REPORT-35692=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96-=E9=A1=B5=E9=9D=A2=E8=AE=BE=E7=BD=AE-=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E6=94=B9=E4=B8=BAINCH=EF=BC=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=85=A8=20=E6=96=B9=E6=B3=95=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/report/UnitFieldPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java b/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java index 9ad44562f3..6af6852d47 100644 --- a/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/UnitFieldPane.java @@ -8,6 +8,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.stable.Constants; +import com.fr.stable.GraphDrawHelper; import com.fr.stable.OperatingSystem; import com.fr.stable.unit.CM; import com.fr.stable.unit.INCH; @@ -53,7 +54,7 @@ public class UnitFieldPane extends JPanel { } //自适应label宽度 - int width = this.getFontMetrics(this.getFont()).stringWidth(this.getText()); + int width = GraphDrawHelper.getWidth(this.getText(), this.getFont()); Dimension unitDimension = new Dimension(width, preferredHeight); this.setMinimumSize(unitDimension); this.setMinimumSize(unitDimension);