From 56b0f337f5814c672ba564847b13f0bb5476611e Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 20 Jul 2016 11:02:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?sonar=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sonar-project.properties | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000000..05253b02f3 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,15 @@ +# must be unique in a given SonarQube instance +sonar.projectKey=finereport.design +# this is the name displayed in the SonarQube UI +sonar.projectName=finereport.design +sonar.projectVersion=1.0 +sonar.branch=dev + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +# Since SonarQube 4.2, this property is optional if sonar.modules is set. +# If not set, SonarQube starts looking for source code from the directory containing +# the sonar-project.properties file. +sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8 \ No newline at end of file From 0555774776602906ca7a2034ade35173abd8c50f Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 20 Jul 2016 14:09:47 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9C=89=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E5=90=8E,=20web=E5=B1=9E=E6=80=A7=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=A0=8F=E8=AE=BE=E7=BD=AE=E4=BF=9D=E5=AD=98=E4=B8=8D?= =?UTF-8?q?=E4=B8=8A.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/webattr/EditToolBar.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/designer/src/com/fr/design/webattr/EditToolBar.java b/designer/src/com/fr/design/webattr/EditToolBar.java index c147b1b0f0..da5ebe2b05 100644 --- a/designer/src/com/fr/design/webattr/EditToolBar.java +++ b/designer/src/com/fr/design/webattr/EditToolBar.java @@ -63,16 +63,8 @@ public class EditToolBar extends BasicPane { private ListSelectionListener listSelectionListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { - if (lastButton != null && lastButton.getWidget() instanceof Button) { - if (!((list.getSelectedValue() instanceof ToolBarButton) - && ((ToolBarButton)(list.getSelectedValue())).getWidget() instanceof CustomToolBarButton)) { - lastButton.setWidget(bp.update()); - } else { - ((Button) lastButton.getWidget()).setShowIcon(bp.icon.isSelected()); - ((Button) lastButton.getWidget()).setShowText(bp.text.isSelected()); - ((Button) lastButton.getWidget()).setText(bp.nameField.getText()); - ((Button) lastButton.getWidget()).setIconName(bp.iconPane.update()); - } + if (lastButton != null) { + lastButton.setWidget(bp.update()); } if (list.getSelectedValue() instanceof ToolBarButton) { lastButton = (ToolBarButton) list.getSelectedValue(); From 3f4465ff1d18f79681f786b3f872376513f3b731 Mon Sep 17 00:00:00 2001 From: zhouping Date: Wed, 20 Jul 2016 15:42:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E6=94=B9=201.?= =?UTF-8?q?=E4=BB=8Etoolbarbtn=E4=B8=8A=E6=8B=96=E4=B8=8Btab=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E5=90=8E=E5=BD=93=E5=89=8D=E7=9A=84=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E5=B9=B6=E9=9D=9E=E9=A1=B6=E5=B1=82=E5=B8=83?= =?UTF-8?q?=E5=B1=80=202.tab=E5=B8=83=E5=B1=80=E9=A1=B6=E5=B1=82=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E7=9A=84=E5=90=8D=E5=AD=97=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?tablayout=203.=E6=94=AF=E6=8C=81tab=E5=B8=83=E5=B1=80=E7=9A=84?= =?UTF-8?q?=E5=B5=8C=E5=A5=97=E5=90=8E=E6=AD=A3=E7=A1=AE=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../creator/cardlayout/XWCardLayout.java | 3 +- .../cardlayout/XWCardMainBorderLayout.java | 9 +++- .../mainframe/EditingMouseListener.java | 50 +++++++++++++++---- .../mainframe/FormCreatorDropTarget.java | 7 ++- 4 files changed, 56 insertions(+), 13 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 621f4c5f5e..346a5ce3a7 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -219,8 +219,7 @@ public class XWCardLayout extends XLayoutContainer { * */ protected void setWrapperName(XLayoutContainer parentPanel, String widgetName) { - //先随便set一个, 以后还是要隐藏的 - parentPanel.toData().setWidgetName("border_card_" + widgetName); + parentPanel.toData().setWidgetName("tablayout" + widgetName.replaceAll(createDefaultName(),"")); } /** diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index b9039b1d6e..42a45c53c3 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.icon.IconPathConstants; @@ -263,6 +264,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ */ @Override public XLayoutContainer getTopLayout() { - return this; + XLayoutContainer xTopLayout = XCreatorUtils.getParentXLayoutContainer(this).getTopLayout(); + if (xTopLayout != null && !xTopLayout.isEditable()){ + return xTopLayout; + } + else{ + return this; + } } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index e66b37552a..a4ccae7c2f 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -1,9 +1,6 @@ package com.fr.design.mainframe; -import java.awt.Color; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Rectangle; +import java.awt.*; import java.awt.event.MouseEvent; import javax.swing.*; @@ -326,10 +323,12 @@ public class EditingMouseListener extends MouseInputAdapter { if (designer.getCursor().getType() == Cursor.HAND_CURSOR) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } - if (e.getX() > (parent.getX() + parent.getWidth() / 2 - EDIT_BTN_WIDTH / 2 - GAP) - && e.getX() < (parent.getX() + parent.getWidth() / 2 + EDIT_BTN_WIDTH / 2 + GAP)) { - if (e.getY() > (parent.getY() + parent.getHeight() / 2 - EDIT_BTN_HEIGHT / 2 - GAP) - && e.getY() < (parent.getY() + parent.getHeight() / 2 + EDIT_BTN_HEIGHT / 2 + GAP + designer.getParaHeight())) { + int minX = getParentPositionX(parent, parent.getX()) + parent.getWidth() / 2; + int minY = getParentPositionY(parent, parent.getY()) + parent.getHeight() / 2; + int offsetX = EDIT_BTN_WIDTH / 2 + GAP; + int offsetY = EDIT_BTN_HEIGHT / 2 + GAP; + if (e.getX() > (minX - offsetX) && e.getX() < (minX + offsetX)) { + if (e.getY() > (minY - offsetY) && e.getY() < (minY + offsetY + designer.getParaHeight())) { designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } } @@ -417,11 +416,43 @@ public class EditingMouseListener extends MouseInputAdapter { designer.repaint(); } + //当前编辑的组件是在布局中,鼠标点击布局外部,需要一次性将布局及其父布局都置为不可编辑 + private void setTopLayoutUnEditable(XLayoutContainer clickedTopLayout, XLayoutContainer clickingTopLayout){ + //双击的前后点击click为相同对象,过滤掉 + if (clickedTopLayout == null || clickedTopLayout == clickingTopLayout){ + return; + } + //位于同一层级的控件,父布局相同,过滤掉 + if (clickingTopLayout != null && clickedTopLayout.getParent() == clickingTopLayout.getParent()){ + return; + } + //前后点击的位于不同层级,要置为不可编辑 + XLayoutContainer xLayoutContainer = (XLayoutContainer)clickedTopLayout.getParent(); + if (xLayoutContainer == clickingTopLayout){ + return; + } + if (xLayoutContainer != null){ + xLayoutContainer.setEditable(false); + setTopLayoutUnEditable((XLayoutContainer) clickedTopLayout.getParent(), clickingTopLayout); + } + } + + private boolean isCreatorInLayout(XCreator creator, XCreator layout){ + if (creator == layout){ + return true; + } + if(layout.getParent() != null){ + return isCreatorInLayout(creator, (XCreator)layout.getParent()); + } + return false; + } + private XCreator processTopLayoutMouseClick(XCreator creator){ XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout(); if(topLayout != null){ - if (clickTopLayout != null && clickTopLayout != topLayout){ + if (clickTopLayout != null && clickTopLayout != topLayout && !isCreatorInLayout(clickTopLayout, topLayout)){ clickTopLayout.setEditable(false); + setTopLayoutUnEditable(clickTopLayout, topLayout); } clickTopLayout = topLayout; if(!topLayout.isEditable()) { @@ -431,6 +462,7 @@ public class EditingMouseListener extends MouseInputAdapter { else{ if(clickTopLayout != null){ clickTopLayout.setEditable(false); + setTopLayoutUnEditable(clickTopLayout, null); } } diff --git a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java index a90ba7fb6e..ed4cf4190a 100644 --- a/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -9,6 +9,7 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; +import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.JWindow; @@ -85,8 +86,12 @@ public class FormCreatorDropTarget extends DropTarget { if (success) { // 如果添加成功,则触发相应事件 XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent(); + //SetSelection时要确保选中的是最顶层的布局 + //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout + XCreator addingXCreator = addingModel.getXCreator(); + Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); designer.getSelectionModel().setSelectedCreators( - FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{addingModel.getXCreator().toData()})); + FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); } else { Toolkit.getDefaultToolkit().beep(); From 66d133546cc02b000b5bafb1744ce8c918e294a2 Mon Sep 17 00:00:00 2001 From: richie Date: Wed, 20 Jul 2016 17:18:00 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.bat | 1 + 1 file changed, 1 insertion(+) create mode 100644 start.bat diff --git a/start.bat b/start.bat new file mode 100644 index 0000000000..7535291dfa --- /dev/null +++ b/start.bat @@ -0,0 +1 @@ +sonar-scanner \ No newline at end of file