diff --git a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index ffeaae0d9..0e45a1e97 100644 --- a/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -3,7 +3,9 @@ package com.fr.design.mainframe.cell.settingpane; import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.util.Locale; +import com.fr.base.FRContext; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ilable.UILabel; @@ -76,23 +78,23 @@ public class CellOtherSetPane extends AbstractCellAttrPane { double p = TableLayout.PREFERRED; double[] rowSize1 = {p, p, p, p, p, p, p}; double[] columnSize1 = {p, f}; - UILabel autoAdjustLabel = new UILabel(Inter.getLocText("Auto_Adjust_Size") + ":", SwingConstants.RIGHT); + UILabel autoAdjustLabel = new UILabel(Inter.getLocText("FR-Designer_Auto_Adjust_Size") + ":", SwingConstants.RIGHT); autoAdjustLabel.setVerticalAlignment(UILabel.TOP); Component[][] components1 = new Component[][]{ new Component[]{autoAdjustLabel, autoshrik}, - new Component[]{new UILabel(Inter.getLocText("Preview") + ":", SwingConstants.RIGHT), previewCellContent}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Preview") + ":", SwingConstants.RIGHT), previewCellContent}, new Component[]{new UILabel(Inter.getLocText("CellWrite-Print_Export") + ":", SwingConstants.RIGHT), printAndExportContent}, new Component[]{null, printAndExportBackground}, - new Component[]{new UILabel(Inter.getLocText("Show_Content") + ":", SwingConstants.RIGHT), showContent}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Show_Content") + ":", SwingConstants.RIGHT), showContent}, new Component[]{null, fileNamePane}, - new Component[]{new UILabel(Inter.getLocText("CellWrite-ToolTip") + ":", SwingConstants.RIGHT), tooltipTextField}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_CellWrite_ToolTip") + ":", SwingConstants.RIGHT), tooltipTextField}, }; JPanel northContentPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1); double[] rowSize2 = {p, p, p, p, p, p}; double[] columnSize2 = {p, f}; Component[][] components2 = new Component[][]{ new Component[]{new JSeparator(JSeparator.HORIZONTAL), null}, - new Component[]{new UILabel(Inter.getLocText("Pagination")), null}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Pagination")), null}, new Component[]{pageBeforeRowCheckBox, pageAfterRowCheckBox}, new Component[]{pageBeforeColumnCheckBox, pageAfterColumnCheckBox}, new Component[]{canBreakOnPaginateCheckBox, null}, @@ -121,22 +123,28 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private JPanel createNormal() { String[] AjustRowTypes = new String[]{ - Inter.getLocText("No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("Default")}; + Inter.getLocText("FR-Designer_No"), Inter.getLocText("Utils-Row_Height"), Inter.getLocText("Utils-Column_Width"), Inter.getLocText("FR-Designer_DEFAULT")}; autoshrik = new UIButtonGroup(AjustRowTypes); - autoshrik.setTwoLine(); - autoshrik.setLayout(new GridLayout(2, 2, 1, 1)); + if (FRContext.getLocale().equals(Locale.US)) { + // 英文显示不全,故每行一个按钮 + autoshrik.setFourLine(); + autoshrik.setLayout(new GridLayout(4, 1, 1, 1)); + } else { + autoshrik.setTwoLine(); + autoshrik.setLayout(new GridLayout(2, 2, 1, 1)); + } previewCellContent = new UICheckBox(Inter.getLocText("CellWrite-Preview_Cell_Content")); printAndExportContent = new UICheckBox(Inter.getLocText("CellWrite-Print_Content")); printAndExportBackground = new UICheckBox(Inter.getLocText("CellWrite-Print_Background")); - showContent = new UIComboBox(new String[]{Inter.getLocText("Default"), Inter.getLocText("CellWrite-Show_As_Image"), Inter.getLocText("CellWrite-Show_As_HTML"), - Inter.getLocText("ShowAsDownload")}); + showContent = new UIComboBox(new String[]{Inter.getLocText("FR-Designer_DEFAULT"), Inter.getLocText("CellWrite-Show_As_Image"), Inter.getLocText("CellWrite-Show_As_HTML"), + Inter.getLocText("FR-Designer_Show_As_Download")}); final CardLayout fileNameLayout = new CardLayout(); final JPanel fileNamePane = new JPanel(fileNameLayout); JPanel fileNameCCPane = new JPanel(new BorderLayout(4, 0)); - fileNameCCPane.add(new UILabel(Inter.getLocText("FileNameForDownload")), BorderLayout.WEST); + fileNameCCPane.add(new UILabel(Inter.getLocText("FR-Designer_File_Name_For_Download")), BorderLayout.WEST); fileNameTextField = new UITextField(); tooltipTextField = new UITextField(); @@ -186,13 +194,13 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } private void initAllNames() { - autoshrik.setGlobalName(Inter.getLocText("Auto_Adjust_Size")); - previewCellContent.setGlobalName(Inter.getLocText("Preview")); + autoshrik.setGlobalName(Inter.getLocText("FR-Designer_Auto_Adjust_Size")); + previewCellContent.setGlobalName(Inter.getLocText("FR-Designer_Preview")); printAndExportContent.setGlobalName(Inter.getLocText("CellWrite-Preview_Cell_Content")); printAndExportBackground.setGlobalName(Inter.getLocText("CellWrite-Print_Background")); - showContent.setGlobalName(Inter.getLocText("Show_Content")); - fileNameTextField.setGlobalName(Inter.getLocText("Show_Content")); - tooltipTextField.setGlobalName(Inter.getLocText("CellWrite-ToolTip")); + showContent.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); + fileNameTextField.setGlobalName(Inter.getLocText("FR-Designer_Show_Content")); + tooltipTextField.setGlobalName(Inter.getLocText("FR-Designer_CellWrite_ToolTip")); pageBeforeRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Row")); pageAfterRowCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_After_Row")); pageBeforeColumnCheckBox.setGlobalName(Inter.getLocText("CellWrite-Page_Before_Column")); @@ -224,10 +232,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } else if (cellGUIAttr.isShowAsHTML()) { showContent.setSelectedItem(Inter.getLocText("CellWrite-Show_As_HTML")); } else if (cellGUIAttr.isShowAsDownload()) { - showContent.setSelectedItem(Inter.getLocText("ShowAsDownload")); + showContent.setSelectedItem(Inter.getLocText("FR-Designer_Show_As_Download")); fileNameTextField.setText(cellGUIAttr.getFileName()); } else { - showContent.setSelectedItem(Inter.getLocText("Default")); + showContent.setSelectedItem(Inter.getLocText("FR-Designer_DEFAULT")); } tooltipTextField.setText(cellGUIAttr.getTooltipText()); CellPageAttr cellPageAttr = cellElement.getCellPageAttr(); // 分页 @@ -272,11 +280,11 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr = new CellGUIAttr(); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Auto_Adjust_Size"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Auto_Adjust_Size"))) { cellGUIAttr.setAdjustMode(autoshrik.getSelectedIndex()); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Preview"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Preview"))) { cellGUIAttr.setPreviewContent(previewCellContent.isSelected()); } @@ -288,7 +296,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellGUIAttr.setPrintBackground(printAndExportBackground.isSelected()); } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Show_Content"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Show_Content"))) { cellGUIAttr.setShowAsDefault(showContent.getSelectedIndex() == 0); cellGUIAttr.setShowAsImage(showContent.getSelectedIndex() == 1); cellGUIAttr.setShowAsHTML(showContent.getSelectedIndex() == 2); @@ -300,7 +308,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } } - if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("CellWrite-ToolTip"))) { + if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_CellWrite_ToolTip"))) { if (tooltipTextField.getText() == null || tooltipTextField.getText().trim().length() <= 0) { cellGUIAttr.setTooltipText(fieldName); } else { diff --git a/designer_base/src/com/fr/design/actions/help/AboutPane.java b/designer_base/src/com/fr/design/actions/help/AboutPane.java index 7f00b5d7c..5ee395f80 100644 --- a/designer_base/src/com/fr/design/actions/help/AboutPane.java +++ b/designer_base/src/com/fr/design/actions/help/AboutPane.java @@ -69,7 +69,7 @@ public class AboutPane extends JPanel { })); // 英文去掉服务电话和 QQ - if (FRContext.getLocale() == Locale.ENGLISH || FRContext.getLocale() == Locale.US || FRContext.getLocale() == Locale.UK){ + if (FRContext.getLocale().equals(Locale.US)){ // do nothing } else { if(ComparatorUtils.equals(ProductConstants.APP_NAME,FINEREPORT)){ @@ -80,8 +80,8 @@ public class AboutPane extends JPanel { contentPane.add(boxCenterAlignmentPane); } - BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website", ProductConstants.WEBSITE_URL)); - BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("register.email", ProductConstants.SUPPORT_EMAIL)); + BoxCenterAligmentPane actionLabel = getURLActionLabel(SiteCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); + BoxCenterAligmentPane emailLabel = getEmailActionLabel(SiteCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL)); contentPane.add(actionLabel); contentPane.add(emailLabel); @@ -111,7 +111,7 @@ public class AboutPane extends JPanel { private String getCopyRight(){ return append(Inter.getLocText("FR-Designer_About_CopyRight"), COPYRIGHT_LABEL, - ProductConstants.HISTORY, StringUtils.BLANK, ProductConstants.COMPANY_NAME); + ProductConstants.HISTORY, StringUtils.BLANK, SiteCenter.getInstance().acquireUrlByKind("company.name", ProductConstants.COMPANY_NAME)); } private String getBuildTitle() { diff --git a/designer_base/src/com/fr/design/actions/help/TutorialAction.java b/designer_base/src/com/fr/design/actions/help/TutorialAction.java index b23835945..8ae2b2962 100644 --- a/designer_base/src/com/fr/design/actions/help/TutorialAction.java +++ b/designer_base/src/com/fr/design/actions/help/TutorialAction.java @@ -59,18 +59,20 @@ public class TutorialAction extends UpdateAction { * @param evt 事件 */ public void actionPerformed(ActionEvent evt) { - Locale locale = FRContext.getLocale(); - if (ComparatorUtils.equals(locale, Locale.CHINA) || ComparatorUtils.equals(locale, Locale.TAIWAN)){ - HttpClient client = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("help")); + String helpURL = SiteCenter.getInstance().acquireUrlByKind("help." + FRContext.getLocale()); + + if (helpURL != null) { + HttpClient client = new HttpClient(helpURL); if(client.getResponseCode() != -1) { try { - Desktop.getDesktop().browse(new URI(SiteCenter.getInstance().acquireUrlByKind("help"))); + Desktop.getDesktop().browse(new URI(helpURL)); return; } catch (Exception e) { //出了异常的话, 依然打开本地教程 } } } + if (OperatingSystem.isMacOS()) { nativeExcuteMacInstallHomePrograms("helptutorial.app"); } diff --git a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java index 3fffe594e..eb75dabe1 100644 --- a/designer_base/src/com/fr/design/formula/FunctionManagerPane.java +++ b/designer_base/src/com/fr/design/formula/FunctionManagerPane.java @@ -159,10 +159,7 @@ public class FunctionManagerPane extends BasicPane { descriptionArea.setWrapStyleWord(true); descriptionArea.setLineWrap(true); northPane.add(descriptionArea); - descriptionArea.setText(Inter.getLocText(new String[]{"Function-The_class_must_inherit","Fuction-The_compiled_class_should_be_copied_to", - "Function-J2EE_server", "Directory", "Function-Source_Code", "Example"}, - new String[]{" \"com.fr.script.AbstractFunction\".", "\n", " \"" + File.separator + "WEB-INF" + File.separator + "classes\"", - ",", ".\n", ":" + FRContext.getCurrentEnv().getPath() + File.separator + "classes"})); + descriptionArea.setText(Inter.getLocText("FR-Designer_Function_Description_Area_Text", File.separator, File.separator, FRContext.getCurrentEnv().getPath() + File.separator)); JPanel descriptionPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); //Description Pane this.add(descriptionPane, BorderLayout.SOUTH); descriptionPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); diff --git a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java index 8a266a2a1..636f72858 100644 --- a/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java +++ b/designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java @@ -28,6 +28,7 @@ import com.fr.design.utils.gui.GUICoreUtils; public class UIButtonGroup extends JPanel implements GlobalNameObserver { private boolean isTwoLine = false; + private boolean isFourLine = false; private static final long serialVersionUID = 1L; protected List labelButtonList; protected int selectedIndex = -1; @@ -176,6 +177,10 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { this.isTwoLine = true; } + public void setFourLine() { + this.isFourLine = true; + } + /** * paintComponent * @@ -201,32 +206,40 @@ public class UIButtonGroup extends JPanel implements GlobalNameObserver { } Graphics2D g2d = (Graphics2D) g; g2d.setColor(UIConstants.LINE_COLOR); - if (!isTwoLine) { + if (isTwoLine) { int width = 0; - for (int i = 0; i < labelButtonList.size() - 1; i++) { + int upCount = (labelButtonList.size() - 1) / 2 + 1; + for (int i = 0; i < upCount - 1; i++) { width += labelButtonList.get(i).getWidth() + 1; - int height = labelButtonList.get(i).getHeight(); + int height = labelButtonList.get(i).getHeight() * 2 + 1; g.drawLine(width, 0, width, height); } - width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1; - + width += labelButtonList.get(upCount).getWidth() + 1; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + g2d.drawLine(0, getHeight() / 2, width, getHeight() / 2); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + } else if (isFourLine) { + // 4 * 1 + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); + for (int i = 1; i <= 3; i++) { + g2d.drawLine(0, getHeight() / 4 * i, getWidth() - 1, getHeight() / 4 * i); + } g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } else { int width = 0; - int upCount = (labelButtonList.size() - 1) / 2 + 1; - for (int i = 0; i < upCount - 1; i++) { + for (int i = 0; i < labelButtonList.size() - 1; i++) { width += labelButtonList.get(i).getWidth() + 1; - int height = labelButtonList.get(i).getHeight() * 2 + 1; + int height = labelButtonList.get(i).getHeight(); g.drawLine(width, 0, width, height); } - width += labelButtonList.get(upCount).getWidth() + 1; + width += labelButtonList.get(labelButtonList.size() - 1).getWidth() + 1; + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.drawRoundRect(0, 0, width, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); - g2d.drawLine(0, getHeight() / 2, width, getHeight() / 2); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 3f809fb4a..e646fce49 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -538,4 +538,26 @@ FR-Designer_Allow_Blank=Allow Blank FR-Designer_PageSetup_Page=Page FR-Designer_Custom_Job_Description=Description FR-Designer_Property=Property -FR-Designer_ClassName=Class Name \ No newline at end of file +FR-Designer_ClassName=Class Name +FR-Designer_Polyblock_Edit=Polyblock Edit +FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class should be copied to\nJ2EE server '{R1}WEB-INF{R2}classes' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R3}classes} +FR-Designer_PageSetup_Horizontal=Horizontal +FR-Designer_PageSetup_Vertical=Vertical +FR-Designer_Gradient_Direction=Gradient Direction +FR-Designer_Drag_To_Select_Gradient=\\ Drag the button below to choose gradient area, click it to choose color +FR-Designer_Display_Value=Display Value +FR-Designer_Actual_Value=Actual Value +FR-Designer_CellWrite_ToolTip=Tool Tip of Cell +FR-Designer_Show_Content=Show content +FR-Designer_Auto_Adjust_Size=Auto adjust +FR-Designer_Show_As_Download=Display the binary content using download link +FR-Designer_File_Name_For_Download=File Name For Download +FR-Designer_No=No +FR-Designer_Pagination=Page Break +FR-Designer_Role=Role +FR-Designer-Move_Tab_First=move to first +FR-Designer-Move_Tab_End=move to end +FR-Designer-Move_Tab_Next=move to next +FR-Designer-Move_Tab_Prev=move to previous +FR-Designer_DS_TableData=Data Set +FR-Designer_Parameter-Formula=Formula diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index 30db869a2..97d062d51 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -539,3 +539,25 @@ FR-Designer_PageSetup_Page=Page FR-Designer_Custom_Job_Description=Description FR-Designer_Property=Property FR-Designer_ClassName=Class Name +FR-Designer_Polyblock_Edit=Aggregation block edition +FR-Designer_Function_Description_Area_Text=The class must inherit 'com.fr.script.AbstractFunction'. The compiled class files should be copied to\nJ2EE server '{R1}WEB-INF{R2}classes' directory.\nAdd the source code(.java file) into the same folder if need.\nExample: {R3}classes +FR-Designer_PageSetup_Horizontal=Horizontal +FR-Designer_PageSetup_Vertical=Vertical +FR-Designer_Gradient_Direction=Gradient Direction +FR-Designer_Drag_To_Select_Gradient=\\ Drag the button below to choose gradient area, click it to choose color +FR-Designer_Display_Value=Display Value +FR-Designer_Actual_Value=Actual Value +FR-Designer_CellWrite_ToolTip=Tool Tip of Cell +FR-Designer_Show_Content=Show content +FR-Designer_Auto_Adjust_Size=Auto adjust +FR-Designer_Show_As_Download=Display the binary content using download link +FR-Designer_File_Name_For_Download=File Name For Download +FR-Designer_No=No +FR-Designer_Pagination=Page Break +FR-Designer-Move_Tab_First=move to first +FR-Designer-Move_Tab_End=move to end +FR-Designer-Move_Tab_Next=move to next +FR-Designer-Move_Tab_Prev=move to previous +FR-Designer_Role=Role +FR-Designer_DS_TableData=Data Set +FR-Designer_Parameter-Formula=Formula diff --git a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties index ba6114955..4dfa2c7d8 100644 --- a/designer_base/src/com/fr/design/locale/designer_ja_JP.properties +++ b/designer_base/src/com/fr/design/locale/designer_ja_JP.properties @@ -518,3 +518,26 @@ FR-Designer_PageSetup_Page=\u30DA\u30FC\u30B8 FR-Designer_Custom_Job_Description=\u8A18\u8FF0 FR-Designer_Property=\u5C5E\u6027 FR-Designer_ClassName=\u985E\u540D +FR-Designer_Polyblock_Edit=\u30A2\u30B0\u30EA\u30B2\u30FC\u30B7\u30E7\u30F3\u30D6\u30ED\u30C3\u30AF\u7DE8\u96C6 +FR-Designer_Function_Description_Area_Text=\u3053\u306E\u30AF\u30E9\u30B9\u306F\u7D99\u627F\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"com.fr.script.AbstractFunction"\u3002\u3092\u7D99\u627F\u3059\u3079\u304D\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u5F8C\u306E\u985E\u30D5\u30A1\u30A4\u30EB\u3092\nJ2EE\u30B5\u30FC\u30D0\u30FC "{R1}WEB-INF{R2}classes" \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u306B\u30B3\u30D4\u30FC\u3057\u3066\u3001class\u306B\u5BFE\u5FDC\u3059\u308Bjava\u30D5\u30A1\u30A4\u30EB\u3082\u5F53\u76EE\u6B21\u306B\u7F6E\u3044\u3066\u304F\u3060\u3055\u3044\u3002\n\u4F8B\u3048\u3070\uFF1A{R3}classes +FR-Designer_PageSetup_Horizontal=\u6A2A\u65B9\u5411 +FR-Designer_PageSetup_Vertical=\u7E26\u65B9\u5411 +FR-Designer_Gradient_Direction=\u65B9\u5411\u3092\u5F90\u3005\u306B\u5909\u5316 +FR-Designer_Drag_To_Select_Gradient=\\ \u4E0B\u65B9\u306E\u30DC\u30BF\u30F3\u3092\u30D7\u30EB\u30C0\u30A6\u30F3\u3057\u3066\u6F38\u6B21\u5909\u5316\u30A8\u30EA\u30A2\u3092\u9078\u629E\u3057\u3001\u30AF\u30EA\u30C3\u30AF\u3057 +FR-Designer_Display_Value=\u8868\u793A\u5024 +FR-Designer_Actual_Value=\u5B9F\u969B\u5024 +FR-Designer_CellWrite_ToolTip=\u30BB\u30EB\u30D2\u30F3\u30C8 +FR-Designer_Show_Content=\u5185\u5BB9\u8868\u793A +FR-Designer_Auto_Adjust_Size=\u81EA\u52D5\u8ABF\u6574 +FR-Designer_Show_As_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30EA\u30F3\u30AF\u3067\uFF12\u9032\u6CD5\u306E\u5185\u5BB9\u3092\u8868\u793A +FR-Designer_File_Name_For_Download=\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u30D5\u30A1\u30A4\u30EB\u540D +FR-Designer_No=\u3044\u3044\u3048 +FR-Designer_Pagination=\u30DA\u30FC\u30B8\u30F3\u30B0 +FR-Designer-Move_Tab_First= +FR-Designer-Move_Tab_End= +FR-Designer-Move_Tab_Next= +FR-Designer-Move_Tab_Prev= +FR-Designer_Role= +FR-Designer_DS_TableData=\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9 +FR-Designer_Parameter-Formula=\u6570\u5F0F + diff --git a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties index 9d540cd01..6e1a7eebc 100644 --- a/designer_base/src/com/fr/design/locale/designer_ko_KR.properties +++ b/designer_base/src/com/fr/design/locale/designer_ko_KR.properties @@ -512,4 +512,26 @@ FR-Designer_Allow_Blank=\uBE48\uCE78\uD5C8\uC6A9 FR-Designer_PageSetup_Page=\uC6F9\uD398\uC774\uC9C0 FR-Designer_Custom_Job_Description=\uC124\uBA85 FR-Designer_Property=\uC18D\uC131 -FR-Designer_ClassName=\uD074\uB798\uC2A4\uB124\uC784 \ No newline at end of file +FR-Designer_ClassName=\uD074\uB798\uC2A4\uB124\uC784 +FR-Designer_Polyblock_Edit=\uCDE8\uD569\uBE14\uB7ED\uD3B8\uC9D1 +FR-Designer_Function_Description_Area_Text=\uD574\uB2F9\uD074\uB798\uC2A4\uB294\uACC4\uC2B9\uD574\uC57C\uD55C\uB2E4."com.fr.script.AbstractFunction".\uCEF4\uD30C\uC77C\uD6C4\uC758\uD074\uB798\uC2A4\uD30C\uC77C\uC744~\uB85C\uBCF5\uC0AC\nJ2EE\uC11C\uBC84 "{R1}WEB-INF{R2}classes" \uB514\uB809\uD130\uB9AC, \uD544\uC694\uC2DC class \uC0C1\uC751\uD558\uB294 java\uC18C\uC2A4\uD30C\uC77C\uB3C4\uD574\uB2F9\uB514\uB809\uD130\uB9AC\uD558\uB2E8\uC5D0\uB450\uC5B4\uD3B8\uC9D1\uBC0F\uCC3E\uC544\uBCF4\uAE30\uB97C\uD560\uC218\uC788\uC2B5\uB2C8\uB2E4.\n\uC608: {R3}classes +FR-Designer_PageSetup_Horizontal=\uAC00\uB85C +FR-Designer_PageSetup_Vertical=\uC138\uB85C +FR-Designer_Gradient_Direction=\uADF8\uB77C\uB370\uC774\uC158 \uBC29\uD5A5 +FR-Designer_Drag_To_Select_Gradient=\\\uD558\uB2E8\uD0A4\uB97C\uB4DC\uB798\uADF8\uD558\uC5EC\uADF8\uB77C\uB370\uC774\uC158\uC601\uC5ED\uC744\uC120\uD0DD\uD558\uACE0\uD0A4\uB97C\uD074\uB9AD\uD558\uC5EC\uD574\uB2F9\uC0C9\uC120\uD0DD +FR-Designer_Display_Value=\uAC12\uBCF4\uC774\uAE30 +FR-Designer_Actual_Value=\uC2E4\uC81C\uAC12 +FR-Designer_CellWrite_ToolTip=\uB0B4\uC6A9\uC54C\uB9BC +FR-Designer_Show_Content=\uB0B4\uC6A9\uBCF4\uC774\uAE30 +FR-Designer_Auto_Adjust_Size=\uC790\uB3D9\uC870\uC815 +FR-Designer_Show_As_Download=\uB2E4\uC6B4\uB85C\uB4DC\uB9C1\uD06C\uB85C2\uC9C4\uBC95\uB0B4\uC6A9\uBCF4\uC774\uAE30 +FR-Designer_File_Name_For_Download=\uB2E4\uC6B4\uB85C\uB4DC\uD30C\uC77C\uBA85 +FR-Designer_No=\uC544\uB2C8\uC624 +FR-Designer_Pagination=\uD398\uC774\uC9C0\uB098\uB204\uAE30 +FR-Designer-Move_Tab_First= +FR-Designer-Move_Tab_End= +FR-Designer-Move_Tab_Next= +FR-Designer-Move_Tab_Prev= +FR-Designer_Role= +FR-Designer_DS_TableData=\uB370\uC774\uD130\uC138\uD2B8 +FR-Designer_Parameter-Formula=\uC218\uC2DD \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index 54f0ac177..bb49175a5 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -543,4 +543,25 @@ FR-Designer_PageSetup_Page=\u9875\u9762 FR-Designer_Custom_Job_Description=\u63CF\u8FF0 FR-Designer_Property=\u5C5E\u6027 FR-Designer_ClassName=\u7C7B\u540D - +FR-Designer_Polyblock_Edit=\u805A\u5408\u5757\u7F16\u8F91 +FR-Designer_Function_Description_Area_Text=\u8BE5\u7C7B\u5FC5\u987B\u7EE7\u627F"com.fr.script.AbstractFunction"\u3002\u5E94\u5C06\u7F16\u8BD1\u540E\u7684\u7C7B\u6587\u4EF6\u62F7\u8D1D\u5230\nJ2EE\u670D\u52A1\u5668 "{R1}WEB-INF{R2}classes" \u76EE\u5F55\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8BDD\u5C06class\u5BF9\u5E94\u7684java\u6E90\u6587\u4EF6\u4E5F\u653E\u7F6E\u5230\u8BE5\u76EE\u5F55\u4E0B\u65B9\u4FBF\u7F16\u8F91\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R3}classes +FR-Designer_PageSetup_Horizontal=\u6A2A\u5411 +FR-Designer_PageSetup_Vertical=\u7EB5\u5411 +FR-Designer_Gradient_Direction=\u6E10\u53D8\u65B9\u5411 +FR-Designer_Drag_To_Select_Gradient=\\ \u62D6\u52A8\u4E0B\u65B9\u6309\u94AE\u9009\u62E9\u6E10\u53D8\u533A\u57DF\uFF0C\u5355\u51FB\u6309\u94AE\u9009\u62E9\u5BF9\u5E94\u989C\u8272 +FR-Designer_Display_Value=\u663E\u793A\u503C +FR-Designer_Actual_Value=\u5B9E\u9645\u503C +FR-Designer_CellWrite_ToolTip=\u5185\u5BB9\u63D0\u793A +FR-Designer_Show_Content=\u663E\u793A\u5185\u5BB9 +FR-Designer_Auto_Adjust_Size=\u81EA\u52A8\u8C03\u6574 +FR-Designer_Show_As_Download=\u7528\u4E0B\u8F7D\u94FE\u63A5\u663E\u793A\u4E8C\u8FDB\u5236\u5185\u5BB9 +FR-Designer_File_Name_For_Download=\u4E0B\u8F7D\u6587\u4EF6\u540D +FR-Designer_No=\u5426 +FR-Designer_Pagination=\u5206\u9875 +FR-Designer-Move_Tab_First=\u79FB\u52A8\u5230\u9996\u4F4D +FR-Designer-Move_Tab_End=\u79FB\u52A8\u5230\u672B\u5C3E +FR-Designer-Move_Tab_Next=\u5F80\u540E\u79FB\u52A8 +FR-Designer-Move_Tab_Prev=\u5F80\u524D\u79FB\u52A8 +FR-Designer_Role=\u89D2\u8272 +FR-Designer_DS_TableData=\u6570\u636E\u96C6 +FR-Designer_Parameter-Formula=\u516C\u5F0F \ No newline at end of file diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 271150729..baa528496 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -531,3 +531,25 @@ FR-Designer_PageSetup_Page=\u9801\u9762 FR-Designer_Custom_Job_Description=\u63CF\u8FF0 FR-Designer_Property=\u5C6C\u6027 FR-Designer_ClassName=\u985E\u540D +FR-Designer_Polyblock_Edit=\u805A\u5408\u584A\u7DE8\u8F2F +FR-Designer_Function_Description_Area_Text=\u8A72\u985E\u5FC5\u9808\u7E7C\u627F"com.fr.script.AbstractFunction"\u3002\u61C9\u5C07\u7DE8\u8B6F\u5F8C\u7684\u985E\u6A94\u6848\u62F7\u8C9D\u5230\nJ2EE\u4F3A\u670D\u5668 "{R1}WEB-INF{R2}classes" \u76EE\u9304\uFF0C\u5982\u679C\u5FC5\u8981\u7684\u8A71\u5C07class\u5C0D\u61C9\u7684java\u539F\u59CB\u6A94\u6848\u4E5F\u653E\u7F6E\u5230\u8A72\u76EE\u9304\u4E0B\u65B9\u4FBF\u7DE8\u8F2F\u548C\u67E5\u770B\u3002\n\u4F8B\u5982\uFF1A{R3}classes +FR-Designer_PageSetup_Horizontal=\u6A2A\u5411 +FR-Designer_PageSetup_Vertical=\u7E31\u5411 +FR-Designer_Gradient_Direction=\u6F38\u8B8A\u65B9\u5411 +FR-Designer_Drag_To_Select_Gradient=\\ \u62D6\u52D5\u4E0B\u767C\u90A3\u500B\u6309\u9215\u61F8\u8457\u5340\u57DF\uFF0C\u55AE\u64CA\u6309\u9215\u9078\u64C7\u984F\u8272 +FR-Designer_Display_Value=\u986F\u793A\u503C +FR-Designer_Actual_Value=\u5BE6\u969B\u503C +FR-Designer_CellWrite_ToolTip=\u5167\u5BB9\u63D0\u793A +FR-Designer_Show_Content=\u986F\u793A\u5167\u5BB9 +FR-Designer_Auto_Adjust_Size=\u81EA\u52D5\u8ABF\u6574 +FR-Designer_Show_As_Download=\u7528\u4E0B\u8F09\u93C8\u63A5\u986F\u793A\u4E8C\u9032\u5236\u5167\u5BB9 +FR-Designer_File_Name_For_Download=\u4E0B\u8F09\u6A94\u6848\u540D +FR-Designer_No=\u5426 +FR-Designer_Pagination=\u5206\u9801 +FR-Designer-Move_Tab_First=\u79FB\u52D5\u5230\u9996\u4F4D +FR-Designer-Move_Tab_End=\u79FB\u52D5\u5230\u672B\u5C3E +FR-Designer-Move_Tab_Next=\u5F80\u5F8C\u79FB\u52D5 +FR-Designer-Move_Tab_Prev=\u5F80\u524D\u79FB\u52D5 +FR-Designer_Role= +FR-Designer_DS_TableData=\u8CC7\u6599\u96C6 +FR-Designer_Parameter-Formula=\u516C\u5F0F 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 411337066..7fcea5d1e 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -312,9 +312,10 @@ public abstract class ToolBarMenuDock { public ShortCut[] createHelpShortCuts() { java.util.List shortCuts = new ArrayList(); shortCuts.add(new WebDemoAction()); - // 英文,把 video 的链接放到 Help 下面 + // 英文,把 video 和帮助文档放到 Help 下面 if (FRContext.getLocale().equals(Locale.US)) { shortCuts.add(new VideoAction()); + shortCuts.add(new TutorialAction()); } shortCuts.add(SeparatorDef.DEFAULT); //shortCuts.add(new TutorialAction()); @@ -400,7 +401,7 @@ public abstract class ToolBarMenuDock { return toolBar; } else { - return polyToolBar(Inter.getLocText(new String[]{"Polybolck", "Edit"})); + return polyToolBar(Inter.getLocText("FR-Designer_Polyblock_Edit")); } } diff --git a/designer_base/src/com/fr/design/present/dict/TableDataDictPane.java b/designer_base/src/com/fr/design/present/dict/TableDataDictPane.java index 149118894..4e454ee9b 100644 --- a/designer_base/src/com/fr/design/present/dict/TableDataDictPane.java +++ b/designer_base/src/com/fr/design/present/dict/TableDataDictPane.java @@ -77,7 +77,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane } }); keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); - FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); + FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); formulaEditor.setEnabled(true); valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); } @@ -95,9 +95,9 @@ public class TableDataDictPane extends FurtherBasicBeanPane Component[][] components = new Component[][]{ - new Component[]{new UILabel(" " + Inter.getLocText("DS-TableData") + ":", UILabel.RIGHT), firstLine}, - new Component[]{new UILabel(Inter.getLocText("Actual_Value") + ":", UILabel.RIGHT), keyColumnPane}, - new Component[]{new UILabel(Inter.getLocText("Display_Value") + ":", UILabel.RIGHT), valueDictPane} + new Component[]{new UILabel(" " + Inter.getLocText("FR-Designer_DS_TableData") + ":", UILabel.RIGHT), firstLine}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + ":", UILabel.RIGHT), keyColumnPane}, + new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + ":", UILabel.RIGHT), valueDictPane} }; JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); @@ -158,7 +158,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane columnIndexEditor1.addItemListener(itemListener); keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNames[0]); - FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); + FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); formulaEditor.setEnabled(true); formulaEditor.addChangeListener(new ChangeListener() { diff --git a/designer_base/src/com/fr/design/roleAuthority/RoleTree.java b/designer_base/src/com/fr/design/roleAuthority/RoleTree.java index 3ee627987..1af8c1caa 100644 --- a/designer_base/src/com/fr/design/roleAuthority/RoleTree.java +++ b/designer_base/src/com/fr/design/roleAuthority/RoleTree.java @@ -1 +1 @@ -package com.fr.design.roleAuthority; import com.fr.general.NameObject; import com.fr.design.constants.UIConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree; import com.fr.design.mainframe.AuthorityPropertyPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.*; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.*; import java.awt.*; import java.util.Enumeration; /** * Author : daisy * Date: 13-8-30 * Time: 下午3:32 */ public class RoleTree extends UserObjectRefreshJTree { private static final long serialVersionUID = 2L; private String roleName = null; public RoleTree() { super(); this.setCellRenderer(roleTreeRenderer); this.setEnabled(true); this.setEditable(true); this.setRowHeight(20); this.setDigIn(true); this.removeMouseListener(treeMouseListener); this.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { doWithValueChanged(e); } }); } public boolean isCheckBoxVisible(TreePath path) { return true; } /** * 更新UI */ public void updateUI() { super.updateUI(); setUI(new UIRoleTreeUI()); } protected void doWithValueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() != null) { if (e.getNewLeadSelectionPath().getLastPathComponent().toString() != Inter.getLocText("Role")) { roleName = e.getNewLeadSelectionPath().getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } } protected void setTabRoleName(String roleName) { } /** * 刷新角色树 * * @param selectedRole 角色 */ public void refreshRoleTree(String selectedRole) { if (EastRegionContainerPane.getInstance().getUpPane() instanceof AuthorityPropertyPane) { AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getUpPane(); authorityPropertyPane.populate(); EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane); } } public void setSelectedRole(String selectedRole, TreePath parent) { ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); if (node.children() != null && node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { ExpandMutableTreeNode n = (ExpandMutableTreeNode) e.nextElement(); Object userObj = n.getUserObject(); String chilld = null; if (userObj instanceof String) { chilld = (String) userObj; } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; chilld = nameObject.getName(); } if (ComparatorUtils.equals(chilld, selectedRole)) { this.setSelectionPath(parent.pathByAddingChild(n)); return; } else { setSelectedRole(selectedRole, parent.pathByAddingChild(n)); } } } } private void refreshElementAndAuthorityPane() { JComponent authorityToolBar = DesignerContext.getDesignerFrame().getToolbarComponent(); if (authorityToolBar instanceof BasicBeanPane) { //说明是工具栏的 ((BasicBeanPane) authorityToolBar).populateAuthority(); } HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().repaint(); } public String getSelectedRoleName() { return roleName; } public void setSelectedRoleName(String name) { roleName = name; } private DefaultTreeCellRenderer roleTreeRenderer = new DefaultTreeCellRenderer() { private static final long serialVersionUID = 2L; public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) value; Object userObj = treeNode.getUserObject(); if (userObj instanceof String) { // p:这个是column field. this.setIcon(null); this.setText((String) userObj); } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; this.setText(nameObject.getName()); this.setIcon(null); } // 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setForeground(UIConstants.FONT_COLOR); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; /* * p:获得选中的NameObject = name + role. */ public NameObject getSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); return new NameObject(selectedUserObject.toString(), ""); } /** * p:添加一个NameObject节点 * @param no 需要添加的节点 */ public void addNameObject(NameObject no) { if (no == null) { return; } DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); // 新建一个放着NameObject的newChildTreeNode,加到Root下面 ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); ExpandMutableTreeNode newChildTreeNode = new ExpandMutableTreeNode(no); root.add(newChildTreeNode); newChildTreeNode.add(new ExpandMutableTreeNode()); treeModel.reload(root); } /** * 刷新树节点 */ public void refreshTreeNode() { DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); if (interceptRefresh(root)) { return; } ExpandMutableTreeNode[] new_nodes = loadChildTreeNodes(root); java.util.List childTreeNodeList = new java.util.ArrayList(); for (int i = 0, len = root.getChildCount(); i < len; i++) { if (root.getChildAt(i) instanceof ExpandMutableTreeNode) { childTreeNodeList.add((ExpandMutableTreeNode) root.getChildAt(i)); } else { childTreeNodeList.add((DefaultMutableTreeNode) root.getChildAt(i)); } } root.removeAllChildren(); for (int ci = 0; ci < new_nodes.length; ci++) { Object cUserObject = new_nodes[ci].getUserObject(); for (int ni = 0, nlen = childTreeNodeList.size(); ni < nlen; ni++) { ExpandMutableTreeNode cTreeNode = (ExpandMutableTreeNode) childTreeNodeList.get(ni); if (ComparatorUtils.equals(cTreeNode.getUserObject(), cUserObject)) { new_nodes[ci].setExpanded(cTreeNode.isExpanded()); if (cTreeNode.getFirstChild() instanceof ExpandMutableTreeNode && cTreeNode.isExpanded()) { checkChildNodes(cTreeNode, new_nodes[ci]); } break; } } root.add(new_nodes[ci]); } } protected void checkChildNodes(ExpandMutableTreeNode oldNode, ExpandMutableTreeNode newNode) { for (int i = 0; i < oldNode.getChildCount(); i++) { ExpandMutableTreeNode oldChild = (ExpandMutableTreeNode) oldNode.getChildAt(i); for (int j = 0; j < newNode.getChildCount(); j++) { ExpandMutableTreeNode newChild = (ExpandMutableTreeNode) newNode.getChildAt(j); ExpandMutableTreeNode[] nodes = RoleTree.this.loadChildTreeNodes(newChild); for (int k = 0; k < nodes.length; k++) { newChild.add(nodes[k]); } if (newChild.getChildCount() > 1 && ((ExpandMutableTreeNode) newChild.getFirstChild()).getUserObject() == PENDING) { newChild.remove(0); } if (ComparatorUtils.equals(oldChild.getUserObject(), newChild.getUserObject())) { newChild.setExpanded(oldChild.isExpanded()); } } } } public NameObject getRealSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } return null; } } \ No newline at end of file +package com.fr.design.roleAuthority; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.itree.checkboxtree.CheckBoxTree; import com.fr.design.gui.itree.checkboxtree.CheckBoxTreeSelectionModel; import com.fr.general.NameObject; import com.fr.design.constants.UIConstants; import com.fr.design.beans.BasicBeanPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree; import com.fr.design.mainframe.AuthorityPropertyPane; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import javax.swing.SwingUtilities; import javax.swing.JTree; import javax.swing.JComponent; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreePath; import java.awt.Component; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; /** * Author : daisy * Time: 下午3:32 * Date: 13-8-30 */ public class RoleTree extends UserObjectRefreshJTree { private static final long serialVersionUID = 2L; private String roleName = null; public RoleTree() { super(); this.setCellRenderer(roleTreeRenderer); this.setEnabled(true); this.setEditable(true); this.setRowHeight(20); this.setDigIn(true); Handler handler = createHandlerForRoleTree(); this.replaceMouseListener(this, handler, 0); this.replaceKeyListener(this, handler, 0); this.addTreeSelectionListener(handler); // this.removeMouseListener(treeMouseListener); // this.addTreeSelectionListener(new TreeSelectionListener() { // public void valueChanged(TreeSelectionEvent e) { // doWithValueChanged(e); // } // }); } public boolean isCheckBoxVisible(TreePath path) { return true; } /** * Creates the mouse listener and key listener used by RoleTree. * * @return the Handler. */ protected Handler createHandlerForRoleTree() { return new Handler(this); } protected static class Handler implements MouseListener, KeyListener, TreeSelectionListener { protected RoleTree _tree; int _hotspot = new UICheckBox().getPreferredSize().width; private int _toggleCount = -1; public Handler(RoleTree tree) { _tree = tree; } protected TreePath getTreePathForMouseEvent(MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) { return null; } if (!_tree.isCheckBoxEnabled()) { return null; } TreePath path = _tree.getPathForLocation(e.getX(), e.getY()); if (path == null) { return null; } // if (clicksInCheckBox(e, path)) { return path; // } else { // return null; // } } // protected boolean clicksInCheckBox(MouseEvent e, TreePath path) { // if (!_tree.isCheckBoxVisible(path)) { // return false; // } else { // Rectangle bounds = _tree.getPathBounds(path); // if (_tree.getComponentOrientation().isLeftToRight()) { // return e.getX() < bounds.x + _hotspot; // } else { // return e.getX() > bounds.x + bounds.width - _hotspot; // } // } // } private TreePath preventToggleEvent(MouseEvent e) { TreePath pathForMouseEvent = getTreePathForMouseEvent(e); if (pathForMouseEvent != null) { int toggleCount = _tree.getToggleClickCount(); if (toggleCount != -1) { _toggleCount = toggleCount; _tree.setToggleClickCount(-1); } } return pathForMouseEvent; } public void mouseClicked(MouseEvent e) { preventToggleEvent(e); } public void mousePressed(MouseEvent e) { TreePath path = preventToggleEvent(e); if (path != null) { toggleSelection(path); e.consume(); } } public void mouseReleased(MouseEvent e) { TreePath path = preventToggleEvent(e); if (path != null) { e.consume(); } if (_toggleCount != -1) { _tree.setToggleClickCount(_toggleCount); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void keyPressed(KeyEvent e) { if (e.isConsumed()) { return; } if (!_tree.isCheckBoxEnabled()) { return; } if (e.getModifiers() == 0 && e.getKeyChar() == KeyEvent.VK_SPACE) { toggleSelections(); } } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void valueChanged(TreeSelectionEvent e) { _tree.treeDidChange(); _tree.doWithValueChanged(e); } private void toggleSelection(TreePath path) { if (!_tree.isEnabled() || !_tree.isCheckBoxEnabled(path)) { return; } CheckBoxTreeSelectionModel selectionModel = _tree.getCheckBoxTreeSelectionModel(); boolean selected = selectionModel.isPathSelected(path, selectionModel.isDigIn()); selectionModel.removeTreeSelectionListener(this); try { if (!selectionModel.isSingleEventMode()) { selectionModel.setBatchMode(true); } if (selected) selectionModel.removeSelectionPath(path); else selectionModel.addSelectionPath(path); } finally { if (!selectionModel.isSingleEventMode()) { selectionModel.setBatchMode(false); } selectionModel.addTreeSelectionListener(this); _tree.treeDidChange(); _tree.doWithValueChanged(path); } } protected void toggleSelections() { TreePath[] treePaths = _tree.getSelectionPaths(); if (treePaths == null) { return; } for (int i = 0, length = treePaths.length; i < length; i++) { TreePath tmpTreePath = treePaths[i]; toggleSelection(tmpTreePath); } // for (TreePath treePath : treePaths) { // toggleSelection(treePath); // } } } /** * 更新UI */ public void updateUI() { super.updateUI(); setUI(new UIRoleTreeUI()); } /** * @param e 选中事件 */ protected void doWithValueChanged(TreeSelectionEvent e) { if (e.getNewLeadSelectionPath() != null) { if (!e.getNewLeadSelectionPath().getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) { roleName = e.getNewLeadSelectionPath().getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } } /** * @param treepath 所选的节点路径 */ protected void doWithValueChanged(TreePath treepath) { if (treepath != null && !treepath.getLastPathComponent().toString().equals(Inter.getLocText("FR-Designer_Role"))) { roleName = treepath.getLastPathComponent().toString(); setTabRoleName(roleName); refreshRoleTree(roleName); refreshElementAndAuthorityPane(); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().judgeSheetAuthority(roleName); } } protected void setTabRoleName(String roleName) { } /** * 刷新角色树 * * @param selectedRole 角色 */ public void refreshRoleTree(String selectedRole) { if (EastRegionContainerPane.getInstance().getUpPane() instanceof AuthorityPropertyPane) { AuthorityPropertyPane authorityPropertyPane = (AuthorityPropertyPane) EastRegionContainerPane.getInstance().getUpPane(); authorityPropertyPane.populate(); EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane); } } public void setSelectedRole(String selectedRole, TreePath parent) { ExpandMutableTreeNode node = (ExpandMutableTreeNode) parent.getLastPathComponent(); if (node.children() != null && node.getChildCount() >= 0) { for (Enumeration e = node.children(); e.hasMoreElements(); ) { ExpandMutableTreeNode n = (ExpandMutableTreeNode) e.nextElement(); Object userObj = n.getUserObject(); String chilld = null; if (userObj instanceof String) { chilld = (String) userObj; } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; chilld = nameObject.getName(); } if (ComparatorUtils.equals(chilld, selectedRole)) { this.setSelectionPath(parent.pathByAddingChild(n)); return; } else { setSelectedRole(selectedRole, parent.pathByAddingChild(n)); } } } } private void refreshElementAndAuthorityPane() { JComponent authorityToolBar = DesignerContext.getDesignerFrame().getToolbarComponent(); if (authorityToolBar instanceof BasicBeanPane) { //说明是工具栏的 ((BasicBeanPane) authorityToolBar).populateAuthority(); } HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().repaint(); } public String getSelectedRoleName() { return roleName; } public void setSelectedRoleName(String name) { roleName = name; } private DefaultTreeCellRenderer roleTreeRenderer = new DefaultTreeCellRenderer() { private static final long serialVersionUID = 2L; public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); ExpandMutableTreeNode treeNode = (ExpandMutableTreeNode) value; Object userObj = treeNode.getUserObject(); if (userObj instanceof String) { // p:这个是column field. this.setIcon(null); this.setText((String) userObj); } else if (userObj instanceof NameObject) { NameObject nameObject = (NameObject) userObj; this.setText(nameObject.getName()); this.setIcon(null); } // 这里新建一个Label作为render是因为JTree在动态刷新的时候,节点上render画布的的宽度不会变,会使得一部分比较长的数据显示为"..." this.setBackgroundNonSelectionColor(UIConstants.NORMAL_BACKGROUND); this.setForeground(UIConstants.FONT_COLOR); this.setBackgroundSelectionColor(UIConstants.FLESH_BLUE); return this; } }; /** * 去除不需要的鼠标监听器 * * @param component 组件 * @param l 所需的鼠标监听器 * @param index 插入的索引 */ private void replaceMouseListener(Component component, MouseListener l, int index) { component.removeMouseListener(treeMouseListener); MouseListener[] listeners = component.getMouseListeners(); for (int i = 0, length = listeners.length; i < length; i++) { component.removeMouseListener(listeners[i]); } // for (MouseListener listener : listeners) { // component.removeMouseListener(listener); // } for (int i = 0; i < listeners.length; i++) { MouseListener listener = listeners[i]; if (index == i) { component.addMouseListener(l); } if (listener instanceof CheckBoxTree.Handler) { continue; } component.addMouseListener(listener); } // index is too large, add to the end. if (index > listeners.length - 1) { component.addMouseListener(l); } } /** * 去除一些不需要的键盘监听器 * * @param component 组件 * @param l 所需的键盘监听器 * @param index 插入的索引 */ private void replaceKeyListener(Component component, KeyListener l, int index) { KeyListener[] listeners = component.getKeyListeners(); for (int i = 0, length = listeners.length; i < length; i++) { component.removeKeyListener(listeners[i]); } // for (MouseListener listener : listeners) { // component.removeMouseListener(listener); // } for (int i = 0; i < listeners.length; i++) { KeyListener listener = listeners[i]; if (index == i) { component.addKeyListener(l); } if (listener instanceof CheckBoxTree.Handler) { continue; } component.addKeyListener(listener); } // index is too large, add to the end. if (index > listeners.length - 1) { component.addKeyListener(l); } } /* * p:获得选中的NameObject = name + role. */ public NameObject getSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); return new NameObject(selectedUserObject.toString(), ""); } /** * p:添加一个NameObject节点 * * @param no 需要添加的节点 */ public void addNameObject(NameObject no) { if (no == null) { return; } DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); // 新建一个放着NameObject的newChildTreeNode,加到Root下面 ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); ExpandMutableTreeNode newChildTreeNode = new ExpandMutableTreeNode(no); root.add(newChildTreeNode); newChildTreeNode.add(new ExpandMutableTreeNode()); treeModel.reload(root); } /** * 刷新树节点 */ public void refreshTreeNode() { DefaultTreeModel treeModel = (DefaultTreeModel) this.getModel(); ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); if (interceptRefresh(root)) { return; } ExpandMutableTreeNode[] new_nodes = loadChildTreeNodes(root); List childTreeNodeList = new ArrayList(); for (int i = 0, len = root.getChildCount(); i < len; i++) { if (root.getChildAt(i) instanceof ExpandMutableTreeNode) { childTreeNodeList.add((ExpandMutableTreeNode) root.getChildAt(i)); } else { childTreeNodeList.add((DefaultMutableTreeNode) root.getChildAt(i)); } } root.removeAllChildren(); for (int ci = 0; ci < new_nodes.length; ci++) { Object cUserObject = new_nodes[ci].getUserObject(); for (int ni = 0, nlen = childTreeNodeList.size(); ni < nlen; ni++) { ExpandMutableTreeNode cTreeNode = (ExpandMutableTreeNode) childTreeNodeList.get(ni); if (ComparatorUtils.equals(cTreeNode.getUserObject(), cUserObject)) { new_nodes[ci].setExpanded(cTreeNode.isExpanded()); if (cTreeNode.getFirstChild() instanceof ExpandMutableTreeNode && cTreeNode.isExpanded()) { checkChildNodes(cTreeNode, new_nodes[ci]); } break; } } root.add(new_nodes[ci]); } } protected void checkChildNodes(ExpandMutableTreeNode oldNode, ExpandMutableTreeNode newNode) { for (int i = 0; i < oldNode.getChildCount(); i++) { ExpandMutableTreeNode oldChild = (ExpandMutableTreeNode) oldNode.getChildAt(i); for (int j = 0; j < newNode.getChildCount(); j++) { ExpandMutableTreeNode newChild = (ExpandMutableTreeNode) newNode.getChildAt(j); ExpandMutableTreeNode[] nodes = RoleTree.this.loadChildTreeNodes(newChild); for (int k = 0; k < nodes.length; k++) { newChild.add(nodes[k]); } if (newChild.getChildCount() > 1 && ((ExpandMutableTreeNode) newChild.getFirstChild()).getUserObject() == PENDING) { newChild.remove(0); } if (ComparatorUtils.equals(oldChild.getUserObject(), newChild.getUserObject())) { newChild.setExpanded(oldChild.isExpanded()); } } } } public NameObject getRealSelectedNameObject() { TreePath selectedTreePath = this.getSelectionPath(); if (selectedTreePath == null) { return null; } ExpandMutableTreeNode selectedTreeNode = (ExpandMutableTreeNode) selectedTreePath.getLastPathComponent(); Object selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } selectedTreeNode = (ExpandMutableTreeNode) selectedTreeNode.getParent(); selectedUserObject = selectedTreeNode.getUserObject(); if (selectedUserObject instanceof NameObject) { return (NameObject) selectedUserObject; } return null; } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/style/background/gradient/GradientBackgroundPane.java b/designer_base/src/com/fr/design/style/background/gradient/GradientBackgroundPane.java index 9ab11eb14..ee0cd3385 100644 --- a/designer_base/src/com/fr/design/style/background/gradient/GradientBackgroundPane.java +++ b/designer_base/src/com/fr/design/style/background/gradient/GradientBackgroundPane.java @@ -43,7 +43,7 @@ public class GradientBackgroundPane extends BackgroundDetailPane { JPanel blankJp = new JPanel(); gradientBar = new GradientBar(4, 254); blankJp.add(gradientBar); - UILabel jl = new UILabel(Inter.getLocText("Drag_to_select_gradient")); + UILabel jl = new UILabel(Inter.getLocText("FR-Designer_Drag_To_Select_Gradient")); jl.setHorizontalAlignment(SwingConstants.CENTER); gradientPanel.add(jl, BorderLayout.NORTH); gradientPanel.add(blankJp, BorderLayout.SOUTH); @@ -53,14 +53,14 @@ public class GradientBackgroundPane extends BackgroundDetailPane { JPanel innercenterPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); centerPane.add(new UILabel(" ")); centerPane.add(innercenterPane); - innercenterPane.add(new UILabel(Inter.getLocText("Gradient-Direction") + ":")); + innercenterPane.add(new UILabel(Inter.getLocText("FR-Designer_Gradient_Direction") + ":")); - left2right = new UIRadioButton(Inter.getLocText("PageSetup-Landscape")); + left2right = new UIRadioButton(Inter.getLocText("FR-Designer_PageSetup_Horizontal")); innercenterPane.add(left2right); left2right.setSelected(true); left2right.addActionListener(reviewListener); - top2bottom = new UIRadioButton(Inter.getLocText("PageSetup-Portrait")); + top2bottom = new UIRadioButton(Inter.getLocText("FR-Designer_PageSetup_Vertical")); innercenterPane.add(top2bottom); top2bottom.addActionListener(reviewListener); diff --git a/designer_base/src/com/fr/design/style/color/ColorSelectConfigManager.java b/designer_base/src/com/fr/design/style/color/ColorSelectConfigManager.java index 4d20c1207..af3d7df81 100644 --- a/designer_base/src/com/fr/design/style/color/ColorSelectConfigManager.java +++ b/designer_base/src/com/fr/design/style/color/ColorSelectConfigManager.java @@ -1,56 +1,192 @@ package com.fr.design.style.color; +import com.fr.file.XMLFileManager; + + +import com.fr.base.FRContext; +import com.fr.cluster.rpc.RPC; +import com.fr.file.BaseClusterHelper; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; +import com.fr.stable.EnvChangedListener; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLTools; +import com.fr.stable.xml.XMLableReader; +import com.fr.general.FRLogger; + import java.awt.Color; import java.util.ArrayList; import java.util.List; +import java.io.InputStream; /** * 最近使用颜色 - * @author focus * + * @author focus */ -public class ColorSelectConfigManager{ - - // 最近使用的颜色个数 - private int colorNums = 20; - // 最近使用颜色 - private List colors; - - private static ColorSelectConfigManager colorSelectConfigManager = null; - - public Color[] getColors() { - if(colors == null){ - colors = new ArrayList(); - } - return colors.toArray(new Color[colors.size()]); - } - - public int getColorNum() { - return colorNums; - } - public void setColorNum(int colorNums) { - this.colorNums = colorNums; - } - - public synchronized static ColorSelectConfigManager getInstance() { - if (colorSelectConfigManager == null) { - colorSelectConfigManager = new ColorSelectConfigManager(); - } - return colorSelectConfigManager; - } - - /** - * 添加颜色到最近使用队列中 - * - * @param color 颜色 - * - */ - public void addToColorQueue(Color color){ - // 过滤重复的最近使用颜色 - // 因为有个后进先出的问题,最近使用的颜色需要放到最前面所以没用set - if(colors.contains(color)){ - colors.remove(color); - } - colors.add(color); - } -} \ No newline at end of file +public class ColorSelectConfigManager extends XMLFileManager implements ColorSelectConfigManagerProvider { + + // 最近使用的颜色个数 + private int colorNums = 20; + + private static ColorSelectConfigManagerProvider configManager = null; + private static ColorSelectConfigManager colorSelectConfigManager = null; + private boolean init = true; + // 最近使用颜色 + private List colors = new ArrayList(); + private static final String RECENT_COLOR_TAG = "RecentColors"; + private static final String COLOR_TAG = "Color"; + + static { + GeneralContext.addEnvChangedListener(new EnvChangedListener() { + public void envChanged() { + ColorSelectConfigManager.envChanged(); + } + }); + } + + private static void envChanged() { + configManager = null; + } + + public Color[] getColors() { + + //初次打开软件时从xml文件中获取历史颜色信息 + if (init) { + ColorSelectConfigManagerProvider manager = ColorSelectConfigManager.getProviderInstance(); + this.colors = manager.getColorsFromFile(); + init = false; + } + if (colors == null) { + colors = new ArrayList(); + } + return colors.toArray(new Color[colors.size()]); + } + + public int getColorNum() { + return colorNums; + } + + public void setColorNum(int colorNums) { + this.colorNums = colorNums; + } + + public synchronized static ColorSelectConfigManager getInstance() { + if (colorSelectConfigManager == null) { + colorSelectConfigManager = new ColorSelectConfigManager(); + } + return colorSelectConfigManager; + } + + /** + * 添加颜色到最近使用队列中 + * + * @param color 颜色 + */ + public void addToColorQueue(Color color) { + // 过滤重复的最近使用颜色 + // 因为有个后进先出的问题,最近使用的颜色需要放到最前面所以没用set + if (colors.contains(color)) { + colors.remove(color); + } + colors.add(color); + + /*@author yaohwu*/ + //将历史颜色信息保存到xml文件中去 + ColorSelectConfigManagerProvider manager = ColorSelectConfigManager.getProviderInstance(); + if (colors != null && !colors.isEmpty()) { + manager.setColorsToFile(colors); + } + try { + FRContext.getCurrentEnv().writeResource(manager); + } catch (Exception e) { + FRLogger.getLogger().error(e.getMessage()); + } + } + + + /** + * 读取配置文件流 + * + * @param input 流 + * @throws Exception 异常 + */ + @Override + public void readFromInputStream(InputStream input) throws Exception { + ColorSelectConfigManager manager = new ColorSelectConfigManager(); + XMLTools.readInputStreamXML(manager, input); + configManager = manager; + FRContext.getCurrentEnv().writeResource(configManager); + } + + + /** + * 获取配置管理接口 + * + * @return 配置管理接口ConfigManagerProvider + */ + public synchronized static ColorSelectConfigManagerProvider getProviderInstance() { + if (configManager == null) { + if (isClusterMember()) { + return configManager; + } + configManager.readXMLFile(); + } + return configManager; + } + + private synchronized static boolean isClusterMember() { + switch (BaseClusterHelper.getClusterState()) { + case LEADER: + configManager = new ColorSelectConfigManager(); + RPC.registerSkeleton(configManager); + return false; + case MEMBER: + String ip = BaseClusterHelper.getMainServiceIP(); + configManager = (ColorSelectConfigManagerProvider) RPC.getProxy(ColorSelectConfigManager.class, ip); + return true; + default: + configManager = new ColorSelectConfigManager(); + break; + } + return false; + } + + public boolean writeResource() throws Exception { + return FRContext.getCurrentEnv().writeResource(ColorSelectConfigManager.getProviderInstance()); + } + + public String fileName() { + return "recentcolors.xml"; + } + + public void readXML(XMLableReader reader) { + String name = reader.getTagName(); + if (reader.isChildNode()) { + if (ComparatorUtils.equals(COLOR_TAG, name)) { + Color color = null; + colors.add(reader.getAttrAsColor("colors", color)); + } + } + } + + public void writeXML(XMLPrintWriter writer) { + writer.startTAG(RECENT_COLOR_TAG); + if (this.colors != null && !this.colors.isEmpty()) { + for (int i = 0; i < this.colors.size(); i++) { + writer.startTAG(COLOR_TAG); + writer.attr("colors", colors.get(i).getRGB()); + writer.end(); + } + } + writer.end(); + } + + public List getColorsFromFile() { + return this.colors; + } + + public void setColorsToFile(List colors) { + this.colors = colors; + } +} diff --git a/designer_base/src/com/fr/design/style/color/ColorSelectConfigManagerProvider.java b/designer_base/src/com/fr/design/style/color/ColorSelectConfigManagerProvider.java new file mode 100644 index 000000000..f9b2ec988 --- /dev/null +++ b/designer_base/src/com/fr/design/style/color/ColorSelectConfigManagerProvider.java @@ -0,0 +1,17 @@ +package com.fr.design.style.color; + +import com.fr.stable.file.RemoteXMLFileManagerProvider; + +import java.awt.Color; +import java.util.List; + + +/** + * Created by yaohwu on 2017/2/8. + */ +public interface ColorSelectConfigManagerProvider extends RemoteXMLFileManagerProvider { + + List getColorsFromFile(); + + void setColorsToFile(List colors); +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java new file mode 100644 index 000000000..93a62287e --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java @@ -0,0 +1,32 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.actions.FormUndoableAction; +import com.fr.design.mainframe.FormDesigner; + +/** + * Created by zhouping on 2017/2/9. + */ +public class TabMoveCustomAction extends FormUndoableAction { + private XCardSwitchButton xCardSwitchButton; + + public TabMoveCustomAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { + super(t); + this.setName(""); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); + this.xCardSwitchButton = xCardSwitchButton; + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + return false; + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java new file mode 100644 index 000000000..ae101dbe4 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java @@ -0,0 +1,66 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.actions.FormUndoableAction; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +/** + * Created by zhouping on 2017/2/9. + */ +public class TabMoveEndAction extends FormUndoableAction { + private XCardSwitchButton xCardSwitchButton; + + public TabMoveEndAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { + super(t); + this.setName(Inter.getLocText("FR-Designer-Move_Tab_End")); + this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/rightright.png")); + this.xCardSwitchButton = xCardSwitchButton; + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); + XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); + CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); + try { + int currentIndex = currentButton.getIndex(); + int maxIndex = xwCardTagLayout.getComponentCount(); + XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); + WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); + xwCardTagLayout.setSwitchingTab(true); + //修改当前tab往后所有tab的索引号 + for (int i = currentIndex + 1; i < maxIndex; i++) { + CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); + tempBtn.setIndex(i - 1); + WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); + tempTab.setIndex(i - 1); + tempTab.setTabNameIndex(i - 1); + } + xwCardTagLayout.remove(xCardSwitchButton); + xwCardTagLayout.add(xCardSwitchButton); + xwCardLayout.remove(xCurrentTab); + xwCardLayout.add(xCurrentTab); + currentButton.setIndex(maxIndex - 1); + currentTab.setIndex(maxIndex - 1); + currentTab.setTabNameIndex(maxIndex - 1); + xwCardTagLayout.setSwitchingTab(false); + }catch (Exception e){ + xwCardTagLayout.setSwitchingTab(false); + FRLogger.getLogger().error(e.getMessage()); + return false; + } + return true; + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java new file mode 100644 index 000000000..0d6047636 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java @@ -0,0 +1,65 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.actions.FormUndoableAction; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +/** + * Created by zhouping on 2017/2/9. + */ +public class TabMoveFirstAction extends FormUndoableAction { + private XCardSwitchButton xCardSwitchButton; + + public TabMoveFirstAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { + super(t); + this.setName(Inter.getLocText("FR-Designer-Move_Tab_First")); + this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/leftleft.png")); + this.xCardSwitchButton = xCardSwitchButton; + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); + XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); + CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); + try { + int currentIndex = currentButton.getIndex(); + XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); + WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); + xwCardTagLayout.setSwitchingTab(true); + //修改当前tab往前所有tab的索引号 + for (int i = currentIndex - 1; i >= 0; i--) { + CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); + tempBtn.setIndex(i + 1); + WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); + tempTab.setIndex(i + 1); + tempTab.setTabNameIndex(i + 1); + } + xwCardTagLayout.remove(xCardSwitchButton); + xwCardTagLayout.add(xCardSwitchButton, 0); + xwCardLayout.remove(xCurrentTab); + xwCardLayout.add(xCurrentTab, 0); + currentButton.setIndex(0); + currentTab.setIndex(0); + currentTab.setTabNameIndex(0); + xwCardTagLayout.setSwitchingTab(false); + }catch (Exception e){ + xwCardTagLayout.setSwitchingTab(false); + FRLogger.getLogger().error(e.getMessage()); + return false; + } + return true; + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java new file mode 100644 index 000000000..15bfa7337 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java @@ -0,0 +1,64 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.actions.FormUndoableAction; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +/** + * Created by zhouping on 2017/2/9. + */ +public class TabMoveNextAction extends FormUndoableAction { + private XCardSwitchButton xCardSwitchButton; + + public TabMoveNextAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { + super(t); + this.setName(Inter.getLocText("FR-Designer-Move_Tab_Next")); + this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/right.png")); + this.xCardSwitchButton = xCardSwitchButton; + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); + XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); + CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); + try { + int currentIndex = currentButton.getIndex(); + XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); + WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); + xwCardTagLayout.setSwitchingTab(true); + //修改下一个tab的索引号 + CardSwitchButton nextBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex + 1).toData(); + nextBtn.setIndex(currentIndex); + WTabFitLayout nextTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex + 1).toData(); + nextTab.setIndex(currentIndex); + nextTab.setTabNameIndex(currentIndex); + + xwCardTagLayout.remove(xCardSwitchButton); + xwCardTagLayout.add(xCardSwitchButton, currentIndex + 1); + xwCardLayout.remove(xCurrentTab); + xwCardLayout.add(xCurrentTab, currentIndex + 1); + currentButton.setIndex(currentIndex + 1); + currentTab.setIndex(currentIndex + 1); + currentTab.setTabNameIndex(currentIndex + 1); + xwCardTagLayout.setSwitchingTab(false); + }catch (Exception e){ + xwCardTagLayout.setSwitchingTab(false); + FRLogger.getLogger().error(e.getMessage()); + return false; + } + return true; + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java new file mode 100644 index 000000000..cac70db82 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java @@ -0,0 +1,64 @@ +package com.fr.design.designer.creator.cardlayout; + +import com.fr.base.BaseUtils; +import com.fr.design.designer.beans.actions.FormUndoableAction; +import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.cardlayout.WTabFitLayout; +import com.fr.general.FRLogger; +import com.fr.general.Inter; + +/** + * Created by zhouping on 2017/2/9. + */ +public class TabMovePrevAction extends FormUndoableAction { + private XCardSwitchButton xCardSwitchButton; + + public TabMovePrevAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { + super(t); + this.setName(Inter.getLocText("FR-Designer-Move_Tab_Prev")); + this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/left.png")); + this.xCardSwitchButton = xCardSwitchButton; + } + + @Override + public boolean executeActionReturnUndoRecordNeeded() { + XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout(); + XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout(); + CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData(); + try { + int currentIndex = currentButton.getIndex(); + XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex); + WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData(); + xwCardTagLayout.setSwitchingTab(true); + //修改上一个tab的索引号 + CardSwitchButton prevBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex - 1).toData(); + prevBtn.setIndex(currentIndex); + WTabFitLayout prevTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex - 1).toData(); + prevTab.setIndex(currentIndex); + prevTab.setTabNameIndex(currentIndex); + + xwCardTagLayout.remove(xCardSwitchButton); + xwCardTagLayout.add(xCardSwitchButton, currentIndex - 1); + xwCardLayout.remove(xCurrentTab); + xwCardLayout.add(xCurrentTab, currentIndex - 1); + currentButton.setIndex(currentIndex - 1); + currentTab.setIndex(currentIndex - 1); + currentTab.setTabNameIndex(currentIndex - 1); + xwCardTagLayout.setSwitchingTab(false); + }catch (Exception e){ + xwCardTagLayout.setSwitchingTab(false); + FRLogger.getLogger().error(e.getMessage()); + return false; + } + return true; + } + + public XCardSwitchButton getxCardSwitchButton() { + return xCardSwitchButton; + } + + public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { + this.xCardSwitchButton = xCardSwitchButton; + } +} diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index fa4c1d4a9..85e26e877 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -89,12 +89,12 @@ public class XCardAddButton extends XButton{ // addbutton对应的XWCardLayout和XWCardTagLayout暂未存入到xml中,重新打开之后先根据父子层获取 if(cardLayout == null && tagLayout ==null ){ - initRalateLayout(); + initRelateLayout(); } int index = cardLayout.toData().getWidgetCount(); //添加新的tab,并将原来的设为未选中状态 - setTabUnselectd(); + setTabUnselected(); addTab(index); this.tagLayout.adjustComponentWidth(); @@ -110,7 +110,7 @@ public class XCardAddButton extends XButton{ LayoutUtils.layoutRootContainer(designer.getRootComponent()); } - private void initRalateLayout(){ + private void initRelateLayout(){ XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent(); this.tagLayout = titleLayout.getTagPart(); @@ -129,7 +129,7 @@ public class XCardAddButton extends XButton{ } //将原来的tab页设置为未选中状态 - private void setTabUnselectd(){ + private void setTabUnselected(){ for(int i=0;i minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) { - if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) { - designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } - } - xElementCase.setHelpBtnOnFocus(false); - if (xElementCase.getCoverPane().getComponentCount() > 1) { - JComponent button1 = (JComponent) xElementCase.getCoverPane().getComponent(1); - int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); - int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); - if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { - if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { - designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - xElementCase.setHelpBtnOnFocus(true); - } - } - } - xElementCase.displayCoverPane(true); - xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT); - + elementCaseMouseMoved(e, component); designer.repaint(); return; } @@ -322,6 +299,35 @@ public class EditingMouseListener extends MouseInputAdapter { designer.repaint(); } + private void elementCaseMouseMoved(MouseEvent e, XCreator component) { + xElementCase = (XElementCase)component; + UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); + if(designer.getCursor().getType() == Cursor.HAND_CURSOR) { + designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } // component.getParent() 是报表块所在的XWTitleLayout + int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); + int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); + if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) { + if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) { + designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + } + xElementCase.setHelpBtnOnFocus(false); + if (xElementCase.getCoverPane().getComponentCount() > 1) { + JComponent button1 = (JComponent) xElementCase.getCoverPane().getComponent(1); + int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); + int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); + if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { + if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { + designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + xElementCase.setHelpBtnOnFocus(true); + } + } + } + xElementCase.displayCoverPane(true); + xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT); + } + private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) { if (xElementCase != null) { int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); @@ -511,9 +517,6 @@ public class EditingMouseListener extends MouseInputAdapter { * @param e 鼠标事件 */ public void mouseClicked(MouseEvent e) { - if (e.getButton() != MouseEvent.BUTTON1) { - return; - } XCreator creator = designer.getComponentAt(e); creator = processTopLayoutMouseClick(creator);