diff --git a/designer/.classpath b/designer/.classpath index f46ca27d3..5d73feddc 100644 --- a/designer/.classpath +++ b/designer/.classpath @@ -1,52 +1,62 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java index eb02932b6..a0e8d80b2 100644 --- a/designer/src/com/fr/design/parameter/ParameterDefinitePane.java +++ b/designer/src/com/fr/design/parameter/ParameterDefinitePane.java @@ -22,7 +22,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.AuthorityToolBarPane; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JWorkBook; -import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.*; import com.fr.design.module.DesignModuleFactory; diff --git a/designer_base/.classpath b/designer_base/.classpath index cc6f823ac..0c04bc6c6 100644 --- a/designer_base/.classpath +++ b/designer_base/.classpath @@ -3,8 +3,57 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/designer_base/src/com/fr/design/actions/file/LocalePane.java b/designer_base/src/com/fr/design/actions/file/LocalePane.java index 3356fa70a..4dd25c504 100644 --- a/designer_base/src/com/fr/design/actions/file/LocalePane.java +++ b/designer_base/src/com/fr/design/actions/file/LocalePane.java @@ -27,6 +27,8 @@ import com.fr.design.dialog.BasicPane; import com.fr.file.filetree.FileNode; import com.fr.general.*; import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.project.ProjectConstants; /** @@ -51,8 +53,8 @@ public class LocalePane extends BasicPane { add(tabbedPane, BorderLayout.CENTER); predefineTableModel = new DefaultTableModel() { - public boolean isCellEditable(int col, int row) { - return false; + public boolean isCellEditable(int row, int column) { + return column == 0; } }; @@ -109,23 +111,39 @@ public class LocalePane extends BasicPane { } private void initPredefinedProperties() { - Map map = Inter.getPredefinedPackageMap(); - LocalePackage chinese = map.get(Locale.SIMPLIFIED_CHINESE); + + Map supportLocaleMap = Inter.getSupportLocaleMap(); + + String[] localeFiles = StableFactory.getLocaleFiles(); + + List sortKeys = new ArrayList(); - Set bundles = chinese.getKindsOfResourceBundle(); - for (ResourceBundle bundle : bundles) { - sortKeys.addAll(bundle.keySet()); + for (String path : localeFiles) { + ResourceBundle chineseBundle = loadResourceBundle(path, Locale.SIMPLIFIED_CHINESE); + sortKeys.addAll(chineseBundle.keySet()); } Collections.sort(sortKeys); + Map> localeResourceBundleMap = new HashMap>(); + for (Map.Entry entry : supportLocaleMap.entrySet()) { + Locale locale = entry.getKey(); + List list = new ArrayList<>(); + for (String path : localeFiles) { + ResourceBundle chineseBundle = loadResourceBundle(path, locale); + list.add(chineseBundle); + } + localeResourceBundleMap.put(locale, list); + } + Map> data = new HashMap>(); - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry> entry : localeResourceBundleMap.entrySet()) { Vector column = new Vector(); + List rbs = entry.getValue(); for (String key : sortKeys) { - column.add(entry.getValue().getLocText(key)); + column.add(readText(rbs, key)); } data.put(entry.getKey(), column); } @@ -140,6 +158,19 @@ public class LocalePane extends BasicPane { } } + private String readText(List rbs, String key) { + for (ResourceBundle rb : rbs) { + if (rb.containsKey(key)) { + return rb.getString(key); + } + } + return null; + } + + private ResourceBundle loadResourceBundle(String dir, Locale locale) { + return ResourceBundle.getBundle(dir, locale, Inter.class.getClassLoader()); + } + private void initCustomProperties() throws Exception { Env env = FRContext.getCurrentEnv(); if (env == null) { @@ -176,22 +207,9 @@ public class LocalePane extends BasicPane { } } - private Properties loadLocaleProperties(String name) { - Properties properties = new Properties(); - InputStream inputStream = IOUtils.readResource("/com/fr/general/locale/" + name); - try { - properties.load(inputStream); - } catch (IOException e) { - FRLogger.getLogger().error(e.getMessage()); - } - return properties; - } - /** * 保存当前编辑的国际化 * - * - * @date 2014-9-30-下午3:10:30 */ public void save() { Env env = FRContext.getCurrentEnv(); 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 44b71999b..23b62431e 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 @@ -11,6 +11,7 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.ilist.TableViewList; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.dialog.BasicPane; +import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; @@ -28,7 +29,7 @@ import java.awt.event.*; */ public class ConnectionTableProcedurePane extends BasicPane { private static int WIDTH = 155; - private ConnectionComboBoxPanel connectionComboBox; + private ConnectionComboBoxPanel connectionComboBox; private UICheckBox tableCheckBox; private UICheckBox viewCheckBox; private UITextField searchField; @@ -37,16 +38,16 @@ public class ConnectionTableProcedurePane extends BasicPane { public ConnectionTableProcedurePane() { this.setLayout(new BorderLayout(4, 4)); - connectionComboBox = new ConnectionComboBoxPanel(com.fr.data.impl.Connection.class){ - protected void refreshItems(){ - super.refreshItems(); - if (tableViewList != null) { - search(); - } - } - }; + connectionComboBox = new ConnectionComboBoxPanel(com.fr.data.impl.Connection.class) { + protected void refreshItems() { + super.refreshItems(); + if (tableViewList != null) { + search(); + } + } + }; tableViewList = new TableViewList(); - ToolTipManager.sharedInstance().registerComponent(tableViewList); + ToolTipManager.sharedInstance().registerComponent(tableViewList); connectionComboBox.addComboBoxActionListener(filter); tableViewList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { @@ -54,8 +55,8 @@ public class ConnectionTableProcedurePane extends BasicPane { Object obj = tableViewList.getSelectedValue(); TableProcedure tableProcedure = null; if (obj instanceof TableProcedure) { - tableProcedure = (TableProcedure)obj; - }else { + tableProcedure = (TableProcedure) obj; + } else { return; } for (int i = 0; i < ConnectionTableProcedurePane.this.listeners.size(); i++) { @@ -79,7 +80,7 @@ public class ConnectionTableProcedurePane extends BasicPane { this.add(connectionComboBox, BorderLayout.NORTH); this.add(tableViewListPane, BorderLayout.CENTER); this.add(filterPane, BorderLayout.SOUTH); - this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height)); + this.setPreferredSize(new Dimension(WIDTH, getPreferredSize().height)); } protected JPanel createCheckBoxgroupPane() { @@ -89,28 +90,42 @@ public class ConnectionTableProcedurePane extends BasicPane { tableCheckBox.setSelected(true); tableCheckBox.addActionListener(filter); first.add(tableCheckBox); - first.add(new UILabel(Inter.getLocText("Table"), BaseUtils.readIcon("/com/fr/design/images/data/tables.png"), UILabel.LEADING)); JPanel second = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); viewCheckBox = new UICheckBox(); viewCheckBox.setSelected(true); viewCheckBox.addActionListener(filter); second.add(viewCheckBox); - second.add(new UILabel(Inter.getLocText("SQL-View"), BaseUtils.readIcon("/com/fr/design/images/data/views.png"), UILabel.LEADING)); + // 根据环境是否为中文设置不同的显示 + if (GeneralContext.isChineseEnv()) { + first.add(new UILabel(Inter.getLocText("FR-Designer_SQL-Table"), + BaseUtils.readIcon("/com/fr/design/images/data/tables.png"), UILabel.LEADING)); + second.add(new UILabel(Inter.getLocText("FR-Designer_SQL-View"), + BaseUtils.readIcon("/com/fr/design/images/data/views.png"), UILabel.LEADING)); + } else { + UILabel ui1 = new UILabel(BaseUtils.readIcon("/com/fr/design/images/data/tables.png"), UILabel.LEADING); + UILabel ui2 = new UILabel(BaseUtils.readIcon("/com/fr/design/images/data/views.png"), UILabel.LEADING); + ui1.setToolTipText(Inter.getLocText("FR-Designer_SQL-Table")); + ui2.setToolTipText(Inter.getLocText("FR-Designer_SQL-View")); + first.add(ui1); + second.add(ui2); + } checkBoxgroupPane.add(first); checkBoxgroupPane.add(second); return checkBoxgroupPane; } - /** - * 给 itemComboBox 加上 itemListener - * @param itemListener - */ - public void addItemListener(ItemListener itemListener) { - connectionComboBox.itemComboBox.addItemListener(itemListener); - } + /** + * 给 itemComboBox 加上 itemListener + * + * @param itemListener + */ + public void addItemListener(ItemListener itemListener) { + connectionComboBox.itemComboBox.addItemListener(itemListener); + } + private DocumentListener searchListener = new DocumentListener() { @Override @@ -146,13 +161,13 @@ public class ConnectionTableProcedurePane extends BasicPane { String[] types = ArrayUtils.EMPTY_STRING_ARRAY; if (tableCheckBox != null) { if (tableCheckBox.isSelected()) { - types = (String[])ArrayUtils.add(types, TableProcedure.TABLE); + types = (String[]) ArrayUtils.add(types, TableProcedure.TABLE); } if (viewCheckBox.isSelected()) { - types = (String[])ArrayUtils.add(types, TableProcedure.VIEW); + types = (String[]) ArrayUtils.add(types, TableProcedure.VIEW); } } else { - types = (String[])ArrayUtils.add(types, TableProcedure.PROCEDURE); + types = (String[]) ArrayUtils.add(types, TableProcedure.PROCEDURE); } tableViewList.populate(selectedObj, searchField.getText().trim(), types); } @@ -162,10 +177,10 @@ public class ConnectionTableProcedurePane extends BasicPane { return "Connection"; } - /** - * - * @param l - */ + /** + * + * @param l + */ public void addDoubleClickListener(DoubleClickSelectedNodeOnTreeListener l) { this.listeners.add(l); } @@ -179,10 +194,11 @@ public class ConnectionTableProcedurePane extends BasicPane { } public static interface DoubleClickSelectedNodeOnTreeListener { - /** - * 处理双击事件 - * @param target - */ - public void actionPerformed(TableProcedure target); + /** + * 处理双击事件 + * + * @param target + */ + public void actionPerformed(TableProcedure target); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java index fd41df325..3fffe594e 100644 --- a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java +++ b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java @@ -132,7 +132,7 @@ public class FunctionManagerPane extends BasicPane { JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); this.add(northPane, BorderLayout.NORTH); JPanel reportletNamePane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - classNameTextField = new UITextField(28); + classNameTextField = new UITextField(25); reportletNamePane.add(classNameTextField); UIButton browserButton = new UIButton(Inter.getLocText("FR-Designer_Select")); browserButton.setPreferredSize(new Dimension(browserButton.getPreferredSize().width, classNameTextField.getPreferredSize().height)); diff --git a/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java b/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java index 585864d60..ee3adaf76 100644 --- a/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java +++ b/designer_base/src/com/fr/design/hyperlink/WebHyperNorthPane.java @@ -51,10 +51,10 @@ public class WebHyperNorthPane extends AbstractHyperlinkPane { urlPane.add(urlTextField); urlTextField.setText(ProductConstants.WEBSITE_URL); - UILabel label = new UILabel(Inter.getLocText(new String[]{"Example","Or"}, new String[]{":http://www.baidu.com","/main.jsp"})); + //UILabel label = new UILabel(Inter.getLocText(new String[]{"Example","Or"}, new String[]{":http://www.baidu.com","/main.jsp"})); JPanel urlWithHelp = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(2); urlWithHelp.add(GUICoreUtils.createNamedPane(urlPane, "URL:")); - urlWithHelp.add(label); + //urlWithHelp.add(label); if(this.needRenamePane){ headerPane.setLayout(new BorderLayout(LayoutConstants.VGAP_LARGE,LayoutConstants.VGAP_SMALL)); diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index eb20ee9e7..093f90e5a 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -27,6 +27,7 @@ import com.fr.file.FILE; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.general.Inter; import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; @@ -42,6 +43,7 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.io.File; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -411,7 +413,14 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt }); UIButton cancelButton = new UIButton(Inter.getLocText("FR-Designer_Cancel")); - cancelButton.setBounds(250, 90, 60, 25); + + // mod by anchore 16/11/16 + if (ComparatorUtils.equals(Locale.JAPAN, GeneralContext.getLocale())) { + cancelButton.setBounds(250, 90, 80, 25); + } else { + cancelButton.setBounds(180, 90, 80, 25); + } + //cancelButton.setBounds(250, 90, 60, 25); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jd.dispose(); 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 2a3fa28d3..8dfd3dfa3 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -321,7 +321,9 @@ public abstract class ToolBarMenuDock { //shortCuts.add(new TutorialAction()); shortCuts.add(SeparatorDef.DEFAULT); if (ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)) { - shortCuts.add(new FeedBackAction()); + + // mod by anchore 16/11/17 去掉反馈 + //shortCuts.add(new FeedBackAction()); shortCuts.add(SeparatorDef.DEFAULT); shortCuts.add(SeparatorDef.DEFAULT); // shortCuts.add(new ForumAction()); diff --git a/designer_base/src/com/fr/design/menu/KeySetUtils.java b/designer_base/src/com/fr/design/menu/KeySetUtils.java index 78a557806..1b62fcdc4 100644 --- a/designer_base/src/com/fr/design/menu/KeySetUtils.java +++ b/designer_base/src/com/fr/design/menu/KeySetUtils.java @@ -4,10 +4,13 @@ package com.fr.design.menu; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.general.Inter; import javax.swing.*; import java.awt.event.KeyEvent; +import java.util.Locale; /** * Created by IntelliJ IDEA. @@ -63,7 +66,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M_Close_Current"); + return Inter.getLocText("FR-Designer_Close"); } @Override @@ -80,7 +83,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M-Save"); + return Inter.getLocText("FR-Designer_Save"); } @Override @@ -148,7 +151,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Export"); + return Inter.getLocText("FR-Designer_Export"); } @Override @@ -183,7 +186,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Export-Excel-Page"); + return Inter.getLocText("FR-Engine_Export-Excel-Page"); } @Override @@ -201,7 +204,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Export-Excel-Simple"); + return Inter.getLocText("FR-Engine_Export-Excel-Simple"); } @Override @@ -219,7 +222,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Export-Excel-PageToSheet"); + return Inter.getLocText("FR-Engine_Export-Excel-PageToSheet"); } @Override @@ -362,7 +365,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("ExportAndOutput"); + return Inter.getLocText("FR-Designer_ExportAndOutput"); } @Override @@ -379,7 +382,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return "EXCEL"+Inter.getLocText("ExportAndOutput"); + return "EXCEL"+Inter.getLocText("FR-Designer_ExportAndOutput"); } @Override @@ -413,7 +416,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M-SwitchWorkspace"); + return Inter.getLocText("FR-Designer_M-SwitchWorkspace"); } @Override @@ -430,7 +433,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M-Exit"); + return Inter.getLocText("FR-Designer_M-Exit"); } @Override @@ -448,7 +451,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M-Template"); + return Inter.getLocText("FR-Designer_M-Template"); } @Override @@ -639,7 +642,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("ReportColumns-Columns"); + return Inter.getLocText("FR-Designer_ReportColumns-Columns"); } @Override @@ -657,7 +660,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M-Repeat-Freeze"); + return Inter.getLocText("FR-Designer_M-Repeat-Freeze"); } @Override @@ -675,7 +678,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Frozen"); + return Inter.getLocText("FR-Engine_Frozen"); } @Override @@ -710,7 +713,14 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText(new String[]{"Allow", "DashBoard-Potence", "Edit"}); + + // mod by anchore 16/11/16 + if (ComparatorUtils.equals(Locale.JAPAN, GeneralContext.getLocale())) { + return Inter.getLocText(new String[]{"FR-Engine_RP_Authority_Edit", "Allow"}); + } else { + return Inter.getLocText(new String[]{"Allow", "FR-Engine_RP_Authority_Edit"}); + } + //return Inter.getLocText(new String[]{"Allow", "DashBoard-Potence", "Edit"}); } @Override @@ -727,7 +737,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("M-Cell"); + return Inter.getLocText("FR-Designer_Cell"); } @Override @@ -761,7 +771,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Widget-Settings"); + return Inter.getLocText("FR-Designer_Widget-Settings"); } @Override @@ -795,7 +805,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Condition_Attributes"); + return Inter.getLocText("FR-Designer_Condition_Attributes"); } @Override @@ -812,7 +822,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Present"); + return Inter.getLocText("FR-Chart-Style_Present"); } @Override @@ -880,7 +890,7 @@ public class KeySetUtils { @Override public String getMenuName() { - return Inter.getLocText("Currency_Line"); + return Inter.getLocText("FR-Designer_Currency_Line"); } @Override diff --git a/designer_base/src/com/fr/design/style/AbstractPopBox.java b/designer_base/src/com/fr/design/style/AbstractPopBox.java index 4630c51ae..d36bca290 100644 --- a/designer_base/src/com/fr/design/style/AbstractPopBox.java +++ b/designer_base/src/com/fr/design/style/AbstractPopBox.java @@ -9,6 +9,7 @@ import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.*; +import java.awt.event.AWTEventListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -21,212 +22,211 @@ import java.util.List; */ public abstract class AbstractPopBox extends JPanel { - protected BackgroundJComponent displayComponent; + protected BackgroundJComponent displayComponent; - private JWindow selectPopupWindow; - private boolean isWindowEventInit = false; + private JWindow selectPopupWindow; + private boolean isWindowEventInit = false; private static int GAP = 2; private static int GAP2 = 20; - private List changeListenerList = new ArrayList(); - - MouseAdapter mouseListener = new MouseAdapter() { - public void mousePressed(MouseEvent evt) { - showPopupMenu(); - } - - public void mouseExited(MouseEvent evt) { - int x= evt.getXOnScreen();//mac和widows的计算结果还不一样 - int y = evt.getYOnScreen(); - if (selectPopupWindow != null) { - Rectangle rectangle = selectPopupWindow.getBounds(); - boolean b1 = x < rectangle.x - GAP || x > rectangle.x + rectangle.width + GAP; - boolean b2 = y < rectangle.y - GAP || y >rectangle.y + rectangle.height + GAP; - if(b1 || b2) { - hidePopupMenu(); + private List changeListenerList = new ArrayList(); + + MouseAdapter mouseListener = new MouseAdapter() { + public void mousePressed(MouseEvent evt) { + showPopupMenu(); + } + + + }; + + AWTEventListener awt = new AWTEventListener() { + public void eventDispatched(AWTEvent event) { + if (event instanceof MouseEvent) { + MouseEvent evt = (MouseEvent) event; + if (evt.getClickCount() > 0) { + mouseClick(evt); } -// if (OperatingSystem.isWindows()) { -// -// }else{ -// Point pp = SwingUtilities.convertPoint(evt.getComponent(), evt.getPoint(), selectPopupWindow.getParent()); -// Rectangle rectangle = selectPopupWindow.getBounds(); -// if (pp.getY() < rectangle.getY() || pp.getY() > rectangle.getY() + rectangle.getHeight()) { -// //hidePopupMenu(); -// } -// } - } - } - }; - - private void showPopupMenu() { - if (selectPopupWindow != null && selectPopupWindow.isVisible()) { - hidePopupMenu(); - return; - } - - if (!this.isEnabled()) { - return; - } - - selectPopupWindow = this.getControlWindow(); - - Point convertPoint = new Point(0, 0); - - // e: 将点(0,0)从ColorSelectionPane的坐标系统转换到屏幕坐标. - SwingUtilities.convertPointToScreen(convertPoint, this); - int y = convertPoint.y + this.getSize().height; - int x = convertPoint.x; - int h = y + selectPopupWindow.getHeight(); - int width = x + selectPopupWindow.getWidth(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - if (h > screenSize.height) { - y = y - selectPopupWindow.getHeight() - GAP2;// 超过屏幕高度了 - } - - if(width > screenSize.width) { - x = screenSize.width - selectPopupWindow.getWidth(); - } - selectPopupWindow.setLocation(x, y); - - selectPopupWindow.setVisible(true); - - //wei : 为了点击别的地方下拉颜色窗口消失 - MouseAdapter parentMouseListener = new MouseAdapter() { - public void mousePressed(MouseEvent evt) { - mouseClick(evt); - } - }; - if (!this.isWindowEventInit && SwingUtilities.getAncestorOfClass(GradientBackgroundPane.class, this) != null) { - SwingUtilities.getAncestorOfClass(GradientBackgroundPane.class, this).addMouseListener(parentMouseListener); - this.isWindowEventInit = true; - } - } - - private void mouseClick(MouseEvent evt) { - int x = evt.getLocationOnScreen().x; - int y = evt.getLocationOnScreen().y; - Rectangle rectangle = this.getControlWindow().getBounds(); - boolean b1 = x < rectangle.x || x > rectangle.x + rectangle.width; - boolean b2 = y < rectangle.y || y > rectangle.y + rectangle.height; - if (b1 || b2) { - this.hidePopupMenu(); - } - } - - protected void hidePopupMenu() { - if (selectPopupWindow != null) { - selectPopupWindow.setVisible(false); - } - - selectPopupWindow = null; - } - - protected JWindow getControlWindow() { - //find parent. - if (this.selectPopupWindow == null) { - Window parentWindow = SwingUtilities.windowForComponent(this); - if (parentWindow != null) { - this.selectPopupWindow = new SelectControlWindow(parentWindow); - } - - selectPopupWindow.addMouseListener(new MouseAdapter() { - public void mouseExited(MouseEvent evt) { - int x = evt.getLocationOnScreen().x; - int y = evt.getLocationOnScreen().y; - - if (selectPopupWindow != null) { - double desValue = 2; - Rectangle rectangle = selectPopupWindow.getBounds(); + } + } + }; + + private void showPopupMenu() { + if (selectPopupWindow != null && selectPopupWindow.isVisible()) { + hidePopupMenu(); + return; + } + + if (!this.isEnabled()) { + return; + } + Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); + + selectPopupWindow = this.getControlWindow(); + + Point convertPoint = new Point(0, 0); + + // e: 将点(0,0)从ColorSelectionPane的坐标系统转换到屏幕坐标. + SwingUtilities.convertPointToScreen(convertPoint, this); + int y = convertPoint.y + this.getSize().height; + int x = convertPoint.x; + int h = y + selectPopupWindow.getHeight(); + int width = x + selectPopupWindow.getWidth(); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + if (h > screenSize.height) { + y = y - selectPopupWindow.getHeight() - GAP2;// 超过屏幕高度了 + } + + if (width > screenSize.width) { + x = screenSize.width - selectPopupWindow.getWidth(); + } + selectPopupWindow.setLocation(x, y); + + selectPopupWindow.setVisible(true); + + //wei : 为了点击别的地方下拉颜色窗口消失 + MouseAdapter parentMouseListener = new MouseAdapter() { + public void mousePressed(MouseEvent evt) { + mouseClick(evt); + } + }; + if (!this.isWindowEventInit && SwingUtilities.getAncestorOfClass(GradientBackgroundPane.class, this) != null) { + SwingUtilities.getAncestorOfClass(GradientBackgroundPane.class, this).addMouseListener(parentMouseListener); + this.isWindowEventInit = true; + } + } + + private void mouseClick(MouseEvent evt) { + Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY()); + Dimension popBoxD = AbstractPopBox.this.getSize(); + Point popBoxP = AbstractPopBox.this.getLocationOnScreen(); + Dimension popMenuD = this.getControlWindow().getSize(); + Point popMenuP = this.getControlWindow().getLocation(); + Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); + Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD); + if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) { + this.hidePopupMenu(); + } + } + + protected void hidePopupMenu() { + if (selectPopupWindow != null) { + selectPopupWindow.setVisible(false); + } + + selectPopupWindow = null; + Toolkit.getDefaultToolkit().removeAWTEventListener(awt); + } + + protected JWindow getControlWindow() { + //find parent. + if (this.selectPopupWindow == null) { + Window parentWindow = SwingUtilities.windowForComponent(this); + if (parentWindow != null) { + this.selectPopupWindow = new SelectControlWindow(parentWindow); + } + + selectPopupWindow.addMouseListener(new MouseAdapter() { + public void mouseExited(MouseEvent evt) { + int x = evt.getLocationOnScreen().x; + int y = evt.getLocationOnScreen().y; + + if (selectPopupWindow != null) { + double desValue = 2; + Rectangle rectangle = selectPopupWindow.getBounds(); boolean b1 = x < rectangle.x + desValue || x >= rectangle.x + rectangle.width - desValue; - boolean b2 = y > rectangle.y + rectangle.height - desValue;//避免了鼠标下移刚进入selectPopupWindow的过程中弹出框隐藏,上移移出后由AbstractPopBox的mouseListener处理 + boolean b2 = y > rectangle.y + rectangle.height - desValue;//避免了鼠标下移刚进入selectPopupWindow的过程中弹出框隐藏,上移移出后由AbstractPopBox的mouseListener处理 if (b1 || b2) { - hidePopupMenu(); - } - } - } - }); - } + hidePopupMenu(); + } + } + } + }); + } - return selectPopupWindow; - } + return selectPopupWindow; + } /** * 添加事件 + * * @param changeListener 事件 */ - public void addSelectChangeListener(ChangeListener changeListener) { - this.changeListenerList.add(changeListener); - } + public void addSelectChangeListener(ChangeListener changeListener) { + this.changeListenerList.add(changeListener); + } /** * 删除事件 + * * @param changeListener 事件 */ - public void removeSelectChangeListener(ChangeListener changeListener) { - this.changeListenerList.remove(changeListener); - } + public void removeSelectChangeListener(ChangeListener changeListener) { + this.changeListenerList.remove(changeListener); + } /** * 响应事件 */ - public void fireChangeListener() { - if (!changeListenerList.isEmpty()) { - ChangeEvent evt = new ChangeEvent(this); - for (int i = 0; i < changeListenerList.size(); i++) { - this.changeListenerList.get(i).stateChanged(evt); - } - } - } + public void fireChangeListener() { + if (!changeListenerList.isEmpty()) { + ChangeEvent evt = new ChangeEvent(this); + for (int i = 0; i < changeListenerList.size(); i++) { + this.changeListenerList.get(i).stateChanged(evt); + } + } + } /** * 待说明 + * * @param background 背景 */ - public void fireDisplayComponent(Background background) { - if (displayComponent != null) { - displayComponent.setSelfBackground(background); - } - fireChangeListener(); - this.repaint(); - } + public void fireDisplayComponent(Background background) { + if (displayComponent != null) { + displayComponent.setSelfBackground(background); + } + fireChangeListener(); + this.repaint(); + } /** * 初始化弹出框的面板 + * * @param preWidth 宽度 * @return 弹出面板 */ - public abstract JPanel initWindowPane(double preWidth); + public abstract JPanel initWindowPane(double preWidth); - private class SelectControlWindow extends JWindow { - private static final long serialVersionUID = -5776589767069105911L; + private class SelectControlWindow extends JWindow { + private static final long serialVersionUID = -5776589767069105911L; - public SelectControlWindow(Window paranet) { - super(paranet); - this.initComponents(); - } + public SelectControlWindow(Window paranet) { + super(paranet); + this.initComponents(); + } - public void initComponents() { - JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.setContentPane(defaultPane); + public void initComponents() { + JPanel defaultPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.setContentPane(defaultPane); // defaultPane.setBorder(UIManager.getBorder("PopupMenu.border")); - if (displayComponent != null) { - defaultPane.add(initWindowPane(displayComponent.getPreferredSize().getWidth())); - } else { - defaultPane.add(initWindowPane(20)); - } - this.pack(); - } - - @Override - public void setVisible(boolean b) { - super.setVisible(b); - AbstractPopBox.this.repaint(); - } - } - - protected boolean isPopupVisible() { - return selectPopupWindow == null ? false : selectPopupWindow.isVisible(); - } + if (displayComponent != null) { + defaultPane.add(initWindowPane(displayComponent.getPreferredSize().getWidth())); + } else { + defaultPane.add(initWindowPane(20)); + } + this.pack(); + } + + @Override + public void setVisible(boolean b) { + super.setVisible(b); + AbstractPopBox.this.repaint(); + } + } + + protected boolean isPopupVisible() { + return selectPopupWindow == null ? false : selectPopupWindow.isVisible(); + } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/style/color/NewColorSelectPane.java b/designer_base/src/com/fr/design/style/color/NewColorSelectPane.java index feffb92e0..bbecf01d3 100644 --- a/designer_base/src/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer_base/src/com/fr/design/style/color/NewColorSelectPane.java @@ -93,7 +93,10 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { } centerPane.add(Box.createVerticalStrut(1)); - UIButton customButton = new UIButton(Inter.getLocText(new String[]{"More", "Color"}) + "..."); + + // mod by anchore 16/11/16 + UIButton customButton = new UIButton(Inter.getLocText("FR-Designer-Basic_More_Color")); + //UIButton customButton = new UIButton(Inter.getLocText(new String[]{"More", "Color"}) + "..."); customButton.addMouseListener(new MouseAdapter() { @Override diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index ae8c589ee..ce7118e69 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -31,6 +31,7 @@ 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.*; import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.project.ProjectConstants; @@ -1535,6 +1536,7 @@ public class RemoteEnv implements Env { para.put("op", "fr_remote_design"); para.put("cmd", "design_save_resource"); para.put("resource", mgr.fileName()); + para.put("class_name", mgr.getClass().getName()); para.put("current_uid", this.createUserID()); para.put("currentUsername", this.getUser()); @@ -2107,7 +2109,7 @@ public class RemoteEnv implements Env { @Override public File[] loadREUFile() throws Exception { File target = new File(CacheManager.getProviderInstance().getCacheDirectory(), - "fr_share"); + ShareConstants.DIR_SHARE_CACHE); StableUtils.deleteFile(target); StableUtils.mkdirs(target); File cacheDir = null; @@ -2122,7 +2124,7 @@ public class RemoteEnv implements Env { HttpClient client = createHttpMethod(para); InputStream input = client.getResponseStream(); zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); - cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "fr_share"); + cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); StableUtils.deleteFile(cacheDir); StableUtils.mkdirs(cacheDir); StableUtils.makesureFileExist(zip); @@ -2146,4 +2148,65 @@ public class RemoteEnv implements Env { } return new File[0]; } + + @Override + public boolean installREUFile(File reuFile) { +// if (reuFile == null) { +// return false; +// } +// try { +// HashMap para = new HashMap(); +// para.put("op", "fr_remote_design"); +// para.put("cmd", "design_install_reufile"); +// para.put("current_uid", this.createUserID()); +// para.put("currentUsername", this.getUser()); +// para.put("reuFileName", reuFile.getName()); +// +// HttpClient client = createHttpMethod(para); +// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile))); +// InputStream input = execute4InputStream(client); +// return ComparatorUtils.equals(stream2String(input), "true"); +// } catch (Exception e) { +// return false; +// } + return false; + } + + @Override + public boolean removeREUFilesByName(String fileName) { + if (StringUtils.isEmpty(fileName)) { + return true; + } + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_remove_reufile"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + para.put("reuFileName", fileName); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + return ComparatorUtils.equals(stream2String(input), "true"); + } catch (Exception e) { + return false; + } + } + + @Override + public String getSharePath() { + try { + HashMap para = new HashMap(); + para.put("op", "fr_remote_design"); + para.put("cmd", "design_get_share_path"); + para.put("current_uid", this.createUserID()); + para.put("currentUsername", this.getUser()); + + HttpClient client = createHttpMethod(para); + InputStream input = execute4InputStream(client); + return stream2String(input); + } catch (Exception e) { + return StringUtils.EMPTY; + } + } } \ No newline at end of file diff --git a/designer_chart/.classpath b/designer_chart/.classpath index 9cb17f77c..865d0fd9a 100644 --- a/designer_chart/.classpath +++ b/designer_chart/.classpath @@ -1,20 +1,43 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java index 3cd2b830c..8402c6819 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartDataPane.java @@ -72,7 +72,7 @@ public class ChartDataPane extends AbstractChartAttrPane { public boolean isSupportCellData() { return supportCellData; } - + /** * 设置数据界面是否支持单元格 */ @@ -109,5 +109,4 @@ public class ChartDataPane extends AbstractChartAttrPane { public void refreshChartDataPane(ChartCollection collection){ this.populate(collection); } - } \ No newline at end of file diff --git a/designer_form/.classpath b/designer_form/.classpath index 4eb8d8868..21414c0fb 100644 --- a/designer_form/.classpath +++ b/designer_form/.classpath @@ -1,15 +1,43 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java index 1d8277c46..196d8752a 100644 --- a/designer_form/src/com/fr/design/mainframe/CoverReportPane.java +++ b/designer_form/src/com/fr/design/mainframe/CoverReportPane.java @@ -3,7 +3,7 @@ package com.fr.design.mainframe; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.icon.IconPathConstants; -import com.fr.form.share.ShareConstants; +import com.fr.share.ShareConstants; import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index d660d9a58..c33e1b113 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -16,6 +16,7 @@ import com.fr.form.ui.ElCaseBindInfo; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.general.SiteCenter; +import com.fr.share.ShareConstants; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; @@ -359,18 +360,22 @@ public class FormWidgetDetailPane extends FormDockView{ } private void installFromDiskZipFile(File chosenFile) { - try { - ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile); - refreshShareMoudule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshDownPanel(false); - refreshComboxData(); - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); - } catch (IOException e) { - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); - FRLogger.getLogger().error(e.getMessage(), e); + if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) { + try { + if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) { + refreshShareMoudule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshDownPanel(false); + refreshComboxData(); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK")); + } else { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); + } + } catch (IOException e) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error")); + FRLogger.getLogger().error(e.getMessage(), e); + } } - } private void refreshShareMoudule() { diff --git a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java index ec663176e..12e5302b0 100644 --- a/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java +++ b/designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java @@ -1,12 +1,10 @@ package com.fr.design.mainframe; import com.fr.base.*; -import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.icon.IconPathConstants; -import com.fr.form.share.ShareConstants; +import com.fr.share.ShareConstants; import com.fr.form.share.ShareLoader; import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.Widget;