From 59f593ab81e904a97c27d4610bd5e7379bad6f3e Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 10 Oct 2016 11:35:58 +0800 Subject: [PATCH 01/22] =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E8=B6=8A?= =?UTF-8?q?=E6=9D=A5=E8=B6=8A=E5=8D=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/cell/GlobalStyleMenuDef.java | 48 +++++++++++++++++-- .../com/fr/grid/selection/CellSelection.java | 7 ++- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java index b33d269966..08cbf2d87d 100644 --- a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java +++ b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java @@ -8,19 +8,27 @@ import com.fr.base.BaseUtils; import com.fr.base.ConfigManager; import com.fr.base.NameStyle; import com.fr.design.actions.ElementCaseAction; +import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.imenu.UIMenu; import com.fr.design.mainframe.CellElementPropertyPane; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; +import com.fr.design.selection.SelectionEvent; +import com.fr.design.selection.SelectionListener; import com.fr.design.style.StylePane; import com.fr.general.Inter; import com.fr.base.ConfigManagerProvider; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; import com.fr.stable.StringUtils; import com.fr.stable.pinyin.PinyinHelper; import java.awt.event.ActionEvent; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; import java.util.Iterator; public class GlobalStyleMenuDef extends MenuDef { @@ -46,8 +54,9 @@ public class GlobalStyleMenuDef extends MenuDef { while (iterator.hasNext()) { String name = (String) iterator.next(); NameStyle nameStyle = NameStyle.getInstance(name); - - UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); + GlobalStyleSelection selection = new GlobalStyleSelection(ePane, nameStyle); + UpdateAction.UseMenuItem useMenuItem =selection.createUseMenuItem(); + selection.registerSelectionListener(ePane, useMenuItem); useMenuItem.setNameStyle(nameStyle); createdMenu.add(useMenuItem); } @@ -113,7 +122,9 @@ public class GlobalStyleMenuDef extends MenuDef { } - public static class GlobalStyleSelection extends ElementCaseAction { + + + public static class GlobalStyleSelection extends TemplateComponentAction { private NameStyle nameStyle; @@ -149,5 +160,36 @@ public class GlobalStyleMenuDef extends MenuDef { stylePane.updateGlobalStyle(getEditingComponent()); return true; } + + private SelectionListener createSelectionListener (){ + return new SelectionListener (){ + + @Override + public void selectionChanged(SelectionEvent e) { + update(); + if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { + Selection selection = getEditingComponent().getSelection(); + if (selection instanceof CellSelection) { + CellSelection cellselection = (CellSelection) selection; + //样式处理 + getEditingComponent().setCellNeedTOFormat(cellselection); + } + } + } + }; + } + + + public void registerSelectionListener(final ElementCasePane ePane, UseMenuItem useMenuItem) { + + SelectionListener listener = createSelectionListener(); + ePane.addSelectionChangeListener(listener); + useMenuItem.addHierarchyListener(new HierarchyListener(){ + @Override + public void hierarchyChanged(HierarchyEvent e) { + ePane.removeSelectionChangeListener(listener); + } + }); + } } } \ No newline at end of file diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index ef7fa3e1e4..e7b5b493c4 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -24,6 +24,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.report.RowColumnPane; import com.fr.design.selection.QuickEditor; +import com.fr.design.selection.SelectionListener; import com.fr.general.Inter; import com.fr.grid.GridUtils; import com.fr.report.cell.CellElement; @@ -36,6 +37,8 @@ import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -434,7 +437,9 @@ public class CellSelection extends Selection { String name = (String) iterato.next(); name = GlobalStyleMenuDef.judgeChina(name); NameStyle nameStyle = NameStyle.getInstance(name); - UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); + GlobalStyleSelection selection = new GlobalStyleSelection(ePane, nameStyle); + UpdateAction.UseMenuItem useMenuItem = selection.createUseMenuItem(); + selection.registerSelectionListener(ePane, useMenuItem); useMenuItem.setNameStyle(nameStyle); styleMenu.add(useMenuItem); } From 768c49fd4f4b2c3ea4c35bf55531cb8d690205bb Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Mon, 10 Oct 2016 14:56:57 +0800 Subject: [PATCH 02/22] =?UTF-8?q?bugfix=EF=BC=9AQQ=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E7=99=BB=E9=99=86=E4=B9=8B=E5=90=8E=EF=BC=8C=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=86=8D=E7=99=BB=E9=99=86=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 但是有个问题,之前的逻辑是记录用户名密码的,但是qq授权拿不到解密之前的用户名密码,不能做再登陆的操作,如果客户那时候修改密码,那实际上这边还是 可以登陆的,算是一个漏洞吧。 --- .../src/com/fr/design/mainframe/bbs/UserInfoPane.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java index b8a168baa0..df18f1f88d 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoPane.java @@ -77,12 +77,11 @@ public class UserInfoPane extends BasicPane{ @Override public void run() { String username = DesignerEnvManager.getEnvManager().getBBSName(); - String password = DesignerEnvManager.getEnvManager().getBBSPassword(); - String loginResult = LoginWebBridge.getHelper().login(username, password); - if (loginResult.equals(LOGININ)) { - markSignIn(username); - }else { + String inShowUsername = DesignerEnvManager.getEnvManager().getInShowBBsName(); + if (StringUtils.isEmpty(username) && StringUtils.isEmpty(inShowUsername)){ markUnSignIn(); + } else { + markSignIn(username); } } }); From a7ea035308f895222bf20a53fd70acee8b5e9d74 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 10 Oct 2016 16:08:41 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E5=86=85=E5=AD=98=E9=87=8A=E6=94=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/cell/GlobalStyleMenuDef.java | 60 +++++++++++++------ .../com/fr/grid/selection/CellSelection.java | 4 +- .../com/fr/design/actions/UpdateAction.java | 27 +++++++++ .../src/com/fr/design/menu/MenuDef.java | 11 +++- 4 files changed, 77 insertions(+), 25 deletions(-) diff --git a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java index 08cbf2d87d..98fde3f751 100644 --- a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java +++ b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java @@ -26,9 +26,8 @@ import com.fr.grid.selection.Selection; import com.fr.stable.StringUtils; import com.fr.stable.pinyin.PinyinHelper; -import java.awt.event.ActionEvent; -import java.awt.event.HierarchyEvent; -import java.awt.event.HierarchyListener; +import java.awt.*; +import java.awt.event.*; import java.util.Iterator; public class GlobalStyleMenuDef extends MenuDef { @@ -43,6 +42,36 @@ public class GlobalStyleMenuDef extends MenuDef { this.setIconPath("/com/fr/design/images/m_web/style.png"); } + protected ContainerListener getContainerListener() { + return containerListener; + } + + private ContainerListener containerListener = new ContainerListener() { + @Override + public void componentAdded(ContainerEvent e) { + + } + + @Override + public void componentRemoved(ContainerEvent e) { + Component c = e.getChild(); + c.dispatchEvent(new MenuDeleteEvent(c)); + } + }; + + private class MenuDeleteEvent extends UpdateAction.ComponentRemoveEvent { + + public MenuDeleteEvent(Component source) { + super(source); + } + + @Override + public void release(SelectionListener listener) { + ePane.removeSelectionChangeListener(listener); + } + } + + /** * 更新菜单项 */ @@ -54,9 +83,7 @@ public class GlobalStyleMenuDef extends MenuDef { while (iterator.hasNext()) { String name = (String) iterator.next(); NameStyle nameStyle = NameStyle.getInstance(name); - GlobalStyleSelection selection = new GlobalStyleSelection(ePane, nameStyle); - UpdateAction.UseMenuItem useMenuItem =selection.createUseMenuItem(); - selection.registerSelectionListener(ePane, useMenuItem); + UpdateAction.UseMenuItem useMenuItem =new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); useMenuItem.setNameStyle(nameStyle); createdMenu.add(useMenuItem); } @@ -161,6 +188,14 @@ public class GlobalStyleMenuDef extends MenuDef { return true; } + public UseMenuItem createUseMenuItem() { + UseMenuItem useMenuItem = super.createUseMenuItem(); + SelectionListener listener = createSelectionListener(); + getEditingComponent().addSelectionChangeListener(listener); + useMenuItem.setSelectionListener(listener); + return useMenuItem; + } + private SelectionListener createSelectionListener (){ return new SelectionListener (){ @@ -178,18 +213,5 @@ public class GlobalStyleMenuDef extends MenuDef { } }; } - - - public void registerSelectionListener(final ElementCasePane ePane, UseMenuItem useMenuItem) { - - SelectionListener listener = createSelectionListener(); - ePane.addSelectionChangeListener(listener); - useMenuItem.addHierarchyListener(new HierarchyListener(){ - @Override - public void hierarchyChanged(HierarchyEvent e) { - ePane.removeSelectionChangeListener(listener); - } - }); - } } } \ No newline at end of file diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index e7b5b493c4..daaac7e26f 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -437,9 +437,7 @@ public class CellSelection extends Selection { String name = (String) iterato.next(); name = GlobalStyleMenuDef.judgeChina(name); NameStyle nameStyle = NameStyle.getInstance(name); - GlobalStyleSelection selection = new GlobalStyleSelection(ePane, nameStyle); - UpdateAction.UseMenuItem useMenuItem = selection.createUseMenuItem(); - selection.registerSelectionListener(ePane, useMenuItem); + UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); useMenuItem.setNameStyle(nameStyle); styleMenu.add(useMenuItem); } diff --git a/designer_base/src/com/fr/design/actions/UpdateAction.java b/designer_base/src/com/fr/design/actions/UpdateAction.java index 72cd74c537..93a553f9ca 100644 --- a/designer_base/src/com/fr/design/actions/UpdateAction.java +++ b/designer_base/src/com/fr/design/actions/UpdateAction.java @@ -12,10 +12,13 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UICheckBoxMenuItem; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.menu.ShortCut; +import com.fr.design.selection.SelectionListener; import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; +import java.awt.event.ComponentEvent; +import java.awt.event.ContainerEvent; import java.beans.PropertyChangeListener; import java.util.HashMap; import java.util.Iterator; @@ -321,12 +324,24 @@ public abstract class UpdateAction extends ShortCut implements Action { toolBar.add(this.createToolBarComponent()); } + public abstract static class ComponentRemoveEvent extends ComponentEvent { + + private static int EVENT_DELETE= 3001; + + public ComponentRemoveEvent(Component source) { + super(source, EVENT_DELETE); + } + + public abstract void release(SelectionListener listener); + } + /** * 全局style的菜单 */ public static class UseMenuItem extends UIMenuItem { private NameStyle nameStyle; + private SelectionListener listener; public UseMenuItem(Action action) { super(action); @@ -337,6 +352,18 @@ public abstract class UpdateAction extends ShortCut implements Action { super(text, icon); } + protected void processEvent(AWTEvent e) { + if (e instanceof ComponentRemoveEvent) { + ((ComponentRemoveEvent) e).release(listener); + return; + } + super.processEvent(e); + } + + public void setSelectionListener(SelectionListener listener) { + this.listener = listener; + } + @Override public void paintComponent(Graphics g) { super.paintComponent(g); diff --git a/designer_base/src/com/fr/design/menu/MenuDef.java b/designer_base/src/com/fr/design/menu/MenuDef.java index aeee4dfb4d..bf85652fd2 100644 --- a/designer_base/src/com/fr/design/menu/MenuDef.java +++ b/designer_base/src/com/fr/design/menu/MenuDef.java @@ -13,9 +13,7 @@ import javax.swing.*; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; +import java.awt.event.*; import java.util.ArrayList; import java.util.List; @@ -164,11 +162,18 @@ public class MenuDef extends ShortCut { createdJMenu.setIcon(BaseUtils.readIcon(this.iconPath)); } createdJMenu.addMenuListener(menuDefListener); + ContainerListener listener = getContainerListener(); + if(listener != null){ + createdJMenu.getPopupMenu().addContainerListener(listener); + } } return createdJMenu; } + protected ContainerListener getContainerListener() { + return null; + } /** * 生成 JPopupMenu * @return 弹出菜单 From 9548f020d731195a1d244ad354a21a16623ec3d2 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 10 Oct 2016 16:17:07 +0800 Subject: [PATCH 04/22] import --- designer/src/com/fr/grid/selection/CellSelection.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index daaac7e26f..ef7fa3e1e4 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -24,7 +24,6 @@ import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.report.RowColumnPane; import com.fr.design.selection.QuickEditor; -import com.fr.design.selection.SelectionListener; import com.fr.general.Inter; import com.fr.grid.GridUtils; import com.fr.report.cell.CellElement; @@ -37,8 +36,6 @@ import com.fr.stable.StableUtils; import javax.swing.*; import java.awt.*; -import java.awt.event.HierarchyEvent; -import java.awt.event.HierarchyListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; From 9e3fe437e286aebd904a9ec4c8f4d9649bfe8f2e Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 10 Oct 2016 16:23:35 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/ElementCaseAction.java | 18 ++-------- .../actions/SelectionListenerAction.java | 36 +++++++++++++++++++ .../actions/cell/GlobalStyleMenuDef.java | 20 ++--------- 3 files changed, 40 insertions(+), 34 deletions(-) create mode 100644 designer/src/com/fr/design/actions/SelectionListenerAction.java diff --git a/designer/src/com/fr/design/actions/ElementCaseAction.java b/designer/src/com/fr/design/actions/ElementCaseAction.java index be9ff9f9a8..bfc0c8b4e5 100644 --- a/designer/src/com/fr/design/actions/ElementCaseAction.java +++ b/designer/src/com/fr/design/actions/ElementCaseAction.java @@ -10,24 +10,10 @@ import com.fr.grid.selection.Selection; import com.fr.design.selection.SelectionEvent; import com.fr.design.selection.SelectionListener; -public abstract class ElementCaseAction extends TemplateComponentAction { +public abstract class ElementCaseAction extends SelectionListenerAction { protected ElementCaseAction(ElementCasePane t) { super(t); - t.addSelectionChangeListener(new SelectionListener() { - - @Override - public void selectionChanged(SelectionEvent e) { - update(); - if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { - Selection selection = getEditingComponent().getSelection(); - if (selection instanceof CellSelection) { - CellSelection cellselection = (CellSelection) selection; - //样式处理 - getEditingComponent().setCellNeedTOFormat(cellselection); - } - } - } - }); + t.addSelectionChangeListener(createSelectionListener()); } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/SelectionListenerAction.java b/designer/src/com/fr/design/actions/SelectionListenerAction.java new file mode 100644 index 0000000000..48cd2d4f9a --- /dev/null +++ b/designer/src/com/fr/design/actions/SelectionListenerAction.java @@ -0,0 +1,36 @@ +package com.fr.design.actions; + +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.selection.SelectionEvent; +import com.fr.design.selection.SelectionListener; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; + +/** + * Created by daniel on 2016/10/10. + */ +public abstract class SelectionListenerAction extends TemplateComponentAction { + + protected SelectionListenerAction(ElementCasePane elementCasePane) { + super(elementCasePane); + } + + protected SelectionListener createSelectionListener () { + return new SelectionListener() { + + @Override + public void selectionChanged(SelectionEvent e) { + update(); + if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { + Selection selection = getEditingComponent().getSelection(); + if (selection instanceof CellSelection) { + CellSelection cellselection = (CellSelection) selection; + //样式处理 + getEditingComponent().setCellNeedTOFormat(cellselection); + } + } + } + }; + } +} diff --git a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java index 98fde3f751..27adef643a 100644 --- a/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java +++ b/designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java @@ -8,6 +8,7 @@ import com.fr.base.BaseUtils; import com.fr.base.ConfigManager; import com.fr.base.NameStyle; import com.fr.design.actions.ElementCaseAction; +import com.fr.design.actions.SelectionListenerAction; import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.UpdateAction; import com.fr.design.gui.imenu.UIMenu; @@ -151,7 +152,7 @@ public class GlobalStyleMenuDef extends MenuDef { - public static class GlobalStyleSelection extends TemplateComponentAction { + public static class GlobalStyleSelection extends SelectionListenerAction { private NameStyle nameStyle; @@ -196,22 +197,5 @@ public class GlobalStyleMenuDef extends MenuDef { return useMenuItem; } - private SelectionListener createSelectionListener (){ - return new SelectionListener (){ - - @Override - public void selectionChanged(SelectionEvent e) { - update(); - if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { - Selection selection = getEditingComponent().getSelection(); - if (selection instanceof CellSelection) { - CellSelection cellselection = (CellSelection) selection; - //样式处理 - getEditingComponent().setCellNeedTOFormat(cellselection); - } - } - } - }; - } } } \ No newline at end of file From cf87ab28afbe87c923c7f67ac8bf7ab9a5460be3 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Mon, 10 Oct 2016 17:32:21 +0800 Subject: [PATCH 06/22] =?UTF-8?q?bugfix:=E6=B2=A1=E6=9C=89qq=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E7=9A=84=E8=B4=A6=E5=8F=B7=E7=BB=91=E5=AE=9A=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/extra/QQLoginWebBridge.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index a2826cd0dd..140c89748e 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -117,7 +117,7 @@ public class QQLoginWebBridge { //账号没有QQ授权 closeQQWindow(); try { - Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("bbs.default"))); + Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("QQ_binding"))); }catch (Exception exp) { } } From d2e20d9f5c05f7a563da13063f702bc829c2ef7e Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 11 Oct 2016 10:50:04 +0800 Subject: [PATCH 07/22] =?UTF-8?q?REPORT-407=20=E8=8B=B1=E6=96=87=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=B8=83=E5=B1=80=E4=B8=8D=E5=90=88=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E5=AD=97=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/FormParaWidgetPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index 78af66a84d..8118d4da27 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -192,7 +192,7 @@ public class FormParaWidgetPane extends JPanel{ } labelPane.add(label,BorderLayout.CENTER); reportPane.add(labelPane,BorderLayout.SOUTH); - reportPane.setPreferredSize(new Dimension((int)jComponent.getPreferredSize().getWidth(),(int)reportPane.getPreferredSize().getHeight())); + reportPane.setPreferredSize(new Dimension((int)reportPane.getPreferredSize().getWidth(),(int)reportPane.getPreferredSize().getHeight())); return reportPane; } From 6fab8994629ac0b1491e7a034cc4018b26c2e0ee Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 11 Oct 2016 14:42:59 +0800 Subject: [PATCH 08/22] =?UTF-8?q?=E6=8D=A2=E4=B8=80=E4=B8=8B=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/export/AbstractExportAction.java | 3 ++- .../src/com/fr/design/actions/file/export/PDFExportAction.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java b/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java index a4a55ac304..0c6f0c8ed0 100644 --- a/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer/src/com/fr/design/actions/file/export/AbstractExportAction.java @@ -5,6 +5,7 @@ package com.fr.design.actions.file.export; import com.fr.base.FRContext; import com.fr.base.Parameter; +import com.fr.io.exporter.pdfstream.PDFStreamExporter; import com.fr.page.PageSetProvider; import com.fr.design.actions.JWorkBookAction; import com.fr.design.gui.iprogressbar.FRProgressBar; @@ -139,7 +140,7 @@ public abstract class AbstractExportAction extends JWorkBookAction { if (exporter instanceof AppExporter) { AppExporter appExporter = (AppExporter) exporter; if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter - || exporter instanceof PDFExporter || exporter instanceof WordExporter) { + || exporter instanceof PDFExporter || exporter instanceof PDFStreamExporter || exporter instanceof WordExporter) { ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果 appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) diff --git a/designer/src/com/fr/design/actions/file/export/PDFExportAction.java b/designer/src/com/fr/design/actions/file/export/PDFExportAction.java index 68fdd783f8..64cf5dabf5 100644 --- a/designer/src/com/fr/design/actions/file/export/PDFExportAction.java +++ b/designer/src/com/fr/design/actions/file/export/PDFExportAction.java @@ -10,6 +10,7 @@ import com.fr.file.filter.ChooseFileFilter; import com.fr.general.Inter; import com.fr.io.exporter.Exporter; import com.fr.io.exporter.PDFExporter; +import com.fr.io.exporter.pdfstream.PDFStreamExporter; /** * Export pdf @@ -28,7 +29,7 @@ public class PDFExportAction extends AbstractExportAction { @Override protected Exporter getExporter() { - return new PDFExporter(); + return new PDFStreamExporter(); } @Override From b793303df7778641b2cc95916efd15c5f3e9dc1c Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 11 Oct 2016 17:17:56 +0800 Subject: [PATCH 09/22] =?UTF-8?q?REPORT-465=20=E6=97=A5=E6=9C=9F=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E7=9A=84format=E5=92=8C=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E7=9B=B8=E4=BA=92=E7=8B=AC=E7=AB=8B,=20?= =?UTF-8?q?=E4=B8=8D=E8=A6=81=E8=81=94=E5=8A=A8=E8=AE=BE=E7=BD=AE,=20?= =?UTF-8?q?=E9=80=A0=E6=88=90=E5=9B=B0=E6=89=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/present/CellWriteAttrPane.java | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/designer/src/com/fr/design/present/CellWriteAttrPane.java b/designer/src/com/fr/design/present/CellWriteAttrPane.java index 5f4d6a8eac..4158dbd6c6 100644 --- a/designer/src/com/fr/design/present/CellWriteAttrPane.java +++ b/designer/src/com/fr/design/present/CellWriteAttrPane.java @@ -1,15 +1,13 @@ package com.fr.design.present; import com.fr.base.FRContext; -import com.fr.base.Style; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.widget.WidgetPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.form.ui.DateEditor; import com.fr.form.ui.NoneWidget; import com.fr.form.ui.Widget; import com.fr.general.FRLogger; @@ -22,8 +20,6 @@ import com.fr.report.cell.TemplateCellElement; import com.fr.report.elementcase.TemplateElementCase; import java.awt.*; -import java.text.Format; -import java.text.SimpleDateFormat; public class CellWriteAttrPane extends BasicPane { @@ -78,22 +74,6 @@ public class CellWriteAttrPane extends BasicPane { Widget cellWidget = cellElement.getWidget(); - if (cellWidget != null && cellWidget instanceof DateEditor) { - // p:日期的格式需要设置到单元格子里面. - DateEditor dateCellEditorDef = (DateEditor) cellWidget; - - // p:需要把下拉的编辑器,日期格式,都放到CellElement的Style里面 - // 这个地方很方便用户,是alex提出的. - // p:日期的格式需要设置到单元格子里面. - Style style = cellElement.getStyle(); - if (style != null) { - Format format = style.getFormat(); - if (format != null && format instanceof SimpleDateFormat) { - SimpleDateFormat simpleDateFormat = (SimpleDateFormat) format; - dateCellEditorDef.setFormatText(simpleDateFormat.toPattern()); - } - } - } // 这里进行克隆的原因是为了保留原始的Widget以便和新的Widget做比较来判断是否发生了改变 if (cellWidget != null) { try { @@ -111,19 +91,6 @@ public class CellWriteAttrPane extends BasicPane { } Widget cellWidget = this.cellEditorDefPane.update(); - // p:需要把下拉的编辑器,日期格式,都放到CellElement的Style里面 - if (cellWidget instanceof DateEditor) { - // p:日期的格式需要设置到单元格子里面. - DateEditor dateCellEditorDef = (DateEditor) cellWidget; - String formatText = dateCellEditorDef.getFormatText(); - if (formatText != null) { - Style style = cellElement.getStyle(); - if (style != null) { - cellElement.setStyle(style.deriveFormat(new SimpleDateFormat(formatText))); - } - } - } - // p:最后把这个cellEditorDef设置到CellGUIAttr. if (cellWidget instanceof NoneWidget) { cellElement.setWidget(null); From 57cf66276b3e69fbc6fe684ea065a60964f729b2 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 11 Oct 2016 20:44:15 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E9=83=A8=E5=88=86=EF=BC=8C=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E7=94=A8=E5=88=B0=E7=9A=84=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/ShareWidgetButton.java | 192 +++++++++++ .../fr/design/mainframe/ShareWidgetPane.java | 29 ++ .../mainframe/widget/UITreeComboBox.java | 312 ++++++++++++++++++ 3 files changed, 533 insertions(+) create mode 100644 designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java create mode 100644 designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java new file mode 100644 index 0000000000..3054bea328 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -0,0 +1,192 @@ +package com.fr.design.mainframe; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.form.share.ShareLoader; +import com.fr.form.ui.ElCaseBindInfo; +import com.fr.form.ui.Widget; +import com.fr.general.ComparatorUtils; +import com.fr.stable.StringUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.Serializable; + +/** + * Coder: zack + * Date: 2016/10/9 + * Time: 16:14 + */ +public class ShareWidgetButton extends JPanel implements MouseListener, MouseMotionListener, Serializable { + private ElCaseBindInfo bindInfo; + private MouseEvent lastPressEvent; + + public ShareWidgetButton(ElCaseBindInfo bindInfo) { + this.bindInfo = bindInfo; + initUI(); + this.setBorder(BorderFactory.createEmptyBorder(0,0,0,0)); + this.addMouseListener(this); + this.addMouseMotionListener(this); + new DragAndDropDragGestureListener(this, DnDConstants.ACTION_COPY_OR_MOVE); + } + + + private void initUI() { + this.setBackground(Color.WHITE); + this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + setPreferredSize(new Dimension(110, 70)); + setLayout(FRGUIPaneFactory.createBorderLayout()); + ImagePanel imagePanel = new ImagePanel((BufferedImage) bindInfo.getCover()); + + this.add(imagePanel, BorderLayout.NORTH); + JPanel panel = new JPanel(); + UILabel label = new UILabel(bindInfo.getName(), SwingConstants.HORIZONTAL); + panel.setBackground(new Color(184, 220, 242)); + panel.add(label); + this.add(panel, BorderLayout.SOUTH); + } + + private class ImagePanel extends JPanel { + + private BufferedImage image; + + public ImagePanel(BufferedImage image) { + this.image = image; + this.setPreferredSize(new Dimension(110, 50)); + } + + @Override + public void paintComponent(Graphics g) { + g.drawImage(image, 0, 0, 110, 70, null); + } + + } + + public ElCaseBindInfo getBindInfo() { + return bindInfo; + } + + public void setBindInfo(ElCaseBindInfo bindInfo) { + this.bindInfo = bindInfo; + } + + @Override + public void mouseClicked(MouseEvent e) { + + } + + @Override + public void mousePressed(MouseEvent e) { + lastPressEvent = e; + } + + @Override + public void mouseReleased(MouseEvent e) { + + } + + @Override + public void mouseEntered(MouseEvent e) { + + } + + @Override + public void mouseExited(MouseEvent e) { + + } + + @Override + public void mouseDragged(MouseEvent e) { + if (BaseUtils.isAuthorityEditing()) { + return; + } + if (lastPressEvent == null) { + return; + } + Object source = e.getSource(); + Widget creatorSource = null; + String shareId = StringUtils.EMPTY; + if (source instanceof ShareWidgetButton) { + ShareWidgetButton no = (ShareWidgetButton) e.getSource(); + if (no == null) { + return; + } + shareId = no.getBindInfo().getId(); + creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId); + } + if (creatorSource != null) { + XCreator xCreator = XCreatorUtils.createXCreator(creatorSource); + xCreator.setShareId(shareId); + WidgetToolBarPane.getTarget().startDraggingBean(xCreator); + lastPressEvent = null; + this.setBorder(null); + } + } + + @Override + public void mouseMoved(MouseEvent e) { + + } + + public class DragAndDropDragGestureListener extends DragSourceAdapter implements DragGestureListener { + private DragSource source; + + public DragAndDropDragGestureListener(ShareWidgetButton tt, int actions) { + source = new DragSource(); + source.createDefaultDragGestureRecognizer(tt, actions, this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + ShareWidgetButton shareWidgetButton = (ShareWidgetButton) dge.getComponent(); + if (shareWidgetButton != null) { + Widget widget = ShareLoader.getLoader().getElCaseEditorById(shareWidgetButton.getBindInfo().getId()); + DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget); + dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this); + } + } + + @Override + public void dragEnter(DragSourceDragEvent dragSourceDragEvent) { + + } + } + + public class DragAndDropTransferable implements Transferable { + private Widget widget; + + public DragAndDropTransferable(Widget widget) { + this.widget = widget; + } + + DataFlavor[] flavors = {new DataFlavor(Widget.class, "Widget")}; + + public DataFlavor[] getTransferDataFlavors() { + return flavors; + } + + public boolean isDataFlavorSupported(DataFlavor flavor) { + for (DataFlavor df : flavors) { + if (ComparatorUtils.equals(df, flavor)) { + return true; + } + } + return false; + } + + public Object getTransferData(DataFlavor df) throws UnsupportedFlavorException, IOException { + return widget; + } + } +} diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java new file mode 100644 index 0000000000..7abfb6900a --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -0,0 +1,29 @@ +package com.fr.design.mainframe; + + +import com.fr.form.ui.ElCaseBindInfo; + + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; + + +/** + * Created by xiaxiang on 2016/10/10. + */ +public class ShareWidgetPane extends JPanel { + public ShareWidgetPane(ArrayList elCaseBindInfos) { + this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离 + int rowCount = (elCaseBindInfos.size() + 1)/2; + this.setLayout(new GridLayout(rowCount, 2, 10, 10)); + for (ElCaseBindInfo rbModuleInfo : elCaseBindInfos) { + ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); + this.add(widgetButton); + } + if (elCaseBindInfos.size() == 1) { + this.add(new JPanel()); + } + + } +} diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java new file mode 100644 index 0000000000..4d92ccc264 --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -0,0 +1,312 @@ +package com.fr.design.mainframe.widget; + +/** + * Created by xiaxiang on 2016/9/30. + */ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.plaf.*; +import javax.swing.plaf.basic.*; +import javax.swing.plaf.metal.*; +import javax.swing.tree.*; + +import com.fr.design.designer.beans.*; +import com.fr.design.designer.beans.events.DesignerEditListener; +import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.mainframe.ComponentTree; +import com.sun.java.swing.plaf.motif.*; +import com.sun.java.swing.plaf.windows.*; + +/** + * 控件树下拉列表框 + */ +public class UITreeComboBox extends JComboBox{ + /** + * 显示用的树 + */ + private ComponentTree tree; + + public UITreeComboBox(ComponentTree componentTree){ + this.setTree(componentTree); + tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); + for(int i=0; iTitle: UITreeComboBoxRenderer

+ *

Description: 树形结构而来的DefaultListCellRenderer

+ */ + class UITreeComboBoxRenderer extends DefaultListCellRenderer { + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus){ + if(value != null){ + TreePath path = (TreePath)value; + Object node = path.getLastPathComponent(); + value = node; + TreeCellRenderer r = tree.getCellRenderer(); + JLabel lb = (JLabel)r.getTreeCellRendererComponent( + tree, value, isSelected, false, false, index, + cellHasFocus); + return lb; + } + return super.getListCellRendererComponent(list, value, index, + isSelected, cellHasFocus); + } + } + + + public TreePath[] getSelectedTreePath() { + XCreator[] creators = tree.getDesigner().getSelectionModel().getSelection().getSelectedCreators(); + TreePath[] paths = new TreePath[creators.length]; + + for (int i = 0; i < paths.length; i++) { + paths[i] = tree.buildTreePath(creators[i]); + } + return paths; + } + + private class TreeComboBoxDesignerEditAdapter implements DesignerEditListener { + + @Override + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { + TreePath[] paths = getSelectedTreePath(); + + if (paths.length == 1) { + tree.setAndScrollSelectionPath(paths[0]); + } else { + tree.setSelectionPaths(paths); + } + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); + } else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + TreePath[] paths = getSelectedTreePath(); + if (paths.length == 1) { + tree.setAndScrollSelectionPath(paths[0]); + } else { + tree.setSelectionPaths(paths); + } + setSelectedItem(paths[0]); + MenuSelectionManager.defaultManager().clearSelectedPath(); + + } else { + return; + } + + } + + @Override + public boolean equals(Object o) { + return o.getClass() == this.getClass(); + } + } + + /** + * 测试 + */ +// public static void main(String args[]){ +// JFrame frame = new JFrame("UITreeComboBox"); +// final UITreeComboBox box = new UITreeComboBox(new ComponentTree(new FormDesigner())); +// box.setPreferredSize(new Dimension(300, 28)); +// frame.getContentPane().add(box); +// frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); +// frame.pack(); +// frame.setVisible(true); +// } +} + +/** + *

Title: UITreeComboBox

+ *

Description: TreePopup

+ */ +class TreePopup extends JPopupMenu implements ComboPopup{ + protected UITreeComboBox comboBox; + protected JScrollPane scrollPane; + + protected MouseMotionListener mouseMotionListener; + protected MouseListener mouseListener; + private MouseListener treeSelectListener = new MouseAdapter(){ + public void mouseClicked (MouseEvent e){ + if (e.isMetaDown()) { + popupMenu(e); + } else { + return; + } + } + }; + + public void popupMenu(MouseEvent e) { + TreePath path = comboBox.getTree().getSelectionPath(); + if (path == null) { + return; + } + Component component = (Component) path.getLastPathComponent(); + if (!(component instanceof XCreator)) { + return; + } + com.fr.design.designer.beans.ComponentAdapter adapter = AdapterBus.getComponentAdapter(comboBox.getTree().getDesigner(), (XCreator) component); + JPopupMenu menu = adapter.getContextPopupMenu(e); + menu.show(comboBox, e.getX(), e.getY()); + } + + public TreePopup(JComboBox comboBox){ + this.comboBox = (UITreeComboBox)comboBox; + setBorder(BorderFactory.createLineBorder(Color.black)); + setLayout(new BorderLayout()); + setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled()); + JTree tree = this.comboBox.getTree(); + if(tree != null){ + scrollPane = new JScrollPane(tree); + scrollPane.setBorder(null); + add(scrollPane, BorderLayout.CENTER); + this.comboBox.addMouseListener(treeSelectListener); + } + } + + public void show(){ + updatePopup(); + show(comboBox, 0, comboBox.getHeight()); + comboBox.getTree().requestFocus(); + } + + public void hide(){ + setVisible(false); + comboBox.firePropertyChange("popupVisible", true, false); + } + + protected JList list = new JList(); + public JList getList(){ + return list; + } + + public MouseMotionListener getMouseMotionListener(){ + if(mouseMotionListener == null){ + mouseMotionListener = new MouseMotionAdapter(){}; + } + return mouseMotionListener; + } + + public KeyListener getKeyListener(){ + return null; + } + + public void uninstallingUI(){} + + /** + * Implementation of ComboPopup.getMouseListener(). + * + * @return a MouseListener or null + * @see ComboPopup#getMouseListener + */ + public MouseListener getMouseListener(){ + if(mouseListener == null){ + mouseListener = new InvocationMouseHandler(); + } + return mouseListener; + } + + protected void togglePopup(){ + if(isVisible()){ + hide(); + } else{ + show(); + } + } + protected void updatePopup(){ + setPreferredSize(new Dimension(comboBox.getSize().width, 200)); + Object selectedObj = comboBox.getSelectedItem(); + if(selectedObj != null){ + TreePath tp = (TreePath)selectedObj; + ((UITreeComboBox)comboBox).getTree().setSelectionPath(tp); + } + } + + protected class InvocationMouseHandler extends MouseAdapter{ + public void mousePressed(MouseEvent e){ + if(!SwingUtilities.isLeftMouseButton(e) || !comboBox.isEnabled()){ + return; + } + if(comboBox.isEditable()){ + Component comp = comboBox.getEditor().getEditorComponent(); + if((!(comp instanceof JComponent)) || + ((JComponent)comp).isRequestFocusEnabled()){ + comp.requestFocus(); + } + } else if(comboBox.isRequestFocusEnabled()){ + comboBox.requestFocus(); + } + togglePopup(); + } + } + + + +} From 5e0f82fee2d8d9ae985e2431a6b403bf650b5e91 Mon Sep 17 00:00:00 2001 From: sunmondong Date: Tue, 11 Oct 2016 22:30:43 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle => build.dev.gradle | 2 +- build.gradle.bak | 86 ------------------- .../{build.gradle => build.dev.gradle} | 2 +- designer_base/build.gradle.bak | 70 --------------- .../{build.gradle => build.dev.gradle} | 2 +- designer_chart/build.gradle.bak | 66 -------------- .../{build.gradle => build.dev.gradle} | 2 +- designer_form/build.gradle.bak | 83 ------------------ 8 files changed, 4 insertions(+), 309 deletions(-) rename build.gradle => build.dev.gradle (97%) delete mode 100644 build.gradle.bak rename designer_base/{build.gradle => build.dev.gradle} (96%) delete mode 100644 designer_base/build.gradle.bak rename designer_chart/{build.gradle => build.dev.gradle} (96%) delete mode 100644 designer_chart/build.gradle.bak rename designer_form/{build.gradle => build.dev.gradle} (97%) delete mode 100644 designer_form/build.gradle.bak diff --git a/build.gradle b/build.dev.gradle similarity index 97% rename from build.gradle rename to build.dev.gradle index abc9815956..507d77e9f5 100644 --- a/build.gradle +++ b/build.dev.gradle @@ -5,7 +5,7 @@ tasks.withType(JavaCompile){ def basicDir="../../" def libDir="${basicDir}/finereport-lib-stable" //获取什么分支名 -FileTree files =fileTree(dir:"./",include:"build.gradle") +FileTree files =fileTree(dir:"./",include:"build.*.gradle") def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) diff --git a/build.gradle.bak b/build.gradle.bak deleted file mode 100644 index 67a8a0e70f..0000000000 --- a/build.gradle.bak +++ /dev/null @@ -1,86 +0,0 @@ -apply plugin: "java" -tasks.withType(JavaCompile){ - options.encoding = "UTF-8" -} -sourceCompatibility=1.7 -def basicDir="../../" -def libDir="${basicDir}/finereport-lib-stable" -//获取什么分支名 -FileTree files =fileTree(dir:"./",include:"build.gradle") -def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ("\\")) -def branchName=buildDir.substring(buildDir.lastIndexOf ("\\")+1) - -task appletJar<<{ - - ant{ - mkdir(dir:"${libDir}/tmp-${branchName}") - mkdir(dir:"build/classes/") - copy(todir:"build/classes/"){ - fileset(dir:"${basicDir}/finereport-core-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-chart-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-report-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-platform-stable/${branchName}/build/classes/main") - - fileset(dir:"${basicDir}/finereport-performance-stable/${branchName}/build/classes/main") - - } - unjar(src:"${libDir}/3rd.jar",dest:"${libDir}/tmp-${branchName}") - unjar(src:"${libDir}/servlet-api.jar",dest:"${libDir}/tmp-${branchName}") - jar(jarfile:"build/libs/fr-applet-8.0.jar"){ - fileset(dir:"build/classes"){ - exclude(name:"*.*") - exclude(name:"bin/*.*") - exclude(name:"classes/**") - exclude(name:"com/fr/schedule/**") - exclude(name:"com/fr/cell/**") - exclude(name:"com/fr/dialog/**") - exclude(name:"com/fr/view/**") - exclude(name:"com/fr/web/**") - exclude(name:"com/fr/fs/**") - exclude(name:"com/fr/design/**") - exclude(name:"com/fr/start/**") - exclude(name:"com/fr/process/**") - } - fileset(dir:"${libDir}/tmp-${branchName}"){ - include(name:"javax/mail/**") - include(name:"javax/servlet/**") - include(name:"org/freehep/**") - include(name:"com/fr/third/JAI/**") - include(name:"com/fr/third/antlr/**") - include(name:"com/fr/third/javax/**") - include(name:"com/sun/xml/**") - include(name:"javax/xml/**") - - } - fileset(dir:"build/classes"){ - include(name:"com/fr/web/*.class") - include(name:"com/fr/web/attr/*.class") - } - } - delete(dir:"${libDir}/tmp-${branchName}") - def jdk6home= "D:/FineReport/develop/java/jdk1.6u35" - def keystore="frapplet.store" - def keycert="fr.cert" - def keypassword="123456" - def keyalias="fr" - - exec(executable:"${jdk6home}/bin/keytool"){ - arg(line:"-genkey -dname "CN=FineReport L=NanJing C=China" -keystore ${keystore} -alias ${keyalias} -validity 3650 -storepass ${keypassword}") - } - exec(executable:"${jdk6home}/bin/keytool"){ - arg(line:"-export -keystore ${keystore} -alias ${keyalias} -file ${keycert} -storepass ${keypassword}") - } - - exec(executable:"${jdk6home}/bin/jarsigner"){ - arg(line:"-keystore ${keystore} -storepass ${keypassword} 'build/libs/fr-applet-8.0.jar' ${keyalias}") - } - delete(file:"${keystore}") - delete(file:"${keycert}") - delete(dir:"build/classes") - - } - -} \ No newline at end of file diff --git a/designer_base/build.gradle b/designer_base/build.dev.gradle similarity index 96% rename from designer_base/build.gradle rename to designer_base/build.dev.gradle index f8cfe57ba4..7b3bea2ba9 100644 --- a/designer_base/build.gradle +++ b/designer_base/build.dev.gradle @@ -24,7 +24,7 @@ sourceSets{ } } //获取什么分支名 -FileTree files =fileTree(dir:'./',include:'build.gradle') +FileTree files =fileTree(dir:'./',include:'build.*.gradle') def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) diff --git a/designer_base/build.gradle.bak b/designer_base/build.gradle.bak deleted file mode 100644 index e7c5a8e1ff..0000000000 --- a/designer_base/build.gradle.bak +++ /dev/null @@ -1,70 +0,0 @@ - -apply plugin: 'java' -tasks.withType(JavaCompile){ - options.encoding = 'UTF-8' -} -//指定构建的jdk版本 -sourceCompatibility=1.8 -//指定生成jar包版本 -version='8.0' -//生成jar包重命名 -jar{ - baseName='fr-designer-core' -} - - -def srcDir="." - -//指定源码路径 -sourceSets{ - main{ - java{ - srcDirs=["${srcDir}/src"] - } - } -} -//获取什么分支名 -FileTree files =fileTree(dir:'./',include:'build.gradle') -def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) -buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) -def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) - -//声明外部依赖 -dependencies{ - -compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') -compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") - - testCompile 'junit:junit:4.12' -} -//复制非.java文件到classes文件夹下参与打包 -task copyFile(type:Copy,dependsOn:compileJava){ - copy{ - from ("${srcDir}/src"){ - exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' - } - into 'build/classes/main' - } - -} - - -//压缩项目中的js文件 -task compressJS{ - ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ - classpath { - fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') - } - } - ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ - fileset (dir:"${srcDir}/src"){ - include (name:'**/*.js') - include (name:'**/*.css') - } - - } -} -jar.dependsOn compressJS - - - diff --git a/designer_chart/build.gradle b/designer_chart/build.dev.gradle similarity index 96% rename from designer_chart/build.gradle rename to designer_chart/build.dev.gradle index cc22b7b34b..f980fa135a 100644 --- a/designer_chart/build.gradle +++ b/designer_chart/build.dev.gradle @@ -23,7 +23,7 @@ sourceSets{ } } } -FileTree files =fileTree(dir:'./',include:'build.gradle') +FileTree files =fileTree(dir:'./',include:'build.*.gradle') def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) diff --git a/designer_chart/build.gradle.bak b/designer_chart/build.gradle.bak deleted file mode 100644 index 92f0551624..0000000000 --- a/designer_chart/build.gradle.bak +++ /dev/null @@ -1,66 +0,0 @@ - -apply plugin: 'java' -tasks.withType(JavaCompile){ - options.encoding = 'UTF-8' -} -//指定构建的jdk版本 -sourceCompatibility=1.8 -//指定生成jar包的版本 -version='8.0' - -def srcDir="." - -//对生成的jar包进行重命名 - -jar{ - baseName='fr-designer-chart' -} - -sourceSets{ - main{ - java{ - srcDirs=["${srcDir}/src"] - } - } -} -FileTree files =fileTree(dir:'./',include:'build.gradle') -def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) -buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) -def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) - -//指定外部依赖 -dependencies{ -compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') -compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") - - testCompile 'junit:junit:4.12' -} -//将非.java 文件复制到classes文件夹下参与打包 -task copyFile(type:Copy,dependsOn:compileJava){ - copy{ - from ("${srcDir}/src"){ - exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' - - } - into 'build/classes/main' - } - -} - -//压缩项目中的js文件 -task compressJS{ - ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ - classpath { - fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') - } - } - ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ - fileset (dir:"${srcDir}/src"){ - include (name:'**/*.js') - include (name:'**/*.css') - } - - } -} -jar.dependsOn compressJS - diff --git a/designer_form/build.gradle b/designer_form/build.dev.gradle similarity index 97% rename from designer_form/build.gradle rename to designer_form/build.dev.gradle index b06cabd306..57ebd74c2c 100644 --- a/designer_form/build.gradle +++ b/designer_form/build.dev.gradle @@ -26,7 +26,7 @@ sourceSets{ } //获取什么分支名 -FileTree files =fileTree(dir:'./',include:'build.gradle') +FileTree files =fileTree(dir:'./',include:'build.*.gradle') def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) diff --git a/designer_form/build.gradle.bak b/designer_form/build.gradle.bak deleted file mode 100644 index 474d4aca95..0000000000 --- a/designer_form/build.gradle.bak +++ /dev/null @@ -1,83 +0,0 @@ - -apply plugin: 'java' -tasks.withType(JavaCompile){ - options.encoding = 'UTF-8' -} -//指定构建的jdk版本 -sourceCompatibility=1.8 -//指定生成的jar包版本 -version='8.0' - -def srcDir="." - - -//指明生成jar包的名字 -jar{ - baseName='fr-designer-report' -} -//源码所在位置 -sourceSets{ - main{ - java{ - srcDirs=["${srcDir}/src", -"${srcDir}/../designer/src"] - } - } -} - -//获取什么分支名 -FileTree files =fileTree(dir:'./',include:'build.gradle') -def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) -buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) -def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) -//声明外部依赖 -dependencies{ -compile fileTree(dir:"../../../finereport-lib-stable${branchName}",include:'**/*.jar') -compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") - - testCompile 'junit:junit:4.12' -} - -//指明无法编译文件所在路径 -def dataContent ={def dir -> - copySpec{ - from ("${dir}"){ - exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' - } - } -} - -//将非.java文件复制到classes文件夹下 参与打包 -task copyFile(type:Copy,dependsOn:compileJava){ - copy{ - with dataContent.call("${srcDir}/src") - with dataContent.call("${srcDir}/../designer/src") - into ('build/classes/main') - } - -} - - -//压缩项目中的js文件 -task compressJS{ - ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ - classpath { - - fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') - } - } - ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ - fileset (dir:"${srcDir}/src"){ - include (name:'**/*.js') - include (name:'**/*.css') - - } - fileset (dir:"${srcDir}/../designer/src"){ - include (name:'**/*.js') - include (name:'**/*.css') - } - - } -} -jar.dependsOn compressJS - From 2325ca73fd6a3a175d4ec0148ef944af38e4096b Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 12 Oct 2016 00:17:50 +0800 Subject: [PATCH 12/22] rt --- .../src/com/fr/design/mainframe/ShareWidgetPane.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java index 7abfb6900a..79f15b3646 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java @@ -13,15 +13,15 @@ import java.util.ArrayList; * Created by xiaxiang on 2016/10/10. */ public class ShareWidgetPane extends JPanel { - public ShareWidgetPane(ArrayList elCaseBindInfos) { + public ShareWidgetPane(ArrayList elCaseBindInfoList) { this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));// 设置面板的边框 ,距离上、左、下、右 的距离 - int rowCount = (elCaseBindInfos.size() + 1)/2; + int rowCount = (elCaseBindInfoList.size() + 1)/2; this.setLayout(new GridLayout(rowCount, 2, 10, 10)); - for (ElCaseBindInfo rbModuleInfo : elCaseBindInfos) { + for (ElCaseBindInfo rbModuleInfo : elCaseBindInfoList) { ShareWidgetButton widgetButton = new ShareWidgetButton(rbModuleInfo); this.add(widgetButton); } - if (elCaseBindInfos.size() == 1) { + if (elCaseBindInfoList.size() == 1) { this.add(new JPanel()); } From 760aff6304c5c5ccbcf44f0974eb2f45a9dd2ccd Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 12 Oct 2016 02:02:18 +0800 Subject: [PATCH 13/22] rt --- .../com/fr/design/mainframe/widget/UITreeComboBox.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 4d92ccc264..dd2c8fa897 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -31,11 +31,11 @@ public class UITreeComboBox extends JComboBox{ public UITreeComboBox(ComponentTree componentTree){ this.setTree(componentTree); tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); - for(int i=0; i Date: Wed, 12 Oct 2016 02:02:51 +0800 Subject: [PATCH 14/22] rt --- .../src/com/fr/design/mainframe/widget/UITreeComboBox.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index dd2c8fa897..8bb921df4b 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -31,10 +31,6 @@ public class UITreeComboBox extends JComboBox{ public UITreeComboBox(ComponentTree componentTree){ this.setTree(componentTree); tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); -// for(int i=0; i Date: Wed, 12 Oct 2016 09:20:56 +0800 Subject: [PATCH 15/22] rt --- .../mainframe/widget/UITreeComboBox.java | 35 ++++++++----------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 8bb921df4b..81afb7cc8d 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -31,6 +31,10 @@ public class UITreeComboBox extends JComboBox{ public UITreeComboBox(ComponentTree componentTree){ this.setTree(componentTree); tree.getDesigner().addDesignerEditListener(new TreeComboBoxDesignerEditAdapter()); +// for(int i=0; i Date: Wed, 12 Oct 2016 09:31:06 +0800 Subject: [PATCH 16/22] rt --- .../fr/design/mainframe/widget/UITreeComboBox.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java index 81afb7cc8d..7f55ddeafe 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java +++ b/designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java @@ -123,22 +123,12 @@ public class UITreeComboBox extends JComboBox{ } - public TreePath[] getSelectedTreePath() { - XCreator[] creators = tree.getDesigner().getSelectionModel().getSelection().getSelectedCreators(); - TreePath[] paths = new TreePath[creators.length]; - - for (int i = 0; i < paths.length; i++) { - paths[i] = tree.buildTreePath(creators[i]); - } - return paths; - } - private class TreeComboBoxDesignerEditAdapter implements DesignerEditListener { @Override public void fireCreatorModified(DesignerEvent evt) { if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { - TreePath[] paths = getSelectedTreePath(); + TreePath[] paths = tree.getSelectedTreePath(); if (paths.length == 1) { tree.setAndScrollSelectionPath(paths[0]); From 0efb563d4ce847285c6c7fff0fa2fa897888f146 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 12 Oct 2016 09:31:48 +0800 Subject: [PATCH 17/22] =?UTF-8?q?componenttree=E5=90=8E=E9=9D=A2=E8=BF=98?= =?UTF-8?q?=E8=A6=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ComponentTree.java | 182 +++++++++--------- 1 file changed, 93 insertions(+), 89 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index fb0586a693..0a268610ec 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -40,7 +40,7 @@ public class ComponentTree extends JTree { TreePath[] paths = getSelectedTreePath(); addTreeSelectionListener(designer); setSelectionPaths(paths); - + designer.addDesignerEditListener(new TreeDesignerEditAdapter()); this.addMouseListener(new MouseAdapter() { @@ -68,15 +68,19 @@ public class ComponentTree extends JTree { setEditable(true); } + public FormDesigner getDesigner() { + return designer; + } + /** * 构造函数 - * + * * @param designer 设计界面组件 * @param model 构造JTree的model */ public ComponentTree(FormDesigner designer,ComponentTreeModel model) { - this(designer); - this.setModel(model); + this(designer); + this.setModel(model); } @@ -96,17 +100,17 @@ public class ComponentTree extends JTree { return super.isPathEditable(path); } - /** - * 将值转换为文本 - * @param value 值 - * @param selected 是否选中 - * @param expanded 扩展 - * @param leaf 是否叶子 - * @param row 行 - * @param hasFocus 是否焦点 - * - * @return 返回文本 - */ + /** + * 将值转换为文本 + * @param value 值 + * @param selected 是否选中 + * @param expanded 扩展 + * @param leaf 是否叶子 + * @param row 行 + * @param hasFocus 是否焦点 + * + * @return 返回文本 + */ @Override public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (value != null && value instanceof XCreator) { @@ -115,25 +119,25 @@ public class ComponentTree extends JTree { return super.convertValueToText(value, selected, expanded, leaf, row, hasFocus); } } - + public void setAndScrollSelectionPath(TreePath treepath) { - setSelectionPath(treepath); - scrollPathToVisible(treepath); + setSelectionPath(treepath); + scrollPathToVisible(treepath); + } + + private void popupMenu(MouseEvent e) { + TreePath path = this.getSelectionPath(); + if (path == null) { + return; + } + Component component = (Component) path.getLastPathComponent(); + if (!(component instanceof XCreator)) { + return; + } + ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component); + JPopupMenu menu = adapter.getContextPopupMenu(e); + menu.show(this, e.getX(), e.getY()); } - - private void popupMenu(MouseEvent e) { - TreePath path = this.getSelectionPath(); - if (path == null) { - return; - } - Component component = (Component) path.getLastPathComponent(); - if (!(component instanceof XCreator)) { - return; - } - ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component); - JPopupMenu menu = adapter.getContextPopupMenu(e); - menu.show(this, e.getX(), e.getY()); - } /** * 刷新 @@ -145,51 +149,51 @@ public class ComponentTree extends JTree { - - public TreePath[] getSelectedTreePath() { - XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators(); - TreePath[] paths = new TreePath[creators.length]; - - for (int i = 0; i < paths.length; i++) { - paths[i] = buildTreePath(creators[i]); - } - return paths; - } - - private class TreeDesignerEditAdapter implements DesignerEditListener { - - @Override - public void fireCreatorModified(DesignerEvent evt) { - if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { - TreePath[] paths = getSelectedTreePath(); - - if (paths.length == 1) { - setAndScrollSelectionPath(paths[0]); - } else { - setSelectionPaths(paths); - } - } else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { - ComponentTree.this.refreshUI(); - TreePath[] paths = getSelectedTreePath(); - - if (paths.length == 1) { - setAndScrollSelectionPath(paths[0]); - } else { - setSelectionPaths(paths); - } - ComponentTree.this.repaint(); - - } else { - ComponentTree.this.refreshUI(); - ComponentTree.this.repaint(); - } - } - - @Override - public boolean equals(Object o) { - return o.getClass() == this.getClass(); - } - } + + public TreePath[] getSelectedTreePath() { + XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators(); + TreePath[] paths = new TreePath[creators.length]; + + for (int i = 0; i < paths.length; i++) { + paths[i] = buildTreePath(creators[i]); + } + return paths; + } + + private class TreeDesignerEditAdapter implements DesignerEditListener { + + @Override + public void fireCreatorModified(DesignerEvent evt) { + if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) { + TreePath[] paths = getSelectedTreePath(); + + if (paths.length == 1) { + setAndScrollSelectionPath(paths[0]); + } else { + setSelectionPaths(paths); + } + } else if(evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) { + ComponentTree.this.refreshUI(); + TreePath[] paths = getSelectedTreePath(); + + if (paths.length == 1) { + setAndScrollSelectionPath(paths[0]); + } else { + setSelectionPaths(paths); + } + ComponentTree.this.repaint(); + + } else { + ComponentTree.this.refreshUI(); + ComponentTree.this.repaint(); + } + } + + @Override + public boolean equals(Object o) { + return o.getClass() == this.getClass(); + } + } /** @@ -211,11 +215,11 @@ public class ComponentTree extends JTree { paths[i] = buildTreePath(searchList.get(i)); } if(paths.length > 0) { - setAndScrollSelectionPath(paths[0]); + setAndScrollSelectionPath(paths[0]); } else { - setSelectionPath(); + setSelectionPath(); } - return paths; + return paths; } @@ -248,7 +252,7 @@ public class ComponentTree extends JTree { * 触发 */ public void fireTreeChanged() { - designer.refreshDesignerUI(); + designer.refreshDesignerUI(); } /** @@ -267,14 +271,14 @@ public class ComponentTree extends JTree { ArrayList path = new ArrayList(); Component parent = comp; - while (parent != null) { - XCreator creator = (XCreator) parent; - path.add(0, parent); - if (creator != comp ) { - creator.notShowInComponentTree(path); - } - parent = parent.getParent(); - } + while (parent != null) { + XCreator creator = (XCreator) parent; + path.add(0, parent); + if (creator != comp ) { + creator.notShowInComponentTree(path); + } + parent = parent.getParent(); + } Object[] components = path.toArray(); return new TreePath(components); } From fc3b700db1da47f99e6178bf27a743cc1d95ad09 Mon Sep 17 00:00:00 2001 From: PanLi320 <854954082@qq.com> Date: Wed, 12 Oct 2016 10:25:02 +0800 Subject: [PATCH 18/22] =?UTF-8?q?bugfix:QQ=E6=8E=88=E6=9D=83=E6=9C=AA?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=EF=BC=8C=E8=B6=85=E9=93=BE=E4=B8=A4=E6=AC=A1?= =?UTF-8?q?=EF=BC=8C=E5=90=8C=E6=AD=A5=E7=9A=84url=EF=BC=8C=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E5=8E=BB=E6=8E=89=EF=BC=8C=E8=AE=BA=E5=9D=9B=E9=82=A3?= =?UTF-8?q?=E8=BE=B9=E8=BF=98=E8=A6=81=E5=81=9A=E6=94=AF=E6=8C=81=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/bbs/UserInfoLabel.java | 5 +---- .../com/fr/design/extra/PluginWebBridge.java | 5 +---- .../com/fr/design/extra/QQLoginWebBridge.java | 19 ------------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java index d0fe7dadba..460f758df6 100644 --- a/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer/src/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -284,10 +284,7 @@ public class UserInfoLabel extends UILabel{ public void mousePressed(MouseEvent e) { if(StringUtils.isNotEmpty(userName)){ try { - String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default") + - "&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=" + - "&username=" + DesignerEnvManager.getEnvManager().getBBSName() + - "&password=" + DesignerEnvManager.getEnvManager().getBBSPassword(); + String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default"); Desktop.getDesktop().browse(new URI(loginUrl)); } catch (Exception exp) { FRContext.getLogger().info(exp.getMessage()); diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index b192873d8c..12c3e85c41 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -379,10 +379,7 @@ public class PluginWebBridge { */ public void getPriviteMessage() { try { - String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default") + - "&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&inajax=" + - "&username=" + DesignerEnvManager.getEnvManager().getBBSName() + - "&password=" + DesignerEnvManager.getEnvManager().getBBSPassword(); + String loginUrl = SiteCenter.getInstance().acquireUrlByKind("bbs.default"); Desktop.getDesktop().browse(new URI(loginUrl)); }catch (Exception exp) { FRContext.getLogger().info(exp.getMessage()); diff --git a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java index 140c89748e..d0bcc27e12 100644 --- a/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/QQLoginWebBridge.java @@ -127,24 +127,5 @@ public class QQLoginWebBridge { if (url.indexOf("qqLogin.html") > 0) { return; } - if (Desktop.isDesktopSupported()) { - try { - //创建一个URI实例,注意不是URL - URI uri = URI.create(url); - //获取当前系统桌面扩展 - Desktop desktop = Desktop.getDesktop(); - //判断系统桌面是否支持要执行的功能 - if (desktop.isSupported(Desktop.Action.BROWSE)) { - //获取系统默认浏览器打开链接 - desktop.browse(uri); - } - } catch (NullPointerException e) { - //此为uri为空时抛出异常 - FRLogger.getLogger().error(e.getMessage()); - } catch (IOException e) { - //此为无法获取系统默认浏览器 - FRLogger.getLogger().error(e.getMessage()); - } - } } } From a996143c18697dc0981714ebc53309a5263a1430 Mon Sep 17 00:00:00 2001 From: zhouping Date: Wed, 12 Oct 2016 11:49:38 +0800 Subject: [PATCH 19/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRAbsoluteLayoutAdapter.java | 12 +- .../designer/creator/XWAbsoluteLayout.java | 19 ++ .../FRAbsoluteLayoutPropertiesGroupModel.java | 184 +++++++++++++++++- .../FRFitLayoutPropertiesGroupModel.java | 67 +++++-- .../properties/LayoutTypeRenderer.java | 14 ++ .../properties/LayoutTypeWrapper.java | 13 ++ .../items/FRFitConstraintsItems.java | 4 +- .../properties/items/FRLayoutTypeItems.java | 16 ++ .../designer/treeview/ComponentTreeModel.java | 27 ++- .../fr/design/gui/core/FormWidgetOption.java | 2 +- .../fr/design/mainframe/ComponentTree.java | 9 + .../design/mainframe/FormParaWidgetPane.java | 9 +- .../widget/editors/LayoutTypeEditor.java | 15 ++ 13 files changed, 360 insertions(+), 31 deletions(-) create mode 100644 designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java create mode 100644 designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java create mode 100644 designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java create mode 100644 designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 3c0f1155c6..8e0a725cd4 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -12,6 +12,7 @@ import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; +import com.fr.form.ui.container.WBodyLayoutType; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; @@ -330,6 +331,15 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter { @Override public GroupModel getLayoutProperties() { XWAbsoluteLayout xwAbsoluteLayout = (XWAbsoluteLayout) container; - return new FRAbsoluteLayoutPropertiesGroupModel(xwAbsoluteLayout); + if (xwAbsoluteLayout.toData().isAbsoluteLayoutAsBody()){ + //如果body是绝对布局,那么获取原来自适应body的属性--布局类型 + WBodyLayoutType layoutType = WBodyLayoutType.FIT; + if (container.getParent() != null) { + layoutType = ((XWFitLayout)container.getParent()).toData().getBodyLayoutType(); + } + return new FRAbsoluteLayoutPropertiesGroupModel(xwAbsoluteLayout, layoutType); + } else { + return new FRAbsoluteLayoutPropertiesGroupModel(xwAbsoluteLayout); + } } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index a1fc32c402..9ac9addc7f 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -75,9 +75,17 @@ public class XWAbsoluteLayout extends XLayoutContainer { xConnectorMap.put(connector, new XConnector(connector, this)); } + this.editable = widget.isAbsoluteLayoutAsBody(); + initPercent(); } + public XWAbsoluteLayout(WAbsoluteLayout widget, Dimension initSize, boolean isAbsoluteLayoutAsBody) { + this(widget, initSize); + widget.setAbsoluteLayoutAsBody(isAbsoluteLayoutAsBody); + this.editable = isAbsoluteLayoutAsBody; + } + /** * 初始化时默认的组件大小 * @@ -443,4 +451,15 @@ public class XWAbsoluteLayout extends XLayoutContainer { } } } + + /** + * 设置布局是否可编辑,不可则显示编辑蒙层 + * 假如是body的话,始终要能编辑,不会出现蒙层 + * + * @param isEditable 可否编辑 + */ + @Override + public void setEditable(boolean isEditable) { + super.setEditable(toData().isAbsoluteLayoutAsBody() || isEditable); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java index fc9c0985cd..f8b695a333 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java @@ -2,27 +2,40 @@ package com.fr.design.designer.properties; import com.fr.design.beans.GroupModel; import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelectionUtils; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.AbsoluteLayoutDirectionEditor; import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; +import com.fr.design.mainframe.widget.editors.LayoutTypeEditor; import com.fr.design.mainframe.widget.editors.PropertyCellEditor; +import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; import com.fr.general.Inter; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import java.awt.*; +import java.util.Arrays; +import java.util.Comparator; /** * Created by zhouping on 2016/8/1. */ public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { - private PropertyCellEditor editor; private DefaultTableCellRenderer renderer; private AbsoluteLayoutDirectionEditor stateEditor; private AbsoluteStateRenderer stateRenderer; private WAbsoluteLayout layout; private XWAbsoluteLayout xwAbsoluteLayout; + private LayoutTypeEditor layoutTypeEditor; + private LayoutTypeRenderer layoutTypeRenderer; + //默认body是0,自适应布局;1,绝对布局. + private WBodyLayoutType layoutType = WBodyLayoutType.FIT; public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){ this.xwAbsoluteLayout = xwAbsoluteLayout; @@ -33,31 +46,65 @@ public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { stateRenderer = new AbsoluteStateRenderer(); } + public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout, WBodyLayoutType layoutType){ + this(xwAbsoluteLayout); + this.layoutTypeEditor = new LayoutTypeEditor(); + this.layoutTypeRenderer = new LayoutTypeRenderer(); + this.layoutType = layoutType; + } + /** * 布局管理器自己的属性 */ @Override public String getGroupName() { - return Inter.getLocText("FR-Designer-Widget_Area_Scaling"); + return Inter.getLocText(layoutType == WBodyLayoutType.ABSOLUTE ? "FR-Designer_Attr_Layout" : "FR-Designer-Widget_Area_Scaling"); } @Override public int getRowCount() { - return 1; + return layoutType == WBodyLayoutType.ABSOLUTE ? 2 : 1; } @Override public TableCellRenderer getRenderer(int row) { - return stateRenderer; + if (layoutType == WBodyLayoutType.ABSOLUTE) { + return row == 0 ? layoutTypeRenderer : stateRenderer; + } + else { + return stateRenderer; + } } @Override public TableCellEditor getEditor(int row) { - return stateEditor; + if (layoutType == WBodyLayoutType.ABSOLUTE) { + return row == 0 ? layoutTypeEditor : stateEditor; + } + else{ + return stateEditor; + } } @Override public Object getValue(int row, int column) { + if (layoutType == WBodyLayoutType.ABSOLUTE){ + if (column == 0) { + switch (row) { + case 0: + return Inter.getLocText("FR-Designer_Attr_Layout_Type"); + default: + return Inter.getLocText("FR-Designer-Widget_Scaling_Mode"); + } + } else { + switch (row) { + case 0: + return layoutType.getTypeValue(); + default: + return layout.getCompState(); + } + } + } if (column == 0) { return Inter.getLocText("FR-Designer-Widget_Scaling_Mode"); } else { @@ -67,6 +114,42 @@ public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { @Override public boolean setValue(Object value, int row, int column) { + if (layoutType == WBodyLayoutType.ABSOLUTE){ + int state = 0; + if(value instanceof Integer) { + state = (Integer)value; + } + if (column == 0 || state < 0) { + return false; + } else { + if (row == 0) { + if (state == WBodyLayoutType.FIT.getTypeValue()) { + XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); + Component[] components = xwAbsoluteLayout.getComponents(); + + Arrays.sort(components, new ComparatorComponentLocation()); + + xfl.getLayoutAdapter().removeBean(xwAbsoluteLayout, xwAbsoluteLayout.getWidth(), xwAbsoluteLayout.getHeight()); + xfl.remove(xwAbsoluteLayout); + xfl.toData().setLayoutType(WBodyLayoutType.FIT); + + for (Component comp : components) { + xfl.add(comp); + } + moveComponents2FitLayout(xfl, components); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()})); + return true; + } + } + if (row == 1) { + layout.setCompState(state); + return true; + } + return false; + } + } int state = 0; if(value instanceof Integer) { state = (Integer)value; @@ -91,4 +174,95 @@ public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { public boolean isEditable(int row) { return true; } + + //把绝对布局中的元素按规则移动到自适应布局中 + private void moveComponents2FitLayout(XWFitLayout xwFitLayout, Component[] components) { + int eachRowCount = 4; + if (components.length <= 1){ + return; + } + int layoutWidth = xwFitLayout.getWidth() - xwFitLayout.toData().getMargin().getLeft() - xwFitLayout.toData().getMargin().getRight(); + int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom(); + int leftMargin = xwFitLayout.toData().getMargin().getLeft(); + int topMargin = xwFitLayout.toData().getMargin().getTop(); + int row = (components.length / eachRowCount) + (components.length % eachRowCount == 0 ? 0 : 1); + //最后一行的列数不定 + int column = components.length % eachRowCount; + int componentWidth = layoutWidth / eachRowCount; + int componentHeight = layoutHeight / row; + for(int i = 0;i < row - 1;i++){ + for(int j = 0;j < eachRowCount;j++){ + components[eachRowCount * i + j].setBounds( + leftMargin + componentWidth * j, + topMargin + componentHeight * i, + j == eachRowCount - 1 ? layoutWidth - componentWidth * (eachRowCount-1) : componentWidth, + componentHeight + ); + } + } + //最后一行列数是特殊的,要单独处理 + int lastRowWidth = layoutWidth / column; + int lastRowHeight = layoutHeight - componentHeight * (row - 1); + for (int i = 0;i < column;i++) { + components[eachRowCount * (row - 1) + i].setBounds( + leftMargin + lastRowWidth * i, + topMargin + componentHeight * (row - 1), + i == column - 1 ? layoutWidth - lastRowWidth * (column-1) : lastRowWidth, + lastRowHeight + ); + } + xwFitLayout.updateBoundsWidget(); + } + + private class ComponentLocationInfo{ + private Component component; + private int horizontalNO; + private int verticalNO; + + public ComponentLocationInfo(Component component, int horizontalNO, int verticalNO){ + this.component = component; + this.horizontalNO = horizontalNO; + this.verticalNO = verticalNO; + } + + public int getHorizontalNO() { + return this.horizontalNO; + } + + public int getVerticalNO() { + return this.verticalNO; + } + + public void setHorizontalNO(int horizontalNO){ + this.horizontalNO = horizontalNO; + } + + public void setVerticalNO(int verticalNO){ + this.verticalNO = verticalNO; + } + } + + //以组件的位置来确定先后顺序,y小的在前,x小的在前 + private class ComparatorComponentLocation implements Comparator { + @Override + public int compare(Object o1, Object o2) { + if(((Component)o1).getY() < ((Component)o2).getY()){ + return -1; + } + else if (((Component)o1).getY() > ((Component)o2).getY()) { + return 1; + } + else { + if (((Component)o1).getX() < ((Component)o2).getX()){ + return -1; + } + else if (((Component)o1).getX() > ((Component)o2).getX()) { + return 1; + } + else{ + return 0; + } + } + } + } } diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index 8a2f507936..25680581c0 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -4,16 +4,25 @@ package com.fr.design.designer.properties; import com.fr.design.beans.GroupModel; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.FormSelectionUtils; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.FitLayoutDirectionEditor; +import com.fr.design.mainframe.widget.editors.LayoutTypeEditor; import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; import com.fr.design.mainframe.widget.editors.PropertyCellEditor; +import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WFitLayout; import com.fr.general.Inter; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; +import java.awt.*; /** * 自适应布局自身的属性表 @@ -28,6 +37,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { private DefaultTableCellRenderer renderer; private FitLayoutDirectionEditor stateEditor; private FitStateRenderer stateRenderer; + private LayoutTypeEditor layoutTypeEditor; + private LayoutTypeRenderer layoutTypeRenderer; private WFitLayout layout; private XWFitLayout xfl; @@ -38,6 +49,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { editor = new PropertyCellEditor(new IntegerPropertyEditor()); stateEditor = new FitLayoutDirectionEditor(); stateRenderer = new FitStateRenderer(); + layoutTypeEditor = new LayoutTypeEditor(); + layoutTypeRenderer = new LayoutTypeRenderer(); } /** @@ -45,31 +58,35 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { */ @Override public String getGroupName() { - return Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"); + return Inter.getLocText("FR-Designer_Layout"); } @Override public int getRowCount() { - return 2; + return 3; } @Override public TableCellRenderer getRenderer(int row) { switch (row) { case 0: - return renderer; + return layoutTypeRenderer; + case 1: + return stateRenderer; default: - return stateRenderer; + return renderer; } } @Override public TableCellEditor getEditor(int row) { switch (row) { - case 0: - return editor; + case 0: + return layoutTypeEditor; + case 1: + return stateEditor; default: - return stateEditor; + return editor; } } @@ -78,16 +95,20 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { if (column == 0) { switch (row) { case 0: - return Inter.getLocText("FR-Designer_Component_Interval"); + return Inter.getLocText("FR-Designer_Attr_Layout_Type"); + case 1: + return Inter.getLocText("FR-Designer_Component_Scale"); default: - return Inter.getLocText("FR-Designer_Component_Scale"); + return Inter.getLocText("FR-Designer_Component_Interval"); } } else { switch (row) { case 0: - return layout.getCompInterval(); + return layout.getBodyLayoutType().getTypeValue(); + case 1: + return layout.getCompState(); default: - return layout.getCompState(); + return layout.getCompInterval(); } } } @@ -101,13 +122,35 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { if (column == 0 || state < 0) { return false; } else { - if (row ==0 && xfl.canAddInterval(state)) { + if (row == 2 && xfl.canAddInterval(state)) { // 设置完间隔后,要同步处理界面组件,容器刷新后显示出对应效果 setLayoutGap(state); return true; }else if (row == 1) { layout.setCompState(state); return true; + }else if (row == 0) { + layout.setLayoutType(WBodyLayoutType.parse(state)); + if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { + WAbsoluteLayout wAbsoluteLayout = new WAbsoluteLayout("body"); + wAbsoluteLayout.setCompState(WAbsoluteLayout.STATE_FIXED); + Component[] components = xfl.getComponents(); + xfl.removeAll(); + XWAbsoluteLayout xwAbsoluteLayout = new XWAbsoluteLayout(wAbsoluteLayout, new Dimension(0,0), true); + xfl.getLayoutAdapter().addBean(xwAbsoluteLayout, 0, 0); + for (Component component : components) { + xwAbsoluteLayout.add(component); + } + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xfl, new Widget[]{wAbsoluteLayout})); + } + else { + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().setSelectedCreators( + FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()})); + } + return true; } return false; } diff --git a/designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java b/designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java new file mode 100644 index 0000000000..033552028b --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/LayoutTypeRenderer.java @@ -0,0 +1,14 @@ +package com.fr.design.designer.properties; + +import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; + +/** + * Created by zhouping on 2016/9/18. + */ +public class LayoutTypeRenderer extends EncoderCellRenderer { + + public LayoutTypeRenderer() { + super(new LayoutTypeWrapper()); + } + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java b/designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java new file mode 100644 index 0000000000..4630fe784a --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/LayoutTypeWrapper.java @@ -0,0 +1,13 @@ +package com.fr.design.designer.properties; + +import com.fr.design.designer.properties.items.FRLayoutTypeItems; + +/** + * Created by zhouping on 2016/9/18. + */ +public class LayoutTypeWrapper extends ItemWrapper{ + + public LayoutTypeWrapper() { + super(new FRLayoutTypeItems()); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java index 6ae6f22c8c..92e63bf1ad 100644 --- a/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java +++ b/designer_form/src/com/fr/design/designer/properties/items/FRFitConstraintsItems.java @@ -13,8 +13,8 @@ import com.fr.general.Inter; public class FRFitConstraintsItems implements ItemProvider{ public static final Item[] ITEMS = new Item[] { - new Item(Inter.getLocText("Adaptive_Full_Area"), WFitLayout.STATE_FULL), - new Item(Inter.getLocText("Adaptive_Original_Scale"), WFitLayout.STATE_ORIGIN)}; + new Item(Inter.getLocText("FR-Designer_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), + new Item(Inter.getLocText("FR_Designer_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN)}; public Item[] getItems() { return ITEMS; diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java new file mode 100644 index 0000000000..a19d975170 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/items/FRLayoutTypeItems.java @@ -0,0 +1,16 @@ +package com.fr.design.designer.properties.items; + +import com.fr.form.ui.container.WBodyLayoutType; + +/** + * Created by zhouping on 2016/9/18. + */ +public class FRLayoutTypeItems implements ItemProvider{ + public static final Item[] ITEMS = new Item[] { + new Item(WBodyLayoutType.FIT.description(), WBodyLayoutType.FIT.getTypeValue()), + new Item(WBodyLayoutType.ABSOLUTE.description(), WBodyLayoutType.ABSOLUTE.getTypeValue())}; + + public Item[] getItems() { + return ITEMS; + } +} diff --git a/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java b/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java index f189bcada2..e94ea1ad05 100644 --- a/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java +++ b/designer_form/src/com/fr/design/designer/treeview/ComponentTreeModel.java @@ -10,11 +10,9 @@ import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import com.fr.base.FRContext; +import com.fr.design.designer.creator.*; import com.fr.design.mainframe.FormDesigner; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWidgetCreator; import com.fr.form.ui.Widget; public class ComponentTreeModel implements TreeModel { @@ -23,6 +21,8 @@ public class ComponentTreeModel implements TreeModel { private Component root; private FormDesigner designer; + private final int ABSOLUTE_AS_BODY_NOT_FOUND = -1; + public ComponentTreeModel(FormDesigner designer, Component root) { this.designer = designer; this.root = root; @@ -38,6 +38,11 @@ public class ComponentTreeModel implements TreeModel { if (parent != null && parent instanceof XLayoutContainer) { XLayoutContainer xlayout = (XLayoutContainer) parent; XCreator creator = xlayout.getXCreator(index); + //绝对布局作为body的时候不显示自适应布局父层 + int absoluteBodyIndex = getAbsoluteBodyIndex(creator); + if (absoluteBodyIndex > ABSOLUTE_AS_BODY_NOT_FOUND){ + return creator.getComponent(absoluteBodyIndex); + } return creator.getXCreator(); } return null; @@ -135,4 +140,20 @@ public class ComponentTreeModel implements TreeModel { FRContext.getLogger().error(e.getMessage(), e); } } + + private int getAbsoluteBodyIndex(XCreator xCreator){ + //绝对布局作为body,父层是自适应布局,找到绝对布局位于父层的index + int index = ABSOLUTE_AS_BODY_NOT_FOUND; + if (xCreator.acceptType(XWFitLayout.class)){ + XWFitLayout bodyFitLayout = (XWFitLayout)xCreator; + for (int i = 0;i < bodyFitLayout.getXCreatorCount();i++){ + //类型是绝对布局并且还是body + if (bodyFitLayout.getXCreator(i).acceptType(XWAbsoluteLayout.class) + && ((XWAbsoluteLayout)bodyFitLayout.getXCreator(i)).toData().isAbsoluteLayoutAsBody()){ + index = i; + } + } + } + return index; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java index 214d2cd679..b3fa73a26d 100644 --- a/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java +++ b/designer_form/src/com/fr/design/gui/core/FormWidgetOption.java @@ -1 +1 @@ -package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_AbsoluteLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_CardLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file +package com.fr.design.gui.core; import javax.swing.Icon; import com.fr.base.BaseUtils; import com.fr.form.ui.ElementCaseEditor; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WCardLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WHorizontalBoxLayout; import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WVerticalBoxLayout; import com.fr.general.Inter; /** * Author : Shockway * Date: 13-6-17 * Time: 上午10:40 */ public class FormWidgetOption extends WidgetOption { /** * 返回名字 * @return 名字 */ @Override public String optionName() { return null; } /** * 返回图标 * @return 图标 */ @Override public Icon optionIcon() { return null; } /** * 组件类 * @return 类 */ @Override public Class widgetClass() { return null; } /** * 返回组件 * @return 控件 */ @Override public Widget createWidget() { return null; } /* * 表单容器 */ public static WidgetOption[] getFormContainerInstance() { return new WidgetOption[] { ABSOLUTELAYOUTCONTAINER, BORDERLAYOUTCONTAINER, HORIZONTALBOXLAYOUTCONTAINER, VERTICALBOXLAYOUTCONTAINER, CARDLAYOUTCONTAINER, FITLAYOUTCONTAINER }; } /** * 表单工具栏上的布局 * @return 控件 */ public static WidgetOption[] getFormLayoutInstance() { return new WidgetOption[] {CARDLAYOUTCONTAINER, ABSOLUTELAYOUTCONTAINER}; } public static final WidgetOption ABSOLUTELAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Absolute"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_absolute_new.png"), WAbsoluteLayout.class); public static final WidgetOption BORDERLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_BorderLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_border.png"), WBorderLayout.class); public static final WidgetOption CARDLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout_Block_Tab"), BaseUtils.readIcon("/com/fr/web/images/form/resources/card_layout_16.png"), WCardLayout.class); public static final WidgetOption HORIZONTALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Layout-HBox"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_h_16.png"), WHorizontalBoxLayout.class); public static final WidgetOption VERTICALBOXLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_VerticalBoxLayout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WVerticalBoxLayout.class); public static final WidgetOption FITLAYOUTCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), BaseUtils.readIcon("/com/fr/web/images/form/resources/boxlayout_v_16.png"), WFitLayout.class); public static final WidgetOption PARAMETERCONTAINER = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Para-Body"), BaseUtils.readIcon("/com/fr/web/images/form/resources/layout_parameter.png"), WParameterLayout.class); public static final WidgetOption ELEMENTCASE = WidgetOptionFactory.createByWidgetClass(Inter .getLocText("FR-Designer_Form-Report"), BaseUtils.readIcon("/com/fr/web/images/form/resources/report_16.png"), ElementCaseEditor.class); } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/ComponentTree.java b/designer_form/src/com/fr/design/mainframe/ComponentTree.java index 0a268610ec..4cf0d2528c 100644 --- a/designer_form/src/com/fr/design/mainframe/ComponentTree.java +++ b/designer_form/src/com/fr/design/mainframe/ComponentTree.java @@ -18,6 +18,8 @@ import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.treeview.ComponentTreeCellRenderer; import com.fr.design.designer.treeview.ComponentTreeModel; import com.fr.stable.StringUtils; @@ -277,6 +279,13 @@ public class ComponentTree extends JTree { if (creator != comp ) { creator.notShowInComponentTree(path); } + //绝对布局作为body的时候不显示自适应布局父层 + if (((XCreator) parent).acceptType(XWAbsoluteLayout.class) + && ((XCreator)parent.getParent()).acceptType(XWFitLayout.class) + && ((XWAbsoluteLayout)parent).toData().isAbsoluteLayoutAsBody()){ + parent = parent.getParent().getParent(); + continue; + } parent = parent.getParent(); } Object[] components = path.toArray(); diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index 8118d4da27..cb111bb929 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -94,12 +94,6 @@ public class FormParaWidgetPane extends JPanel{ private void initFormParaComponent() { this.removeAll(); // 菜单中的布局先注释掉 - - JPanel reportPane = new JPanel(new FlowLayout()); - reportPane.add(new ToolBarButton(FormWidgetOption.ELEMENTCASE)); - add(createNormalCombinationPane(reportPane,Inter.getLocText("FR-Designer-Form-ToolBar_Report"))); - add(createJSeparator()); - JPanel paraPane = new JPanel(new FlowLayout()); ToolBarButton paraButton = new paraButton(FormWidgetOption.PARAMETERCONTAINER); paraPane.add(paraButton); @@ -111,7 +105,8 @@ public class FormParaWidgetPane extends JPanel{ for(WidgetOption option : loadLayoutOptions()){ layoutPane.add(new ToolBarButton(option)); } - add(createNormalCombinationPane(layoutPane,Inter.getLocText("FR-Designer_Layout"))); + layoutPane.add(new ToolBarButton(FormWidgetOption.ELEMENTCASE)); + add(createNormalCombinationPane(layoutPane,Inter.getLocText("FR-Designer_Layout_Block_Blank"))); jSeparatorLayout = createJSeparator(); add(jSeparatorLayout); diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java new file mode 100644 index 0000000000..05de57f52c --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/LayoutTypeEditor.java @@ -0,0 +1,15 @@ +package com.fr.design.mainframe.widget.editors; + +import com.fr.design.designer.properties.EnumerationEditor; +import com.fr.design.designer.properties.items.FRLayoutTypeItems; + +/** + * Created by zhouping on 2016/9/18. + */ +public class LayoutTypeEditor extends EnumerationEditor { + + public LayoutTypeEditor() { + super(new FRLayoutTypeItems()); + } + +} \ No newline at end of file From 74e8773a81c78181b50a6f9a0ede910c81a7347e Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 13 Oct 2016 10:07:45 +0800 Subject: [PATCH 20/22] =?UTF-8?q?dev=E6=89=93=E5=8C=85=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=EF=BC=8C=E5=85=88=E6=8A=8Axcreator=E4=BC=A0=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 133 +++++++++++------- 1 file changed, 85 insertions(+), 48 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index ab08de3fea..552402398a 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -15,6 +15,7 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; import javax.swing.*; import javax.swing.border.Border; @@ -27,7 +28,7 @@ import java.util.List; /** * @author richer * @since 6.5.3 com.fr.base.listener.OB的设计组件 - * + * */ public abstract class XCreator extends JPanel implements XComponent, XCreatorTools { @@ -44,6 +45,8 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo // XCreator加入到某些XLayoutContainer中时,能调整宽度或者高度 private int[] directions; private Rectangle backupBound; + private String shareId = StringUtils.EMPTY;//如果组件是共享的会有这个属性 + private boolean isHelpBtnOnFocus = false;//焦点是否在帮助按钮上 public XCreator(Widget ob, Dimension initSize) { this.data = ob; @@ -83,7 +86,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo setSize(this.backupSize); } } - + /** * 备份当前大小 */ @@ -113,76 +116,76 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public XLayoutContainer getTopLayout(){ return null; } - + /** * 获取当前XCreator的一个封装父容器 - * + * * @param widgetName 当前组件名 - * + * * @return 封装的父容器 - * + * * * @date 2014-11-25-下午4:47:23 - * + * */ protected XLayoutContainer getCreatorWrapper(String widgetName){ return new XWTitleLayout(); } - + /** * 将当前对象添加到父容器中 - * + * * @param parentPanel 父容器组件 - * + * * * @date 2014-11-25-下午4:57:55 - * + * */ - protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight){ + protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight){ parentPanel.add(this, WTitleLayout.BODY); } - + /** * 设置父容器的名字 - * + * * @param parentPanel 当前父容器 * @param widgetName 当前控件名 - * + * * * @date 2014-11-27-上午9:47:00 - * + * */ protected void setWrapperName(XLayoutContainer parentPanel, String widgetName){ parentPanel.toData().setWidgetName(widgetName); } - + /** * 初始化当前组件的父容器 * 大体分为三种: Scale缩放型, Title标题型, Border自定义标题栏 - * + * * @param minHeight 最小高度 - * + * * @return 父容器 - * + * * * @date 2014-11-25-下午5:15:23 - * + * */ public XLayoutContainer initCreatorWrapper(int minHeight){ XLayoutContainer parentPanel; String widgetName = this.toData().getWidgetName(); parentPanel = this.getCreatorWrapper(widgetName); - + int width = this.getWidth(); int height = this.getHeight(); - + parentPanel.setLocation(this.getX(), this.getY()); parentPanel.setSize(width, height); setWrapperName(parentPanel, widgetName); this.setLocation(0, 0); this.addToWrapper(parentPanel, width, minHeight); LayoutUtils.layoutRootContainer(parentPanel); - + return parentPanel; } @@ -291,7 +294,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public Dimension getMinimumSize() { return new Dimension(0, 0); } - + /** * 是否支持切换到报表界面编辑 * @return 是则返回true @@ -299,7 +302,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public boolean isReport(){ return false; } - + /** * 该组件是否可以拖入参数面板 * @return 是则返回true @@ -359,7 +362,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void setBackupBound(Rectangle rec) { this.backupBound = rec; } - + /** * 控件树不显示此组件 * @param path 控件树list @@ -367,7 +370,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void notShowInComponentTree(ArrayList path) { return; } - + /** * 重置组件的名称 * @param name 名称 @@ -375,7 +378,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void resetCreatorName(String name) { toData().setWidgetName(name); } - + /** * 返回编辑的子组件,scale为其内部组件 * @return 组件 @@ -383,7 +386,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public XCreator getEditingChildCreator() { return this; } - + /** * 返回对应属性表的组件,scale和title返回其子组件 * @return 组件 @@ -391,7 +394,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public XCreator getPropertyDescriptorCreator() { return this; } - + /** * 更新子组件的Bound; 没有不处理 * @param minHeight 最小高度 @@ -399,7 +402,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void updateChildBound(int minHeight) { return; } - + /** * 是否作为控件树的叶子节点 * @return 是则返回true @@ -407,7 +410,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public boolean isComponentTreeLeaf() { return true; } - + /** * 是否为sclae和title专属容器 * @return 是则返回true @@ -415,7 +418,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public boolean isDedicateContainer() { return false; } - + /** * 是否接收这种类型 * @param acceptTypes 接收的类型 @@ -432,13 +435,13 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo /** * 是否组件要缩放(自适应里部分组件需要, 如数字、文本、下拉框、下拉复选框、密码、下拉树、下拉复选树、日期) - * + * * @return 是则返回true */ public boolean shouldScaleCreator() { return false; } - + /** * 是否支持标题样式 * @return 默认false @@ -446,10 +449,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public boolean hasTitleStyle() { return false; } - + /** * 响应点击事件 - * + * * @param editingMouseListener 鼠标点击,位置处理器 * @param e 鼠标点击事件 */ @@ -468,10 +471,10 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo } } } - + /** * 删除相关组件 - * + * * @param creator 当前组件 * @param designer 表单设计器 * @@ -479,17 +482,17 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void deleteRelatedComponent(XCreator creator,FormDesigner designer){ return; } - + /** * 选择相关组件 - * + * * @param creator 当前组件 - * + * */ public void seleteRelatedComponent(XCreator creator){ return; } - + /** * 返回组件 * @return @@ -498,7 +501,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public XCreator getXCreator(){ return this; } - + /** * 按百分比调整组件 * @param percent 百分比 @@ -507,7 +510,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public void adjustCompSize(double percent){ return; } - + /** * 返回一些需要的子组件 * @return 返回一些需要的子组件 @@ -516,11 +519,11 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public ArrayList getTargetChildrenList(){ return new ArrayList(); } - + public XLayoutContainer getOuterLayout(){ return this.getBackupParent(); } - + /** * 重新调整子组件宽度 * @param width 宽度 @@ -553,4 +556,38 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo public boolean supportRenameInWidgetTree() { return true; } + + /** + * 组件是否是共享组件 + * @return 是否是共享组件 + */ + public boolean isShared() { + return StringUtils.isNotEmpty(shareId); + } + + public void setShareId(String shareId) { + this.shareId = shareId; + } + + public String getShareId() { + return shareId; + } + + /** + * 焦点是否在帮助按钮上 + * @return 焦点是否在帮助按钮上 + */ + public boolean isHelpBtnOnFocus() { + return isHelpBtnOnFocus; + } + + public void setHelpBtnOnFocus(boolean helpBtnOnFocus) { + isHelpBtnOnFocus = helpBtnOnFocus; + } + + /** + * 设置共享帮助信息 + * @param msg 帮助信息 + */ + public void setSharedMsg(String msg){} } \ No newline at end of file From 07b771326aabd4be5332135501d3b8c1cc25051f Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 13 Oct 2016 10:54:10 +0800 Subject: [PATCH 21/22] =?UTF-8?q?REPORT-338=20=20=E6=97=A5=E6=96=87?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=EF=BC=8C=E8=B6=85=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E9=80=89=E9=A1=B9=E6=97=A0=E6=95=88?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperlink/AbstractHyperlinkPane.java | 2 +- .../hyperlink/HyperlinkTargetFrame.java | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java index bc54473291..6a236a4e34 100644 --- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java +++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java @@ -127,7 +127,7 @@ public abstract class AbstractHyperlinkPane extends BasicBe public void updateBean(T link) { updateSubHyperlinkBean(link); - link.setTargetFrame((String) targetFrameComboBox.getSelectedItem()); + link.setTargetFrame(HyperlinkTargetFrame.getName(targetFrameComboBox.getSelectedIndex())); link.setHeight(Utils.objectToNumber(heightTextFiled.getText(), false).intValue()); link.setWidth(Utils.objectToNumber(widthTextFiled.getText(), false).intValue()); } diff --git a/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java new file mode 100644 index 0000000000..56d590f039 --- /dev/null +++ b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java @@ -0,0 +1,44 @@ +package com.fr.design.hyperlink; + +/** + * Created by ibm on 2016/10/13. + */ +public enum HyperlinkTargetFrame { + BLANK_FRAME("_blank", 0), DIALOG_FRAME("_dialog", 1), SELF_FRAME("_self", 2); + + private String name; + private int index; + + + HyperlinkTargetFrame(String name, int index) { + this.name = name; + this.index = index; + } + + public static String getName(int index) { + for (HyperlinkTargetFrame hyperlinkTargetFrame : HyperlinkTargetFrame.values()) { + if (hyperlinkTargetFrame.getIndex() == index) { + return hyperlinkTargetFrame.name; + } + } + return null; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + public String getName() { + return name; + + } + + public void setName(String name) { + this.name = name; + } +} + From e79268436682c6c45114f27157d5b4940e498053 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 13 Oct 2016 11:29:21 +0800 Subject: [PATCH 22/22] =?UTF-8?q?REPORT-338=20=E6=97=A5=E6=96=87=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=EF=BC=8C=E8=B6=85=E9=93=BE=E6=8E=A5=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=A1=86=E9=80=89=E9=A1=B9=E6=97=A0=E6=95=88=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/hyperlink/AbstractHyperlinkPane.java | 2 +- .../fr/design/hyperlink/HyperlinkTargetFrame.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java index 6a236a4e34..8a2773f58a 100644 --- a/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java +++ b/designer_base/src/com/fr/design/hyperlink/AbstractHyperlinkPane.java @@ -127,7 +127,7 @@ public abstract class AbstractHyperlinkPane extends BasicBe public void updateBean(T link) { updateSubHyperlinkBean(link); - link.setTargetFrame(HyperlinkTargetFrame.getName(targetFrameComboBox.getSelectedIndex())); + link.setTargetFrame(HyperlinkTargetFrame.parse(targetFrameComboBox.getSelectedIndex()).getName()); link.setHeight(Utils.objectToNumber(heightTextFiled.getText(), false).intValue()); link.setWidth(Utils.objectToNumber(widthTextFiled.getText(), false).intValue()); } diff --git a/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java index 56d590f039..80e9f21a0a 100644 --- a/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java +++ b/designer_base/src/com/fr/design/hyperlink/HyperlinkTargetFrame.java @@ -8,22 +8,26 @@ public enum HyperlinkTargetFrame { private String name; private int index; - + private static HyperlinkTargetFrame[] arrayOfValues; HyperlinkTargetFrame(String name, int index) { this.name = name; this.index = index; } - public static String getName(int index) { + public static HyperlinkTargetFrame parse(int index) { + if (arrayOfValues == null) { + arrayOfValues = HyperlinkTargetFrame.values(); + } for (HyperlinkTargetFrame hyperlinkTargetFrame : HyperlinkTargetFrame.values()) { if (hyperlinkTargetFrame.getIndex() == index) { - return hyperlinkTargetFrame.name; + return hyperlinkTargetFrame; } } - return null; + return BLANK_FRAME; } + public int getIndex() { return index; }