From b20500ac93987efe69fedf9ec4b6557cf8dff2ab Mon Sep 17 00:00:00 2001 From: finereport Date: Fri, 1 Sep 2017 16:08:28 +0800 Subject: [PATCH 01/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E9=9B=86=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E9=9A=8F=E6=84=8F=E9=80=89=E5=8F=96=E5=85=B6=E4=BB=96=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=9E=E6=8E=A5=E7=9A=84?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../connect/ConnectionTableProcedurePane.java | 13 +++++++++++++ .../tabledata/tabledatapane/DBTableDataPane.java | 13 ++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java index 23b62431ec..0377f0bd4a 100644 --- a/designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java +++ b/designer_base/src/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java @@ -1,6 +1,8 @@ package com.fr.design.data.datapane.connect; import com.fr.base.BaseUtils; +import com.fr.data.impl.AbstractDatabaseConnection; +import com.fr.data.impl.Connection; import com.fr.design.constants.UIConstants; import com.fr.data.core.db.TableProcedure; import com.fr.design.border.UIRoundedBorder; @@ -20,6 +22,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.*; import java.awt.event.*; +import java.util.List; /** * 数据集编辑面板左边的部分 @@ -39,6 +42,12 @@ public class ConnectionTableProcedurePane extends BasicPane { public ConnectionTableProcedurePane() { this.setLayout(new BorderLayout(4, 4)); connectionComboBox = new ConnectionComboBoxPanel(com.fr.data.impl.Connection.class) { + + @Override + protected void filterConnection(Connection connection, String conName, List nameList) { + filter(connection, conName, nameList); + } + protected void refreshItems() { super.refreshItems(); if (tableViewList != null) { @@ -83,6 +92,10 @@ public class ConnectionTableProcedurePane extends BasicPane { this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height)); } + protected void filter(Connection connection, String conName, List nameList) { + connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class}); + } + protected JPanel createCheckBoxgroupPane() { JPanel checkBoxgroupPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); JPanel first = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); diff --git a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index 75b3219ebd..947e17106b 100644 --- a/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -5,7 +5,11 @@ import com.fr.base.FRContext; import com.fr.base.Parameter; import com.fr.base.ParameterHelper; import com.fr.data.core.db.TableProcedure; +import com.fr.data.impl.AbstractDatabaseConnection; +import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; +import com.fr.data.impl.JDBCDatabaseConnection; +import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; @@ -37,6 +41,7 @@ import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; +import org.sqlite.JDBC; import javax.swing.*; import javax.swing.text.BadLocationException; @@ -102,7 +107,12 @@ public class DBTableDataPane extends AbstractTableDataPane { sqlSplitPane.add(box, BorderLayout.CENTER); // 左边的Panel,上面是选择DatabaseConnection的ComboBox,下面DatabaseConnection对应的Table - connectionTableProcedurePane = new ConnectionTableProcedurePane(); + connectionTableProcedurePane = new ConnectionTableProcedurePane() { + @Override + protected void filter(Connection connection, String conName, List nameList) { + connection.addConnection(nameList, conName, new Class[]{JDBCDatabaseConnection.class, JNDIDatabaseConnection.class}); + } + }; connectionTableProcedurePane.addDoubleClickListener(new DoubleClickSelectedNodeOnTreeListener() { @Override @@ -138,6 +148,7 @@ public class DBTableDataPane extends AbstractTableDataPane { this.add(mainSplitPane, BorderLayout.CENTER); } + private boolean isPreviewOrRefreshButton (FocusEvent e) { if (e.getOppositeComponent() != null) { String name = e.getOppositeComponent().getName(); From aaeb8067456e30b2d272513eb4d993ab59b8e2fd Mon Sep 17 00:00:00 2001 From: zhouping Date: Mon, 4 Sep 2017 15:10:33 +0800 Subject: [PATCH 02/37] =?UTF-8?q?REPORT-2975=209.0=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=20=E5=90=8C=E6=AD=A5=E4=B8=80=E4=BB=BD?= =?UTF-8?q?=E5=88=B0master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/gui/ilable/UILabel.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designer_base/src/com/fr/design/gui/ilable/UILabel.java b/designer_base/src/com/fr/design/gui/ilable/UILabel.java index b1c90d8ff5..c0b921dee1 100644 --- a/designer_base/src/com/fr/design/gui/ilable/UILabel.java +++ b/designer_base/src/com/fr/design/gui/ilable/UILabel.java @@ -29,6 +29,11 @@ public class UILabel extends JLabel { super(text); } + public UILabel(String text, boolean enable) { + super(text); + this.setEnabled(enable); + } + public UILabel(Icon image, int horizontalAlignment) { super(image, horizontalAlignment); } From 3165d1fcfe0631add57eb6f56c9d770d0c97000f Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Wed, 13 Sep 2017 18:45:59 +0800 Subject: [PATCH 03/37] =?UTF-8?q?BI=E5=90=AF=E5=8A=A8=E7=94=A8=E4=BA=86UIb?= =?UTF-8?q?utton=EF=BC=8C=E5=AF=BC=E8=87=B4FRCoreContext=E6=8F=90=E5=89=8D?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/roleAuthority/ReportAndFSManagePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 4555c336bb..98c570786c 100644 --- a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1 +1 @@ -package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; import com.fr.base.FRCoreContext; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.ToolBarDef; import com.fr.general.Inter; import com.fr.general.VT4FR; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Enumeration; /** * 设计器左下角面板,用于在权限编辑时存放角色 * Author : daisy * Date: 13-8-30 * Time: 下午2:22 */ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { private static final int REPORT_PLATEFORM_MANAGE = 0; private static final int FS_MANAGE = 1; private static final int LEFT_GAP = -125; private static boolean isSupportFS = false; private TreePath treePath = null; private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static RoleTree roleTree; // carl:我先屏了,现在半拉子,等客户要了再好好做 // private AddAction addAction = new AddAction(); // private RemoveAction removeAction = new RemoveAction(); private RefreshAction refreshAction = new RefreshAction(); private UIHeadGroup buttonGroup; private RoleSourceOP op; protected String[] roleNames = new String[2]; public synchronized static ReportAndFSManagePane getInstance() { singleton.op = new RoleSourceOP(); singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); singleton.setDefaultSelectedRole(); return singleton; } public ReportAndFSManagePane() { initRoleTree(); this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); this.add(iniToolBarPane(), BorderLayout.NORTH); refreshAction.setEnabled(true); UIScrollPane scrollPane = new UIScrollPane(roleTree); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(4, 4)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); registerDSChangeListener(); } private void initRoleTree() { roleTree = new RoleTree() { public void refreshRoleTree(String selectedRole) { super.refreshRoleTree(selectedRole); changeAlreadyEditedPaneRole(selectedRole); } protected void doWithValueChanged(TreeSelectionEvent e) { super.doWithValueChanged(e); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); setSelectedRole(roleTree.getSelectedRoleName(), parent); } protected void setTabRoleName(String roleName) { roleNames[getMode()] = roleTree.getSelectedRoleName(); } }; roleTree.setEnabled(true); roleTree.setEditable(false); // RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); // treeCellEditor.addCellEditorListener(treeCellEditor); // roleTree.setCellEditor(treeCellEditor); roleTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); roleTree.setEditable(false); // int row = roleTree.getRowForLocation(e.getX(), e.getY()); // TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); // if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // if (!(ap instanceof DaoAuthenticationProvider)) { // roleTree.setEditable(true); // roleTree.startEditingAtPath(path); // treePath = path; // } // } } }); } private void changeAlreadyEditedPaneRole(String selectedRole) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); roleTree.setSelectedRole(selectedRole, parent); } public void setDefaultSelectedRole() { //设置选中的节点 TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); String selectedRole = null; if (singleton != null) { selectedRole = roleNames[getMode()]; } if (selectedRole == null) { if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { return; } selectedRole = node.getFirstChild().getChildAt(0).toString(); } roleTree.setSelectedRole(selectedRole, parent); } public RoleTree getRoleTree() { return roleTree; } /** * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) */ private void checkChanges() { //如若有变化,则弹出下面的对话框 int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } private JPanel iniToolBarPane() { ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); toolbarPane.add(toolBar, BorderLayout.CENTER); return toolbarPane; } private void initbuttonGroup() { isSupportFS = supportFineDecision(); Icon[] iconArray = null; String[] textArray = null; if (isSupportFS) { iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; } else { iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/platform_16_16.png")}; textArray = new String[]{Inter.getLocText("M_Server-Platform_Manager")}; } buttonGroup = new UIHeadGroup(iconArray, textArray) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { op.setDataMode(getMode()); //判断是否可编辑 refreshDockingView(); } setDefaultSelectedRole(); if (singleton != null) { changeAlreadyEditedPaneRole(roleNames[getMode()]); } } }; buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); buttonGroup.setNeedLeftRightOutLine(false); } private boolean supportFineDecision() { byte[] bytes = FRCoreContext.getBytes(); return VT4FR.isLicAvailable(bytes) && VT4FR.FS_BI.support(); } private int getMode(){ return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; } // /** // * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 // */ // public void checkToolButtonsEnabled() { // if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // PrivilegeFilter pf = pm.getPrivilegeFilter(); // boolean isClickable = !(ap instanceof DaoAuthenticationProvider) // && pf instanceof AuthorityControlFilter; // addAction.setEnabled(isClickable); // removeAction.setEnabled(isClickable); // } else { // addAction.setEnabled(false); // removeAction.setEnabled(false); // } // // } /** * 刷新界面 */ public void refreshDockingView() { populate(new RoleSourceOP()); // this.checkToolButtonsEnabled(); } private void populate(RoleSourceOP op) { this.op = op; roleTree.populate(op); expandTree(roleTree, true); } public String getViewTitle() { return null; } public Icon getViewIcon() { return null; } /** * 最佳定位 * @return 定位 */ public Location preferredLocation() { return null; } /** * 注册数据库改变的响应的Listener */ public void registerDSChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } }); } // private class AddAction extends UpdateAction { // public AddAction() { // this.setName(Inter.getLocText("Add")); // this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); // } // // @Override // public void actionPerformed(ActionEvent e) { // refreshDockingView(); // // DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); // ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); // ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); // String newName = Inter.getLocText("newNode") + (++newIndex); // parentNode.add(new ExpandMutableTreeNode(newName)); // op.addAction(newName); // roleTree.updateUI(); // // try { // synchronized (AuthorityRoleDAOManager.class) { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { // newName = Inter.getLocText("newNode") + (++newIndex); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); // // AuthorityRoleDAOManager.doEnd(pf); // } // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // } // } // private class RemoveAction extends UpdateAction { // // public RemoveAction() { // this.setName(Inter.getLocText("Remove")); // this.setSmallIcon(UIConstants.CLEAR_ICON); // } // // @Override // public void actionPerformed(ActionEvent e) { // // // NameObject selectedNO = roleTree.getSelectedNameObject(); // // if (selectedNO == null) { // return; // } // // int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", // Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); // if (returnVal == JOptionPane.OK_OPTION) { // op.removeAction(selectedNO.getName()); // // try { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // roleTree.requestFocus(); // roleTree.setSelectionRow(roleTree.getRowCount() - 1); // } // } // } /* * 刷新ReportletsTree */ private class RefreshAction extends UpdateAction { public RefreshAction() { this.setName(Inter.getLocText("FR-Designer_Refresh")); this.setSmallIcon(UIConstants.REFRESH_ICON); } @Override public void actionPerformed(ActionEvent evt) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } // private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { // // private NameObject editingNO; // private String oldName; // private String newName; // private UITextField jTextField; // // public RoleTreeCellEditor(final UITextField textField) { // super(textField); // this.jTextField = textField; // this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); // } // // @Override // public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { // editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // oldName = editingNO.getName(); // // delegate.setValue(oldName); // // editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); // // return editorComponent; // } // // @Override // // public boolean isCellEditable(EventObject anEvent) { // NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // return !(no.getName() == Inter.getLocText("Role")); // } // // @Override // public Object getCellEditorValue() { // newName = super.getCellEditorValue().toString(); // editingNO.setName(newName); // return editingNO; // } // // // private boolean checkRoleNameNotEmpty() { // refreshDockingView(); // // String currentText = delegate.getCellEditorValue().toString(); // boolean isContained = false; // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null && // !ComparatorUtils.equals(oldName, currentText)) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if(ComparatorUtils.equals(_authority.getName(), currentText)){ // isContained = true; // break; // } // } // } catch (Exception e) { // } // } // // if (currentText.isEmpty() || isContained) { // JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // delegate.setValue(oldName); // return false; // } // return true; // } // // /* // * 下面两个方法是CellEditorListener的 // */ // @Override // public void editingCanceled(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // roleTree.stopEditing(); // if (treePath == null) { // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // @Override // public void editingStopped(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // } // // private void changeValue() { // newName = delegate.getCellEditorValue().toString(); // if (!newName.isEmpty() && newName != oldName) { // roleTree.setSelectedRoleName(newName); // op.rename(oldName, newName); // // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if (ComparatorUtils.equals(_authority.getName(), oldName)) { // _authority.setName(newName); // } // } // } catch (Exception e) { // } // } // // try { // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e) { // FRContext.getLogger().error(e.getMessage(), e); // } // } // } // } /** * 展开树 * @param tree 树 * @param isExpand 是否展开 */ public void expandTree(JTree tree, boolean isExpand) { TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), isExpand); } private void expandAll(JTree tree, TreePath parent, boolean expand) { TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } if (expand) { tree.expandPath(parent); } else { tree.collapsePath(parent); } } } \ No newline at end of file +package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; import com.fr.base.FRCoreContext; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.ToolBarDef; import com.fr.general.Inter; import com.fr.general.VT4FR; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Enumeration; /** * 设计器左下角面板,用于在权限编辑时存放角色 * Author : daisy * Date: 13-8-30 * Time: 下午2:22 */ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { private static final int REPORT_PLATEFORM_MANAGE = 0; private static final int FS_MANAGE = 1; private static final int LEFT_GAP = -125; private static boolean isSupportFS = false; private TreePath treePath = null; private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static RoleTree roleTree; // carl:我先屏了,现在半拉子,等客户要了再好好做 // private AddAction addAction = new AddAction(); // private RemoveAction removeAction = new RemoveAction(); private RefreshAction refreshAction = new RefreshAction(); private UIHeadGroup buttonGroup; private RoleSourceOP op; protected String[] roleNames = new String[2]; public synchronized static ReportAndFSManagePane getInstance() { singleton.op = new RoleSourceOP(); singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); singleton.setDefaultSelectedRole(); return singleton; } public ReportAndFSManagePane() { initRoleTree(); this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); this.add(iniToolBarPane(), BorderLayout.NORTH); refreshAction.setEnabled(true); UIScrollPane scrollPane = new UIScrollPane(roleTree); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(4, 4)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); registerDSChangeListener(); } private void initRoleTree() { roleTree = new RoleTree() { public void refreshRoleTree(String selectedRole) { super.refreshRoleTree(selectedRole); changeAlreadyEditedPaneRole(selectedRole); } protected void doWithValueChanged(TreeSelectionEvent e) { super.doWithValueChanged(e); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); setSelectedRole(roleTree.getSelectedRoleName(), parent); } protected void setTabRoleName(String roleName) { roleNames[getMode()] = roleTree.getSelectedRoleName(); } }; roleTree.setEnabled(true); roleTree.setEditable(false); // RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); // treeCellEditor.addCellEditorListener(treeCellEditor); // roleTree.setCellEditor(treeCellEditor); roleTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); roleTree.setEditable(false); // int row = roleTree.getRowForLocation(e.getX(), e.getY()); // TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); // if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // if (!(ap instanceof DaoAuthenticationProvider)) { // roleTree.setEditable(true); // roleTree.startEditingAtPath(path); // treePath = path; // } // } } }); } private void changeAlreadyEditedPaneRole(String selectedRole) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); roleTree.setSelectedRole(selectedRole, parent); } public void setDefaultSelectedRole() { //设置选中的节点 TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); String selectedRole = null; if (singleton != null) { selectedRole = roleNames[getMode()]; } if (selectedRole == null) { if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { return; } selectedRole = node.getFirstChild().getChildAt(0).toString(); } roleTree.setSelectedRole(selectedRole, parent); } public RoleTree getRoleTree() { return roleTree; } /** * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) */ private void checkChanges() { //如若有变化,则弹出下面的对话框 int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } private JPanel iniToolBarPane() { ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); toolbarPane.add(toolBar, BorderLayout.CENTER); return toolbarPane; } private void initbuttonGroup() { Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; String[] textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; buttonGroup = new UIHeadGroup(iconArray, textArray) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { op.setDataMode(getMode()); //判断是否可编辑 refreshDockingView(); } setDefaultSelectedRole(); if (singleton != null) { changeAlreadyEditedPaneRole(roleNames[getMode()]); } } }; buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); buttonGroup.setNeedLeftRightOutLine(false); } private int getMode(){ return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; } // /** // * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 // */ // public void checkToolButtonsEnabled() { // if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // PrivilegeFilter pf = pm.getPrivilegeFilter(); // boolean isClickable = !(ap instanceof DaoAuthenticationProvider) // && pf instanceof AuthorityControlFilter; // addAction.setEnabled(isClickable); // removeAction.setEnabled(isClickable); // } else { // addAction.setEnabled(false); // removeAction.setEnabled(false); // } // // } /** * 刷新界面 */ public void refreshDockingView() { populate(new RoleSourceOP()); // this.checkToolButtonsEnabled(); } private void populate(RoleSourceOP op) { this.op = op; roleTree.populate(op); expandTree(roleTree, true); } public String getViewTitle() { return null; } public Icon getViewIcon() { return null; } /** * 最佳定位 * @return 定位 */ public Location preferredLocation() { return null; } /** * 注册数据库改变的响应的Listener */ public void registerDSChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } }); } // private class AddAction extends UpdateAction { // public AddAction() { // this.setName(Inter.getLocText("Add")); // this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); // } // // @Override // public void actionPerformed(ActionEvent e) { // refreshDockingView(); // // DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); // ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); // ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); // String newName = Inter.getLocText("newNode") + (++newIndex); // parentNode.add(new ExpandMutableTreeNode(newName)); // op.addAction(newName); // roleTree.updateUI(); // // try { // synchronized (AuthorityRoleDAOManager.class) { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { // newName = Inter.getLocText("newNode") + (++newIndex); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); // // AuthorityRoleDAOManager.doEnd(pf); // } // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // } // } // private class RemoveAction extends UpdateAction { // // public RemoveAction() { // this.setName(Inter.getLocText("Remove")); // this.setSmallIcon(UIConstants.CLEAR_ICON); // } // // @Override // public void actionPerformed(ActionEvent e) { // // // NameObject selectedNO = roleTree.getSelectedNameObject(); // // if (selectedNO == null) { // return; // } // // int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", // Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); // if (returnVal == JOptionPane.OK_OPTION) { // op.removeAction(selectedNO.getName()); // // try { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // roleTree.requestFocus(); // roleTree.setSelectionRow(roleTree.getRowCount() - 1); // } // } // } /* * 刷新ReportletsTree */ private class RefreshAction extends UpdateAction { public RefreshAction() { this.setName(Inter.getLocText("FR-Designer_Refresh")); this.setSmallIcon(UIConstants.REFRESH_ICON); } @Override public void actionPerformed(ActionEvent evt) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } // private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { // // private NameObject editingNO; // private String oldName; // private String newName; // private UITextField jTextField; // // public RoleTreeCellEditor(final UITextField textField) { // super(textField); // this.jTextField = textField; // this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); // } // // @Override // public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { // editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // oldName = editingNO.getName(); // // delegate.setValue(oldName); // // editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); // // return editorComponent; // } // // @Override // // public boolean isCellEditable(EventObject anEvent) { // NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // return !(no.getName() == Inter.getLocText("Role")); // } // // @Override // public Object getCellEditorValue() { // newName = super.getCellEditorValue().toString(); // editingNO.setName(newName); // return editingNO; // } // // // private boolean checkRoleNameNotEmpty() { // refreshDockingView(); // // String currentText = delegate.getCellEditorValue().toString(); // boolean isContained = false; // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null && // !ComparatorUtils.equals(oldName, currentText)) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if(ComparatorUtils.equals(_authority.getName(), currentText)){ // isContained = true; // break; // } // } // } catch (Exception e) { // } // } // // if (currentText.isEmpty() || isContained) { // JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // delegate.setValue(oldName); // return false; // } // return true; // } // // /* // * 下面两个方法是CellEditorListener的 // */ // @Override // public void editingCanceled(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // roleTree.stopEditing(); // if (treePath == null) { // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // @Override // public void editingStopped(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // } // // private void changeValue() { // newName = delegate.getCellEditorValue().toString(); // if (!newName.isEmpty() && newName != oldName) { // roleTree.setSelectedRoleName(newName); // op.rename(oldName, newName); // // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if (ComparatorUtils.equals(_authority.getName(), oldName)) { // _authority.setName(newName); // } // } // } catch (Exception e) { // } // } // // try { // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e) { // FRContext.getLogger().error(e.getMessage(), e); // } // } // } // } /** * 展开树 * @param tree 树 * @param isExpand 是否展开 */ public void expandTree(JTree tree, boolean isExpand) { TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), isExpand); } private void expandAll(JTree tree, TreePath parent, boolean expand) { TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } if (expand) { tree.expandPath(parent); } else { tree.collapsePath(parent); } } } \ No newline at end of file From a67e88d662297a5f2846a49244f0c075bcf0779e Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Wed, 13 Sep 2017 18:48:13 +0800 Subject: [PATCH 04/37] fix --- .../roleAuthority/ReportAndFSManagePane.java | 541 +++++++++++++++++- 1 file changed, 540 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java index 98c570786c..2c332c3129 100644 --- a/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer_base/src/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -1 +1,540 @@ -package com.fr.design.roleAuthority; import com.fr.base.BaseUtils; import com.fr.base.FRCoreContext; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.tabledata.Prepare4DataSourceChange; import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.ToolBarDef; import com.fr.general.Inter; import com.fr.general.VT4FR; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Enumeration; /** * 设计器左下角面板,用于在权限编辑时存放角色 * Author : daisy * Date: 13-8-30 * Time: 下午2:22 */ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { private static final int REPORT_PLATEFORM_MANAGE = 0; private static final int FS_MANAGE = 1; private static final int LEFT_GAP = -125; private static boolean isSupportFS = false; private TreePath treePath = null; private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static RoleTree roleTree; // carl:我先屏了,现在半拉子,等客户要了再好好做 // private AddAction addAction = new AddAction(); // private RemoveAction removeAction = new RemoveAction(); private RefreshAction refreshAction = new RefreshAction(); private UIHeadGroup buttonGroup; private RoleSourceOP op; protected String[] roleNames = new String[2]; public synchronized static ReportAndFSManagePane getInstance() { singleton.op = new RoleSourceOP(); singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); singleton.setDefaultSelectedRole(); return singleton; } public ReportAndFSManagePane() { initRoleTree(); this.setLayout(new BorderLayout(4, 0)); this.setBorder(null); this.add(iniToolBarPane(), BorderLayout.NORTH); refreshAction.setEnabled(true); UIScrollPane scrollPane = new UIScrollPane(roleTree); scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); initbuttonGroup(); JPanel jPanel = new JPanel(new BorderLayout(4, 4)); JPanel buttonPane = new JPanel(new GridLayout()); buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); buttonPane.add(buttonGroup, BorderLayout.CENTER); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); registerDSChangeListener(); } private void initRoleTree() { roleTree = new RoleTree() { public void refreshRoleTree(String selectedRole) { super.refreshRoleTree(selectedRole); changeAlreadyEditedPaneRole(selectedRole); } protected void doWithValueChanged(TreeSelectionEvent e) { super.doWithValueChanged(e); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); setSelectedRole(roleTree.getSelectedRoleName(), parent); } protected void setTabRoleName(String roleName) { roleNames[getMode()] = roleTree.getSelectedRoleName(); } }; roleTree.setEnabled(true); roleTree.setEditable(false); // RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); // treeCellEditor.addCellEditorListener(treeCellEditor); // roleTree.setCellEditor(treeCellEditor); roleTree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); roleTree.setEditable(false); // int row = roleTree.getRowForLocation(e.getX(), e.getY()); // TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); // if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // if (!(ap instanceof DaoAuthenticationProvider)) { // roleTree.setEditable(true); // roleTree.startEditingAtPath(path); // treePath = path; // } // } } }); } private void changeAlreadyEditedPaneRole(String selectedRole) { RolesAlreadyEditedPane.getInstance().refreshDockingView(); RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); roleTree.setSelectedRole(selectedRole, parent); } public void setDefaultSelectedRole() { //设置选中的节点 TreeNode root = (TreeNode) roleTree.getModel().getRoot(); TreePath parent = new TreePath(root); ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); String selectedRole = null; if (singleton != null) { selectedRole = roleNames[getMode()]; } if (selectedRole == null) { if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { return; } selectedRole = node.getFirstChild().getChildAt(0).toString(); } roleTree.setSelectedRole(selectedRole, parent); } public RoleTree getRoleTree() { return roleTree; } /** * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) */ private void checkChanges() { //如若有变化,则弹出下面的对话框 int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); if (returnVal == JOptionPane.OK_OPTION) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } private JPanel iniToolBarPane() { ToolBarDef toolbarDef = new ToolBarDef(); toolbarDef.addShortCut(refreshAction); UIToolbar toolBar = ToolBarDef.createJToolBar(); toolbarDef.updateToolBar(toolBar); JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); toolbarPane.add(toolBar, BorderLayout.CENTER); return toolbarPane; } private void initbuttonGroup() { Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; String[] textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; buttonGroup = new UIHeadGroup(iconArray, textArray) { public void tabChanged(int index) { roleTree.setEditable(false); if (op != null) { op.setDataMode(getMode()); //判断是否可编辑 refreshDockingView(); } setDefaultSelectedRole(); if (singleton != null) { changeAlreadyEditedPaneRole(roleNames[getMode()]); } } }; buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); buttonGroup.setNeedLeftRightOutLine(false); } private int getMode(){ return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; } // /** // * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 // */ // public void checkToolButtonsEnabled() { // if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { // PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); // AuthenticationProvider ap = pm.getAuthenticationProvider(); // PrivilegeFilter pf = pm.getPrivilegeFilter(); // boolean isClickable = !(ap instanceof DaoAuthenticationProvider) // && pf instanceof AuthorityControlFilter; // addAction.setEnabled(isClickable); // removeAction.setEnabled(isClickable); // } else { // addAction.setEnabled(false); // removeAction.setEnabled(false); // } // // } /** * 刷新界面 */ public void refreshDockingView() { populate(new RoleSourceOP()); // this.checkToolButtonsEnabled(); } private void populate(RoleSourceOP op) { this.op = op; roleTree.populate(op); expandTree(roleTree, true); } public String getViewTitle() { return null; } public Icon getViewIcon() { return null; } /** * 最佳定位 * @return 定位 */ public Location preferredLocation() { return null; } /** * 注册数据库改变的响应的Listener */ public void registerDSChangeListener() { DesignTableDataManager.addDsChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } }); } // private class AddAction extends UpdateAction { // public AddAction() { // this.setName(Inter.getLocText("Add")); // this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); // } // // @Override // public void actionPerformed(ActionEvent e) { // refreshDockingView(); // // DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); // ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); // ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); // String newName = Inter.getLocText("newNode") + (++newIndex); // parentNode.add(new ExpandMutableTreeNode(newName)); // op.addAction(newName); // roleTree.updateUI(); // // try { // synchronized (AuthorityRoleDAOManager.class) { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { // newName = Inter.getLocText("newNode") + (++newIndex); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); // // AuthorityRoleDAOManager.doEnd(pf); // } // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // } // } // private class RemoveAction extends UpdateAction { // // public RemoveAction() { // this.setName(Inter.getLocText("Remove")); // this.setSmallIcon(UIConstants.CLEAR_ICON); // } // // @Override // public void actionPerformed(ActionEvent e) { // // // NameObject selectedNO = roleTree.getSelectedNameObject(); // // if (selectedNO == null) { // return; // } // // int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", // Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); // if (returnVal == JOptionPane.OK_OPTION) { // op.removeAction(selectedNO.getName()); // // try { // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); // // AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e1) { // FRContext.getLogger().error(e1.getMessage(), e1); // } // // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // roleTree.requestFocus(); // roleTree.setSelectionRow(roleTree.getRowCount() - 1); // } // } // } /* * 刷新ReportletsTree */ private class RefreshAction extends UpdateAction { public RefreshAction() { this.setName(Inter.getLocText("FR-Designer_Refresh")); this.setSmallIcon(UIConstants.REFRESH_ICON); } @Override public void actionPerformed(ActionEvent evt) { roleTree.refreshTreeNode(); expandTree(roleTree, true); roleTree.updateUI(); } } // private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { // // private NameObject editingNO; // private String oldName; // private String newName; // private UITextField jTextField; // // public RoleTreeCellEditor(final UITextField textField) { // super(textField); // this.jTextField = textField; // this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); // } // // @Override // public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { // editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // oldName = editingNO.getName(); // // delegate.setValue(oldName); // // editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); // // return editorComponent; // } // // @Override // // public boolean isCellEditable(EventObject anEvent) { // NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); // return !(no.getName() == Inter.getLocText("Role")); // } // // @Override // public Object getCellEditorValue() { // newName = super.getCellEditorValue().toString(); // editingNO.setName(newName); // return editingNO; // } // // // private boolean checkRoleNameNotEmpty() { // refreshDockingView(); // // String currentText = delegate.getCellEditorValue().toString(); // boolean isContained = false; // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null && // !ComparatorUtils.equals(oldName, currentText)) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if(ComparatorUtils.equals(_authority.getName(), currentText)){ // isContained = true; // break; // } // } // } catch (Exception e) { // } // } // // if (currentText.isEmpty() || isContained) { // JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // delegate.setValue(oldName); // return false; // } // return true; // } // // /* // * 下面两个方法是CellEditorListener的 // */ // @Override // public void editingCanceled(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // roleTree.stopEditing(); // if (treePath == null) { // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // } // // @Override // public void editingStopped(ChangeEvent e) { // if (!checkRoleNameNotEmpty()) { // treePath = null; // return; // } // changeValue(); // roleTree.refreshTreeNode(); // expandTree(roleTree, true); // roleTree.updateUI(); // } // // private void changeValue() { // newName = delegate.getCellEditorValue().toString(); // if (!newName.isEmpty() && newName != oldName) { // roleTree.setSelectedRoleName(newName); // op.rename(oldName, newName); // // AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); // if (pf != null) { // try { // Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); // // while (iterator.hasNext()) { // AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) // .getValue(); // Authority _authority = authorityAllocation.getAuthority(); // if (ComparatorUtils.equals(_authority.getName(), oldName)) { // _authority.setName(newName); // } // } // } catch (Exception e) { // } // } // // try { // AuthorityRoleDAOManager.doEnd(pf); // } catch (Exception e) { // FRContext.getLogger().error(e.getMessage(), e); // } // } // } // } /** * 展开树 * @param tree 树 * @param isExpand 是否展开 */ public void expandTree(JTree tree, boolean isExpand) { TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), isExpand); } private void expandAll(JTree tree, TreePath parent, boolean expand) { TreeNode node = (TreeNode) parent.getLastPathComponent(); if (node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { TreeNode n = (TreeNode) e.nextElement(); TreePath path = parent.pathByAddingChild(n); expandAll(tree, path, expand); } } if (expand) { tree.expandPath(parent); } else { tree.collapsePath(parent); } } } \ No newline at end of file +package com.fr.design.roleAuthority; + +import com.fr.base.BaseUtils; +import com.fr.base.FRCoreContext; +import com.fr.design.actions.UpdateAction; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.DesignTableDataManager; +import com.fr.design.data.tabledata.Prepare4DataSourceChange; +import com.fr.design.gui.ibutton.UIHeadGroup; +import com.fr.design.gui.icontainer.UIScrollPane; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DockingView; +import com.fr.design.menu.ToolBarDef; +import com.fr.general.Inter; +import com.fr.general.VT4FR; + +import javax.swing.*; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Enumeration; + +/** + * 设计器左下角面板,用于在权限编辑时存放角色 + * Author : daisy + * Date: 13-8-30 + * Time: 下午2:22 + */ +public class ReportAndFSManagePane extends DockingView implements Prepare4DataSourceChange { + + private static final int REPORT_PLATEFORM_MANAGE = 0; + private static final int FS_MANAGE = 1; + private static final int LEFT_GAP = -125; + private static boolean isSupportFS = false; + private TreePath treePath = null; + + private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); + + private static RoleTree roleTree; + // carl:我先屏了,现在半拉子,等客户要了再好好做 +// private AddAction addAction = new AddAction(); +// private RemoveAction removeAction = new RemoveAction(); + private RefreshAction refreshAction = new RefreshAction(); + private UIHeadGroup buttonGroup; + private RoleSourceOP op; + protected String[] roleNames = new String[2]; + + public synchronized static ReportAndFSManagePane getInstance() { + singleton.op = new RoleSourceOP(); + singleton.op.setDataMode(isSupportFS ? FS_MANAGE : REPORT_PLATEFORM_MANAGE); + singleton.setDefaultSelectedRole(); + return singleton; + + } + + public ReportAndFSManagePane() { + initRoleTree(); + this.setLayout(new BorderLayout(4, 0)); + this.setBorder(null); + this.add(iniToolBarPane(), BorderLayout.NORTH); + refreshAction.setEnabled(true); + UIScrollPane scrollPane = new UIScrollPane(roleTree); + scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 0)); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + initbuttonGroup(); + JPanel jPanel = new JPanel(new BorderLayout(4, 4)); + JPanel buttonPane = new JPanel(new GridLayout()); + buttonPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.LINE_COLOR)); + buttonPane.add(buttonGroup, BorderLayout.CENTER); + jPanel.add(buttonPane, BorderLayout.NORTH); + jPanel.add(scrollPane, BorderLayout.CENTER); + this.add(jPanel, BorderLayout.CENTER); + registerDSChangeListener(); + } + + private void initRoleTree() { + roleTree = new RoleTree() { + public void refreshRoleTree(String selectedRole) { + super.refreshRoleTree(selectedRole); + changeAlreadyEditedPaneRole(selectedRole); + } + + + protected void doWithValueChanged(TreeSelectionEvent e) { + super.doWithValueChanged(e); + TreeNode root = (TreeNode) roleTree.getModel().getRoot(); + TreePath parent = new TreePath(root); + setSelectedRole(roleTree.getSelectedRoleName(), parent); + + } + + protected void setTabRoleName(String roleName) { + roleNames[getMode()] = roleTree.getSelectedRoleName(); + } + }; + roleTree.setEnabled(true); + roleTree.setEditable(false); +// RoleTreeCellEditor treeCellEditor = new RoleTreeCellEditor(new UITextField()); +// treeCellEditor.addCellEditorListener(treeCellEditor); +// roleTree.setCellEditor(treeCellEditor); + roleTree.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + super.mouseClicked(e); + roleTree.setEditable(false); +// int row = roleTree.getRowForLocation(e.getX(), e.getY()); +// TreePath path = roleTree.getPathForLocation(e.getX(), e.getY()); +// if (e.getClickCount() == 2 && buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { +// PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); +// AuthenticationProvider ap = pm.getAuthenticationProvider(); +// if (!(ap instanceof DaoAuthenticationProvider)) { +// roleTree.setEditable(true); +// roleTree.startEditingAtPath(path); +// treePath = path; +// } +// } + } + }); + } + + private void changeAlreadyEditedPaneRole(String selectedRole) { + RolesAlreadyEditedPane.getInstance().refreshDockingView(); + RoleTree roleTree = RolesAlreadyEditedPane.getInstance().getRoleTree(); + TreeNode root = (TreeNode) roleTree.getModel().getRoot(); + TreePath parent = new TreePath(root); + roleTree.setSelectedRole(selectedRole, parent); + } + + public void setDefaultSelectedRole() { + //设置选中的节点 + TreeNode root = (TreeNode) roleTree.getModel().getRoot(); + TreePath parent = new TreePath(root); + ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); + String selectedRole = null; + if (singleton != null) { + selectedRole = roleNames[getMode()]; + } + if (selectedRole == null) { + if (node.getChildCount() <= 0 || node.getFirstChild().getChildCount() <= 0) { + return; + } + selectedRole = node.getFirstChild().getChildAt(0).toString(); + } + roleTree.setSelectedRole(selectedRole, parent); + } + + + public RoleTree getRoleTree() { + return roleTree; + } + + /** + * 检查f) 每增删改一个角色信息(及时保存),先对比下privilege下之前的角色信息有没有发生变化(即在此期间有没有在其他途径中修改过) + */ + private void checkChanges() { + //如若有变化,则弹出下面的对话框 + int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Role_changed_isRefresh") + "?", + Inter.getLocText("FR-Designer_Refresh"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + roleTree.refreshTreeNode(); + expandTree(roleTree, true); + roleTree.updateUI(); + } + + } + + private JPanel iniToolBarPane() { + ToolBarDef toolbarDef = new ToolBarDef(); + toolbarDef.addShortCut(refreshAction); + UIToolbar toolBar = ToolBarDef.createJToolBar(); + toolbarDef.updateToolBar(toolBar); + JPanel toolbarPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + toolbarPane.add(toolBar, BorderLayout.CENTER); + return toolbarPane; + } + + private void initbuttonGroup() { + Icon[] iconArray = new Icon[]{BaseUtils.readIcon("/com/fr/web/images/platform/demo.png")}; + String[] textArray = new String[]{Inter.getLocText("FR-Designer_FS_Name")}; + buttonGroup = new UIHeadGroup(iconArray, textArray) { + public void tabChanged(int index) { + roleTree.setEditable(false); + if (op != null) { + op.setDataMode(getMode()); + //判断是否可编辑 + refreshDockingView(); + } + setDefaultSelectedRole(); + if (singleton != null) { + changeAlreadyEditedPaneRole(roleNames[getMode()]); + } + } + }; + buttonGroup.setBorder(BorderFactory.createMatteBorder(1, LEFT_GAP, 0, 0, UIConstants.LINE_COLOR)); + buttonGroup.setNeedLeftRightOutLine(false); + } + + + private int getMode(){ + return isSupportFS?FS_MANAGE: REPORT_PLATEFORM_MANAGE; + } + + +// /** +// * 检查看看是否可以增删刷新按钮是都可以编辑,并且检查角色树是不是可以编辑 +// */ +// public void checkToolButtonsEnabled() { +// if (buttonGroup.getSelectedIndex() == REPORT_PLATEFORM_MANAGE) { +// PrivilegeManagerProvider pm = PrivilegeManager.getProviderInstance(); +// AuthenticationProvider ap = pm.getAuthenticationProvider(); +// PrivilegeFilter pf = pm.getPrivilegeFilter(); +// boolean isClickable = !(ap instanceof DaoAuthenticationProvider) +// && pf instanceof AuthorityControlFilter; +// addAction.setEnabled(isClickable); +// removeAction.setEnabled(isClickable); +// } else { +// addAction.setEnabled(false); +// removeAction.setEnabled(false); +// } +// +// } + + + /** + * 刷新界面 + */ + public void refreshDockingView() { + populate(new RoleSourceOP()); +// this.checkToolButtonsEnabled(); + } + + private void populate(RoleSourceOP op) { + this.op = op; + roleTree.populate(op); + expandTree(roleTree, true); + } + + public String getViewTitle() { + return null; + } + + public Icon getViewIcon() { + return null; + } + + /** + * 最佳定位 + * @return 定位 + */ + public Location preferredLocation() { + return null; + } + + /** + * 注册数据库改变的响应的Listener + */ + public void registerDSChangeListener() { + DesignTableDataManager.addDsChangeListener(new ChangeListener() { + + public void stateChanged(ChangeEvent e) { + roleTree.refreshTreeNode(); + expandTree(roleTree, true); + roleTree.updateUI(); + } + }); + + } + +// private class AddAction extends UpdateAction { +// public AddAction() { +// this.setName(Inter.getLocText("Add")); +// this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); +// } +// +// @Override +// public void actionPerformed(ActionEvent e) { +// refreshDockingView(); +// +// DefaultTreeModel treeModel = (DefaultTreeModel) roleTree.getModel(); +// ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); +// ExpandMutableTreeNode parentNode = (ExpandMutableTreeNode) root.getChildAt(0); +// String newName = Inter.getLocText("newNode") + (++newIndex); +// parentNode.add(new ExpandMutableTreeNode(newName)); +// op.addAction(newName); +// roleTree.updateUI(); +// +// try { +// synchronized (AuthorityRoleDAOManager.class) { +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); +// +// if (AuthorityRoleDAOManager.getAuthorityAllocation(pf, newName) != null) { +// newName = Inter.getLocText("newNode") + (++newIndex); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// } +// +// AuthorityRoleDAOManager.addAuthorityRole(pf, new Authority(newName), new Allocation(), false, true); +// +// AuthorityRoleDAOManager.doEnd(pf); +// } +// } catch (Exception e1) { +// FRContext.getLogger().error(e1.getMessage(), e1); +// } +// } +// } + +// private class RemoveAction extends UpdateAction { +// +// public RemoveAction() { +// this.setName(Inter.getLocText("Remove")); +// this.setSmallIcon(UIConstants.CLEAR_ICON); +// } +// +// @Override +// public void actionPerformed(ActionEvent e) { +// +// +// NameObject selectedNO = roleTree.getSelectedNameObject(); +// +// if (selectedNO == null) { +// return; +// } +// +// int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Utils-Are_you_sure_to_remove_the_selected_item") + ":" + selectedNO.getName() + "?", +// Inter.getLocText("Remove"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); +// if (returnVal == JOptionPane.OK_OPTION) { +// op.removeAction(selectedNO.getName()); +// +// try { +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(true); +// +// AuthorityRoleDAOManager.removeAuthorityRole(pf, new Authority(selectedNO.getName()), true); +// AuthorityRoleDAOManager.doEnd(pf); +// } catch (Exception e1) { +// FRContext.getLogger().error(e1.getMessage(), e1); +// } +// +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// roleTree.updateUI(); +// roleTree.requestFocus(); +// roleTree.setSelectionRow(roleTree.getRowCount() - 1); +// } +// } +// } + + + /* + * 刷新ReportletsTree + */ + private class RefreshAction extends UpdateAction { + + public RefreshAction() { + this.setName(Inter.getLocText("FR-Designer_Refresh")); + this.setSmallIcon(UIConstants.REFRESH_ICON); + } + + @Override + public void actionPerformed(ActionEvent evt) { + roleTree.refreshTreeNode(); + expandTree(roleTree, true); + roleTree.updateUI(); + } + } + + +// private class RoleTreeCellEditor extends DefaultCellEditor implements TreeCellEditor, CellEditorListener { +// +// private NameObject editingNO; +// private String oldName; +// private String newName; +// private UITextField jTextField; +// +// public RoleTreeCellEditor(final UITextField textField) { +// super(textField); +// this.jTextField = textField; +// this.jTextField.setPreferredSize(new Dimension(DesignerEnvManager.getEnvManager().getLastWestRegionContainerWidth() - 5, this.jTextField.getHeight())); +// } +// +// @Override +// public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) { +// editingNO = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); +// oldName = editingNO.getName(); +// +// delegate.setValue(oldName); +// +// editorComponent.setPreferredSize(new java.awt.Dimension(ReportAndFSManagePane.this.getPreferredSize().width, editorComponent.getPreferredSize().height)); +// +// return editorComponent; +// } +// +// @Override +// +// public boolean isCellEditable(EventObject anEvent) { +// NameObject no = ReportAndFSManagePane.this.roleTree.getSelectedNameObject(); +// return !(no.getName() == Inter.getLocText("Role")); +// } +// +// @Override +// public Object getCellEditorValue() { +// newName = super.getCellEditorValue().toString(); +// editingNO.setName(newName); +// return editingNO; +// } +// +// +// private boolean checkRoleNameNotEmpty() { +// refreshDockingView(); +// +// String currentText = delegate.getCellEditorValue().toString(); +// boolean isContained = false; +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); +// if (pf != null && +// !ComparatorUtils.equals(oldName, currentText)) { +// try { +// Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); +// +// while (iterator.hasNext()) { +// AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) +// .getValue(); +// Authority _authority = authorityAllocation.getAuthority(); +// if(ComparatorUtils.equals(_authority.getName(), currentText)){ +// isContained = true; +// break; +// } +// } +// } catch (Exception e) { +// } +// } +// +// if (currentText.isEmpty() || isContained) { +// JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("RoleName_Can_Not_Be_Null") + "!"); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// delegate.setValue(oldName); +// return false; +// } +// return true; +// } +// +// /* +// * 下面两个方法是CellEditorListener的 +// */ +// @Override +// public void editingCanceled(ChangeEvent e) { +// if (!checkRoleNameNotEmpty()) { +// treePath = null; +// return; +// } +// roleTree.stopEditing(); +// if (treePath == null) { +// return; +// } +// changeValue(); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// } +// +// @Override +// public void editingStopped(ChangeEvent e) { +// if (!checkRoleNameNotEmpty()) { +// treePath = null; +// return; +// } +// changeValue(); +// roleTree.refreshTreeNode(); +// expandTree(roleTree, true); +// roleTree.updateUI(); +// } +// +// private void changeValue() { +// newName = delegate.getCellEditorValue().toString(); +// if (!newName.isEmpty() && newName != oldName) { +// roleTree.setSelectedRoleName(newName); +// op.rename(oldName, newName); +// +// AuthorityControlFilter pf = AuthorityRoleDAOManager.getAuthControlFilter(false); +// if (pf != null) { +// try { +// Iterator iterator = AuthorityRoleDAOManager.authorityAllocationIterator(pf); +// +// while (iterator.hasNext()) { +// AuthorityAllocation authorityAllocation = (AuthorityAllocation) ((Map.Entry) iterator.next()) +// .getValue(); +// Authority _authority = authorityAllocation.getAuthority(); +// if (ComparatorUtils.equals(_authority.getName(), oldName)) { +// _authority.setName(newName); +// } +// } +// } catch (Exception e) { +// } +// } +// +// try { +// AuthorityRoleDAOManager.doEnd(pf); +// } catch (Exception e) { +// FRContext.getLogger().error(e.getMessage(), e); +// } +// } +// } +// } + + + /** + * 展开树 + * @param tree 树 + * @param isExpand 是否展开 + */ + public void expandTree(JTree tree, boolean isExpand) { + TreeNode root = (TreeNode) tree.getModel().getRoot(); + expandAll(tree, new TreePath(root), isExpand); + } + + + private void expandAll(JTree tree, TreePath parent, boolean expand) { + TreeNode node = (TreeNode) parent.getLastPathComponent(); + if (node.getChildCount() >= 0) { + for (Enumeration e = node.children(); e.hasMoreElements(); ) { + TreeNode n = (TreeNode) e.nextElement(); + TreePath path = parent.pathByAddingChild(n); + expandAll(tree, path, expand); + } + } + if (expand) { + tree.expandPath(parent); + } else { + tree.collapsePath(parent); + } + } + +} \ No newline at end of file From cb9cfc27efff79baf05303ac539ae12665bd7331 Mon Sep 17 00:00:00 2001 From: finereport Date: Mon, 18 Sep 2017 22:11:41 +0800 Subject: [PATCH 05/37] =?UTF-8?q?RES-2=20=E5=85=B3=E8=81=94=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E9=A2=84=E8=A7=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/DesignTableDataManager.java | 62 +++++++++++++++---- .../datapane/preview/PreviewTablePane.java | 5 +- .../wrapper/AbstractTableDataWrapper.java | 2 +- designer_base/src/com/fr/env/RemoteEnv.java | 13 +++- 4 files changed, 67 insertions(+), 15 deletions(-) diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 5248c9626a..17afec4717 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -6,19 +6,24 @@ import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreXmlUtils; -import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedureConstants; -import com.fr.design.data.tabledata.wrapper.*; import com.fr.design.DesignModelAdapter; +import com.fr.design.data.datapane.preview.PreviewTablePane; +import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper; +import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; +import com.fr.design.data.tabledata.wrapper.StoreProcedureNameWrapper; +import com.fr.design.data.tabledata.wrapper.TableDataFactory; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.parameter.ParameterInputPane; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.general.ComparatorUtils; @@ -34,9 +39,16 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.io.ByteArrayOutputStream; import java.text.Collator; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; +import java.util.Timer; +import java.util.TimerTask; /** * 设计器管理操作数据集的类: @@ -55,11 +67,11 @@ public abstract class DesignTableDataManager { * 其实globalDsCache没有绝对的必要,只是为了操作方便。如果没有它,那么每次清空服务器数据集或者存储过程的时候,还要去遍历找一下, * 这个操作可能比较复杂 。 从减少代码复杂度的角度看,还是很有必要的 */ - private static java.util.Map globalDsCache = new ConcurrentHashMap(); - private static java.util.Map dsNameChangedMap = new ConcurrentHashMap(); + private static java.util.Map globalDsCache = new java.util.HashMap(); + private static java.util.Map dsNameChangedMap = new HashMap(); // private static List dsListeners = new ArrayList(); - private static Map> dsListenersMap = new ConcurrentHashMap>();; + private static Map> dsListenersMap = new HashMap>(); public static String NO_PARAMETER = "no_paramater_pane"; @@ -352,7 +364,20 @@ public abstract class DesignTableDataManager { * @throws Exception 异常 */ public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(tabledata, rowCount, true, needLoadingBar); + return previewTableData(null, tabledata, rowCount, true, needLoadingBar); + } + + /** + * 预览需要参数的数据集 + * + * @param tabledata 数据集 + * @param rowCount 需要预览的行数 + * @param needLoadingBar 是否需要加载进度条 + * @return 数据集 + * @throws Exception 异常 + */ + public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { + return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar); } /** @@ -365,7 +390,20 @@ public abstract class DesignTableDataManager { * @throws Exception 异常 */ public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(tabledata, rowCount, false, needLoadingBar); + return previewTableData(null, tabledata, rowCount, false, needLoadingBar); + } + + /** + * 预览不需要参数的数据集 + * + * @param tabledata 数据集 + * @param rowCount 需要预览的行数 + * @param needLoadingBar 是否需要加载进度条 + * @return 数据集 + * @throws Exception 异常 + */ + public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { + return previewTableData(tableDataSource, tabledata, rowCount, false, needLoadingBar); } /** @@ -377,7 +415,7 @@ public abstract class DesignTableDataManager { * 而获取数据集的字段名字时,则没必要 * @return */ - private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { + private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); Env currentEnv = FRContext.getCurrentEnv(); ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata); @@ -407,7 +445,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - return currentEnv.previewTableData(tabledata, parameterMap, rowCount); + return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount); } catch (TableDataException e) { throw new TableDataException(e.getMessage(), e); } finally { diff --git a/designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java index 28e421b542..71e10728bd 100644 --- a/designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer_base/src/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -6,6 +6,7 @@ package com.fr.design.data.datapane.preview; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.base.TableData; +import com.fr.data.TableDataSource; import com.fr.data.impl.DBTableData; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; @@ -13,6 +14,7 @@ import com.fr.design.DesignerEnvManager; import com.fr.design.data.DesignTableDataManager; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicPane; +import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.iprogressbar.AutoProgressBar; @@ -362,7 +364,8 @@ public class PreviewTablePane extends BasicPane { } } connectionBar.close(); - previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(tableData, (int) maxPreviewNumberField.getValue(), true); + TableDataSource dataSource = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getTarget(); + previewTableData = DesignTableDataManager.previewTableDataNeedInputParameters(dataSource, tableData, (int) maxPreviewNumberField.getValue(), true); // parameterInputDialog // update之后的parameters,转成一个parameterMap,用于预览TableData PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue()); diff --git a/designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java b/designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java index 90e2adfab7..17d42b0e15 100644 --- a/designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java +++ b/designer_base/src/com/fr/design/data/tabledata/wrapper/AbstractTableDataWrapper.java @@ -58,7 +58,7 @@ public abstract class AbstractTableDataWrapper implements TableDataWrapper { EmbeddedTableData embeddedTableData = null; try { - embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tabledata, TableData.RESULT_NOT_NEED, false); + embeddedTableData = DesignTableDataManager.previewTableDataNotNeedInputParameters(tds, tabledata, TableData.RESULT_NOT_NEED, false); } catch (Exception e) { if (e.getMessage()!=null) { DesignUtils.errorMessage(e.getMessage()); diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 3c25fc7ff0..61ccb3ebaa 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -10,6 +10,7 @@ import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; import com.fr.base.Utils; import com.fr.base.remote.RemoteDeziConstants; +import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; @@ -1253,6 +1254,11 @@ public class RemoteEnv extends AbstractEnv { return DavXMLUtils.readXMLParameters(input); } + @Override + public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception { + return previewTableData(null, tableData, parameterMap, rowCount); + } + /** * 根据指定的参数生成一个实际可预览的数据集 * @@ -1262,7 +1268,7 @@ public class RemoteEnv extends AbstractEnv { * @return 实际的二维数据集 * @throws Exception 如果生成数据失败则抛出此异常 */ - public EmbeddedTableData previewTableData(Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { + public EmbeddedTableData previewTableData(TableDataSource dataSource, Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 把tableData写成xml文件到out @@ -1301,6 +1307,11 @@ public class RemoteEnv extends AbstractEnv { return previewTableData(tableData, parameterMap, -1); } + @Override + public Object previewTableData(TableDataSource dataSource, Object tableData, Map parameterMap, int start, int end, String[] cols, int[] colIdx) throws Exception { + return previewTableData(dataSource, tableData, parameterMap, -1); + } + /** * nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的 * From 8c22eab84b5efcc665af586833113d809773fde5 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 19 Sep 2017 14:45:08 +0800 Subject: [PATCH 06/37] =?UTF-8?q?REPORT-4652=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=AF=86=E7=A0=81=E6=9C=89=E7=89=B9=E6=AE=8A=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=EF=BC=8C=E6=B2=A1=E6=B3=95=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 3c25fc7ff0..11c48ec8f4 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -85,6 +85,7 @@ import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.Socket; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -157,6 +158,15 @@ public class RemoteEnv extends AbstractEnv { return password; } + // 修复密码中包含特殊字符,无法登录的问题 + private String getEncodedPassword() { + try { + return URLEncoder.encode(password, "UTF-8"); + } catch (UnsupportedEncodingException e) { + return password; + } + } + public void setPassword(String password) { this.password = password; clearUserID(); @@ -382,7 +392,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "test_server_connection"); para.put("user", user); - para.put("password", password); + para.put("password", getEncodedPassword()); if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) { return false; @@ -505,7 +515,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "r_sign_in"); para.put("user", user); - para.put("password", password); + para.put("password", getEncodedPassword()); simulaRPC(para, true); @@ -1990,7 +2000,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "design_get_designer_version"); para.put("user", user); - para.put("password", password); + para.put("password", getEncodedPassword()); HttpClient client = createHttpMethod(para, true); try { From 4183e3b50c374cff57c502d11332a648de4bbfe9 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 21 Sep 2017 11:25:04 +0800 Subject: [PATCH 07/37] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E9=99=85=E5=8C=96=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/report/UnitFieldPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/report/UnitFieldPane.java b/designer/src/com/fr/design/report/UnitFieldPane.java index e74155a932..e115e8a3f9 100644 --- a/designer/src/com/fr/design/report/UnitFieldPane.java +++ b/designer/src/com/fr/design/report/UnitFieldPane.java @@ -48,7 +48,7 @@ public class UnitFieldPane extends JPanel { } else if (unitType == Constants.UNIT_INCH) { this.setText(Inter.getLocText("FR-Designer_Unit_INCH")); } else { - this.setText(Inter.getLocText("FR-Designer_Unit_MM-mm")); + this.setText(Inter.getLocText("FR-Designer_Unit_MM")); } //ajust the heigt of unitLabel. From d9cb9c1aa51c5f477510451000cd14f029fcc6c9 Mon Sep 17 00:00:00 2001 From: plough Date: Thu, 21 Sep 2017 16:55:13 +0800 Subject: [PATCH 08/37] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=82=AC=E5=81=9C=E6=8F=90=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/gui/ibutton/UIButton.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButton.java b/designer_base/src/com/fr/design/gui/ibutton/UIButton.java index 776a6a284a..91602372da 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButton.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButton.java @@ -36,7 +36,7 @@ public class UIButton extends JButton implements UIObserver { private CellBorderStyle border = null; protected UIObserverListener uiObserverListener; - private static final int TOOLTIP_INIT_DELAY = 1000; // 延迟 1s 显示提示文字 + private static final int TOOLTIP_INIT_DELAY = 300; // 延迟 0.3s 显示提示文字 public UIButton() { this(StringUtils.EMPTY); From 0e646e2c5bfb51f24f76e9119eae6acc54213a66 Mon Sep 17 00:00:00 2001 From: hzzz Date: Thu, 21 Sep 2017 20:27:11 +0800 Subject: [PATCH 09/37] =?UTF-8?q?=E5=A4=8D=E9=80=89=E6=A1=86=E6=A0=91?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java | 1 - 1 file changed, 1 deletion(-) diff --git a/designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java b/designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java index 0642f96f4a..bd1747c8ac 100644 --- a/designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java +++ b/designer_base/src/com/fr/design/gui/itree/checkboxtree/NullTristateCheckBox.java @@ -65,7 +65,6 @@ public class NullTristateCheckBox extends TristateCheckBox { // @Override public void updateUI() { - super.updateUI(); clearAttribute(); } From 3718d8c56854f0d9d83182c7369b185533413663 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 22 Sep 2017 09:40:36 +0800 Subject: [PATCH 10/37] =?UTF-8?q?REPORT-4694=20tab=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=88=87=E6=8D=A2tab=E6=97=B6=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=B2=A1=E6=9C=89=E6=94=B9=E5=8F=98=E5=92=8C?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E8=BE=B9=E7=95=8C=E5=8F=AF=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/WidgetAbsoluteBoundPane.java | 24 ++-- .../designer/component/WidgetBoundPane.java | 110 +++++++++++++++++- .../layout/WTabFitLayoutDefinePane.java | 41 ++++++- .../layout/WTitleLayoutDefinePane.java | 6 +- 4 files changed, 164 insertions(+), 17 deletions(-) diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 7cf0493de7..3862b5f00c 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -1,26 +1,20 @@ package com.fr.design.widget.ui.designer.component; 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.gui.ispinner.UISpinner; import com.fr.design.widget.WidgetBoundsPaneFactory; -import com.fr.form.ui.container.WAbsoluteLayout; - +import com.fr.form.ui.container.WLayout; import java.awt.*; /** * Created by ibm on 2017/8/3. */ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { - protected XWAbsoluteLayout parent; private UISpinner x; private UISpinner y; public WidgetAbsoluteBoundPane(XCreator source){ super(source); - XLayoutContainer xLayoutContainer = getParent(source); - this.parent = (XWAbsoluteLayout) xLayoutContainer; } public void initBoundPane() { @@ -40,13 +34,25 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { if (parent == null) { return; } - WAbsoluteLayout wabs = parent.toData(); + WLayout wabs = parent.toData(); wabs.setBounds(creator.toData(), bounds); creator.setBounds(bounds); } + + public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){ + bounds.width = w; + } + + public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){ + bounds.height = h; + } + + + + protected String title4PopupWindow() { - return ""; + return "absoluteBound"; } public void populate() { diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index da5334cc27..4af43dbd10 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -1,11 +1,22 @@ package com.fr.design.widget.ui.designer.component; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.utils.ComponentUtils; import com.fr.design.widget.WidgetBoundsPaneFactory; +import com.fr.form.ui.PaddingMargin; +import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WLayout; +import com.fr.general.Inter; +import javax.swing.*; import java.awt.*; /** @@ -13,6 +24,9 @@ import java.awt.*; */ public class WidgetBoundPane extends BasicPane { + private static final int MINHEIGHT = WLayout.MIN_HEIGHT; + private static final int MINWIDTH = WLayout.MIN_WIDTH; + protected XLayoutContainer parent; protected XCreator creator; protected UISpinner width; protected UISpinner height; @@ -20,6 +34,7 @@ public class WidgetBoundPane extends BasicPane { public WidgetBoundPane(XCreator source) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.creator = source; + this.parent = getParent(source); initBoundPane(); } @@ -34,19 +49,20 @@ public class WidgetBoundPane extends BasicPane { public void initBoundPane() { width = new UISpinner(0, 1200, 1); height = new UISpinner(0, 1200, 1); + if (creator.acceptType(XWCardLayout.class)) { + width.setEnabled(false); + height.setEnabled(false); + } this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height)); } public void update() { - Rectangle bounds = new Rectangle(creator.getBounds()); - bounds.width = (int) width.getValue(); - bounds.height = (int) height.getValue(); - creator.setBounds(bounds); + fix(); } protected String title4PopupWindow() { - return ""; + return "widgetBound"; } public void populate() { @@ -54,4 +70,88 @@ public class WidgetBoundPane extends BasicPane { width.setValue(bounds.width); height.setValue(bounds.height); } + + public void fix() { + Rectangle bounds = new Rectangle(creator.getBounds()); + int w = (int) width.getValue(); + int h = (int) height.getValue(); + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + WLayout wabs = parent.toData(); + if (bounds.width != w) { + limitWidth(wabs, w, bounds, rec); + } + if (bounds.height != h) { + limitHeight(wabs, h, bounds, rec); + } + creator.setBounds(bounds); + } + + + public void adjustComponents(Rectangle bounds, int difference, int row) { + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + Rectangle backupBounds = getBound(); + FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator); + if (layoutAdapter != null) { + layoutAdapter.setEdit(true); + layoutAdapter.calculateBounds(backupBounds, bounds, creator, row, difference); + } + } + + public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) { + int difference = 0; + int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling()); + PaddingMargin margin = wabs.getMargin(); + if (bounds.width != w) { + if (bounds.width == rec.width - margin.getLeft() - margin.getRight()) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); + width.setValue(bounds.width); + return; + } else if (w < minWidth) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Width") + Integer.toString(minWidth)); + width.setValue(bounds.width); + return; + } + difference = bounds.width - w; + bounds.width = w; + } + width.setValue(bounds.width); + wabs.setBounds(creator.toData(), bounds); + adjustComponents(bounds, difference, 0); + } + + public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) { + int difference = 0; + PaddingMargin margin = wabs.getMargin(); + int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling()); + if (bounds.height != h) { + if (bounds.height == rec.height - margin.getTop() - margin.getBottom()) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); + height.setValue(bounds.height); + return; + } else if (h < minHeight) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Height") + Integer.toString(minHeight)); + height.setValue(bounds.height); + return; + } + difference = bounds.height - h; + bounds.height = h; + } + wabs.setBounds(creator.toData(), bounds); + creator.setBounds(bounds); + adjustComponents(bounds, difference, 1); + } + + + public Rectangle getBound() { + Rectangle bounds = new Rectangle(creator.getBounds()); + if (parent == null) { + return bounds; + } + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + bounds.x += rec.x; + bounds.y += rec.y; + return bounds; + + } + } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java index 82ea84af0c..b522950a31 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java @@ -2,6 +2,9 @@ package com.fr.design.widget.ui.designer.layout; import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.cardlayout.XWCardLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; +import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -11,7 +14,12 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.TabFitLayoutBackgroundPane; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; +import com.fr.form.ui.container.cardlayout.WCardTagLayout; +import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.*; @@ -70,16 +78,47 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify { borderStyle.populate(ob); paddingBoundPane.populate(ob); componentInterval.setValue(ob.getCompInterval()); + if(ob.getCurrentCard() == null){ + ob.setCurrentCard(getRelateSwitchButton(ob)); + } titleField.setText(ob.getCurrentCard().getText()); } + private CardSwitchButton getRelateSwitchButton(WTabFitLayout layout){ + int index = layout.getIndex(); + + XWCardLayout cardLayout = (XWCardLayout)creator.getBackupParent(); + XWCardMainBorderLayout border = (XWCardMainBorderLayout)cardLayout.getBackupParent(); + WCardMainBorderLayout borderLayout = border.toData(); + WCardTitleLayout titleLayout = borderLayout.getTitlePart(); + if(titleLayout == null){ + return null; + } + + WCardTagLayout tagLayout = titleLayout.getTagPart(); + return tagLayout == null ? null : tagLayout.getSwitchButton(index); + } + + + private void setLayoutGap(int gap, WTabFitLayout layout, XWTabFitLayout xwTabFitLayout) { + if(xwTabFitLayout.canAddInterval(gap)){ + int interval = layout.getCompInterval(); + if (gap != interval) { + xwTabFitLayout.moveContainerMargin(); + xwTabFitLayout.moveCompInterval(xwTabFitLayout.getAcualInterval()); + layout.setCompInterval(gap); + xwTabFitLayout.addCompInterval(xwTabFitLayout.getAcualInterval()); + } + } + } @Override public WTabFitLayout updateBean() { WTabFitLayout layout = (WTabFitLayout) creator.toData(); borderStyle.update(layout); paddingBoundPane.update(layout); - layout.setCompInterval((int)componentInterval.getValue()); + int gap = (int)componentInterval.getValue(); + setLayoutGap(gap, layout, (XWTabFitLayout)creator); layout.getCurrentCard().setText(titleField.getText()); return layout; } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java index dd0b80bba7..a507a99b89 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java @@ -12,6 +12,7 @@ import com.fr.design.widget.ui.designer.AbstractDataModify; import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.form.ui.*; import com.fr.form.ui.container.WTitleLayout; +import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.*; @@ -32,7 +33,6 @@ public abstract class WTitleLayoutDefinePane Date: Fri, 22 Sep 2017 10:14:10 +0800 Subject: [PATCH 11/37] =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=9B=9E=E9=80=80=20&=20=E4=B8=8B=E6=8B=89=E6=A1=86=E5=9B=9E?= =?UTF-8?q?=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/start/Designer.java | 14 ++++++-------- .../design/gui/icombobox/UIComboBoxRenderer.java | 13 ++++++++++--- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index bd4c455e71..9d93644a28 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -135,26 +135,24 @@ public class Designer extends BaseDesigner { public UILargeToolbar createLargeToolbar() { UILargeToolbar largeToolbar = super.createLargeToolbar(); largeToolbar.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 4)); - JPanel templeJpanel = new JPanel() { + largeToolbar.add(new JPanel() { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); dim.width = 1; return dim; } - }; - templeJpanel.setBackground(Color.WHITE); - largeToolbar.add(templeJpanel); + }); createRunButton(largeToolbar); largeToolbar.add(run); - templeJpanel = new JPanel() { + run.setBackground(UIConstants.TREE_BACKGROUND); + largeToolbar.add(new JPanel() { public Dimension getPreferredSize() { Dimension dim = super.getPreferredSize(); dim.width = GAP; return dim; } - }; - templeJpanel.setBackground(Color.WHITE); - largeToolbar.add(templeJpanel); + }); + largeToolbar.addSeparator(new Dimension(2, 42)); largeToolbar.setBorder(new MatteBorder(new Insets(0, 0, 1, 0), UIConstants.LINE_COLOR)); return largeToolbar; } diff --git a/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java b/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java index 4be4fdcf09..9e5a0c3b9f 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java +++ b/designer_base/src/com/fr/design/gui/icombobox/UIComboBoxRenderer.java @@ -26,9 +26,16 @@ public class UIComboBoxRenderer extends DefaultListCellRenderer { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { cellHasFocus = cellHasFocus && !this.isEnabled(); JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - renderer.setForeground(Color.black); - list.setSelectionBackground(UIConstants.COMBOBOX_BTN_PRESS); - list.setSelectionForeground(Color.black); + renderer.setOpaque(true); + list.setSelectionBackground(UIConstants.NORMAL_BLUE); + list.setSelectionForeground(Color.WHITE); + if (isSelected) { + renderer.setForeground(list.getSelectionForeground()); + renderer.setBackground(list.getSelectionBackground()); + } else { + renderer.setForeground(list.getForeground()); + renderer.setBackground(list.getBackground()); + } renderer.setText(" " + renderer.getText()); return renderer; } From e4c3f89c19f471b883d9ec77f6eacd1d8b37dfaf Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 22 Sep 2017 10:30:06 +0800 Subject: [PATCH 12/37] =?UTF-8?q?=E7=AE=AD=E5=A4=B4=E5=9B=BE=E6=A0=87=20&?= =?UTF-8?q?=20tab=E9=A2=9C=E8=89=B2=E9=97=B4=E8=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/ibutton/UIHeadGroup.java | 4 ++-- .../fr/design/images/buttonicon/leftNormal.png | Bin 165 -> 193 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java b/designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java index 3e7c488c14..28957a87ce 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIHeadGroup.java @@ -23,8 +23,8 @@ public class UIHeadGroup extends JPanel { public UIHeadGroup(String[] textArray) { labelButtonList = new ArrayList(textArray.length); - this.setBackground(UIConstants.NORMAL_BACKGROUND); - this.setLayout(new GridLayout(0, textArray.length, 1, 0)); + this.setBackground(UIConstants.TREE_BACKGROUND); + this.setLayout(new GridLayout(0, textArray.length, 0, 0)); // this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); for (int i = 0; i < textArray.length; i++) { final int index = i; diff --git a/designer_base/src/com/fr/design/images/buttonicon/leftNormal.png b/designer_base/src/com/fr/design/images/buttonicon/leftNormal.png index 883288d2f6653cab07d065ff049b8429839eb462..e23f392bbb12e35b5bb062cdecea6994ebecfda7 100644 GIT binary patch delta 152 zcmV;J0B8TD0l@)~F@JkWL_t(26=Pr+P_TCGTA5|bmgylof(e;}%wE2Hxx&w%KaVgn zG6o@wW7Pms{Qv*|13-oH$cjO13=Q}cW7PmOc>z!Y!(@p*<60RXIgClOTZf{MNX00000EGX+0i^+uF?3%^L_t(26=PtaJ6O4Lr58R+nb0Nw{{6dk`SRrr=;AOwh6a$t z|NsB%acRP;0iPzE8jv(OfY>mAR|6v>V`F4w- From dc8f26b12764d5f14fe4009bd8c1f3552a5f4b91 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 22 Sep 2017 11:55:05 +0800 Subject: [PATCH 13/37] =?UTF-8?q?REPORT-4713=20=E8=A1=A8=E5=8D=95=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E5=B7=A5=E5=85=B7=E6=A0=8F=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=90=8E=EF=BC=8C=E6=B2=A1=E6=B3=95=E6=92=A4?= =?UTF-8?q?=E9=94=80=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/AbstractDataModify.java | 10 +++++++ .../mainframe/widget/BasicPropertyPane.java | 2 +- .../accessibles/BaseAccessibleEditor.java | 12 +++++++- .../src/com/fr/design/widget/DataModify.java | 5 ++++ .../AccessibleElementCaseToolBarEditor.java | 30 +++++++++++++++++++ .../widget/ui/FormWidgetCardPane.java | 15 +++++++--- .../ui/designer/AbstractDataModify.java | 7 +++++ .../ui/designer/DateEditorDefinePane.java | 10 +++---- .../designer/component/PaddingBoundPane.java | 9 ++++-- .../component/WidgetAbsoluteBoundPane.java | 6 ++++ .../designer/component/WidgetBoundPane.java | 2 ++ .../layout/ElementEditorDefinePane.java | 10 +++++-- 12 files changed, 103 insertions(+), 15 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/AbstractDataModify.java b/designer/src/com/fr/design/widget/ui/AbstractDataModify.java index 23c5a02f82..b7ab8a6063 100644 --- a/designer/src/com/fr/design/widget/ui/AbstractDataModify.java +++ b/designer/src/com/fr/design/widget/ui/AbstractDataModify.java @@ -3,6 +3,7 @@ package com.fr.design.widget.ui; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DataCreatorUI; import com.fr.design.widget.DataModify; +import com.fr.stable.StringUtils; import javax.swing.*; @@ -10,6 +11,7 @@ import javax.swing.*; * Created by richie on 15/11/16. */ public abstract class AbstractDataModify extends BasicBeanPane implements DataModify { + protected String globalName; @Override public DataCreatorUI dataUI() { @@ -20,4 +22,12 @@ public abstract class AbstractDataModify extends BasicBeanPane implements public JComponent toSwingComponent() { return this; } + + public void setGlobalName(String globalName){ + this.globalName = globalName; + } + + public String getGlobalName(){ + return globalName; + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java index 21287530ee..c66530b62a 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -25,7 +25,7 @@ public class BasicPropertyPane extends BasicPane { this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); widgetName = new UITextField(); - + widgetName.setGlobalName(Inter.getLocText("FR-Designer_Widget_Name")); double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p}; diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java index c71cd8ad1d..43231203ef 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import javax.swing.BorderFactory; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import javax.swing.JComponent; @@ -77,7 +78,14 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor setOpaque(false); if (showButton) { - btPopup = new UIButton(); + btPopup = new UIButton(){ + public void registerChangeListener(UIObserverListener listener) { + return; + } + public boolean shouldResponseChangeListener() { + return false; + } + }; initPopupButton(); btPopup.addActionListener(new ActionListener() { @@ -189,4 +197,6 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor public static void showMessage(String message, Component editorComponent) { JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE); } + + } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/widget/DataModify.java b/designer_base/src/com/fr/design/widget/DataModify.java index 25ab46a687..96552e7f0e 100644 --- a/designer_base/src/com/fr/design/widget/DataModify.java +++ b/designer_base/src/com/fr/design/widget/DataModify.java @@ -15,4 +15,9 @@ public interface DataModify { DataCreatorUI dataUI(); JComponent toSwingComponent(); + + String getGlobalName(); + + void setGlobalName(String globalName); + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java index 1695892ba6..31c0749c99 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java @@ -5,11 +5,16 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.FormWebWidgetConstants; import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane; +import com.fr.design.mainframe.widget.editors.ITextComponent; +import com.fr.design.mainframe.widget.editors.TextField; import com.fr.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper; import com.fr.form.web.FormToolBarManager; +import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.*; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -54,4 +59,29 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit options.addAll(defaultOptions); return options.toArray(new WidgetOption[options.size()]); } + + protected ITextComponent createTextField() { + TextField textField = new TextField(){ + protected void initListener() { + if (shouldResponseChangeListener()) { + getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + } + @Override + public void removeUpdate(DocumentEvent e) { + attributeChange(); + } + @Override + public void changedUpdate(DocumentEvent e) { + + } + }); + } + } + }; + textField.setGlobalName(Inter.getLocText("Form-EC_toolbar")); + return textField; + } + } diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index fb75edbabb..3cfe27375d 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -18,6 +18,7 @@ import com.fr.form.ui.Widget; import com.fr.form.ui.container.WScaleLayout; import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.widget.CRBoundsWidget; +import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.StringUtils; @@ -199,13 +200,19 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane { public void updateCreator() { + currentEditorDefinePane.setGlobalName(getGlobalName()); Widget widget = currentEditorDefinePane.updateBean(); - widgetPropertyPane.update(widget); - if (widgetBoundPane != null) { + if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name"))){ + widgetPropertyPane.update(widget); + xCreator.resetCreatorName(widget.getWidgetName()); + designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); + return; + } + + if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) { widgetBoundPane.update(); } - xCreator.resetCreatorName(widget.getWidgetName()); - designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED); + fireValueChanged(); } diff --git a/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java b/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java index 7e521ac916..e0fc7c11ca 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java @@ -12,6 +12,7 @@ import javax.swing.*; */ public abstract class AbstractDataModify extends BasicBeanPane implements DataModify { protected XCreator creator; + protected String globalName; public AbstractDataModify(XCreator xCreator){ @@ -28,5 +29,11 @@ public abstract class AbstractDataModify extends BasicBeanPane implements return this; } + public void setGlobalName(String globalName){ + this.globalName = globalName; + } + public String getGlobalName(){ + return globalName; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java index ed9b5de27a..9bcd832da9 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java @@ -64,12 +64,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane Date: Fri, 22 Sep 2017 12:13:55 +0800 Subject: [PATCH 14/37] =?UTF-8?q?=E4=BF=AE=E6=94=B9import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/widget/ui/AbstractDataModify.java | 4 ++-- .../design/mainframe/widget/BasicPropertyPane.java | 6 ++++-- .../widget/accessibles/BaseAccessibleEditor.java | 6 +++++- .../src/com/fr/design/widget/DataModify.java | 3 ++- .../AccessibleElementCaseToolBarEditor.java | 2 +- .../mainframe/widget/ui/FormWidgetCardPane.java | 7 +++++-- .../widget/ui/designer/AbstractDataModify.java | 3 ++- .../widget/ui/designer/DateEditorDefinePane.java | 9 +++++++-- .../ui/designer/component/PaddingBoundPane.java | 7 +++++-- .../designer/component/WidgetAbsoluteBoundPane.java | 3 ++- .../ui/designer/component/WidgetBoundPane.java | 5 +++-- .../ui/designer/layout/ElementEditorDefinePane.java | 6 ++++-- .../ui/designer/layout/WTabFitLayoutDefinePane.java | 7 ++++--- .../ui/designer/layout/WTitleLayoutDefinePane.java | 13 +++++++------ 14 files changed, 53 insertions(+), 28 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/AbstractDataModify.java b/designer/src/com/fr/design/widget/ui/AbstractDataModify.java index b7ab8a6063..3836464b28 100644 --- a/designer/src/com/fr/design/widget/ui/AbstractDataModify.java +++ b/designer/src/com/fr/design/widget/ui/AbstractDataModify.java @@ -3,9 +3,9 @@ package com.fr.design.widget.ui; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.DataCreatorUI; import com.fr.design.widget.DataModify; -import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.JComponent; + /** * Created by richie on 15/11/16. diff --git a/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java b/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java index c66530b62a..6546bd56ca 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java +++ b/designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java @@ -8,8 +8,10 @@ import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by plough on 2017/8/7. diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java index 43231203ef..ec6d4405ed 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java @@ -1,6 +1,10 @@ package com.fr.design.mainframe.widget.accessibles; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; diff --git a/designer_base/src/com/fr/design/widget/DataModify.java b/designer_base/src/com/fr/design/widget/DataModify.java index 96552e7f0e..b901d7c69e 100644 --- a/designer_base/src/com/fr/design/widget/DataModify.java +++ b/designer_base/src/com/fr/design/widget/DataModify.java @@ -2,7 +2,8 @@ package com.fr.design.widget; import com.fr.design.data.DataCreatorUI; -import javax.swing.*; +import javax.swing.JComponent; + public interface DataModify { diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java index 31c0749c99..ec675fe7ed 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java @@ -12,7 +12,7 @@ import com.fr.form.web.FormToolBarManager; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; -import javax.swing.*; +import javax.swing.SwingUtilities; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.util.ArrayList; diff --git a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java index 3cfe27375d..0bc744e51c 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java +++ b/designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java @@ -22,8 +22,11 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JPanel; +import java.awt.BorderLayout; + /** * Created by ibm on 2017/7/25. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java b/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java index e0fc7c11ca..3aca5f00a7 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java @@ -5,7 +5,8 @@ import com.fr.design.data.DataCreatorUI; import com.fr.design.designer.creator.XCreator; import com.fr.design.widget.DataModify; -import javax.swing.*; +import javax.swing.JComponent; + /** * Created by kerry on 17/07/28. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java index 9bcd832da9..5931cf7742 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java @@ -20,10 +20,15 @@ import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.UtilEvalError; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java index bb2bbe3bf1..a5b13c66a4 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java @@ -11,8 +11,11 @@ import com.fr.form.ui.AbstractMarginWidget; import com.fr.form.ui.PaddingMargin; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.Component; + /** * Created by ibm on 2017/8/3. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 402348f411..c35cc79269 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -6,7 +6,8 @@ import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.form.ui.container.WLayout; import com.fr.general.Inter; -import java.awt.*; +import java.awt.Rectangle; + /** * Created by ibm on 2017/8/3. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index 916a499f58..68feb15960 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -16,8 +16,9 @@ import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import java.awt.Rectangle; + /** * Created by ibm on 2017/7/30. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java index 0bc4b818f6..9fd1c6e94b 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java @@ -11,8 +11,10 @@ import com.fr.form.web.FormToolBarManager; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by ibm on 2017/8/7. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java index b522950a31..b3678eecd9 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java @@ -19,11 +19,12 @@ import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTitleLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; /** * Created by ibm on 2017/8/5. diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java index a507a99b89..ac1659b316 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java @@ -2,21 +2,22 @@ package com.fr.design.widget.ui.designer.layout; import com.fr.design.designer.creator.XCreator; import com.fr.design.foldablepane.UIExpandablePane; -import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor; import com.fr.design.widget.ui.designer.AbstractDataModify; -import com.fr.design.widget.ui.designer.component.PaddingBoundPane; -import com.fr.form.ui.*; -import com.fr.form.ui.container.WTitleLayout; +import com.fr.form.ui.AbstractBorderStyleWidget; +import com.fr.form.ui.LayoutBorderStyle; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; + /** * Created by ibm on 2017/8/3. From a4ba146687e3ad4a4215b960437ff7a4bf33de38 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 22 Sep 2017 12:35:08 +0800 Subject: [PATCH 15/37] =?UTF-8?q?alphafine=E5=8A=A0=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 6 + .../fr/design/mainframe/DesignerFrame.java | 1847 ++++++++--------- .../mainframe/toolbar/ToolBarMenuDock.java | 253 +-- 3 files changed, 1060 insertions(+), 1046 deletions(-) diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index 405a5e64d4..b335bbad03 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -1,5 +1,6 @@ package com.fr.design.actions.help.alphafine; +import com.fr.base.FRContext; import com.fr.base.FRCoreContext; import com.fr.general.VT4FR; import com.fr.stable.OperatingSystem; @@ -247,4 +248,9 @@ public class AlphaFineConfigManager implements XMLable { public void setOperateCount(int operateCount) { this.operateCount = operateCount; } + + + public static boolean isALPHALicAvailable() { + return FRContext.getCurrentEnv() != null && VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support(); + } } diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index f28c43de77..df92a6bf09 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -6,16 +6,22 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.Env; import com.fr.base.FRContext; +import com.fr.base.FRCoreContext; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; -import com.fr.design.file.*; +import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.file.MutilTempalteTabPane; +import com.fr.design.file.NewTemplatePane; +import com.fr.design.file.SaveSomeTemplatePane; +import com.fr.design.file.TemplateTreePane; import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIMenuHighLight; @@ -37,6 +43,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralContext; import com.fr.general.Inter; +import com.fr.general.VT4FR; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; @@ -54,8 +61,20 @@ import javax.swing.border.MatteBorder; import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; -import java.awt.dnd.*; -import java.awt.event.*; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; @@ -65,115 +84,226 @@ import java.util.List; import java.util.logging.Level; public class DesignerFrame extends JFrame implements JTemplateActionListener, TargetModifiedListener { - private static final long serialVersionUID = -8732559571067484460L; - private static final int LEFT_ALIGN_GAP = -5; - private static final int MENU_HEIGHT = 26; - private static final Integer SECOND_LAYER = new Integer(100); - private static final Integer TOP_LAYER = new Integer((200)); - - public static final String DESIGNER_FRAME_NAME = "designer_frame"; - public static final Dimension MIN_SIZE = new Dimension(100, 100); - - private static java.util.List> appList = new java.util.ArrayList>(); - - private ToolBarMenuDock ad; - - private DesktopCardPane centerTemplateCardPane; - - private JPanel toolbarPane; - private JComponent toolbarComponent; - - private JPanel menuPane; - private JMenuBar menuBar; - private JPanel eastCenterPane; - private UIToolbar combineUp; - private NewTemplatePane newWorkBookPane = null; - private Icon closeMode = UIConstants.CLOSE_OF_AUTHORITY; - private JLayeredPane layeredPane = this.getLayeredPane(); - private JPanel basePane = new JPanel(); - // 上面的虚线 - private DottedLine upDottedLine; - // 下面的虚线 - private DottedLine downDottedLine; - - // 左边的虚线 - private DottedLine leftDottedLine; - - // 右边的虚线 - private DottedLine rightDottedLine; - - private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); - private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); - - private WindowAdapter windowAdapter = new WindowAdapter() { - public void windowOpened(WindowEvent e) { - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); - reCalculateFrameSize(); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); - - } - - @Override - public void windowClosing(WindowEvent e) { - SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); - // 只有一个文件未保存时 - if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) { - int choose = saveSomeTempaltePane.saveLastOneTemplate(); - if (choose != JOptionPane.CANCEL_OPTION) { - DesignerFrame.this.exit(); - } - } else { - if (saveSomeTempaltePane.showSavePane()) { - DesignerFrame.this.exit(); - } - } - } - - }; - - private JComponent closeButton = new JComponent() { - protected void paintComponent(Graphics g) { - g.setColor(UIConstants.NORMAL_BACKGROUND); - g.fillArc(0, 0, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, - 0, 360); - closeMode.paintIcon(this, g, 0, 0); - } - }; - - /** - * 注册app. - * - * @param app - * 注册app. - */ - public static void registApp(App app) { - if (app != null) { - appList.add(app); - } - } - + public static final String DESIGNER_FRAME_NAME = "designer_frame"; + public static final Dimension MIN_SIZE = new Dimension(100, 100); + private static final long serialVersionUID = -8732559571067484460L; + private static final int LEFT_ALIGN_GAP = -5; + private static final int MENU_HEIGHT = 26; + private static final Integer SECOND_LAYER = new Integer(100); + private static final Integer TOP_LAYER = new Integer((200)); + private static java.util.List> appList = new java.util.ArrayList>(); + + private ToolBarMenuDock ad; + + private DesktopCardPane centerTemplateCardPane; + + private JPanel toolbarPane; + private JComponent toolbarComponent; + + private JPanel menuPane; + private JMenuBar menuBar; + private JPanel eastCenterPane; + private UIToolbar combineUp; + private NewTemplatePane newWorkBookPane = null; + private Icon closeMode = UIConstants.CLOSE_OF_AUTHORITY; + private JLayeredPane layeredPane = this.getLayeredPane(); + private JPanel basePane = new JPanel(); + // 上面的虚线 + private DottedLine upDottedLine; + // 下面的虚线 + private DottedLine downDottedLine; + + // 左边的虚线 + private DottedLine leftDottedLine; + + // 右边的虚线 + private DottedLine rightDottedLine; + + private int contentWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth()); + private int contentHeight = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight()); + + private WindowAdapter windowAdapter = new WindowAdapter() { + public void windowOpened(WindowEvent e) { + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setComposite(); + reCalculateFrameSize(); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().doResize(); + + } + + @Override + public void windowClosing(WindowEvent e) { + SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(true); + // 只有一个文件未保存时 + if (HistoryTemplateListPane.getInstance().getHistoryCount() == 1) { + int choose = saveSomeTempaltePane.saveLastOneTemplate(); + if (choose != JOptionPane.CANCEL_OPTION) { + DesignerFrame.this.exit(); + } + } else { + if (saveSomeTempaltePane.showSavePane()) { + DesignerFrame.this.exit(); + } + } + } + + }; + + private JComponent closeButton = new JComponent() { + protected void paintComponent(Graphics g) { + g.setColor(UIConstants.NORMAL_BACKGROUND); + g.fillArc(0, 0, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, + 0, 360); + closeMode.paintIcon(this, g, 0, 0); + } + }; + private MouseListener closeMouseListener = new MouseAdapter() { + public void mousePressed(MouseEvent e) { + closeMode = UIConstants.CLOSE_PRESS_AUTHORITY; + closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.repaint(); + } + + public void mouseExited(MouseEvent e) { + closeMode = UIConstants.CLOSE_OF_AUTHORITY; + closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.repaint(); + } + + public void mouseMoved(MouseEvent e) { + closeMode = UIConstants.CLOSE_OVER_AUTHORITY; + closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.repaint(); + } + + public void mouseReleased(MouseEvent e) { + if (BaseUtils.isAuthorityEditing()) { + BaseUtils.setAuthorityEditing(false); + WestRegionContainerPane.getInstance().replaceDownPane( + TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); + DesignerContext.getDesignerFrame().resetToolkitByPlus( + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); + needToAddAuhtorityPaint(); + refreshDottedLine(); + fireAuthorityStateToNomal(); + } + } + + public void mouseEntered(MouseEvent e) { + closeMode = UIConstants.CLOSE_OVER_AUTHORITY; + closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.repaint(); + } + }; + + public DesignerFrame(ToolBarMenuDock ad) { + + setName(DESIGNER_FRAME_NAME); + this.ad = ad; + this.initTitleIcon(); + this.setTitle();// james:因为有默认的了 + // set this to context. + DesignerContext.setDesignerFrame(this); + + // the content pane + basePane.setLayout(new BorderLayout()); + toolbarPane = new JPanel() { + public Dimension getPreferredSize() { + Dimension dim = super.getPreferredSize(); + // dim.height = TOOLBAR_HEIGHT; + return dim; + } + }; + toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST); + eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH); + JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + panel.add(newWorkBookPane = ad.getNewTemplatePane(), BorderLayout.WEST); + panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); + eastCenterPane.add(panel, BorderLayout.CENTER); + + eastPane.add(eastCenterPane, BorderLayout.CENTER); + toolbarPane.add(eastPane, BorderLayout.NORTH); + toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); + + JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); + centerPane.add(toolbarPane, BorderLayout.NORTH); + + + basePane.add(centerPane, BorderLayout.CENTER); + laoyoutWestPane(); +// JPanel eastRegionPane = new JPanel(new BorderLayout()); +// eastRegionPane.add(EastRegionContainerPane.getInstance(), BorderLayout.CENTER); +// eastRegionPane.add(JSliderPane.getInstance(), BorderLayout.SOUTH); +// basePane.add(eastRegionPane, BorderLayout.EAST); + + basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); + basePane.setBounds(0, 0, contentWidth, contentHeight); + + // 数值越小。越在底层 + layeredPane.add(basePane); + // 调整Window大小 + modWindowBounds(); + + + // p:检查所有按钮的可见性和是否可以编辑性. + checkToolbarMenuEnable(); + + // window close listener. + this.addWindowListeners(getFrameListeners()); + + this.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + reCalculateFrameSize(); + if (BaseUtils.isAuthorityEditing()) { + doResize(); + } + } + }); + this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); + this.setVisible(false); + this.setExtendedState(JFrame.MAXIMIZED_BOTH); + this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); + closeMode = UIConstants.CLOSE_OF_AUTHORITY; + initMenuPane(); + } + + /** + * 注册app. + * + * @param app 注册app. + */ + public static void registApp(App app) { + if (app != null) { + appList.add(app); + } + } + public static void removeApp(App app) { - + if (app != null) { appList.remove(app); } } - protected DesktopCardPane getCenterTemplateCardPane() { - return centerTemplateCardPane; - } - - /** - * 初始menuPane的方法 方便OEM时修改该组件 - */ - protected void initMenuPane(){ - menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); - basePane.add(menuPane, BorderLayout.NORTH); - this.resetToolkitByPlus(null); - } - + protected DesktopCardPane getCenterTemplateCardPane() { + return centerTemplateCardPane; + } + + /** + * 初始menuPane的方法 方便OEM时修改该组件 + */ + protected void initMenuPane() { + menuPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + menuPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); + menuPane.add(initNorthEastPane(ad), BorderLayout.EAST); + basePane.add(menuPane, BorderLayout.NORTH); + this.resetToolkitByPlus(null); + } + /** * @param ad * @return @@ -184,658 +314,532 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta final JPanel northEastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); //优先级为-1,保证最后全面刷新一次 GeneralContext.listenPluginRunningChanged(new PluginEventListener(-1) { - + @Override public void on(PluginEvent event) { - + refreshNorthEastPane(northEastPane, ad); DesignUtils.refreshDesignerFrame(FRContext.getCurrentEnv()); } }, new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(PluginModule.ExtraDesign); } }); refreshNorthEastPane(northEastPane, ad); - return northEastPane; - } - + return northEastPane; + } + private void refreshNorthEastPane(JPanel northEastPane, ToolBarMenuDock ad) { - + northEastPane.removeAll(); TitlePlaceProcessor processor = ExtraDesignClassManager.getInstance().getSingle(TitlePlaceProcessor.MARK_STRING); if (processor == null) { processor = new DefaultTitlePlace(); } processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); - if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { - northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); - } + if (AlphaFineConfigManager.isALPHALicAvailable() && DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { + northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); + } } - - public DesignerFrame(ToolBarMenuDock ad) { - - setName(DESIGNER_FRAME_NAME); - this.ad = ad; - this.initTitleIcon(); - this.setTitle();// james:因为有默认的了 - // set this to context. - DesignerContext.setDesignerFrame(this); - - // the content pane - basePane.setLayout(new BorderLayout()); - toolbarPane = new JPanel() { - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - // dim.height = TOOLBAR_HEIGHT; - return dim; - } - }; - toolbarPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel eastPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eastPane.add(ad.createLargeToolbar(), BorderLayout.WEST); - eastCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - eastCenterPane.add(combineUp = combineUpTooBar(null), BorderLayout.NORTH); - JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - panel.add(newWorkBookPane =ad.getNewTemplatePane(), BorderLayout.WEST); - panel.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER); - eastCenterPane.add(panel, BorderLayout.CENTER); - - eastPane.add(eastCenterPane, BorderLayout.CENTER); - toolbarPane.add(eastPane, BorderLayout.NORTH); - toolbarPane.add(new UIMenuHighLight(), BorderLayout.SOUTH); - - JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - centerPane.add(centerTemplateCardPane = new DesktopCardPane(), BorderLayout.CENTER); - centerPane.add(toolbarPane, BorderLayout.NORTH); - - - basePane.add(centerPane, BorderLayout.CENTER); - laoyoutWestPane(); -// JPanel eastRegionPane = new JPanel(new BorderLayout()); -// eastRegionPane.add(EastRegionContainerPane.getInstance(), BorderLayout.CENTER); -// eastRegionPane.add(JSliderPane.getInstance(), BorderLayout.SOUTH); -// basePane.add(eastRegionPane, BorderLayout.EAST); - basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST); - basePane.setBounds(0, 0, contentWidth, contentHeight); - - // 数值越小。越在底层 - layeredPane.add(basePane); - // 调整Window大小 - modWindowBounds(); - - - - // p:检查所有按钮的可见性和是否可以编辑性. - checkToolbarMenuEnable(); - - // window close listener. - this.addWindowListeners(getFrameListeners()); - - this.addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { - reCalculateFrameSize(); - if (BaseUtils.isAuthorityEditing()) { - doResize(); - } - } - }); - this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - this.setVisible(false); - this.setExtendedState(JFrame.MAXIMIZED_BOTH); - this.setDropTarget(new DropTarget(this, DnDConstants.ACTION_MOVE, new FileDropTargetListener(), true)); - closeMode = UIConstants.CLOSE_OF_AUTHORITY; - initMenuPane(); - } - - public void initTitleIcon() { - try { - @SuppressWarnings("unchecked") - List image = ICODecoder.read(DesignerFrame.class - .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); - this.setIconImages(image); - } catch (IOException e) { - FRContext.getLogger().error(e.getMessage(), e); - this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); - } - } - - private void addWindowListeners(ArrayList listeners){ - for(WindowListener listener : listeners){ - this.addWindowListener(listener); - } - } - - protected ArrayList getFrameListeners(){ - ArrayList arrayList = new ArrayList(); - arrayList.add(windowAdapter); - return arrayList; - } - - - protected void laoyoutWestPane(){ - basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST); - } - - // 调整windows大小 - private void reCalculateFrameSize() { - contentHeight = layeredPane.getHeight(); - contentWidth = layeredPane.getWidth(); - layeredPane.remove(basePane); - basePane.setBounds(0, 0, contentWidth, contentHeight); - layeredPane.add(basePane); - layeredPane.repaint(); - } - - /** - * 更新 - */ - public void populateAuthorityArea() { - int centerWidth = contentWidth - WestRegionContainerPane.getInstance().getContainerWidth() - - EastRegionContainerPane.getInstance().getContainerWidth(); - // 上面的虚线 - upDottedLine = new DottedLine(UIScrollBar.HORIZONTAL, centerWidth); - upDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), MENU_HEIGHT - 1, centerWidth, - 3); - - // 下面的虚线 - downDottedLine = new DottedLine(UIScrollBar.HORIZONTAL, centerWidth); - downDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), contentHeight - 3, - centerWidth, 3); - - // 左边的虚线 - leftDottedLine = new DottedLine(UIScrollBar.VERTICAL, contentHeight - MENU_HEIGHT); - leftDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), MENU_HEIGHT, 3, - contentHeight - MENU_HEIGHT); - - rightDottedLine = new DottedLine(UIScrollBar.VERTICAL, contentHeight - MENU_HEIGHT); - rightDottedLine.setBounds(contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - 3, - MENU_HEIGHT, 3, contentHeight - MENU_HEIGHT); - - } - - private void addDottedLine() { - layeredPane.add(upDottedLine, SECOND_LAYER); - layeredPane.add(downDottedLine, SECOND_LAYER); - layeredPane.add(leftDottedLine, SECOND_LAYER); - layeredPane.add(rightDottedLine, SECOND_LAYER); - layeredPane.add(closeButton, TOP_LAYER); - } - - private void removeDottedLine() { - layeredPane.remove(upDottedLine); - layeredPane.remove(downDottedLine); - layeredPane.remove(leftDottedLine); - layeredPane.remove(rightDottedLine); - layeredPane.remove(closeButton); - } - - public JLayeredPane getContentFrame() { - return layeredPane; - } - - /** - * 刷新 - */ - public void refreshDottedLine() { - if (BaseUtils.isAuthorityEditing()) { - populateAuthorityArea(); - populateCloseButton(); - addDottedLine(); - } else { - removeDottedLine(); - } - layeredPane.repaint(); - } - - /** - * 刷新DottedLine - */ - public void doResize() { - removeDottedLine(); - populateAuthorityArea(); - populateCloseButton(); - addDottedLine(); - } - - private MouseListener closeMouseListener = new MouseAdapter() { - public void mousePressed(MouseEvent e) { - closeMode = UIConstants.CLOSE_PRESS_AUTHORITY; - closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); - closeButton.repaint(); - } - - public void mouseExited(MouseEvent e) { - closeMode = UIConstants.CLOSE_OF_AUTHORITY; - closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); - closeButton.repaint(); - } - - public void mouseMoved(MouseEvent e) { - closeMode = UIConstants.CLOSE_OVER_AUTHORITY; - closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); - closeButton.repaint(); - } - - public void mouseReleased(MouseEvent e) { - if (BaseUtils.isAuthorityEditing()) { - BaseUtils.setAuthorityEditing(false); - WestRegionContainerPane.getInstance().replaceDownPane( - TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); - DesignerContext.getDesignerFrame().resetToolkitByPlus( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus()); - needToAddAuhtorityPaint(); - refreshDottedLine(); - fireAuthorityStateToNomal(); - } - } - - public void mouseEntered(MouseEvent e) { - closeMode = UIConstants.CLOSE_OVER_AUTHORITY; - closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); - closeButton.repaint(); - } - }; - - /** - * 刷新CloseButton - */ - public void populateCloseButton() { - - closeButton.addMouseListener(closeMouseListener); - closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); - closeButton.setBorder(null); - int x = contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - closeMode.getIconWidth() / 2; - int y = MENU_HEIGHT - closeMode.getIconHeight() / 2; - closeButton.setBounds(x, y, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, - UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH); - } - - /** - * 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体 - */ - private void fireAuthorityStateToNomal() { - java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); - for (int i = 0; i < opendedTemplate.size(); i++) { - // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 - if (opendedTemplate.get(i).isDoSomethingInAuthority()) { - opendedTemplate.get(i).fireAuthorityStateToNomal(); - } - } - } - - public void setCloseMode(Icon closeMode) { - this.closeMode = closeMode; - } - - private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) { - combineUp = new UIToolbar(FlowLayout.LEFT); - combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); - combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); - UIButton[] fixButtons = ad.createUp(); - for (int i = 0; i < fixButtons.length; i++) { - combineUp.add(fixButtons[i]); - } - if (!BaseUtils.isAuthorityEditing()) { - combineUp.addSeparator(new Dimension(2, 16)); - if (toolbar4Form != null) { - for (int i = 0; i < toolbar4Form.length; i++) { - combineUp.add(toolbar4Form[i]); - } - } - } - - //添加分享按钮 - addShareButton(); - - //添加插件中的按钮 - addExtraButtons(); - - return combineUp; - } - - private void addExtraButtons(){ - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if(jt == null){ - return; - } - - - UIButton[] extraButtons = jt.createExtraButtons(); - for (int i = 0; i < extraButtons.length; i++) { - combineUp.add(extraButtons[i]); - } - if (extraButtons.length > 0) { - combineUp.addSeparator(new Dimension(2, 16)); - } - } - - private void addShareButton(){ - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if(jt == null){ - return; - } - - combineUp.addSeparator(new Dimension(2, 16)); - UIButton[] shareButtons = jt.createShareButton(); - for (int i = 0; i < shareButtons.length; i++) { - combineUp.add(shareButtons[i]); - } - } - - /** - * 检查 - * - * @param flag - * 组件是否可见 - * @param al - * 组件名称 - */ - public void checkCombineUp(boolean flag, ArrayList al) { - combineUp.checkComponentsByNames(flag, al); - - } - - /** - * 刷新工具条. - */ - public void refreshToolbar() { - this.ad.updateToolBarDef(); - } - - /** - * 重置相关的工具条. - * - * @param plus - * 工具条中相关信息 - */ - public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { - if (plus == null) { - plus = ToolBarMenuDock.NULLAVOID; - } - - DesignState designState = new DesignState(plus); - MenuManager.getInstance().setMenus4Designer(designState); - if (menuBar != null) { - menuPane.remove(menuBar); - } - menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); - - if (combineUp != null) { - eastCenterPane.remove(combineUp); - combineUp = null; - } - - // 保存撤销那些按钮的面板 - eastCenterPane.add(combineUp = combineUpTooBar(ad.resetUpToolBar(plus)), BorderLayout.NORTH); - - if (toolbarComponent != null) { - toolbarPane.remove(toolbarComponent); - } - - // 颜色,字体那些按钮的工具栏 - toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); - - this.checkToolbarMenuEnable(); - this.validate(); - layeredPane.repaint(); - } - - public JComponent getToolbarComponent() { - return this.toolbarComponent; - } - - /** - * 判断是否在权限编辑状态,若是在权限编辑状态,则需要有虚线框和关闭突变 - */ - public void needToAddAuhtorityPaint() { - - newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); - } - - /** - * 检查工具条. - */ - private void checkToolbarMenuEnable() { - if (this.ad != null) { - this.ad.updateMenuDef(); - this.ad.updateToolBarDef(); - } - } - - /** - * 设置标题 - */ - public void setTitle() { + + public void initTitleIcon() { + try { + @SuppressWarnings("unchecked") + List image = ICODecoder.read(DesignerFrame.class + .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + this.setIconImages(image); + } catch (IOException e) { + FRContext.getLogger().error(e.getMessage(), e); + this.setIconImage(BaseUtils.readImage("/com/fr/base/images/oem/logo.png")); + } + } + + private void addWindowListeners(ArrayList listeners) { + for (WindowListener listener : listeners) { + this.addWindowListener(listener); + } + } + + protected ArrayList getFrameListeners() { + ArrayList arrayList = new ArrayList(); + arrayList.add(windowAdapter); + return arrayList; + } + + protected void laoyoutWestPane() { + basePane.add(WestRegionContainerPane.getInstance(), BorderLayout.WEST); + } + + // 调整windows大小 + private void reCalculateFrameSize() { + contentHeight = layeredPane.getHeight(); + contentWidth = layeredPane.getWidth(); + layeredPane.remove(basePane); + basePane.setBounds(0, 0, contentWidth, contentHeight); + layeredPane.add(basePane); + layeredPane.repaint(); + } + + /** + * 更新 + */ + public void populateAuthorityArea() { + int centerWidth = contentWidth - WestRegionContainerPane.getInstance().getContainerWidth() + - EastRegionContainerPane.getInstance().getContainerWidth(); + // 上面的虚线 + upDottedLine = new DottedLine(UIScrollBar.HORIZONTAL, centerWidth); + upDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), MENU_HEIGHT - 1, centerWidth, + 3); + + // 下面的虚线 + downDottedLine = new DottedLine(UIScrollBar.HORIZONTAL, centerWidth); + downDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), contentHeight - 3, + centerWidth, 3); + + // 左边的虚线 + leftDottedLine = new DottedLine(UIScrollBar.VERTICAL, contentHeight - MENU_HEIGHT); + leftDottedLine.setBounds(WestRegionContainerPane.getInstance().getContainerWidth(), MENU_HEIGHT, 3, + contentHeight - MENU_HEIGHT); + + rightDottedLine = new DottedLine(UIScrollBar.VERTICAL, contentHeight - MENU_HEIGHT); + rightDottedLine.setBounds(contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - 3, + MENU_HEIGHT, 3, contentHeight - MENU_HEIGHT); + + } + + private void addDottedLine() { + layeredPane.add(upDottedLine, SECOND_LAYER); + layeredPane.add(downDottedLine, SECOND_LAYER); + layeredPane.add(leftDottedLine, SECOND_LAYER); + layeredPane.add(rightDottedLine, SECOND_LAYER); + layeredPane.add(closeButton, TOP_LAYER); + } + + private void removeDottedLine() { + layeredPane.remove(upDottedLine); + layeredPane.remove(downDottedLine); + layeredPane.remove(leftDottedLine); + layeredPane.remove(rightDottedLine); + layeredPane.remove(closeButton); + } + + public JLayeredPane getContentFrame() { + return layeredPane; + } + + /** + * 刷新 + */ + public void refreshDottedLine() { + if (BaseUtils.isAuthorityEditing()) { + populateAuthorityArea(); + populateCloseButton(); + addDottedLine(); + } else { + removeDottedLine(); + } + layeredPane.repaint(); + } + + /** + * 刷新DottedLine + */ + public void doResize() { + removeDottedLine(); + populateAuthorityArea(); + populateCloseButton(); + addDottedLine(); + } + + /** + * 刷新CloseButton + */ + public void populateCloseButton() { + + closeButton.addMouseListener(closeMouseListener); + closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); + closeButton.setBorder(null); + int x = contentWidth - EastRegionContainerPane.getInstance().getContainerWidth() - closeMode.getIconWidth() / 2; + int y = MENU_HEIGHT - closeMode.getIconHeight() / 2; + closeButton.setBounds(x, y, UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH, + UIConstants.CLOSE_AUTHORITY_HEIGHT_AND_WIDTH); + } + + /** + * 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体 + */ + private void fireAuthorityStateToNomal() { + java.util.List> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); + for (int i = 0; i < opendedTemplate.size(); i++) { + // 如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表 + if (opendedTemplate.get(i).isDoSomethingInAuthority()) { + opendedTemplate.get(i).fireAuthorityStateToNomal(); + } + } + } + + public void setCloseMode(Icon closeMode) { + this.closeMode = closeMode; + } + + private UIToolbar combineUpTooBar(JComponent[] toolbar4Form) { + combineUp = new UIToolbar(FlowLayout.LEFT); + combineUp.setBorder(new MatteBorder(new Insets(0, LEFT_ALIGN_GAP, 1, 0), UIConstants.LINE_COLOR)); + combineUp.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 2)); + UIButton[] fixButtons = ad.createUp(); + for (int i = 0; i < fixButtons.length; i++) { + combineUp.add(fixButtons[i]); + } + if (!BaseUtils.isAuthorityEditing()) { + combineUp.addSeparator(new Dimension(2, 16)); + if (toolbar4Form != null) { + for (int i = 0; i < toolbar4Form.length; i++) { + combineUp.add(toolbar4Form[i]); + } + } + } + + //添加分享按钮 + addShareButton(); + + //添加插件中的按钮 + addExtraButtons(); + + return combineUp; + } + + private void addExtraButtons() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return; + } + + + UIButton[] extraButtons = jt.createExtraButtons(); + for (int i = 0; i < extraButtons.length; i++) { + combineUp.add(extraButtons[i]); + } + if (extraButtons.length > 0) { + combineUp.addSeparator(new Dimension(2, 16)); + } + } + + private void addShareButton() { + JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (jt == null) { + return; + } + + combineUp.addSeparator(new Dimension(2, 16)); + UIButton[] shareButtons = jt.createShareButton(); + for (int i = 0; i < shareButtons.length; i++) { + combineUp.add(shareButtons[i]); + } + } + + /** + * 检查 + * + * @param flag 组件是否可见 + * @param al 组件名称 + */ + public void checkCombineUp(boolean flag, ArrayList al) { + combineUp.checkComponentsByNames(flag, al); + + } + + /** + * 刷新工具条. + */ + public void refreshToolbar() { + this.ad.updateToolBarDef(); + } + + /** + * 重置相关的工具条. + * + * @param plus 工具条中相关信息 + */ + public void resetToolkitByPlus(ToolBarMenuDockPlus plus) { + if (plus == null) { + plus = ToolBarMenuDock.NULLAVOID; + } + + DesignState designState = new DesignState(plus); + MenuManager.getInstance().setMenus4Designer(designState); + if (menuBar != null) { + menuPane.remove(menuBar); + } + menuPane.add(menuBar = ad.createJMenuBar(plus), BorderLayout.CENTER); + + if (combineUp != null) { + eastCenterPane.remove(combineUp); + combineUp = null; + } + + // 保存撤销那些按钮的面板 + eastCenterPane.add(combineUp = combineUpTooBar(ad.resetUpToolBar(plus)), BorderLayout.NORTH); + + if (toolbarComponent != null) { + toolbarPane.remove(toolbarComponent); + } + + // 颜色,字体那些按钮的工具栏 + toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER); + + this.checkToolbarMenuEnable(); + this.validate(); + layeredPane.repaint(); + } + + public JComponent getToolbarComponent() { + return this.toolbarComponent; + } + + /** + * 判断是否在权限编辑状态,若是在权限编辑状态,则需要有虚线框和关闭突变 + */ + public void needToAddAuhtorityPaint() { + + newWorkBookPane.setButtonGray(BaseUtils.isAuthorityEditing()); + } + + /** + * 检查工具条. + */ + private void checkToolbarMenuEnable() { + if (this.ad != null) { + this.ad.updateMenuDef(); + this.ad.updateToolBarDef(); + } + } + + /** + * 设置标题 + */ + public void setTitle() { JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); StringBuilder defaultTitleSB = new StringBuilder(); defaultTitleSB.append(ProductConstants.PRODUCT_NAME); - defaultTitleSB.append(" "); - defaultTitleSB.append(ProductConstants.BRANCH); - // james:标识登录的用户和登录的ENV - String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); - Env env = DesignerEnvManager.getEnvManager().getEnv(envName); - if (env != null) { - defaultTitleSB.append(env.getUser()).append('@').append(envName).append('['); - defaultTitleSB.append(env.getEnvDescription()); - defaultTitleSB.append(']'); - if (editingTemplate != null) { - String path = editingTemplate.getEditingFILE().getPath(); - if (!editingTemplate.getEditingFILE().exists()) { - path = FILEFactory.MEM_PREFIX + path; - } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { - path = env.getPath() + File.separator + path; - } - defaultTitleSB.append(" " + path); - } - - } - setTitle(defaultTitleSB.toString()); - } - - /** - * modify window bounds. - */ - private void modWindowBounds() { - // set the window bounds to the same as last closed - DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); - Rectangle windowBounds = designerEnvManager.getWindowBounds(); - if (windowBounds != null) { - int locX = windowBounds.x; - int locY = windowBounds.y; - - if (!OperatingSystem.isWindows()) { - locX = Math.max(1, locX); - locY = Math.max(1, locY); - } - - this.setLocation(new Point(locX, locY)); - - int width = windowBounds.width; - int height = windowBounds.height; - if (width > MIN_SIZE.width && height > MIN_SIZE.height) { - this.setSize(width, height); - } else { - GUICoreUtils.setWindowFullScreen(this); - } - } else { - GUICoreUtils.setWindowFullScreen(this); - } - } - - + defaultTitleSB.append(" "); + defaultTitleSB.append(ProductConstants.BRANCH); + // james:标识登录的用户和登录的ENV + String envName = DesignerEnvManager.getEnvManager().getCurEnvName(); + Env env = DesignerEnvManager.getEnvManager().getEnv(envName); + if (env != null) { + defaultTitleSB.append(env.getUser()).append('@').append(envName).append('['); + defaultTitleSB.append(env.getEnvDescription()); + defaultTitleSB.append(']'); + if (editingTemplate != null) { + String path = editingTemplate.getEditingFILE().getPath(); + if (!editingTemplate.getEditingFILE().exists()) { + path = FILEFactory.MEM_PREFIX + path; + } else if (path.startsWith(ProjectConstants.REPORTLETS_NAME)) { + path = env.getPath() + File.separator + path; + } + defaultTitleSB.append(" " + path); + } + + } + setTitle(defaultTitleSB.toString()); + } + + /** + * modify window bounds. + */ + private void modWindowBounds() { + // set the window bounds to the same as last closed + DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); + Rectangle windowBounds = designerEnvManager.getWindowBounds(); + if (windowBounds != null) { + int locX = windowBounds.x; + int locY = windowBounds.y; + + if (!OperatingSystem.isWindows()) { + locX = Math.max(1, locX); + locY = Math.max(1, locY); + } + + this.setLocation(new Point(locX, locY)); + + int width = windowBounds.width; + int height = windowBounds.height; + if (width > MIN_SIZE.width && height > MIN_SIZE.height) { + this.setSize(width, height); + } else { + GUICoreUtils.setWindowFullScreen(this); + } + } else { + GUICoreUtils.setWindowFullScreen(this); + } + } + + /** * 报表运行环境改变时,需要刷新某些面板 * * @param env 环境 */ public void refreshEnv(Env env) { - + this.setTitle(); DesignerFrameFileDealerPane.getInstance().refreshDockingView(); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TemplateTreePane.getInstance().refreshDockingView(); DesignTableDataManager.clearGlobalDs(); - EastRegionContainerPane.getInstance().refreshDownPane(); - } - - /** - * 返回选中的模板. - */ - public JTemplate getSelectedJTemplate() { - return this.centerTemplateCardPane.getSelectedJTemplate(); - } - - /** - * 保存当前编辑的模板 - */ - - public void saveCurrentEditingTemplate() { - JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (editingTemplate == null) { - return; - } - if (editingTemplate.isSaved()) {// isSaved == true表示已经保存过,或者新建的一张模板 - if (editingTemplate.getEditingFILE().exists()) {// 表示磁盘上的某一张已经保存过的模板,要添加到历史中 - // HistoryTemplateListPane.getInstance().addHistory(); - } - } else { - editingTemplate.stopEditing(); - if (!editingTemplate.getEditingFILE().exists()) { - int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), - Inter.getLocText("Utils-Would_you_like_to_save") + " \"" + editingTemplate.getEditingFILE() - + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { - editingTemplate.saveTemplate(); - FRLogger.getLogger().log( - Level.INFO, - Inter.getLocText(new String[] { "Template", "already-saved" }, new String[] { - editingTemplate.getEditingFILE().getName(), "." })); - } - } else { - if (editingTemplate.saveTemplate()) { - editingTemplate.saveTemplate(); - FRLogger.getLogger().log( - Level.INFO, - Inter.getLocText(new String[] { "Template", "already-saved" }, new String[] { - editingTemplate.getEditingFILE().getName(), "." })); - } - } - } - } - - /** - * 添加新建模板, 并激活. - */ - public void addAndActivateJTemplate() { - addAndActivateJTemplate(ad.createNewTemplate()); - layeredPane.repaint(); - } - - /** - * 添加 模板, 并激活. - * - * @param jt - * 添加的模板. - */ - public void addAndActivateJTemplate(JTemplate jt) { - if (jt == null || jt.getEditingFILE() == null) { - return; - } - jt.addJTemplateActionListener(this); - jt.addTargetModifiedListener(this); - centerTemplateCardPane.showJTemplate(jt); - setTitle(); - layeredPane.repaint(); - } - - /** - * 激活已经存在的模板 - * - * @param jt - * 模板 - */ - public void activateJTemplate(JTemplate jt) { - if (jt == null || jt.getEditingFILE() == null) { - return; - } - centerTemplateCardPane.showJTemplate(jt); - setTitle(); - layeredPane.repaint(); - } - - /** - * 对象侦听 - * - * @param e - * 事件 - */ - public void targetModified(TargetModifiedEvent e) { - this.checkToolbarMenuEnable(); - } - - /** - * 模板关闭时 处理. - * - * @param jt - * 模板 - */ - public void templateClosed(JTemplate jt) { - } - - /** - * 模板打开时 处理. - * - * @param jt - * 模板 - */ - public void templateOpened(JTemplate jt) { - } - - /** - * 模板保存时 处理. - * - * @param jt - * 模板 - */ - public void templateSaved(JTemplate jt) { - this.checkToolbarMenuEnable(); - } - - /** - * 打开模板文件,如果是已经打开的就激活此模板所对应的JInternalFrame - * - * @param tplFile - * 文件 - */ - public void openTemplate(FILE tplFile) { - // 测试连接,如果连接失败,则提示 - try { - if (FRContext.getCurrentEnv() != null - && !FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) { - JOptionPane.showMessageDialog( - DesignerContext.getDesignerFrame(), - Inter.getLocText(new String[] { "FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened" }, new String[] { - ",", "!" }), Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); - return; - } - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage()); - } - - // p:判断一下,如何文件为空或者文件不存在,直接返回. - if (tplFile == null || !tplFile.exists()) { - JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), - ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); - DesignerFrameFileDealerPane.getInstance().refresh(); - return; - } + EastRegionContainerPane.getInstance().refreshDownPane(); + } + + /** + * 返回选中的模板. + */ + public JTemplate getSelectedJTemplate() { + return this.centerTemplateCardPane.getSelectedJTemplate(); + } + + /** + * 保存当前编辑的模板 + */ + + public void saveCurrentEditingTemplate() { + JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + if (editingTemplate == null) { + return; + } + if (editingTemplate.isSaved()) {// isSaved == true表示已经保存过,或者新建的一张模板 + if (editingTemplate.getEditingFILE().exists()) {// 表示磁盘上的某一张已经保存过的模板,要添加到历史中 + // HistoryTemplateListPane.getInstance().addHistory(); + } + } else { + editingTemplate.stopEditing(); + if (!editingTemplate.getEditingFILE().exists()) { + int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), + Inter.getLocText("Utils-Would_you_like_to_save") + " \"" + editingTemplate.getEditingFILE() + + "\" ?", ProductConstants.PRODUCT_NAME, JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.YES_OPTION && editingTemplate.saveTemplate()) { + editingTemplate.saveTemplate(); + FRLogger.getLogger().log( + Level.INFO, + Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ + editingTemplate.getEditingFILE().getName(), "."})); + } + } else { + if (editingTemplate.saveTemplate()) { + editingTemplate.saveTemplate(); + FRLogger.getLogger().log( + Level.INFO, + Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{ + editingTemplate.getEditingFILE().getName(), "."})); + } + } + } + } + + /** + * 添加新建模板, 并激活. + */ + public void addAndActivateJTemplate() { + addAndActivateJTemplate(ad.createNewTemplate()); + layeredPane.repaint(); + } + + /** + * 添加 模板, 并激活. + * + * @param jt 添加的模板. + */ + public void addAndActivateJTemplate(JTemplate jt) { + if (jt == null || jt.getEditingFILE() == null) { + return; + } + jt.addJTemplateActionListener(this); + jt.addTargetModifiedListener(this); + centerTemplateCardPane.showJTemplate(jt); + setTitle(); + layeredPane.repaint(); + } + + /** + * 激活已经存在的模板 + * + * @param jt 模板 + */ + public void activateJTemplate(JTemplate jt) { + if (jt == null || jt.getEditingFILE() == null) { + return; + } + centerTemplateCardPane.showJTemplate(jt); + setTitle(); + layeredPane.repaint(); + } + + /** + * 对象侦听 + * + * @param e 事件 + */ + public void targetModified(TargetModifiedEvent e) { + this.checkToolbarMenuEnable(); + } + + /** + * 模板关闭时 处理. + * + * @param jt 模板 + */ + public void templateClosed(JTemplate jt) { + } + + /** + * 模板打开时 处理. + * + * @param jt 模板 + */ + public void templateOpened(JTemplate jt) { + } + + /** + * 模板保存时 处理. + * + * @param jt 模板 + */ + public void templateSaved(JTemplate jt) { + this.checkToolbarMenuEnable(); + } + + /** + * 打开模板文件,如果是已经打开的就激活此模板所对应的JInternalFrame + * + * @param tplFile 文件 + */ + public void openTemplate(FILE tplFile) { + // 测试连接,如果连接失败,则提示 + try { + if (FRContext.getCurrentEnv() != null + && !FRContext.getCurrentEnv().testServerConnectionWithOutShowMessagePane()) { + JOptionPane.showMessageDialog( + DesignerContext.getDesignerFrame(), + Inter.getLocText(new String[]{"FR-Chart-Server_disconnected", "FR-Server-Design_template_unopened"}, new String[]{ + ",", "!"}), Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); + return; + } + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + + // p:判断一下,如何文件为空或者文件不存在,直接返回. + if (tplFile == null || !tplFile.exists()) { + JOptionPane.showMessageDialog(this, Inter.getLocText("Warning-Template_Do_Not_Exsit"), + ProductConstants.PRODUCT_NAME, JOptionPane.INFORMATION_MESSAGE); + DesignerFrameFileDealerPane.getInstance().refresh(); + return; + } try { openFile(tplFile); @@ -844,209 +848,198 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta addAndActivateJTemplate(); } - } - - /** - * 是否不合版本的设计器 - * - * @param jt - * 当前模板 - * - * @return 是否不合版本 - * - * - * @date 2014-10-14-下午6:30:37 - */ - private boolean inValidDesigner(JTemplate jt) { - return jt.isOldDesigner() || (!jt.isJWorkBook() && jt.isNewDesigner()); - } - - /** - * 打开指定的文件 - * - * @param tplFile - * 指定的文件 - * - * - * @date 2014-10-14-下午6:31:05 - */ - private void openFile(FILE tplFile) { - String fileName = tplFile.getName(); - int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); - if (indexOfLastDot < 0) { - return; - } - String fileExtention = fileName.substring(indexOfLastDot + 1); - for (int i = 0, len = appList.size(); i < len; i++) { - App app = appList.get(i); - String[] defaultAppExtentions = app.defaultExtentions(); - boolean opened = false; - for (int j = 0; j < defaultAppExtentions.length; j++) { - if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { - JTemplate jt = null; - try { - jt = app.openTemplate(tplFile); - } catch (Exception e) { - FRLogger.getLogger().error(e.getMessage(), e); - } - if (jt == null) { - return; - } - // 新的form不往前兼容 - if (inValidDesigner(jt)) { - this.addAndActivateJTemplate(); - MutilTempalteTabPane.getInstance().setTemTemplate( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); - } else { - activeTemplate(tplFile, jt); - } - opened = true; - break; - } - } - if (opened) { - break; - } - } - } - - /** - * 激活指定的模板 - * - * @param tplFile - * 模板文件 - * @param jt - * 当前报表 - * - * - * @date 2014-10-14-下午6:31:23 - */ - private void activeTemplate(FILE tplFile, JTemplate jt) { - // 如果该模板已经打开,则进行激活就可以了 - String fullName = StableUtils.pathJoin(new String[] { ProjectConstants.REPORTLETS_NAME, tplFile.getName() }); - if (tplFile instanceof FileNodeFILE) { - fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); - } - // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 - if (tplFile instanceof FileFILE) { - fullName = tplFile.getPath(); - } - fullName = fullName.replaceAll("/", "\\\\"); - int index = HistoryTemplateListPane.getInstance().contains(fullName); - if (index != -1) { - this.activateJTemplate(HistoryTemplateListPane.getInstance().getHistoryList().get(index)); - } else { - this.addAndActivateJTemplate(jt); - } - - } - - /** - * Exit退出 - */ - public void exit() { - Thread thread = new Thread() { - @Override - public void run() { - DesignerEnvManager.doEndMapSaveWorkersIndesign(); - } - }; - thread.start(); - - try { - thread.join(); - } catch (InterruptedException e) { - FRLogger.getLogger().error("Map Thread Error"); - } - - DesignerEnvManager.getEnvManager().setLastOpenFile( - HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); - - DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY( - WestRegionContainerPane.getInstance().getToolPaneY()); - DesignerEnvManager.getEnvManager().setLastWestRegionContainerWidth( - WestRegionContainerPane.getInstance().getContainerWidth()); - DesignerEnvManager.getEnvManager().setLastEastRegionToolPaneY( - EastRegionContainerPane.getInstance().getToolPaneY()); - DesignerEnvManager.getEnvManager().setLastEastRegionContainerWidth( - EastRegionContainerPane.getInstance().getContainerWidth()); - - DesignerEnvManager.getEnvManager().saveXMLFile(); - - Env currentEnv = FRContext.getCurrentEnv(); - try { - currentEnv.signOut(); - GeneralContext.fireEnvSignOutListener(); - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - this.setVisible(false); - this.dispose(); - - this.ad.shutDown(); - - System.exit(0); - } - - // harry:添加程序外拖拽文件进来打开的功能 - class FileDropTargetListener implements DropTargetListener { - - @Override - public void dragEnter(DropTargetDragEvent event) { - } - - @Override - public void dragExit(DropTargetEvent event) { - } - - @Override - public void dragOver(DropTargetDragEvent event) { - } - - @Override - public void dropActionChanged(DropTargetDragEvent event) { - if (!isDragAcceptable(event)) { - event.rejectDrag(); - return; - } - } - - @SuppressWarnings("unchecked") - @Override - public void drop(DropTargetDropEvent event) { - if (!isDropAcceptable(event)) { - event.rejectDrop(); - return; - } - - event.acceptDrop(DnDConstants.ACTION_MOVE); - Transferable transferable = event.getTransferable(); - DataFlavor[] flavors = transferable.getTransferDataFlavors(); - for (int i = 0; i < flavors.length; i++) { - DataFlavor d = flavors[i]; - try { - if (ComparatorUtils.equals(d, DataFlavor.javaFileListFlavor)) { - List fileList = (List) transferable.getTransferData(d); - Iterator iterator = fileList.iterator(); - while (iterator.hasNext()) { - File f = iterator.next(); - DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - } - } - event.dropComplete(true); - } - - public boolean isDragAcceptable(DropTargetDragEvent event) { - return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; - } - - public boolean isDropAcceptable(DropTargetDropEvent event) { - return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; - } - } + } + + /** + * 是否不合版本的设计器 + * + * @param jt 当前模板 + * @return 是否不合版本 + * @date 2014-10-14-下午6:30:37 + */ + private boolean inValidDesigner(JTemplate jt) { + return jt.isOldDesigner() || (!jt.isJWorkBook() && jt.isNewDesigner()); + } + + /** + * 打开指定的文件 + * + * @param tplFile 指定的文件 + * @date 2014-10-14-下午6:31:05 + */ + private void openFile(FILE tplFile) { + String fileName = tplFile.getName(); + int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT); + if (indexOfLastDot < 0) { + return; + } + String fileExtention = fileName.substring(indexOfLastDot + 1); + for (int i = 0, len = appList.size(); i < len; i++) { + App app = appList.get(i); + String[] defaultAppExtentions = app.defaultExtentions(); + boolean opened = false; + for (int j = 0; j < defaultAppExtentions.length; j++) { + if (defaultAppExtentions[j].equalsIgnoreCase(fileExtention)) { + JTemplate jt = null; + try { + jt = app.openTemplate(tplFile); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage(), e); + } + if (jt == null) { + return; + } + // 新的form不往前兼容 + if (inValidDesigner(jt)) { + this.addAndActivateJTemplate(); + MutilTempalteTabPane.getInstance().setTemTemplate( + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); + } else { + activeTemplate(tplFile, jt); + } + opened = true; + break; + } + } + if (opened) { + break; + } + } + } + + /** + * 激活指定的模板 + * + * @param tplFile 模板文件 + * @param jt 当前报表 + * @date 2014-10-14-下午6:31:23 + */ + private void activeTemplate(FILE tplFile, JTemplate jt) { + // 如果该模板已经打开,则进行激活就可以了 + String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()}); + if (tplFile instanceof FileNodeFILE) { + fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); + } + // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 + if (tplFile instanceof FileFILE) { + fullName = tplFile.getPath(); + } + fullName = fullName.replaceAll("/", "\\\\"); + int index = HistoryTemplateListPane.getInstance().contains(fullName); + if (index != -1) { + this.activateJTemplate(HistoryTemplateListPane.getInstance().getHistoryList().get(index)); + } else { + this.addAndActivateJTemplate(jt); + } + + } + + /** + * Exit退出 + */ + public void exit() { + Thread thread = new Thread() { + @Override + public void run() { + DesignerEnvManager.doEndMapSaveWorkersIndesign(); + } + }; + thread.start(); + + try { + thread.join(); + } catch (InterruptedException e) { + FRLogger.getLogger().error("Map Thread Error"); + } + + DesignerEnvManager.getEnvManager().setLastOpenFile( + HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath()); + + DesignerEnvManager.getEnvManager().setLastWestRegionToolPaneY( + WestRegionContainerPane.getInstance().getToolPaneY()); + DesignerEnvManager.getEnvManager().setLastWestRegionContainerWidth( + WestRegionContainerPane.getInstance().getContainerWidth()); + DesignerEnvManager.getEnvManager().setLastEastRegionToolPaneY( + EastRegionContainerPane.getInstance().getToolPaneY()); + DesignerEnvManager.getEnvManager().setLastEastRegionContainerWidth( + EastRegionContainerPane.getInstance().getContainerWidth()); + + DesignerEnvManager.getEnvManager().saveXMLFile(); + + Env currentEnv = FRContext.getCurrentEnv(); + try { + currentEnv.signOut(); + GeneralContext.fireEnvSignOutListener(); + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + this.setVisible(false); + this.dispose(); + + this.ad.shutDown(); + + System.exit(0); + } + + // harry:添加程序外拖拽文件进来打开的功能 + class FileDropTargetListener implements DropTargetListener { + + @Override + public void dragEnter(DropTargetDragEvent event) { + } + + @Override + public void dragExit(DropTargetEvent event) { + } + + @Override + public void dragOver(DropTargetDragEvent event) { + } + + @Override + public void dropActionChanged(DropTargetDragEvent event) { + if (!isDragAcceptable(event)) { + event.rejectDrag(); + return; + } + } + + @SuppressWarnings("unchecked") + @Override + public void drop(DropTargetDropEvent event) { + if (!isDropAcceptable(event)) { + event.rejectDrop(); + return; + } + + event.acceptDrop(DnDConstants.ACTION_MOVE); + Transferable transferable = event.getTransferable(); + DataFlavor[] flavors = transferable.getTransferDataFlavors(); + for (int i = 0; i < flavors.length; i++) { + DataFlavor d = flavors[i]; + try { + if (ComparatorUtils.equals(d, DataFlavor.javaFileListFlavor)) { + List fileList = (List) transferable.getTransferData(d); + Iterator iterator = fileList.iterator(); + while (iterator.hasNext()) { + File f = iterator.next(); + DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + } + } + event.dropComplete(true); + } + + public boolean isDragAcceptable(DropTargetDragEvent event) { + return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; + } + + public boolean isDropAcceptable(DropTargetDropEvent event) { + return (event.getDropAction() & DnDConstants.ACTION_COPY_OR_MOVE) != 0; + } + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index a8305a49ac..9dab4fb664 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -5,17 +5,33 @@ package com.fr.design.mainframe.toolbar; import com.fr.base.BaseUtils; import com.fr.base.FRContext; -import com.fr.base.FRCoreContext; import com.fr.design.DesignState; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; -import com.fr.design.actions.community.*; -import com.fr.design.actions.file.*; +import com.fr.design.actions.community.BBSAction; +import com.fr.design.actions.community.BugAction; +import com.fr.design.actions.community.NeedAction; +import com.fr.design.actions.community.QuestionAction; +import com.fr.design.actions.community.SignAction; +import com.fr.design.actions.community.UpAction; +import com.fr.design.actions.community.VideoAction; +import com.fr.design.actions.file.CloseCurrentTemplateAction; +import com.fr.design.actions.file.ExitDesignerAction; +import com.fr.design.actions.file.OpenRecentReportMenuDef; +import com.fr.design.actions.file.OpenTemplateAction; +import com.fr.design.actions.file.PreferenceAction; +import com.fr.design.actions.file.SwitchExistEnv; import com.fr.design.actions.help.AboutAction; import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.alphafine.AlphaFineAction; -import com.fr.design.actions.server.*; +import com.fr.design.actions.help.alphafine.AlphaFineConfigManager; +import com.fr.design.actions.server.ConnectionListAction; +import com.fr.design.actions.server.FunctionManagerAction; +import com.fr.design.actions.server.GlobalParameterAction; +import com.fr.design.actions.server.GlobalTableDataAction; +import com.fr.design.actions.server.PlatformManagerAction; +import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; import com.fr.design.fun.TableDataPaneProcessor; @@ -35,7 +51,6 @@ import com.fr.env.RemoteEnv; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.general.VT4FR; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -48,8 +63,11 @@ import com.fr.stable.StringUtils; import javax.swing.*; import java.awt.*; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import java.util.Locale; +import java.util.Set; /** * @author richer @@ -61,12 +79,63 @@ import java.util.List; * 还有docking的状态的保存,下次打开设计器,也应该是这样的 */ public abstract class ToolBarMenuDock { + public static final int PANLE_HEIGNT = 26; + public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() { + + @Override + public ToolBarDef[] toolbars4Target() { + return new ToolBarDef[0]; + } + + + @Override + public ShortCut[] shortcut4FileMenu() { + return new ShortCut[0]; + } + + @Override + public MenuDef[] menus4Target() { + return new MenuDef[0]; + } + + @Override + public JPanel[] toolbarPanes4Form() { + return new JPanel[0]; + } + + public JComponent[] toolBarButton4Form() { + return new JComponent[0]; + } + + public JComponent toolBar4Authority() { + return new JPanel(); + } + + @Override + public int getMenuState() { + return DesignState.WORK_SHEET; + } + + public int getToolBarHeight() { + return PANLE_HEIGNT; + } + + /** + * 导出菜单的子菜单 ,目前用于图表设计器 + * + * @return 子菜单 + */ + public ShortCut[] shortcut4ExportMenu() { + return new ShortCut[0]; + } + + }; private static final String FINEREPORT = "FineReport"; private static final int MENUBAR_HEIGHT = 22; - public static final int PANLE_HEIGNT = 26; private MenuDef[] menus; private ToolBarDef toolBarDef; private List shortCutsList; + /** * 更新菜单 */ @@ -118,6 +187,10 @@ public abstract class ToolBarMenuDock { return jMenuBar; } + ////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////menu below///////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////// + /** * 生成报表设计和表单设计的编辑区域 * @@ -127,10 +200,6 @@ public abstract class ToolBarMenuDock { return null; } - ////////////////////////////////////////////////////////////////////////////////////////// - ///////////////////////////////menu below///////////////////////////////////////////////// - ////////////////////////////////////////////////////////////////////////////////////////// - public MenuDef[] menus(final ToolBarMenuDockPlus plus) { java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 @@ -164,6 +233,7 @@ public abstract class ToolBarMenuDock { /** * 获取所有actionmodel + * * @param menuList */ private void addAllUpdateActionsToList(List menuList) { @@ -175,6 +245,7 @@ public abstract class ToolBarMenuDock { /** * 递归获取所有UpdateAction + * * @param menuDef */ private void addUpdateActionToList(MenuDef menuDef, int level) { @@ -195,11 +266,11 @@ public abstract class ToolBarMenuDock { } } - public void addCommunityMenuDef(java.util.List menuList){ + public void addCommunityMenuDef(java.util.List menuList) { Locale locale = FRContext.getLocale(); - Locale [] locales =supportCommunityLocales(); - for(int i = 0; i < locales.length; i++) { - if(locale.equals(locales[i])){ + Locale[] locales = supportCommunityLocales(); + for (int i = 0; i < locales.length; i++) { + if (locale.equals(locales[i])) { menuList.add(createCommunityMenuDef()); break; } @@ -218,13 +289,13 @@ public abstract class ToolBarMenuDock { // 给菜单加插件入口 for (MenuDef m : menuDefs) { switch (m.getAnchor()) { - case MenuHandler.TEMPLATE : + case MenuHandler.TEMPLATE: insertMenu(m, MenuHandler.TEMPLATE, new TemplateTargetAction(plus)); break; - case MenuHandler.INSERT : + case MenuHandler.INSERT: insertMenu(m, MenuHandler.INSERT); break; - case MenuHandler.CELL : + case MenuHandler.CELL: insertMenu(m, MenuHandler.CELL); break; default: @@ -271,7 +342,7 @@ public abstract class ToolBarMenuDock { addSwitchExistEnvAction(menuDef); - menuDef.addShortCut( new ExitDesignerAction()); + menuDef.addShortCut(new ExitDesignerAction()); insertMenu(menuDef, MenuHandler.FILE); return menuDef; @@ -293,7 +364,7 @@ public abstract class ToolBarMenuDock { menuDef.addShortCut(new SwitchExistEnv()); } - protected ShortCut openTemplateAction(){ + protected ShortCut openTemplateAction() { return new OpenTemplateAction(); } @@ -308,17 +379,15 @@ public abstract class ToolBarMenuDock { * 创建论坛登录面板, chart那边不需要 * * @return 面板组件 - * */ - public Component createBBSLoginPane(){ + public Component createBBSLoginPane() { return new UILabel(); } - public Component createAlphafinePane(){ + public Component createAlphafinePane() { return new UILabel(); } - protected MenuDef createServerMenuDef(ToolBarMenuDockPlus plus) { MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Server"), 'S'); @@ -361,6 +430,7 @@ public abstract class ToolBarMenuDock { /** * 创建帮助子菜单 + * * @return 帮组菜单的子菜单 */ public ShortCut[] createHelpShortCuts() { @@ -372,25 +442,22 @@ public abstract class ToolBarMenuDock { shortCuts.add(new TutorialAction()); } shortCuts.add(SeparatorDef.DEFAULT); - //shortCuts.add(new TutorialAction()); shortCuts.add(SeparatorDef.DEFAULT); - if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { - - // mod by anchore 16/11/17 去掉反馈 - //shortCuts.add(new FeedBackAction()); + if (ComparatorUtils.equals(ProductConstants.APP_NAME, FINEREPORT)) { shortCuts.add(SeparatorDef.DEFAULT); + } + if (AlphaFineConfigManager.isALPHALicAvailable()) { + shortCuts.add(new AlphaFineAction()); shortCuts.add(SeparatorDef.DEFAULT); - // shortCuts.add(new ForumAction()); } shortCuts.add(SeparatorDef.DEFAULT); - shortCuts.add(new AlphaFineAction()); - shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(new AboutAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } /** * 创建社区子菜单 + * * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { @@ -405,6 +472,7 @@ public abstract class ToolBarMenuDock { shortCuts.add(new SignAction()); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } + public MenuDef createHelpMenuDef() { MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H'); ShortCut[] otherHelpShortCuts = createHelpShortCuts(); @@ -414,6 +482,7 @@ public abstract class ToolBarMenuDock { insertMenu(menuDef, MenuHandler.HELP); return menuDef; } + public MenuDef createCommunityMenuDef() { MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C'); ShortCut[] otherCommunityShortCuts = createCommunityShortCuts(); @@ -423,6 +492,7 @@ public abstract class ToolBarMenuDock { insertMenu(menuDef, MenuHandler.BBS); return menuDef; } + /** * 生成工具栏 * @@ -460,7 +530,6 @@ public abstract class ToolBarMenuDock { } } - protected JPanel polyToolBar(String text) { JPanel panel = new JPanel(new BorderLayout()) { public Dimension getPreferredSize() { @@ -477,7 +546,6 @@ public abstract class ToolBarMenuDock { return panel; } - /** * 重置上面的工具栏 * @@ -488,7 +556,6 @@ public abstract class ToolBarMenuDock { return plus.toolBarButton4Form(); } - /** * 创建大的工具按钮 * @@ -507,62 +574,11 @@ public abstract class ToolBarMenuDock { return new UIButton[0]; } - protected void refreshLargeToolbarState() { } - public static final ToolBarMenuDockPlus NULLAVOID = new ToolBarMenuDockPlus() { - - @Override - public ToolBarDef[] toolbars4Target() { - return new ToolBarDef[0]; - } - - - @Override - public ShortCut[] shortcut4FileMenu() { - return new ShortCut[0]; - } - - @Override - public MenuDef[] menus4Target() { - return new MenuDef[0]; - } - - @Override - public JPanel[] toolbarPanes4Form() { - return new JPanel[0]; - } - - public JComponent[] toolBarButton4Form() { - return new JComponent[0]; - } - - public JComponent toolBar4Authority() { - return new JPanel(); - } - - @Override - public int getMenuState() { - return DesignState.WORK_SHEET; - } - public int getToolBarHeight(){ - return PANLE_HEIGNT; - } - - /** - * 导出菜单的子菜单 ,目前用于图表设计器 - * - * @return 子菜单 - */ - public ShortCut[] shortcut4ExportMenu(){ - return new ShortCut[0]; - } - - }; - - public NewTemplatePane getNewTemplatePane(){ + public NewTemplatePane getNewTemplatePane() { return new NewTemplatePane() { @Override public Icon getNew() { @@ -584,28 +600,28 @@ public abstract class ToolBarMenuDock { protected void insertMenu(MenuDef menuDef, String anchor) { insertMenu(menuDef, anchor, new NoTargetAction()); } - + protected void insertMenu(MenuDef menuDef, String anchor, ShortCutMethodAction action) { - + listenPluginMenuChange(menuDef, anchor, action); Set set = ExtraDesignClassManager.getInstance().getArray(MenuHandler.MARK_STRING); addExtraMenus(menuDef, anchor, action, set); - + } - + private void listenPluginMenuChange(final MenuDef menuDef, final String anchor, final ShortCutMethodAction action) { - + PluginFilter filter = new PluginFilter() { - + @Override public boolean accept(PluginContext context) { - + return context.contain(MenuHandler.MARK_STRING); } }; - + GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() { - + @Override public void on(PluginEvent event) { PluginRuntime runtime = event.getContext().getRuntime(); @@ -614,59 +630,59 @@ public abstract class ToolBarMenuDock { } }, filter); GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() { - + @Override public void on(PluginEvent event) { - + PluginRuntime runtime = event.getContext().getRuntime(); Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); addExtraMenus(menuDef, anchor, action, menuHandlers); } }, filter); } - + private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { - - + + List target = new ArrayList<>(); for (MenuHandler handler : set) { if (ComparatorUtils.equals(handler.category(), anchor)) { target.add(handler); } } - + for (MenuHandler handler : target) { int insertPosition = handler.insertPosition(menuDef.getShortCutCount()); if (insertPosition == MenuHandler.HIDE) { return; } ShortCut shortCut = action.methodAction(handler); - if (shortCut == null){ + if (shortCut == null) { continue; } menuDef.removeShortCut(shortCut); } } - + private void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { - + List target = new ArrayList<>(); for (MenuHandler handler : set) { if (ComparatorUtils.equals(handler.category(), anchor)) { target.add(handler); } } - + for (MenuHandler handler : target) { int insertPosition = handler.insertPosition(menuDef.getShortCutCount()); if (insertPosition == MenuHandler.HIDE) { return; } ShortCut shortCut = action.methodAction(handler); - if (shortCut == null){ + if (shortCut == null) { continue; } - + if (insertPosition == MenuHandler.LAST) { if (handler.insertSeparatorBefore()) { menuDef.addShortCut(SeparatorDef.DEFAULT); @@ -676,48 +692,47 @@ public abstract class ToolBarMenuDock { menuDef.insertShortCut(insertPosition, shortCut); if (handler.insertSeparatorBefore()) { menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); - insertPosition ++; + insertPosition++; } if (handler.insertSeparatorAfter()) { - insertPosition ++; + insertPosition++; menuDef.insertShortCut(insertPosition, SeparatorDef.DEFAULT); } } } } - + /** * 设计器退出时, 做的一些操作. - * */ - public void shutDown(){ + public void shutDown() { } - private interface ShortCutMethodAction{ + private interface ShortCutMethodAction { public ShortCut methodAction(MenuHandler handler); } - private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction{ + private abstract class AbstractShortCutMethodAction implements ShortCutMethodAction { - public ShortCut methodAction(MenuHandler handler){ + public ShortCut methodAction(MenuHandler handler) { return handler.shortcut(); } } //不需要编辑对象的菜单, 比如文件, 服务器, 关于 - private class NoTargetAction extends AbstractShortCutMethodAction{ + private class NoTargetAction extends AbstractShortCutMethodAction { } //模板为对象的菜单, 比如模板, 后续如果单元格也要, 直接加个CellTargetAction即可. //在methodAction中做handler.shortcut(cell), 不需要修改handler中原有接口, 加个shortcut(cell). - private class TemplateTargetAction extends AbstractShortCutMethodAction{ + private class TemplateTargetAction extends AbstractShortCutMethodAction { private ToolBarMenuDockPlus plus; - public TemplateTargetAction(ToolBarMenuDockPlus plus){ + public TemplateTargetAction(ToolBarMenuDockPlus plus) { this.plus = plus; } From 365cf23f880dc86e25bf884ec44d81177d4d233f Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 22 Sep 2017 12:37:00 +0800 Subject: [PATCH 16/37] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=99=BD=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../actions/cell/style/AlignmentAction.java | 207 ++++++++++-------- .../cell/style/ReportFontBoldAction.java | 140 ++++++------ .../cell/style/ReportFontItalicAction.java | 14 +- .../cell/style/ReportFontUnderlineAction.java | 13 +- .../fr/design/mainframe/ElementCasePane.java | 99 ++------- .../fr/design/gui/ibutton/UIToggleButton.java | 2 +- 6 files changed, 237 insertions(+), 238 deletions(-) diff --git a/designer/src/com/fr/design/actions/cell/style/AlignmentAction.java b/designer/src/com/fr/design/actions/cell/style/AlignmentAction.java index 326b47f650..c3b690c97e 100644 --- a/designer/src/com/fr/design/actions/cell/style/AlignmentAction.java +++ b/designer/src/com/fr/design/actions/cell/style/AlignmentAction.java @@ -1,111 +1,134 @@ package com.fr.design.actions.cell.style; -import javax.swing.Icon; - import com.fr.base.BaseUtils; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; -import com.fr.design.constants.UIConstants; import com.fr.design.actions.ButtonGroupAction; import com.fr.design.actions.utils.ReportActionUtils; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButtonGroup; -import com.fr.general.Inter; +import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.mainframe.ElementCasePane; +import com.fr.general.Inter; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; +import com.fr.stable.Constants; + +import javax.swing.*; public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { - public AlignmentAction(ElementCasePane t, Icon[] iconArray, - Integer[] valueArray) { - super(t, iconArray, valueArray); - } - - - /** - * executeStyle - * - * @param style - * @param selectedStyle - * @return style - */ - public Style executeStyle(Style style, Style selectedStyle) { - return style.deriveHorizontalAlignment(getSelectedValue()); - } - - /** - * 更新Style - * - * @param style style - */ - public void updateStyle(Style style) { - setSelectedIndex(BaseUtils.getAlignment4Horizontal(style)); - } - - /** - * executeActionReturnUndoRecordNeeded - * - * @return - */ - public boolean executeActionReturnUndoRecordNeeded() { - ElementCasePane reportPane = this.getEditingComponent(); - if (reportPane == null) { - return false; - } - - return ReportActionUtils.executeAction(this, reportPane); - } - - /** - * update - */ - public void update() { - super.update(); - - //peter:如果当前没有ReportFrame,不需要继续. - if (!this.isEnabled()) { - return; - } - - //got simple cell element from row and column - ElementCasePane reportPane = this.getEditingComponent(); - if (reportPane == null) { - this.setEnabled(false); - return; - } - Selection cs = reportPane.getSelection(); - TemplateElementCase tplEC = reportPane.getEditingElementCase(); - - if (tplEC != null && cs instanceof FloatSelection) { - FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); - Object value = selectedFloat.getValue(); - if (value instanceof BaseChartCollection) { - this.setEnabled(false); - return; - } - } - this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); - } - - /** - * 创建工具条,且有提示 - * - * @return - */ - public UIButtonGroup createToolBarComponent() { - UIButtonGroup group = super.createToolBarComponent(); - if (group != null) { - group.setForToolBarButtonGroup(true); - group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")}); - } - for (int i = 0; i < 3; i++) { - group.getButton(i).setRoundBorder(true, UIConstants.ARC); - group.getButton(i).setBorderPainted(true); - } - return group; - } + private static final Icon[] normalBlackIcon = new Icon[]{ + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; + + private static final Icon[] toggleWhiteIcon = new Icon[]{ + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png"), + BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png")}; + + private static final Integer[] valueArray = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; + + public AlignmentAction(ElementCasePane t) { + super(t, normalBlackIcon, valueArray); + } + + + /** + * executeStyle + * + * @param style + * @param selectedStyle + * @return style + */ + public Style executeStyle(Style style, Style selectedStyle) { + return style.deriveHorizontalAlignment(getSelectedValue()); + } + + /** + * 更新Style + * + * @param style style + */ + public void updateStyle(Style style) { + UIButtonGroup buttonGroup = createToolBarComponent(); + int selected = BaseUtils.getAlignment4Horizontal(style); + for (int i = 0; i < normalBlackIcon.length; i++) { + UIToggleButton button = buttonGroup.getButton(i); + Icon currentIcon = button.getIcon(); + Icon newIcon = selected == valueArray[i] ? toggleWhiteIcon[i] : normalBlackIcon[i]; + if (newIcon != currentIcon) { + button.setIcon(newIcon); + } + } + setSelectedIndex(selected); + } + + /** + * executeActionReturnUndoRecordNeeded + * + * @return + */ + public boolean executeActionReturnUndoRecordNeeded() { + ElementCasePane reportPane = this.getEditingComponent(); + if (reportPane == null) { + return false; + } + + return ReportActionUtils.executeAction(this, reportPane); + } + + /** + * update + */ + public void update() { + super.update(); + + //peter:如果当前没有ReportFrame,不需要继续. + if (!this.isEnabled()) { + return; + } + + //got simple cell element from row and column + ElementCasePane reportPane = this.getEditingComponent(); + if (reportPane == null) { + this.setEnabled(false); + return; + } + Selection cs = reportPane.getSelection(); + TemplateElementCase tplEC = reportPane.getEditingElementCase(); + + if (tplEC != null && cs instanceof FloatSelection) { + FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); + Object value = selectedFloat.getValue(); + if (value instanceof BaseChartCollection) { + this.setEnabled(false); + return; + } + } + this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); + } + + /** + * 创建工具条,且有提示 + * + * @return + */ + public UIButtonGroup createToolBarComponent() { + UIButtonGroup group = super.createToolBarComponent(); + if (group != null) { + group.setForToolBarButtonGroup(true); + group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")}); + } + for (int i = 0; i < 3; i++) { + group.getButton(i).setRoundBorder(true, UIConstants.ARC); + group.getButton(i).setBorderPainted(true); + } + return group; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java b/designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java index 101d1f1f0d..0abe5ff4b2 100644 --- a/designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java +++ b/designer/src/com/fr/design/actions/cell/style/ReportFontBoldAction.java @@ -8,84 +8,96 @@ import com.fr.base.Style; import com.fr.base.core.StyleUtils; import com.fr.design.actions.ToggleButtonUpdateAction; import com.fr.design.gui.ibutton.UIToggleButton; -import com.fr.general.FRFont; -import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.general.FRFont; +import com.fr.general.Inter; + +import javax.swing.*; /** * Bold. */ public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { - private UIToggleButton button; - protected Style style; + private UIToggleButton button; + protected Style style; + private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"); + private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png"); + + public ReportFontBoldAction(ElementCasePane t) { + super(t); - public ReportFontBoldAction(ElementCasePane t) { - super(t); + this.setName(Inter.getLocText("FRFont-bold")); + this.setSmallIcon(blackIcon); + } - this.setName(Inter.getLocText("FRFont-bold")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); - } + /** + * 根据按钮状态获取格式 + * + * @param style + * @param defStyle + * @return + */ + @Override + public Style executeStyle(Style style, Style defStyle) { + button = createToolBarComponent(); + button.setIcon(getToggleButtonIcon(button.isSelected())); + button.setSelected(!button.isSelected()); + if (button.isSelected()) { + setSelectedFont(style); + button.setSelected(false); + } else { + setUnselectedFont(style); + button.setSelected(true); + } - /** - * 根据按钮状态获取格式 - * - * @param style - * @param defStyle - * @return - */ - @Override - public Style executeStyle(Style style, Style defStyle) { - createToolBarComponent().setSelected(!createToolBarComponent().isSelected()); - if (createToolBarComponent().isSelected()) { - setSelectedFont(style); - createToolBarComponent().setSelected(false); - } else { - setUnselectedFont(style); - createToolBarComponent().setSelected(true); - } + return this.style; + } - return this.style; - } + protected Icon getToggleButtonIcon(boolean isSelected) { + return isSelected ? blackIcon : whiteIcon; + } - protected void setSelectedFont(Style style) { - this.style = StyleUtils.boldReportFont(style); - } + protected void setSelectedFont(Style style) { + this.style = StyleUtils.boldReportFont(style); + } - protected void setUnselectedFont(Style style) { - this.style = StyleUtils.unBoldReportFont(style); - } + protected void setUnselectedFont(Style style) { + this.style = StyleUtils.unBoldReportFont(style); + } - /** - * Update Style. - */ - @Override - public void updateStyle(Style style) { - if (style == null) { - return; - } - FRFont frFont = style.getFRFont(); - if (frFont == null) { - return; - } - createToolBarComponent().setSelected(isStyle(frFont)); - } + /** + * Update Style. + */ + @Override + public void updateStyle(Style style) { + if (style == null) { + return; + } + FRFont frFont = style.getFRFont(); + if (frFont == null) { + return; + } + button = createToolBarComponent(); + button.setSelected(isStyle(frFont)); + button.setIcon(getToggleButtonIcon(!button.isSelected())); + } - protected boolean isStyle(FRFont frFont) { - return frFont.isBold(); - } + protected boolean isStyle(FRFont frFont) { + return frFont.isBold(); + } - /** - * Gets component on toolbar. - * - * @return the created components on toolbar. - */ - @Override - public UIToggleButton createToolBarComponent() { - if (button == null) { - button = GUICoreUtils.createToolBarComponent(this); - button.setEventBannded(true); - } - return button; - } + /** + * Gets component on toolbar. + * + * @return the created components on toolbar. + */ + @Override + public UIToggleButton createToolBarComponent() { + if (button == null) { + button = GUICoreUtils.createToolBarComponent(this); + button.setEventBannded(true); + } + return button; + } } \ No newline at end of file diff --git a/designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java b/designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java index 1e6c87a1aa..7857cefe8b 100644 --- a/designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java +++ b/designer/src/com/fr/design/actions/cell/style/ReportFontItalicAction.java @@ -10,16 +10,21 @@ import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; +import javax.swing.*; + /** * Bold. */ public class ReportFontItalicAction extends ReportFontBoldAction { - - public ReportFontItalicAction(ElementCasePane t) { + + private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"); + private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic_white.png"); + + public ReportFontItalicAction(ElementCasePane t) { super(t); this.setName(Inter.getLocText("FRFont-italic")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); + this.setSmallIcon(blackIcon); } @@ -31,6 +36,9 @@ public class ReportFontItalicAction extends ReportFontBoldAction { this.style = StyleUtils.unItalicReportFont(style); } + protected Icon getToggleButtonIcon(boolean isSelected) { + return isSelected ? blackIcon : whiteIcon; + } protected boolean isStyle(FRFont frFont) { return frFont.isItalic(); diff --git a/designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java b/designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java index e79782abfb..96369867db 100644 --- a/designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java +++ b/designer/src/com/fr/design/actions/cell/style/ReportFontUnderlineAction.java @@ -11,15 +11,21 @@ import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; import com.fr.stable.Constants; +import javax.swing.*; + /** * Bold. */ public class ReportFontUnderlineAction extends ReportFontBoldAction { - public ReportFontUnderlineAction(ElementCasePane t) { + + private final static Icon blackIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"); + private final static Icon whiteIcon = BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline_white.png"); + + public ReportFontUnderlineAction(ElementCasePane t) { super(t); this.setName(Inter.getLocText("FRFont-Underline")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); + this.setSmallIcon(blackIcon); } protected void setSelectedFont (Style style) { @@ -30,6 +36,9 @@ public class ReportFontUnderlineAction extends ReportFontBoldAction { this.style = StyleUtils.setReportFontUnderline(style, false); } + protected Icon getToggleButtonIcon(boolean isSelected) { + return isSelected ? blackIcon : whiteIcon; + } protected boolean isStyle(FRFont frFont) { return frFont.getUnderline() != Constants.LINE_NONE; diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index 1a6cf0ddae..0445b09877 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -3,34 +3,7 @@ */ package com.fr.design.mainframe; -import java.awt.AWTEvent; -import java.awt.Adjustable; -import java.awt.Dimension; -import java.awt.Image; -import java.awt.Rectangle; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.Transferable; -import java.awt.event.*; -import java.lang.reflect.Constructor; -import java.util.Set; - -import javax.swing.AbstractAction; -import javax.swing.ActionMap; -import javax.swing.Icon; -import javax.swing.InputMap; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JScrollBar; -import javax.swing.KeyStroke; - -import com.fr.base.BaseUtils; -import com.fr.base.DynamicUnitList; -import com.fr.base.FRContext; -import com.fr.base.Formula; -import com.fr.base.ScreenResolution; -import com.fr.base.Style; +import com.fr.base.*; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -39,30 +12,8 @@ import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.BorderAction; import com.fr.design.actions.cell.CleanAuthorityAction; -import com.fr.design.actions.cell.style.AlignmentAction; -import com.fr.design.actions.cell.style.ReportFontBoldAction; -import com.fr.design.actions.cell.style.ReportFontForegroundAction; -import com.fr.design.actions.cell.style.ReportFontItalicAction; -import com.fr.design.actions.cell.style.ReportFontNameAction; -import com.fr.design.actions.cell.style.ReportFontSizeAction; -import com.fr.design.actions.cell.style.ReportFontUnderlineAction; -import com.fr.design.actions.cell.style.StyleBackgroundAction; -import com.fr.design.actions.columnrow.CancelColumnAction; -import com.fr.design.actions.columnrow.CancelRowAction; -import com.fr.design.actions.columnrow.ColumnHideAction; -import com.fr.design.actions.columnrow.ColumnWidthAction; -import com.fr.design.actions.columnrow.DeleteColumnAction; -import com.fr.design.actions.columnrow.DeleteRowAction; -import com.fr.design.actions.columnrow.FootColumnAction; -import com.fr.design.actions.columnrow.FootRowAction; -import com.fr.design.actions.columnrow.HeadColumnAction; -import com.fr.design.actions.columnrow.HeadRowAction; -import com.fr.design.actions.columnrow.InsertColumnAction; -import com.fr.design.actions.columnrow.InsertRowAction; -import com.fr.design.actions.columnrow.ResetColumnHideAction; -import com.fr.design.actions.columnrow.ResetRowHideAction; -import com.fr.design.actions.columnrow.RowHeightAction; -import com.fr.design.actions.columnrow.RowHideAction; +import com.fr.design.actions.cell.style.*; +import com.fr.design.actions.columnrow.*; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CutAction; @@ -74,6 +25,7 @@ import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.cell.editor.*; +import com.fr.design.cell.editor.CellEditor; import com.fr.design.constants.UIConstants; import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; @@ -83,11 +35,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.menu.KeySetUtils; -import com.fr.design.menu.MenuDef; -import com.fr.design.menu.NameSeparator; -import com.fr.design.menu.ShortCut; -import com.fr.design.menu.ToolBarDef; +import com.fr.design.menu.*; import com.fr.design.selection.QuickEditor; import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionEvent; @@ -95,11 +43,7 @@ import com.fr.design.selection.SelectionListener; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.grid.Grid; -import com.fr.grid.GridColumn; -import com.fr.grid.GridCorner; -import com.fr.grid.GridRow; -import com.fr.grid.GridUtils; +import com.fr.grid.*; import com.fr.grid.dnd.ElementCasePaneDropTarget; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; @@ -119,9 +63,17 @@ import com.fr.report.elementcase.ElementCase; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ArrayUtils; import com.fr.stable.ColumnRow; -import com.fr.stable.Constants; import com.fr.stable.unit.FU; +import javax.swing.*; +import java.awt.*; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.event.*; +import java.lang.reflect.Constructor; +import java.util.Set; + import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; /** @@ -186,7 +138,7 @@ public abstract class ElementCasePane extends Tar /** * Constructor. */ - public ElementCasePane(T t) { + public ElementCasePane(T t) { super(t); // marks:能触发processEvent,不管是否给component增加listener。这里是使在reportPane中的任意位置滑动鼠标轮都能 // 下拉grid。 @@ -209,7 +161,7 @@ public abstract class ElementCasePane extends Tar this.setLayout(new RGridLayout()); //todo 直接修改分辨率 - if (this.resolution == 0){ + if (this.resolution == 0) { this.resolution = ScreenResolution.getScreenResolution(); } @@ -243,7 +195,6 @@ public abstract class ElementCasePane extends Tar } - public int getMenuState() { return DesignState.WORK_SHEET; } @@ -294,8 +245,8 @@ public abstract class ElementCasePane extends Tar setFormatState(DesignerContext.FORMAT_STATE_NULL); formatBrush.setSelected(false); grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR); - if(DesignerContext.getReferencedElementCasePane() == null){ - return; + if (DesignerContext.getReferencedElementCasePane() == null) { + return; } ((ElementCasePane) DesignerContext.getReferencedElementCasePane()).getGrid().setNotShowingTableSelectPane(true); @@ -348,11 +299,11 @@ public abstract class ElementCasePane extends Tar } - public void setResolution(int resolution){ + public void setResolution(int resolution) { this.resolution = resolution; } - public int getResolution(){ + public int getResolution() { return this.resolution; } @@ -1149,7 +1100,7 @@ public abstract class ElementCasePane extends Tar HeadColumnAction headcolumnAction = new HeadColumnAction(this); FootColumnAction footcolumnAction = new FootColumnAction(this); - ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(),this.resolution); + ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(), this.resolution); ElementCase elementCase = this.getEditingElementCase(); boolean cancel = false; ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); @@ -1267,11 +1218,7 @@ public abstract class ElementCasePane extends Tar protected ToolBarDef createAlignmentToolBar() { return ShortCut.asToolBarDef(new ShortCut[]{ - new AlignmentAction(this, new Icon[]{ - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}, - new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT})} + new AlignmentAction(this)} ); } diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java b/designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java index 21c8bb419a..c51a72acdf 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIToggleButton.java @@ -122,7 +122,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{ @Override public void mouseClicked(MouseEvent e) { if (isEnabled() && !isEventBannded) { - setSelectedWithFireListener(!isSelected()); + setSelectedWithFireListener(!isSelected()); } } }; From 6627a860f8e15c7b1fe46c92aae28c3ec3f312ec Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 22 Sep 2017 12:37:05 +0800 Subject: [PATCH 17/37] =?UTF-8?q?=E5=9B=BE=E6=A0=87=E7=99=BD=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/images/m_format/.DS_Store | Bin 0 -> 6148 bytes .../design/images/m_format/cellstyle/.DS_Store | Bin 0 -> 8196 bytes .../images/m_format/cellstyle/bold_white.png | Bin 0 -> 235 bytes .../m_format/cellstyle/h_center_normal_white.png | Bin 0 -> 119 bytes .../m_format/cellstyle/h_left_normal_white.png | Bin 0 -> 128 bytes .../m_format/cellstyle/h_right_normal_white.png | Bin 0 -> 142 bytes .../images/m_format/cellstyle/italic_white.png | Bin 0 -> 158 bytes .../m_format/cellstyle/underline_white.png | Bin 0 -> 176 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 designer_base/src/com/fr/design/images/m_format/.DS_Store create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/.DS_Store create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/bold_white.png create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/italic_white.png create mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/underline_white.png diff --git a/designer_base/src/com/fr/design/images/m_format/.DS_Store b/designer_base/src/com/fr/design/images/m_format/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bf4865111dbb346a1de4da555831d48f400f975e GIT binary patch literal 6148 zcmeHK!A{#i5SJDj#hwMrJ_12hn5DrUNx>P8`%yKiXyo` z&<~)!7WyCX5k2-NdS_;LQ-MOS2&x%r_RY@D%-V0QT`vHL-YD(>cmUv_5;k0HZV?(M zos)+35DHzRgbGd|1r?3wqS*7^d zDHGby^ArPgT0e~5CTcwJmbUY(3X@C~y0)qDem}|LeB8@NSzPLPTikKh{OGr))pgu~ zw>+6_cH6SE)t$EGq_es4qAj~yFQ-%2S$V$k=ELVNUr)b%|8aKy^Fk+qz|U68GmA60 zMB^4(j)Njg^XwCj&N62ijLZNtzzjSf2J9B*EIy!T=0{})n1Q=tfc6K8O6Xgx4eG4} z8~S~u@g^Y&+H{v7loox9wLu&~5hfMUqzZe*5GEb{(#H7~Yl9{ogq|7e*qMdBp$I)Y z`lSvB;Tz{8Y_X2qrN$HMY`Lpy1TigECNMN(`mpc%E=~*wolcTMZ|r;iSyS z%2X&yMh7mD?xa#}<2fo26=*8JwR@K)R8U4UyMCW!#RShdonGL0`a>G7h)#C>$8=3g zT2V=JKeqJ^so1r!Lz<#*E{F}i!l)}+;O|Rw*ZKv)^5ARDgJbwQr}uP0TQHRVvDKp* zYE(l7j;=m6coyRAoHp{Xx84 z;<~_k!k&0Fmw2}s?tx*8wb0+2BfHsq?e8ryZ1;Wu=3LgRjl@9?AHCy9+}g;Y2YEOi zkjqXy4C&*auT7i>4$H{H5||MVPhWWS?B*dE$@$?h3~CGkUhul_aP)+uM3k(9d_bf- zc>NZ?@BtohoI4B%satGq&2`H4|Lgs~|KH+>kt!+>6}W2(sLuJ@^D}s5YU_r7Tx%yd z-r?ZJ{VHt*f|Hcvuu_i0?*3tj>jYgHlNwuTi#uq4{f7X2O_PD+{y+U)VexkxXQzq# JKmFVL|4%AqyZrzF literal 0 HcmV?d00001 diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/bold_white.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/bold_white.png new file mode 100644 index 0000000000000000000000000000000000000000..f10c6bef134a73de2e0380c969788d90f2b1a2f7 GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|mU_B4hFAzD zCrH#iuvh!RC}PEXr0+(}=?*=POZ|FmPwQDO9qQ@nsh{|C<^;jM*p7XlL)bpm)cZ57IRrY~|gz_Y|q;=gy}Pa*il%;gB`7j5Y@C?(K3;E6KhVJpp00i_>zopr0O2oD`v3p{ literal 0 HcmV?d00001 diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/h_center_normal_white.png new file mode 100644 index 0000000000000000000000000000000000000000..2f7432769b62e696e9e0dcb5435310f779d377b0 GIT binary patch literal 119 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|3_V>OLo5W7 z6C^%02tH~4@8HnqFVWZ_Q>#%G;G=L&HDsgYv!06v2?-Ls%n?}&8rT>vHA=9rHPHbP0l+XkK(VHPU literal 0 HcmV?d00001 diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/h_left_normal_white.png new file mode 100644 index 0000000000000000000000000000000000000000..94a2be8dc23a2d9b565ec594da58c405fde6f30f GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|tUO&DLo5W7 z6C^%02tH~4@8HnqFVWZ_Q>#(sQN$RU@OxQZ3ddc;OXk;vd$@?2>?lwCcOXv literal 0 HcmV?d00001 diff --git a/designer_base/src/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png b/designer_base/src/com/fr/design/images/m_format/cellstyle/h_right_normal_white.png new file mode 100644 index 0000000000000000000000000000000000000000..e8d21e9d0650b8156d9b892c6440fa62edb8be98 GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|JUm?-Lo5W7 z6C^%02tH~4@8HnqFVWZ_Q>#(6VV1+1?iJ6Ol5$-NttU9!iZ7V$0~09M{2J4cXS7jo hQ5W|GUG6QRt8U3KbLh*2~7Y85HxlG literal 0 HcmV?d00001 From 66cebb04cb0161bf388be0c61aa0d9ae38bfb9bb Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 22 Sep 2017 12:37:17 +0800 Subject: [PATCH 18/37] tmp --- .../src/com/fr/design/images/m_format/.DS_Store | Bin 6148 -> 0 bytes .../design/images/m_format/cellstyle/.DS_Store | Bin 8196 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 designer_base/src/com/fr/design/images/m_format/.DS_Store delete mode 100644 designer_base/src/com/fr/design/images/m_format/cellstyle/.DS_Store diff --git a/designer_base/src/com/fr/design/images/m_format/.DS_Store b/designer_base/src/com/fr/design/images/m_format/.DS_Store deleted file mode 100644 index bf4865111dbb346a1de4da555831d48f400f975e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!A{#i5SJDj#hwMrJ_12hn5DrUNx>P8`%yKiXyo` z&<~)!7WyCX5k2-NdS_;LQ-MOS2&x%r_RY@D%-V0QT`vHL-YD(>cmUv_5;k0HZV?(M zos)+35DHzRgbGd|1r?3wqS*7^d zDHGby^ArPgT0e~5CTcwJmbUY(3X@C~y0)qDem}|LeB8@NSzPLPTikKh{OGr))pgu~ zw>+6_cH6SE)t$EGq_es4qAj~yFQ-%2S$V$k=ELVNUr)b%|8aKy^Fk+qz|U68GmA60 zMB^4(j)Njg^XwCj&N62ijLZNtzzjSf2J9B*EIy!T=0{})n1Q=tfc6K8O6Xgx4eG4} z8~S~u@g^Y&+H{v7loox9wLu&~5hfMUqzZe*5GEb{(#H7~Yl9{ogq|7e*qMdBp$I)Y z`lSvB;Tz{8Y_X2qrN$HMY`Lpy1TigECNMN(`mpc%E=~*wolcTMZ|r;iSyS z%2X&yMh7mD?xa#}<2fo26=*8JwR@K)R8U4UyMCW!#RShdonGL0`a>G7h)#C>$8=3g zT2V=JKeqJ^so1r!Lz<#*E{F}i!l)}+;O|Rw*ZKv)^5ARDgJbwQr}uP0TQHRVvDKp* zYE(l7j;=m6coyRAoHp{Xx84 z;<~_k!k&0Fmw2}s?tx*8wb0+2BfHsq?e8ryZ1;Wu=3LgRjl@9?AHCy9+}g;Y2YEOi zkjqXy4C&*auT7i>4$H{H5||MVPhWWS?B*dE$@$?h3~CGkUhul_aP)+uM3k(9d_bf- zc>NZ?@BtohoI4B%satGq&2`H4|Lgs~|KH+>kt!+>6}W2(sLuJ@^D}s5YU_r7Tx%yd z-r?ZJ{VHt*f|Hcvuu_i0?*3tj>jYgHlNwuTi#uq4{f7X2O_PD+{y+U)VexkxXQzq# JKmFVL|4%AqyZrzF From 3fc4230154b8a75f1559b25d8fa9491e175746c3 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 22 Sep 2017 12:42:34 +0800 Subject: [PATCH 19/37] rt --- designer_base/src/com/fr/design/mainframe/DesignerFrame.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index df92a6bf09..b456b0a1ad 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -6,7 +6,6 @@ package com.fr.design.mainframe; import com.fr.base.BaseUtils; import com.fr.base.Env; import com.fr.base.FRContext; -import com.fr.base.FRCoreContext; import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; @@ -43,7 +42,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.GeneralContext; import com.fr.general.Inter; -import com.fr.general.VT4FR; import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.manage.PluginFilter; From 83061d0ba2a44e084dcbbf8a92c4da9a257fc006 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Fri, 22 Sep 2017 12:43:14 +0800 Subject: [PATCH 20/37] rt --- .../alphafine/AlphaFineConfigManager.java | 48 ++++++------------- 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index b335bbad03..8d58ce4578 100644 --- a/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer_base/src/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -16,79 +16,68 @@ import javax.swing.*; */ public class AlphaFineConfigManager implements XMLable { + private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); /** * 是否开启alphafine */ private boolean isEnabled = true; - /** * 是否联网搜索 */ private boolean isSearchOnLine = true; /** - * 快捷键设置 + * 搜索范围 */ - private String shortcuts; - /** - * 搜索范围 + * 快捷键设置 */ - + private String shortcuts; /** * 猜您需要 */ private boolean isContainRecommend = true; - /** * 设置 */ private boolean isContainAction = true; - /** * 帮助文档 */ private boolean isContainDocument = true; - /** * 模板 */ private boolean isContainTemplate = true; - /** * 模板内容 */ private boolean isContainFileContent; - /** * 应用中心 */ private boolean isContainPlugin = true; - /** * 快捷键 */ private KeyStroke shortCutKeyStore; - /** * 是否提醒 */ private boolean isNeedRemind = true; - /** * 直接操作菜单次数 */ private int operateCount; - - - - private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); - public static AlphaFineConfigManager getInstance() { return alphaFineConfigManager; } + public static boolean isALPHALicAvailable() { + return FRContext.getCurrentEnv() != null && VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support(); + } + @Override public Object clone() throws CloneNotSupportedException { AlphaFineConfigManager manager = (AlphaFineConfigManager) super.clone(); @@ -131,8 +120,6 @@ public class AlphaFineConfigManager implements XMLable { writer.end(); } - - public boolean isSearchOnLine() { return isSearchOnLine; } @@ -148,20 +135,20 @@ public class AlphaFineConfigManager implements XMLable { return shortcuts; } + public void setShortcuts(String shortcuts) { + this.shortcuts = shortcuts; + this.shortCutKeyStore = convert2KeyStroke(this.shortcuts); + } + /** * 返回默认快捷键 + * * @return */ private String getDefaultShortCuts() { - return OperatingSystem.isMacOS()? "meta + D" : "ctrl + D"; + return OperatingSystem.isMacOS() ? "meta + D" : "ctrl + D"; } - public void setShortcuts(String shortcuts) { - this.shortcuts = shortcuts; - this.shortCutKeyStore = convert2KeyStroke(this.shortcuts); - } - - public boolean isContainAction() { return isContainAction; } @@ -248,9 +235,4 @@ public class AlphaFineConfigManager implements XMLable { public void setOperateCount(int operateCount) { this.operateCount = operateCount; } - - - public static boolean isALPHALicAvailable() { - return FRContext.getCurrentEnv() != null && VT4FR.isLicAvailable(FRCoreContext.getBytes()) && VT4FR.ALPHA_FINE.support(); - } } From 716f2a8b25bbb03ab8589cd5c45af27e7c726be8 Mon Sep 17 00:00:00 2001 From: vito Date: Fri, 22 Sep 2017 15:35:32 +0800 Subject: [PATCH 21/37] =?UTF-8?q?REPORT-3686=20=E8=BF=9C=E7=A8=8B=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E8=AF=B7=E6=B1=82=E6=B2=A1=E6=9C=89=E6=9D=83=E9=99=90?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=202/2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/env/RemoteEnv.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 41e4860d2b..2188b322b0 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -175,12 +175,8 @@ public class RemoteEnv extends AbstractEnv { * 根据nameValuePairs,也就是参数对,生成PostMethod,不同之处在于,参数拼在path后面,不是method.addParameters */ private HttpClient createHttpMethod2(HashMap para) throws EnvException { - StringBuilder sb = new StringBuilder(path); - - sb.append('?'); - sb.append("id=").append(createUserID()); - - return new HttpClient(sb.toString(), para, true); + String methodPath = path + '?' + "id=" + createUserID(); + return new HttpClient(methodPath, para, true); } @@ -362,7 +358,7 @@ public class RemoteEnv extends AbstractEnv { Inter.getLocText(new String[]{"Datasource-Connection_failed", "Registration-User_Name", "Password", "Error"}, new String[]{",", "", "", "!"}) , Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); return false; - } else if (res.indexOf("RegistEditionException") != -1) { + } else if (res.contains("RegistEditionException")) { if (needMessage) { JOptionPane.showMessageDialog(parentComponent, Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"})); } else { @@ -415,9 +411,8 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "heart_beat"); para.put("user", user); - para.put("userid", userID); - HttpClient client = createHttpMethod(para, true); + HttpClient client = createHttpMethod(para); execute4InputStream(client); //这做法不好, 30秒刷一次, 刷新的时候会重新构建树, 构建完会把子节点都收缩起来, 效果太差. @@ -552,7 +547,7 @@ public class RemoteEnv extends AbstractEnv { if (resJSON == null) { return false; } - if (resJSON.indexOf("RegistEditionException") != -1) { + if (resJSON.contains("RegistEditionException")) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Lic_does_not_Support_Remote")); return false; } From fb3d56a3125a1fdb35ac1cbabce3220a491e165e Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 22 Sep 2017 16:28:20 +0800 Subject: [PATCH 22/37] =?UTF-8?q?REPORT-4688=20[9.0=E4=BA=8C=E8=BD=AE?= =?UTF-8?q?=E5=9B=9E=E5=BD=92]=E6=96=B0=E5=BB=BAsheet2=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=EF=BC=8C=E6=92=A4?= =?UTF-8?q?=E9=94=80=E4=B8=80=E6=AC=A1=E6=93=8D=E4=BD=9C=E5=90=8Esheet2?= =?UTF-8?q?=E8=A2=AB=E6=95=B4=E4=B8=AA=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/ElementCasePaneDelegate.java | 3 +++ .../src/com/fr/design/mainframe/ReportFloatPane.java | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index b358b53024..bbc87fa78c 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -176,6 +176,9 @@ public class ElementCasePaneDelegate extends ElementCasePane { for (int i = 0; i < actions.length; i++) { subMenuDef.addShortCut(actions[i]); } + + // 顺便更新右侧属性面板悬浮元素tab中的菜单项 + ReportFloatPane.getInstance().refreshInsertFloatMenu(this); } // 格式菜单 diff --git a/designer/src/com/fr/design/mainframe/ReportFloatPane.java b/designer/src/com/fr/design/mainframe/ReportFloatPane.java index 9f579f4f96..8207c9db0f 100644 --- a/designer/src/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer/src/com/fr/design/mainframe/ReportFloatPane.java @@ -23,7 +23,6 @@ import java.awt.*; public class ReportFloatPane extends JPanel { private static ReportFloatPane THIS; - private ElementCasePaneDelegate elementCasePaneDelegate; private MenuDef insertFloatMenu; private ReportFloatPane() { @@ -37,6 +36,14 @@ public class ReportFloatPane extends JPanel { return THIS; } + public void refreshInsertFloatMenu(ElementCasePaneDelegate elementCasePaneDelegate) { + UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); + insertFloatMenu.clearShortCuts(); + for (int i = 0; i < actions.length; i++) { + insertFloatMenu.addShortCut(actions[i]); + } + } + private void initComponent() { this.setLayout(new BorderLayout()); @@ -72,7 +79,7 @@ public class ReportFloatPane extends JPanel { insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float")); insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png"); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); + ElementCasePaneDelegate elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); for (int i = 0; i < actions.length; i++) { insertFloatMenu.addShortCut(actions[i]); From 75805ca67962f1197b716a716479afccfe71042c Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 22 Sep 2017 16:36:52 +0800 Subject: [PATCH 23/37] =?UTF-8?q?REPORT-4688=20=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/ReportFloatPane.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ReportFloatPane.java b/designer/src/com/fr/design/mainframe/ReportFloatPane.java index 8207c9db0f..e759600426 100644 --- a/designer/src/com/fr/design/mainframe/ReportFloatPane.java +++ b/designer/src/com/fr/design/mainframe/ReportFloatPane.java @@ -37,8 +37,8 @@ public class ReportFloatPane extends JPanel { } public void refreshInsertFloatMenu(ElementCasePaneDelegate elementCasePaneDelegate) { - UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); insertFloatMenu.clearShortCuts(); + UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); for (int i = 0; i < actions.length; i++) { insertFloatMenu.addShortCut(actions[i]); } @@ -49,7 +49,7 @@ public class ReportFloatPane extends JPanel { UIToolbar topToolBar = new UIToolbar(); topToolBar.setLayout(new BorderLayout()); - insertFloatMenu = createInsertToolBar(); + initInsertToolBar(); topToolBar.setPreferredSize(new Dimension(155,20)); topToolBar.add(createButtonUI(), BorderLayout.CENTER); topToolBar.setBorder(BorderFactory.createEmptyBorder(-1, -1, -1, -1)); @@ -73,19 +73,14 @@ public class ReportFloatPane extends JPanel { this.add(leftTopPane, BorderLayout.NORTH); } - private MenuDef createInsertToolBar() { - MenuDef insertFloatMenu = new MenuDef(true); + private void initInsertToolBar() { + insertFloatMenu = new MenuDef(true); insertFloatMenu.setName(KeySetUtils.INSERT_FLOAT.getMenuKeySetName()); insertFloatMenu.setTooltip(Inter.getLocText("FR-Designer_T_Insert_Float")); insertFloatMenu.setIconPath("com/fr/design/images/control/addPopup.png"); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); ElementCasePaneDelegate elementCasePaneDelegate = (ElementCasePaneDelegate) editingTemplate.getCurrentElementCasePane(); - UpdateAction[] actions = ActionFactory.createFloatInsertAction(ElementCasePane.class, elementCasePaneDelegate); - for (int i = 0; i < actions.length; i++) { - insertFloatMenu.addShortCut(actions[i]); - } - return insertFloatMenu; - + refreshInsertFloatMenu(elementCasePaneDelegate); } private UIButton createButtonUI() { From 9fce24b6c9b5218daddb802d6f9a48714a373603 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 22 Sep 2017 17:22:53 +0800 Subject: [PATCH 24/37] =?UTF-8?q?REPORT-4781=20=E5=BC=B9=E5=87=BA=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=8C=89=E9=92=AE=E8=A7=86=E8=A7=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accessibles/BaseAccessibleEditor.java | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java index ec6d4405ed..e0d134ad6c 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java @@ -4,29 +4,31 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; - +import javax.swing.AbstractButton; import javax.swing.BorderFactory; - +import com.fr.design.constants.UIConstants; import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; - import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; - +import javax.swing.plaf.ButtonUI; import com.fr.base.BaseUtils; import com.fr.design.Exception.ValidationException; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.widget.editors.ITextComponent; import com.fr.design.mainframe.widget.editors.TextField; import com.fr.design.dialog.BasicPane; import com.fr.design.designer.properties.Decoder; import com.fr.design.designer.properties.Encoder; +import com.fr.design.utils.gui.GUIPaintUtils; /** * @since 6.5.3 @@ -89,6 +91,26 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor public boolean shouldResponseChangeListener() { return false; } + @Override + public ButtonUI getUI() { + return new UIButtonUI() { + @Override + protected boolean isPressed(AbstractButton b) { + return model.isArmed() && model.isPressed(); + } + + @Override + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL); + } + } + }; + } }; initPopupButton(); btPopup.addActionListener(new ActionListener() { From 5e595038843abbeadbcbe180d37535ae15eee7e7 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 23 Sep 2017 00:12:10 +0800 Subject: [PATCH 25/37] =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/alphafine/AlphaFineHelper.java | 1 - .../alphafine/cell/model/ActionModel.java | 11 +-- .../alphafine/component/AlphaFineDialog.java | 76 ++++++++++--------- .../alphafine/component/AlphaFinePane.java | 3 +- .../search/manager/FileSearchManager.java | 7 +- .../search/manager/RecentSearchManager.java | 29 +++++-- .../toolbar/UpdateActionManager.java | 12 +++ 7 files changed, 87 insertions(+), 52 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java index 178c6d7e31..012f5e8727 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java +++ b/designer/src/com/fr/design/mainframe/alphafine/AlphaFineHelper.java @@ -19,7 +19,6 @@ import java.util.List; * Created by XiaXiang on 2017/5/8. */ public class AlphaFineHelper { - public static final NoResultModel NO_RESULT_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_AlphaFine_NoResult")); public static final NoResultModel NO_CONNECTION_MODEL = new NoResultModel(Inter.getLocText("FR-Designer_ConnectionFailed")); private static AlphaFineDialog alphaFineDialog; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java index 8e2ccd9a79..cf703d8795 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.cell.model; +import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.alphafine.CellType; import com.fr.general.FRLogger; import com.fr.json.JSONException; @@ -11,15 +12,15 @@ import javax.swing.*; * Created by XiaXiang on 2017/4/20. */ public class ActionModel extends AlphaCellModel { - private Action action; + private UpdateAction action; - public ActionModel(String name, String description, Action action, int searchCount) { + public ActionModel(String name, String description, UpdateAction action, int searchCount) { this(name, description, action); setSearchCount(searchCount); } - public ActionModel(String name, String description, Action action) { + public ActionModel(String name, String description, UpdateAction action) { super(name, null, CellType.ACTION); this.action = action; this.setDescription(description); @@ -43,11 +44,11 @@ public class ActionModel extends AlphaCellModel { return action != null ? action.hashCode() : 0; } - public Action getAction() { + public UpdateAction getAction() { return action; } - public void setAction(Action action) { + public void setAction(UpdateAction action) { this.action = action; } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java index e973c6a422..e712edb478 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFineDialog.java @@ -367,7 +367,6 @@ public class AlphaFineDialog extends UIDialog { * 停止加载状态 */ private void fireStopLoading() { - searchListModel.resetState(); if (searchResultPane != null) { removeLeftPane(); } @@ -665,25 +664,18 @@ public class AlphaFineDialog extends UIDialog { searchTextField.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_DOWN) { - searchResultList.requestFocus(); - searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); - } - } - - @Override - public void keyReleased(KeyEvent e) { - int keyCode = e.getKeyCode(); - if (keyCode == KeyEvent.VK_ESCAPE) { - if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) { - AlphaFineDialog.this.setVisible(false); - } else { - searchTextField.setText(null); - removeSearchResult(); + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (searchResultList.getModel().getSize() > 1) { + dealWithSearchResult(searchResultList.getSelectedValue()); } - } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { - dealWithSearchResult(searchResultList.getSelectedValue()); - } + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + if (searchResultList.getSelectedIndex() == searchResultList.getModel().getSize() - 1) { + searchResultList.setSelectedIndex(0); + } + searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() + 1); + } else if (e.getKeyCode() == KeyEvent.VK_UP) { + searchResultList.setSelectedIndex(searchResultList.getSelectedIndex() - 1); + } else escAlphaFine(e); } }); @@ -754,7 +746,9 @@ public class AlphaFineDialog extends UIDialog { private void doNavigate() { AlphaFineDialog.this.dispose(); final AlphaCellModel model = searchResultList.getSelectedValue(); - model.doAction(); + if (model != null) { + model.doAction(); + } } /** @@ -888,6 +882,21 @@ public class AlphaFineDialog extends UIDialog { this.splitLabel = splitLabel; } + /** + * 键盘退出AlphaFine + * + * @param e + */ + private void escAlphaFine(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + if (StringUtils.isBlank(searchTextField.getText()) || ComparatorUtils.equals(searchTextField.getText(), searchTextField.getPlaceHolder())) { + AlphaFineDialog.this.setVisible(false); + } else { + searchTextField.setText(null); + removeSearchResult(); + } + } + } /** * +-------------------------------------+ @@ -907,7 +916,9 @@ public class AlphaFineDialog extends UIDialog { */ @Override public void setSelectedIndex(int index) { - if (index > 0 && checkSelectedIndex(index)) { + if (index == 0 && getModel().getSize() > 1) { + super.setSelectedIndex(1); + } else if (index > 0 && checkSelectedIndex(index)) { int previousIndex = getSelectedIndex(); super.setSelectedIndex(index); AlphaCellModel cellModel = getSelectedValue(); @@ -930,21 +941,6 @@ public class AlphaFineDialog extends UIDialog { } private void initListListener() { - addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_ENTER) { - dealWithSearchResult(getSelectedValue()); - } else if (e.getKeyCode() == KeyEvent.VK_UP) { - if (getSelectedIndex() == 1) { - searchTextField.requestFocus(); - } - } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { - searchTextField.requestFocus(); - } - } - }); - addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { @@ -968,6 +964,14 @@ public class AlphaFineDialog extends UIDialog { } } }); + + addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + escAlphaFine(e); + + } + }); } } diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 8c962a0010..5d24a85c44 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.alphafine.component; +import com.bulenkov.iconloader.IconLoader; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.help.alphafine.AlphaFineContext; import com.fr.design.actions.help.alphafine.AlphaFineListener; @@ -27,7 +28,7 @@ public class AlphaFinePane extends BasicPane { Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); } UIButton refreshButton = new UIButton(); - refreshButton.setIcon(IOUtils.readIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); + refreshButton.setIcon(IconLoader.getIcon("/com/fr/design/mainframe/alphafine/images/smallsearch.png")); refreshButton.setToolTipText(Inter.getLocText("FR-Designer_AlphaFine")); refreshButton.set4ToolbarButton(); refreshButton.setRolloverEnabled(false); diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java index 0c1a3b61b2..76cc8a6351 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/FileSearchManager.java @@ -19,7 +19,12 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index 69959830c5..c191c0c11e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -10,6 +10,7 @@ import com.fr.design.mainframe.alphafine.cell.model.ActionModel; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; import com.fr.design.mainframe.alphafine.model.SearchResult; +import com.fr.design.mainframe.toolbar.UpdateActionManager; import com.fr.file.XMLFileManager; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; @@ -26,8 +27,17 @@ import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLableReader; -import java.io.*; -import java.util.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.StringReader; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; /** * Created by XiaXiang on 2017/5/15. @@ -220,21 +230,24 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear recentModelList = recentKVModelMap.get(searchText); SearchResult resultModelList = recentModelList; Iterator modelIterator = resultModelList.iterator(); + SearchResult searchResult = new SearchResult(); while (modelIterator.hasNext()) { AlphaCellModel model = modelIterator.next(); - if (model.getType() == CellType.ACTION && !((ActionModel) model).getAction().isEnabled()) { - modelIterator.remove(); + if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) { + continue; + } else { + searchResult.add(model); } } - Collections.sort(resultModelList); - int size = resultModelList.size(); + Collections.sort(searchResult); + int size = searchResult.size(); if (size > MAX_SIZE) { SearchResult result = new SearchResult(); - result.addAll(resultModelList.subList(0, MAX_SIZE)); + result.addAll(searchResult.subList(0, MAX_SIZE)); return result; } - return resultModelList; + return searchResult; } } return recentModelList; diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java index 47ae6101fa..845eb3660e 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java @@ -1,5 +1,8 @@ package com.fr.design.mainframe.toolbar; +import com.fr.design.actions.UpdateAction; +import com.fr.general.ComparatorUtils; + import java.util.List; /** @@ -23,4 +26,13 @@ public class UpdateActionManager { public void setUpdateActions(List updateActions) { this.updateActions = updateActions; } + + public boolean isEnable(UpdateAction updateAction) { + for (UpdateActionModel action : updateActions) { + if (ComparatorUtils.equals(updateAction.getName(), action.getActionName()) && action.getAction().isEnabled()) { + return true; + } + } + return false; + } } From 96b74b956e6f36b788024d59d0d5a265f422838b Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 23 Sep 2017 00:15:13 +0800 Subject: [PATCH 26/37] rt --- .../mainframe/alphafine/search/manager/PluginSearchManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java index 25efb5f6bd..2ea8ba0e84 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/PluginSearchManager.java @@ -103,6 +103,7 @@ public class PluginSearchManager implements AlphaFineSearchProcessor { if (jsonArray != null) { SearchResult searchResult = new SearchResult(); for (int i = 0; i < jsonArray.length(); i++) { + AlphaFineHelper.checkCancel(); PluginModel cellModel = getPluginModel(jsonArray.optJSONObject(i), false); if (!AlphaFineHelper.getFilterResult().contains(cellModel)) { searchResult.add(cellModel); From f79dc54891a6d0aae636c508b51eee524520a5bb Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 23 Sep 2017 00:21:11 +0800 Subject: [PATCH 27/37] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/alphafine/component/AlphaFinePane.java | 2 +- designer/src/com/fr/start/Designer.java | 2 +- designer_base/src/com/fr/design/mainframe/DesignerFrame.java | 2 +- .../src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 5d24a85c44..0034e5c606 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -23,7 +23,7 @@ public class AlphaFinePane extends BasicPane { private static AlphaFinePane alphaFinePane; public AlphaFinePane() { - setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 14)); + setLayout(new BorderLayout()); if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { Toolkit.getDefaultToolkit().addAWTEventListener(AlphaFineDialog.listener(), AWTEvent.KEY_EVENT_MASK); } diff --git a/designer/src/com/fr/start/Designer.java b/designer/src/com/fr/start/Designer.java index bd4c455e71..07e262d63c 100644 --- a/designer/src/com/fr/start/Designer.java +++ b/designer/src/com/fr/start/Designer.java @@ -352,7 +352,7 @@ public class Designer extends BaseDesigner { * * @return 面板组件 */ - public Component createAlphafinePane() { + public Component createAlphaFinePane() { return AlphaFinePane.getAlphaFinePane(); } diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index b456b0a1ad..c85763a890 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -340,7 +340,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } processor.hold(northEastPane, LogMessageBar.getInstance(), ad.createBBSLoginPane()); if (AlphaFineConfigManager.isALPHALicAvailable() && DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isEnabled()) { - northEastPane.add(ad.createAlphafinePane(), BorderLayout.CENTER); + northEastPane.add(ad.createAlphaFinePane(), BorderLayout.CENTER); } } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 9dab4fb664..258a9e22bb 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -384,7 +384,7 @@ public abstract class ToolBarMenuDock { return new UILabel(); } - public Component createAlphafinePane() { + public Component createAlphaFinePane() { return new UILabel(); } From ed26cbcec1dc05ca68f923b5a84f4bfe8ca3a720 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Sat, 23 Sep 2017 00:56:20 +0800 Subject: [PATCH 28/37] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=EF=BC=8C=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/alphafine/cell/model/ActionModel.java | 2 -- .../mainframe/alphafine/cell/model/AlphaCellModel.java | 5 +++-- .../mainframe/alphafine/cell/render/ContentCellRender.java | 3 +-- .../mainframe/alphafine/cell/render/TitleCellRender.java | 1 - .../design/mainframe/alphafine/component/AlphaFinePane.java | 2 -- .../design/mainframe/alphafine/preview/FilePreviewPane.java | 2 +- .../fr/design/mainframe/alphafine/preview/NoResultPane.java | 2 +- 7 files changed, 6 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java index cf703d8795..cb2bbc4376 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/ActionModel.java @@ -6,8 +6,6 @@ import com.fr.general.FRLogger; import com.fr.json.JSONException; import com.fr.json.JSONObject; -import javax.swing.*; - /** * Created by XiaXiang on 2017/4/20. */ diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java b/designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java index ee9a9f55c9..04af821950 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/model/AlphaCellModel.java @@ -27,7 +27,7 @@ public abstract class AlphaCellModel implements Comparable { this.content = content; } - + public CellType getType() { return type; } @@ -68,6 +68,7 @@ public abstract class AlphaCellModel implements Comparable { public boolean isNeedToSendToServer() { return true; } + /** * model转json * @@ -102,7 +103,7 @@ public abstract class AlphaCellModel implements Comparable { @Override public int compareTo(Object o) { - AlphaCellModel cellModel = (AlphaCellModel)o; + AlphaCellModel cellModel = (AlphaCellModel) o; int difference = cellModel.getSearchCount() - this.getSearchCount(); if (difference != 0) { return difference; diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index a99aecf3a2..d8cd66d97e 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -5,7 +5,6 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.cell.model.AlphaCellModel; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; -import com.fr.general.IOUtils; import com.fr.stable.StringUtils; import javax.swing.*; @@ -55,7 +54,7 @@ public class ContentCellRender implements ListCellRenderer { detailLabel.setForeground(AlphaFineConstants.LIGHT_GRAY); panel.add(detailLabel, BorderLayout.CENTER); int width = (int) (titleLabel.getPreferredSize().getWidth() + detailLabel.getPreferredSize().getWidth()); - if ( width > AlphaFineConstants.LEFT_WIDTH - OFFSET) { + if (width > AlphaFineConstants.LEFT_WIDTH - OFFSET) { int nameWidth = (int) (AlphaFineConstants.LEFT_WIDTH - detailLabel.getPreferredSize().getWidth() - OFFSET); titleLabel.setPreferredSize(new Dimension(nameWidth, AlphaFineConstants.CELL_HEIGHT)); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java b/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java index 97f68cbf75..8d1d5a5f9b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java +++ b/designer/src/com/fr/design/mainframe/alphafine/cell/render/TitleCellRender.java @@ -3,7 +3,6 @@ package com.fr.design.mainframe.alphafine.cell.render; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.cell.model.MoreModel; -import com.fr.general.IOUtils; import javax.swing.*; import java.awt.*; diff --git a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java index 0034e5c606..d4ab8326d6 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/component/AlphaFinePane.java @@ -8,10 +8,8 @@ import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.utils.ThemeUtils; -import com.fr.general.IOUtils; import com.fr.general.Inter; -import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java index 15b69aab27..1ba7a5b915 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/FilePreviewPane.java @@ -18,7 +18,7 @@ public class FilePreviewPane extends JPanel { float widthScale = (AlphaFineConstants.RIGHT_WIDTH) / (float) image.getWidth(); float heightScale = (AlphaFineConstants.CONTENT_HEIGHT) / (float) image.getHeight(); Image showImage; - showImage = widthScale > heightScale? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH); + showImage = widthScale > heightScale ? image.getScaledInstance((int) (image.getWidth() * heightScale), AlphaFineConstants.CONTENT_HEIGHT, Image.SCALE_SMOOTH) : image.getScaledInstance(AlphaFineConstants.RIGHT_WIDTH, (int) (image.getWidth() * widthScale), Image.SCALE_SMOOTH); label.setIcon(new ImageIcon(showImage)); add(label); } diff --git a/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java index 6b80aae8be..738ecf4efd 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java +++ b/designer/src/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -20,7 +20,7 @@ public class NoResultPane extends JPanel { image.setPreferredSize(new Dimension(150, 111)); image.setHorizontalAlignment(SwingConstants.CENTER); image.setIcon(IconLoader.getIcon(iconUrl)); - image.setBorder(BorderFactory.createEmptyBorder(100,0,0,0)); + image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0)); UILabel description = new UILabel(title); description.setForeground(AlphaFineConstants.MEDIUM_GRAY); description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14)); From 86d64f9addfbca4e755e2d0b9e0b52c131081454 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 Sep 2017 11:39:44 +0800 Subject: [PATCH 29/37] 1 --- .../design/data/DesignTableDataManager.java | 55 +---- .../fr/design/designer/TargetComponent.java | 10 +- designer_base/src/com/fr/env/RemoteEnv.java | 219 ++++-------------- .../src/com/fr/design/mainframe/JForm.java | 24 +- 4 files changed, 84 insertions(+), 224 deletions(-) diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 17afec4717..621e303b1b 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -6,24 +6,19 @@ import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreXmlUtils; +import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedureConstants; +import com.fr.design.data.tabledata.wrapper.*; import com.fr.design.DesignModelAdapter; -import com.fr.design.data.datapane.preview.PreviewTablePane; -import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper; -import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; -import com.fr.design.data.tabledata.wrapper.StoreProcedureNameWrapper; -import com.fr.design.data.tabledata.wrapper.TableDataFactory; -import com.fr.design.data.tabledata.wrapper.TableDataWrapper; -import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.parameter.ParameterInputPane; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.general.ComparatorUtils; @@ -39,16 +34,8 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.io.ByteArrayOutputStream; import java.text.Collator; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Timer; -import java.util.TimerTask; /** * 设计器管理操作数据集的类: @@ -364,20 +351,7 @@ public abstract class DesignTableDataManager { * @throws Exception 异常 */ public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(null, tabledata, rowCount, true, needLoadingBar); - } - - /** - * 预览需要参数的数据集 - * - * @param tabledata 数据集 - * @param rowCount 需要预览的行数 - * @param needLoadingBar 是否需要加载进度条 - * @return 数据集 - * @throws Exception 异常 - */ - public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar); + return previewTableData(tabledata, rowCount, true, needLoadingBar); } /** @@ -390,20 +364,7 @@ public abstract class DesignTableDataManager { * @throws Exception 异常 */ public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(null, tabledata, rowCount, false, needLoadingBar); - } - - /** - * 预览不需要参数的数据集 - * - * @param tabledata 数据集 - * @param rowCount 需要预览的行数 - * @param needLoadingBar 是否需要加载进度条 - * @return 数据集 - * @throws Exception 异常 - */ - public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(tableDataSource, tabledata, rowCount, false, needLoadingBar); + return previewTableData(tabledata, rowCount, false, needLoadingBar); } /** @@ -415,7 +376,7 @@ public abstract class DesignTableDataManager { * 而获取数据集的字段名字时,则没必要 * @return */ - private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { + private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); Env currentEnv = FRContext.getCurrentEnv(); ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata); @@ -445,7 +406,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount); + return currentEnv.previewTableData(tabledata, parameterMap, rowCount); } catch (TableDataException e) { throw new TableDataException(e.getMessage(), e); } finally { diff --git a/designer_base/src/com/fr/design/designer/TargetComponent.java b/designer_base/src/com/fr/design/designer/TargetComponent.java index 4eedfa0129..ef5369b659 100644 --- a/designer_base/src/com/fr/design/designer/TargetComponent.java +++ b/designer_base/src/com/fr/design/designer/TargetComponent.java @@ -1,16 +1,16 @@ package com.fr.design.designer; -import javax.swing.*; - +import com.fr.design.DesignState; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; +import com.fr.design.mainframe.AuthorityEditPane; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.DesignState; import com.fr.design.menu.MenuDef; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; import com.fr.stable.StringUtils; -import com.fr.design.mainframe.*; + +import javax.swing.*; /** * 模板设计界面 @@ -31,7 +31,7 @@ public abstract class TargetComponent extends JComponent { public abstract void stopEditing(); - public final T getTarget() { + public T getTarget() { return target; } diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 72a20cf939..2188b322b0 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -1,16 +1,7 @@ package com.fr.env; -import com.fr.base.AbstractEnv; -import com.fr.base.EnvException; -import com.fr.base.FRContext; -import com.fr.base.FRCoreContext; -import com.fr.base.ModifiedTable; -import com.fr.base.Parameter; -import com.fr.base.StoreProcedureParameter; -import com.fr.base.TableData; -import com.fr.base.Utils; +import com.fr.base.*; import com.fr.base.remote.RemoteDeziConstants; -import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; @@ -26,34 +17,17 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; -import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.file.filetree.FileNode; -import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogger; -import com.fr.general.IOUtils; -import com.fr.general.Inter; -import com.fr.general.LogRecordTime; -import com.fr.general.VT4FR; +import com.fr.general.*; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; -import com.fr.plugin.Plugin; -import com.fr.plugin.PluginLicense; -import com.fr.plugin.PluginLicenseManager; -import com.fr.plugin.PluginLoader; import com.fr.share.ShareConstants; -import com.fr.stable.ArrayUtils; -import com.fr.stable.EncodeConstants; -import com.fr.stable.JavaCompileInfo; -import com.fr.stable.LicUtils; -import com.fr.stable.ProductConstants; -import com.fr.stable.StableUtils; -import com.fr.stable.StringUtils; -import com.fr.stable.SvgProvider; +import com.fr.stable.*; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -62,38 +36,17 @@ import com.fr.stable.xml.XMLableReader; import com.fr.web.ResourceConstants; import javax.swing.*; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; +import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.awt.*; -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.Socket; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; +import java.util.*; import java.util.List; -import java.util.Map; import java.util.Timer; -import java.util.TimerTask; import java.util.logging.Level; import java.util.regex.Pattern; @@ -159,15 +112,6 @@ public class RemoteEnv extends AbstractEnv { return password; } - // 修复密码中包含特殊字符,无法登录的问题 - private String getEncodedPassword() { - try { - return URLEncoder.encode(password, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return password; - } - } - public void setPassword(String password) { this.password = password; clearUserID(); @@ -231,12 +175,8 @@ public class RemoteEnv extends AbstractEnv { * 根据nameValuePairs,也就是参数对,生成PostMethod,不同之处在于,参数拼在path后面,不是method.addParameters */ private HttpClient createHttpMethod2(HashMap para) throws EnvException { - StringBuilder sb = new StringBuilder(path); - - sb.append('?'); - sb.append("id=").append(createUserID()); - - return new HttpClient(sb.toString(), para, true); + String methodPath = path + '?' + "id=" + createUserID(); + return new HttpClient(methodPath, para, true); } @@ -393,7 +333,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "test_server_connection"); para.put("user", user); - para.put("password", getEncodedPassword()); + para.put("password", password); if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) { return false; @@ -418,7 +358,7 @@ public class RemoteEnv extends AbstractEnv { Inter.getLocText(new String[]{"Datasource-Connection_failed", "Registration-User_Name", "Password", "Error"}, new String[]{",", "", "", "!"}) , Inter.getLocText("FR-Server-All_Error"), JOptionPane.ERROR_MESSAGE); return false; - } else if (res.indexOf("RegistEditionException") != -1) { + } else if (res.contains("RegistEditionException")) { if (needMessage) { JOptionPane.showMessageDialog(parentComponent, Inter.getLocText(new String[]{"Datasource-Connection_failed", "Version-does-not-support"}, new String[]{",", "!"})); } else { @@ -439,7 +379,6 @@ public class RemoteEnv extends AbstractEnv { private void extraChangeEnvPara() { //在env连接之前, 加载一下不依赖env的插件. 看看需不需要改变参数. - PluginLoader.init(); DesignerEnvProcessor envProcessor = ExtraDesignClassManager.getInstance().getSingle(DesignerEnvProcessor.XML_TAG); if (envProcessor != null) { this.path = envProcessor.changeEnvPathBeforeConnect(user, password, path); @@ -472,9 +411,8 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "heart_beat"); para.put("user", user); - para.put("userid", userID); - HttpClient client = createHttpMethod(para, true); + HttpClient client = createHttpMethod(para); execute4InputStream(client); //这做法不好, 30秒刷一次, 刷新的时候会重新构建树, 构建完会把子节点都收缩起来, 效果太差. @@ -516,7 +454,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "r_sign_in"); para.put("user", user); - para.put("password", getEncodedPassword()); + para.put("password", password); simulaRPC(para, true); @@ -609,7 +547,7 @@ public class RemoteEnv extends AbstractEnv { if (resJSON == null) { return false; } - if (resJSON.indexOf("RegistEditionException") != -1) { + if (resJSON.contains("RegistEditionException")) { JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Lic_does_not_Support_Remote")); return false; } @@ -1264,11 +1202,6 @@ public class RemoteEnv extends AbstractEnv { return DavXMLUtils.readXMLParameters(input); } - @Override - public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception { - return previewTableData(null, tableData, parameterMap, rowCount); - } - /** * 根据指定的参数生成一个实际可预览的数据集 * @@ -1278,7 +1211,7 @@ public class RemoteEnv extends AbstractEnv { * @return 实际的二维数据集 * @throws Exception 如果生成数据失败则抛出此异常 */ - public EmbeddedTableData previewTableData(TableDataSource dataSource, Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { + public EmbeddedTableData previewTableData(Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 把tableData写成xml文件到out @@ -1317,11 +1250,6 @@ public class RemoteEnv extends AbstractEnv { return previewTableData(tableData, parameterMap, -1); } - @Override - public Object previewTableData(TableDataSource dataSource, Object tableData, Map parameterMap, int start, int end, String[] cols, int[] colIdx) throws Exception { - return previewTableData(dataSource, tableData, parameterMap, -1); - } - /** * nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的 * @@ -1448,17 +1376,13 @@ public class RemoteEnv extends AbstractEnv { return; } SignIn.signIn(remoteEnv); - resetLicenseBytes(); + FRCoreContext.resetBytes(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshToolArea(); } catch (Exception em) { FRContext.getLogger().error(em.getMessage(), em); } } - private void resetLicenseBytes() { - FRCoreContext.retryLicLock(); - } - /** * 停止连接 */ @@ -1858,8 +1782,7 @@ public class RemoteEnv extends AbstractEnv { } LogRecordTime[] records = DavXMLUtils.readXMLLogRecords(input); for (LogRecordTime logRecordTime : records) { - DesignerLogHandler.getInstance().printRemoteLog(logRecordTime); - + //TODO } } @@ -2011,7 +1934,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "design_get_designer_version"); para.put("user", user); - para.put("password", getEncodedPassword()); + para.put("password", password); HttpClient client = createHttpMethod(para, true); try { @@ -2058,7 +1981,8 @@ public class RemoteEnv extends AbstractEnv { public void setLicName(String licName) { //do nth } - + + /** * 获取当前env的build文件路径 */ @@ -2094,74 +2018,8 @@ public class RemoteEnv extends AbstractEnv { info.parseJSON(jo); return info; } - - /** - * 将文件拷贝到插件目录 - * - * @param dir 要拷贝的文件 - * @param plugin 插件 - */ - public void copyFilesToPluginAndLibFolder(File dir, Plugin plugin) throws Exception { - - } - - /** - * 将文件添加到指定目录或者删除指定目录的文件 - * - * @param file 解压插件的临时目录 - * @param plugin 当前处理的插件 - */ - public void movePluginEmbFile(File file, Plugin plugin) throws Exception { - - } - - /** - * 将文件从插件目录删除 - * - * @param plugin 要删除插件 - * @return 同上 - */ - public String[] deleteFileFromPluginAndLibFolder(Plugin plugin) { - return new String[0]; - } - - /** - * 保存插件的配置文件 - * - * @param plugin 插件 - */ - public void writePlugin(Plugin plugin) throws Exception { - - } - - - /** - * 获取插件的配置目录 - * - * @param plugin - */ - public String getPluginFilePath(Plugin plugin) { - - return StringUtils.EMPTY; - } - - public void readPluginLicenses() throws Exception { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - HashMap para = new HashMap(); - para.put("op", "fr_remote_design"); - para.put("cmd", "design_plugin_licenses"); - - InputStream inputStream = postBytes2ServerB(out.toByteArray(), para); - String pluginsLicensesStr = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); - if (StringUtils.isNotBlank(pluginsLicensesStr) && pluginsLicensesStr.startsWith("[")) { - JSONArray jsonArray = new JSONArray(pluginsLicensesStr); - for (int i = 0; i < jsonArray.length(); i++) { - PluginLicense pluginLicense = new PluginLicense(); - pluginLicense.parseJSON(jsonArray.getJSONObject(i)); - PluginLicenseManager.getInstance().addRemotePluginLicense(pluginLicense); - } - } - } + + @Override public String pluginServiceAction(String serviceID, String req) throws Exception { @@ -2182,12 +2040,6 @@ public class RemoteEnv extends AbstractEnv { @Override public void pluginServiceStart(String serviceID){ } - - @Override - public void checkAndRegisterLic(FileNode node, Plugin plugin) throws Exception { - - } - @Override public File[] loadREUFile() throws Exception { File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), @@ -2303,9 +2155,34 @@ public class RemoteEnv extends AbstractEnv { return StringUtils.EMPTY; } } - + @Override - public void doWhenServerShutDown() { + public boolean isLocalEnv() { + + return false; + } + + @Override + public boolean hasPluginServiceStarted(String key) { + return true; + } + + @Override + public JSONArray getPluginStatus() { + + try { + HashMap para = new HashMap(); + para.put("op", "plugin"); + para.put("cmd", "get_status"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + return new JSONArray(stream2String(input)); + } catch (Exception e) { + return JSONArray.create(); + } } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index 0a4aa98944..0d7f93c088 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -12,7 +12,11 @@ import com.fr.design.designer.beans.actions.FormDeleteAction; import com.fr.design.designer.beans.actions.PasteAction; import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEvent; -import com.fr.design.designer.creator.*; +import com.fr.design.designer.creator.XComponent; +import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XCreatorUtils; +import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.XWAbsoluteBodyLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -499,6 +503,24 @@ public class JForm extends JTemplate implements BaseJForm { } + @Override + public void setTarget(Form form) { + if (this.formDesign == null) { + super.setTarget(form); + return; + } + this.formDesign.setTarget(form); + } + + @Override + public Form getTarget() { + if (this.formDesign == null) { + return super.getTarget(); + } + + return this.formDesign.getTarget(); + } + @Override protected FormModelAdapter createDesignModel() { return new FormModelAdapter(this); From 3502bdbe13935d2715050901728c0fc49040201a Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 Sep 2017 11:40:04 +0800 Subject: [PATCH 30/37] 1 --- .../src/com/fr/design/data/DesignTableDataManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 621e303b1b..aa5304b5f9 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -49,7 +49,7 @@ import java.util.Map.Entry; * * @author zhou */ -public abstract class DesignTableDataManager { +public abstract class Desig nTableDataManager { /** * 其实globalDsCache没有绝对的必要,只是为了操作方便。如果没有它,那么每次清空服务器数据集或者存储过程的时候,还要去遍历找一下, * 这个操作可能比较复杂 。 从减少代码复杂度的角度看,还是很有必要的 From ef960a7526eb043f639fed717b4acec301980a92 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 Sep 2017 11:40:14 +0800 Subject: [PATCH 31/37] 1 --- .../src/com/fr/design/data/DesignTableDataManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index aa5304b5f9..621e303b1b 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -49,7 +49,7 @@ import java.util.Map.Entry; * * @author zhou */ -public abstract class Desig nTableDataManager { +public abstract class DesignTableDataManager { /** * 其实globalDsCache没有绝对的必要,只是为了操作方便。如果没有它,那么每次清空服务器数据集或者存储过程的时候,还要去遍历找一下, * 这个操作可能比较复杂 。 从减少代码复杂度的角度看,还是很有必要的 From 56ac47162525077be9ac552151875ed74674c0f6 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 Sep 2017 12:36:28 +0800 Subject: [PATCH 32/37] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=20=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 --- .../design/data/DesignTableDataManager.java | 55 ++++++++++-- designer_base/src/com/fr/env/RemoteEnv.java | 90 ++++++++++++++++--- 2 files changed, 125 insertions(+), 20 deletions(-) diff --git a/designer_base/src/com/fr/design/data/DesignTableDataManager.java b/designer_base/src/com/fr/design/data/DesignTableDataManager.java index 621e303b1b..17afec4717 100644 --- a/designer_base/src/com/fr/design/data/DesignTableDataManager.java +++ b/designer_base/src/com/fr/design/data/DesignTableDataManager.java @@ -6,19 +6,24 @@ import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreXmlUtils; -import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fr.data.impl.EmbeddedTableData; import com.fr.data.impl.storeproc.ProcedureDataModel; import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedureConstants; -import com.fr.design.data.tabledata.wrapper.*; import com.fr.design.DesignModelAdapter; +import com.fr.design.data.datapane.preview.PreviewTablePane; +import com.fr.design.data.tabledata.wrapper.ServerTableDataWrapper; +import com.fr.design.data.tabledata.wrapper.StoreProcedureDataWrapper; +import com.fr.design.data.tabledata.wrapper.StoreProcedureNameWrapper; +import com.fr.design.data.tabledata.wrapper.TableDataFactory; +import com.fr.design.data.tabledata.wrapper.TableDataWrapper; +import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.iprogressbar.AutoProgressBar; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.parameter.ParameterInputPane; -import com.fr.design.dialog.DialogActionAdapter; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.general.ComparatorUtils; @@ -34,8 +39,16 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.io.ByteArrayOutputStream; import java.text.Collator; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Timer; +import java.util.TimerTask; /** * 设计器管理操作数据集的类: @@ -351,7 +364,20 @@ public abstract class DesignTableDataManager { * @throws Exception 异常 */ public static EmbeddedTableData previewTableDataNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(tabledata, rowCount, true, needLoadingBar); + return previewTableData(null, tabledata, rowCount, true, needLoadingBar); + } + + /** + * 预览需要参数的数据集 + * + * @param tabledata 数据集 + * @param rowCount 需要预览的行数 + * @param needLoadingBar 是否需要加载进度条 + * @return 数据集 + * @throws Exception 异常 + */ + public static EmbeddedTableData previewTableDataNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { + return previewTableData(tableDataSource, tabledata, rowCount, true, needLoadingBar); } /** @@ -364,7 +390,20 @@ public abstract class DesignTableDataManager { * @throws Exception 异常 */ public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { - return previewTableData(tabledata, rowCount, false, needLoadingBar); + return previewTableData(null, tabledata, rowCount, false, needLoadingBar); + } + + /** + * 预览不需要参数的数据集 + * + * @param tabledata 数据集 + * @param rowCount 需要预览的行数 + * @param needLoadingBar 是否需要加载进度条 + * @return 数据集 + * @throws Exception 异常 + */ + public static EmbeddedTableData previewTableDataNotNeedInputParameters(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean needLoadingBar) throws Exception { + return previewTableData(tableDataSource, tabledata, rowCount, false, needLoadingBar); } /** @@ -376,7 +415,7 @@ public abstract class DesignTableDataManager { * 而获取数据集的字段名字时,则没必要 * @return */ - private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { + private static EmbeddedTableData previewTableData(TableDataSource tableDataSource, TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); Env currentEnv = FRContext.getCurrentEnv(); ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata); @@ -406,7 +445,7 @@ public abstract class DesignTableDataManager { parameter.setValue(parameterMap.get(parameter.getName())); } } - return currentEnv.previewTableData(tabledata, parameterMap, rowCount); + return currentEnv.previewTableData(tableDataSource, tabledata, parameterMap, rowCount); } catch (TableDataException e) { throw new TableDataException(e.getMessage(), e); } finally { diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 2188b322b0..165ed3468a 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -1,7 +1,16 @@ package com.fr.env; -import com.fr.base.*; +import com.fr.base.AbstractEnv; +import com.fr.base.EnvException; +import com.fr.base.FRContext; +import com.fr.base.FRCoreContext; +import com.fr.base.ModifiedTable; +import com.fr.base.Parameter; +import com.fr.base.StoreProcedureParameter; +import com.fr.base.TableData; +import com.fr.base.Utils; import com.fr.base.remote.RemoteDeziConstants; +import com.fr.data.TableDataSource; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; import com.fr.data.impl.Connection; @@ -21,13 +30,25 @@ import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; import com.fr.file.filetree.FileNode; -import com.fr.general.*; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogger; +import com.fr.general.IOUtils; +import com.fr.general.Inter; +import com.fr.general.LogRecordTime; +import com.fr.general.VT4FR; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.share.ShareConstants; -import com.fr.stable.*; +import com.fr.stable.ArrayUtils; +import com.fr.stable.EncodeConstants; +import com.fr.stable.JavaCompileInfo; +import com.fr.stable.LicUtils; +import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.SvgProvider; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -35,18 +56,40 @@ import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLableReader; import com.fr.web.ResourceConstants; -import javax.swing.*; -import javax.xml.transform.*; +import javax.swing.JOptionPane; +import javax.swing.UIManager; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import java.awt.*; -import java.io.*; +import java.awt.Component; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.Socket; -import java.util.*; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Timer; +import java.util.TimerTask; import java.util.logging.Level; import java.util.regex.Pattern; @@ -112,6 +155,15 @@ public class RemoteEnv extends AbstractEnv { return password; } + // 修复密码中包含特殊字符,无法登录的问题 + private String getEncodedPassword() { + try { + return URLEncoder.encode(password, "UTF-8"); + } catch (UnsupportedEncodingException e) { + return password; + } + } + public void setPassword(String password) { this.password = password; clearUserID(); @@ -333,7 +385,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "test_server_connection"); para.put("user", user); - para.put("password", password); + para.put("password", getEncodedPassword()); if (path.startsWith("https") && (!DesignerEnvManager.getEnvManager().isHttps())) { return false; @@ -454,7 +506,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "r_sign_in"); para.put("user", user); - para.put("password", password); + para.put("password", getEncodedPassword()); simulaRPC(para, true); @@ -1202,6 +1254,11 @@ public class RemoteEnv extends AbstractEnv { return DavXMLUtils.readXMLParameters(input); } + @Override + public EmbeddedTableData previewTableData(Object tableData, Map parameterMap, int rowCount) throws Exception { + return previewTableData(null, tableData, parameterMap, rowCount); + } + /** * 根据指定的参数生成一个实际可预览的数据集 * @@ -1211,7 +1268,7 @@ public class RemoteEnv extends AbstractEnv { * @return 实际的二维数据集 * @throws Exception 如果生成数据失败则抛出此异常 */ - public EmbeddedTableData previewTableData(Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { + public EmbeddedTableData previewTableData(TableDataSource dataSource, Object tableData, java.util.Map parameterMap, int rowCount) throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); // 把tableData写成xml文件到out @@ -1250,6 +1307,11 @@ public class RemoteEnv extends AbstractEnv { return previewTableData(tableData, parameterMap, -1); } + @Override + public Object previewTableData(TableDataSource dataSource, Object tableData, Map parameterMap, int start, int end, String[] cols, int[] colIdx) throws Exception { + return previewTableData(dataSource, tableData, parameterMap, -1); + } + /** * nameValuePairs,这个参数要接着this.path,拼成一个URL,否则服务器端req.getParameter是无法得到的 * @@ -1934,7 +1996,7 @@ public class RemoteEnv extends AbstractEnv { para.put("op", "fr_remote_design"); para.put("cmd", "design_get_designer_version"); para.put("user", user); - para.put("password", password); + para.put("password", getEncodedPassword()); HttpClient client = createHttpMethod(para, true); try { @@ -2155,6 +2217,10 @@ public class RemoteEnv extends AbstractEnv { return StringUtils.EMPTY; } } + + public void doWhenServerShutDown() { + + } @Override public boolean isLocalEnv() { From 5c86706a6013c9fb623b7a2e7e3acda07f198b96 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 25 Sep 2017 13:10:31 +0800 Subject: [PATCH 33/37] =?UTF-8?q?REPORT-4372=20=E6=97=A5=E6=9C=9F=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E9=97=AE=E9=A2=98=3D>=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E6=8F=90=E7=A4=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/DateEditorDefinePane.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java index 5931cf7742..5a4ee9ac30 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java @@ -25,10 +25,7 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.SimpleDateFormat; @@ -43,6 +40,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane可以自动换行 + super.setText("" + text + ""); + } + }; sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); return sampleLabel; From f42e92abf88262eb2cc7b237db8c6cbbc978a668 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 25 Sep 2017 13:23:49 +0800 Subject: [PATCH 34/37] =?UTF-8?q?REPORT-4796=20=E8=A1=A8=E5=8D=95=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E5=9D=97=E8=83=8C=E6=99=AF=E6=97=A0=E6=B3=95=E4=BF=9D?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../accessibles/BaseAccessibleEditor.java | 7 ------ .../AccessibleElementCaseToolBarEditor.java | 25 ++++++------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java index e0d134ad6c..c2a1893d32 100644 --- a/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java +++ b/designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import javax.swing.AbstractButton; import javax.swing.BorderFactory; import com.fr.design.constants.UIConstants; -import com.fr.design.event.UIObserverListener; import com.fr.design.gui.ibutton.UIButton; import javax.swing.JComponent; import javax.swing.JOptionPane; @@ -85,12 +84,6 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor if (showButton) { btPopup = new UIButton(){ - public void registerChangeListener(UIObserverListener listener) { - return; - } - public boolean shouldResponseChangeListener() { - return false; - } @Override public ButtonUI getUI() { return new UIButtonUI() { diff --git a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java index ec675fe7ed..4321ab1dc8 100644 --- a/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java +++ b/designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.widget.accessibles; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.event.UIObserverListener; import com.fr.design.gui.core.WidgetOption; import com.fr.design.mainframe.FormWebWidgetConstants; import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane; @@ -13,8 +14,6 @@ import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import javax.swing.SwingUtilities; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -61,23 +60,13 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit } protected ITextComponent createTextField() { - TextField textField = new TextField(){ - protected void initListener() { - if (shouldResponseChangeListener()) { - getDocument().addDocumentListener(new DocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - } - @Override - public void removeUpdate(DocumentEvent e) { - attributeChange(); - } - @Override - public void changedUpdate(DocumentEvent e) { + TextField textField = new TextField() { + public void registerChangeListener(UIObserverListener listener) { + return; + } - } - }); - } + public boolean shouldResponseChangeListener() { + return false; } }; textField.setGlobalName(Inter.getLocText("Form-EC_toolbar")); From d36e7d661770c3992796a3cfe38e410093685575 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 25 Sep 2017 14:01:12 +0800 Subject: [PATCH 35/37] =?UTF-8?q?REPORT-4372=20=E6=97=A5=E6=9C=9F=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E9=97=AE=E9=A2=98=3D>=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E6=8F=90=E7=A4=BA=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8(=E6=BC=8F=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=B8=AA)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/DateEditorDefinePane.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java b/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java index 101bce139a..a0622c253b 100644 --- a/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java +++ b/designer/src/com/fr/design/widget/ui/DateEditorDefinePane.java @@ -36,7 +36,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane可以自动换行 + super.setText("" + text + ""); + } + }; sampleLabel.setHorizontalAlignment(SwingConstants.CENTER); sampleLabel.setFont(FRContext.getDefaultValues().getFRFont()); return sampleLabel; From 3fc91a5eaba80077725be9a465de0a39a8a26b1a Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 Sep 2017 15:11:20 +0800 Subject: [PATCH 36/37] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=20build=20failed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/JForm.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/JForm.java b/designer_form/src/com/fr/design/mainframe/JForm.java index dfa3784233..79b4ccc960 100644 --- a/designer_form/src/com/fr/design/mainframe/JForm.java +++ b/designer_form/src/com/fr/design/mainframe/JForm.java @@ -18,6 +18,7 @@ import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWAbsoluteBodyLayout; +import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.properties.FormWidgetAuthorityEditPane; import com.fr.design.event.TargetModifiedEvent; import com.fr.design.event.TargetModifiedListener; @@ -58,8 +59,17 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; import com.fr.stable.bridge.StableFactory; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; From 5a27503c24012aa6c2f25daca99fa97e787d02ed Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Mon, 25 Sep 2017 15:12:12 +0800 Subject: [PATCH 37/37] 1 --- .../mainframe/errorinfo/ErrorInfoUploader.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java index 10ff2779b4..07aadbe915 100644 --- a/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java +++ b/designer/src/com/fr/design/mainframe/errorinfo/ErrorInfoUploader.java @@ -29,6 +29,8 @@ public class ErrorInfoUploader { private static ErrorInfoUploader collector; private static boolean licSupport = true; + // 在一台不能上网的电脑里发现了10w个errorinfo... + private static final int MAX_ERROR_SIZE = 2000; static { GeneralContext.addEnvChangedListener(new EnvChangedListener() { @@ -123,6 +125,11 @@ public class ErrorInfoUploader { } File[] files = folder.listFiles(); + if (files.length > MAX_ERROR_SIZE) { + StableUtils.deleteFile(folder); + return; + } + try { for (File file : files) { String filePath = file.getPath(); @@ -131,6 +138,11 @@ public class ErrorInfoUploader { if (suffix.endsWith(SUFFIX)) { Thread.sleep(1000L); String content = IOUtils.inputStream2String(new FileInputStream(file)); + if (content.length() > MAX_ERROR_SIZE) { + file.delete(); + continue; + } + String url = SiteCenter.getInstance().acquireUrlByKind("design.error"); if (sendErroInfo(url, content)) { file.delete();