diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index 83d7dbc8e8..9aa8f6a2e6 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -2105,3 +2105,4 @@ FR-Designer_Insert_Text=Insert_Text FR-Designer_Double=Double FR-Designer_Add_Event=Add Event FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit +FR-Designer_Remove_Item=Remove Item 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 915b1eac93..c4fecf6de5 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 @@ -462,9 +462,9 @@ FR-Designer_Attr_Bidirectional_Adaptive=Bidirectional adaptive FR-Designer-Selected_Widget=Selected widget FR-Designer_LocalWidget=Local component library FR-Designer_AllCategories=All categories -FR-Designer_Download_Template=Download components -FR-Designer_Install_Template=Install components -FR-Designer_Delete_Template=Delete components +FR-Designer_Download_Template=Download +FR-Designer_Install_Template=Install +FR-Designer_Delete_Template=Delete FR-Designer_Mobile-Refresh=Refresh FR-Designer_Mobile-ToolBar=Toolbar FR-Designer_WLayout-Absolute-ToolTips=Freestyle layout, add control in any position of the layout @@ -2106,3 +2106,4 @@ FR-Designer_Scale_Slider=Scale_Slider FR-Designer_Scale_Grade=Scale_Grade FR-Designer_Add_Event=Add Event FR-Designer_Not_Support_Authority_Edit=this element does not support authority edit +FR-Designer_Remove_Item=Remove Item 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 0e6bbf7f31..7fada9bf15 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 @@ -2109,3 +2109,4 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Insert_Formula= FR-Designer_Not_Support_Authority_Edit=\u3053\u306E\u8981\u7D20\u306F\u6A29\u9650\u5236\u5FA1\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093 +FR-Designer_Remove_Item= 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 d27bb8fd44..4e100cdae3 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 @@ -2109,3 +2109,4 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Add_Event= FR-Designer_Not_Support_Authority_Edit=\uD574\uB2F9\uC694\uC18C\uB294\uAD8C\uD55C\uCEE8\uD2B8\uB864\uC744\uC9C0\uC6D0\uD558\uC9C0\uC54A\uC2B5\uB2C8\uB2E4. +FR-Designer_Remove_Item= 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 8f128d45ab..1116ff64ac 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 @@ -467,9 +467,9 @@ FR-Designer_AllCategories=\u6240\u6709\u5206\u7C7B FR-Designer_SimpleDetail_Report=\u7B80\u5355\u660E\u7EC6\u8868 FR-Designer_SimpleCross_Report=\u7B80\u5355\u4EA4\u53C9\u8868 FR-Designer_DoubleLayer_Report=\u53CC\u5C42\u8868\u5934 -FR-Designer_Download_Template=\u4E0B\u8F7D\u7EC4\u4EF6 -FR-Designer_Install_Template=\u5B89\u88C5\u7EC4\u4EF6 -FR-Designer_Delete_Template=\u5220\u9664\u7EC4\u4EF6 +FR-Designer_Download_Template=\u4E0B\u8F7D +FR-Designer_Install_Template=\u5B89\u88C5 +FR-Designer_Delete_Template=\u5220\u9664 FR-Designer_Mobile-ToolBar=\u5DE5\u5177\u680F FR-Designer_Mobile-Refresh=\u5237\u65B0 FR-Designer_WLayout-Absolute-ToolTips=\u81EA\u7531\u5F0F\u5E03\u5C40\uFF0C\u53EF\u4EE5\u5728\u5E03\u5C40\u5185\u4EFB\u610F\u4F4D\u7F6E\u6DFB\u52A0\u63A7\u4EF6 @@ -2112,3 +2112,4 @@ FR-Designer_Scale_Up=\u653E\u5927 FR-Designer_Scale_Slider=\u7F29\u653E\u6ED1\u5757 FR-Designer_Scale_Grade=\u7F29\u653E\u7EA7\u522B\uFF0C\u5355\u51FB\u540E\u8C03\u8282\u663E\u793A\u6BD4\u4F8B\u3002 FR-Designer_Not_Support_Authority_Edit=\u8BE5\u5143\u7D20\u4E0D\u652F\u6301\u6743\u9650\u63A7\u5236 +FR-Designer_Remove_Item=\u5220\u9664\u9009\u4E2D 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 d525837958..c544325802 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 @@ -2109,3 +2109,4 @@ FR-Designer_Use_Params_Template= FR-Designer_Label_Name= FR-Designer_Add_Event= FR-Designer_Not_Support_Authority_Edit=\u8A72\u5143\u7D20\u4E0D\u652F\u63F4\u8A31\u53EF\u6B0A\u63A7\u5236 +FR-Designer_Remove_Item= \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index c33e1b113b..43c3cf4e05 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -4,11 +4,13 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; +import com.fr.design.icon.IconPathConstants; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.ShareLoader; @@ -40,7 +42,7 @@ import java.net.URISyntaxException; */ public class FormWidgetDetailPane extends FormDockView{ - private UITabbedPane tabbedPane; + private JPanel tabbedPane; private UIScrollPane downPane; private JPanel reuWidgetPanel; private UIComboBox comboBox; @@ -50,11 +52,16 @@ public class FormWidgetDetailPane extends FormDockView{ private JPanel editPanel; private JPanel resetPanel; private JPanel menutPanel; + private JPanel menutPanelNorthPane; private static final int OFFSET_X = 140; private static final int OFFSET_Y = 26; private SwingWorker sw; //组件面板是否可以编辑 private boolean isEdit; + private CardLayout card; + + private static final String REPORT_TAB = Inter.getLocText("FR-Engine_Report"); + private static final String CHART_TAB = Inter.getLocText("FR-Designer-Form-ToolBar_Chart"); public static FormWidgetDetailPane getInstance() { if (HOLDER.singleton == null) { @@ -115,12 +122,21 @@ public class FormWidgetDetailPane extends FormDockView{ } initReuWidgetPanel(); initMenuPanel(); - tabbedPane = new UITabbedPane(); - tabbedPane.setOpaque(true); - tabbedPane.setBorder(null); - tabbedPane.setTabPlacement(SwingConstants.BOTTOM); - tabbedPane.addTab(Inter.getLocText("FR-Engine_Report"), reuWidgetPanel); - tabbedPane.addTab(Inter.getLocText("FR-Designer-Form-ToolBar_Chart"), new JPanel()); + + card = new CardLayout(); + tabbedPane = new JPanel(); + tabbedPane.setLayout(card); + tabbedPane.add(REPORT_TAB, reuWidgetPanel); + tabbedPane.add(CHART_TAB, new JPanel()); + UIHeadGroup tabsHeaderIconPane = new UIHeadGroup(new String[] {REPORT_TAB, CHART_TAB}) { + @Override + public void tabChanged(int index) { + card.show(tabbedPane, labelButtonList.get(index).getText()); + } + }; + tabsHeaderIconPane.setNeedLeftRightOutLine(false); + + add(tabsHeaderIconPane, BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); } @@ -140,17 +156,20 @@ public class FormWidgetDetailPane extends FormDockView{ private void initMenuPanel() { menutPanel = new JPanel(); menutPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3)); - menutPanel.setPreferredSize(new Dimension(240, 48)); - menutPanel.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), + menutPanel.setBorder(BorderFactory.createEmptyBorder(3, 10, 10, 15)); +// menutPanel.setPreferredSize(new Dimension(240, 48)); + + menutPanelNorthPane = new JPanel(new BorderLayout()); + menutPanelNorthPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"), SwingConstants.HORIZONTAL), BorderLayout.WEST); + menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); + menutPanelNorthPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); - menutPanel.add(initEditButtonPane(), BorderLayout.EAST); - menutPanel.add(new JPanel(), BorderLayout.CENTER); + menutPanel.add(menutPanelNorthPane, BorderLayout.NORTH); comboBox = new UIComboBox(getFormCategories()); - comboBox.setPreferredSize(new Dimension(240, 30)); + comboBox.setPreferredSize(new Dimension(240, comboBox.getPreferredSize().height)); initComboBoxSelectedListener(); - menutPanel.add(comboBox, BorderLayout.SOUTH); + menutPanel.add(comboBox, BorderLayout.CENTER); reuWidgetPanel.add(menutPanel, BorderLayout.NORTH); } @@ -159,10 +178,13 @@ public class FormWidgetDetailPane extends FormDockView{ * 创建菜单栏按钮面板 */ private JPanel initEditButtonPane() { - editPanel = new JPanel(); - editPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - editPanel.add(createRefreshButton(), BorderLayout.WEST); - editPanel.add(createDownloadButton(), BorderLayout.EAST); + editPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); + + editPanel.add(createRefreshButton()); + editPanel.add(createDownloadButton()); + editPanel.add(createInstallButton()); + editPanel.add(createDeleteButton()); + return editPanel; } @@ -185,8 +207,38 @@ public class FormWidgetDetailPane extends FormDockView{ reuWidgetPanel.remove(deleteButton); } }); + + deleteButton = new UIButton(Inter.getLocText("FR-Designer_Remove_Item")); + deleteButton.set4ToolbarButton(); + deleteButton.setOpaque(true); + deleteButton.setBackground(Color.red); + deleteButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (ShareLoader.getLoader().removeModulesFromList()) { + refreshShareMoudule(); + reuWidgetPanel.remove(deleteButton); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); + refreshDownPanel(false); + replaceButtonPanel(false); + refreshComboxData(); + } else { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); + } + + } + }); + JPanel deletePane = new JPanel(new BorderLayout()); + deletePane.add(deleteButton, BorderLayout.CENTER); + deletePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); + resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); resetPanel.add(resetButton, BorderLayout.CENTER); + resetPanel.add(deletePane, BorderLayout.WEST); + + refreshDownPanel(true); + return resetPanel; } @@ -210,35 +262,46 @@ public class FormWidgetDetailPane extends FormDockView{ }); } + /** + * 创建工具条按钮 + */ + private UIButton createToolButton(Icon icon, String toolTip, ActionListener actionListener) { + UIButton toolButton = new UIButton(); + toolButton.setIcon(icon); + toolButton.setToolTipText(toolTip); + toolButton.set4ToolbarButton(); + toolButton.addActionListener(actionListener); + return toolButton; + + } + /** * 创建刷新按钮 */ private UIButton createRefreshButton() { - UIButton refreshButton = new UIButton(); - refreshButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/refresh.png")); - refreshButton.setToolTipText(Inter.getLocText("FR-Designer_Refresh")); - refreshButton.set4ToolbarButton(); - refreshButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (sw != null) { - sw.cancel(true); - } - sw = new SwingWorker() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/refresh.png"), + Inter.getLocText("FR-Designer_Refresh"), + new ActionListener() { @Override - protected Object doInBackground() throws Exception { - ShareLoader.getLoader().refreshModule(); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - refreshComboxData(); - refreshDownPanel(false); - return null; + public void actionPerformed(ActionEvent e) { + if (sw != null) { + sw.cancel(true); + } + sw = new SwingWorker() { + @Override + protected Object doInBackground() throws Exception { + ShareLoader.getLoader().refreshModule(); + elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); + refreshComboxData(); + refreshDownPanel(false); + return null; + } + }; + sw.execute(); } - }; - sw.execute(); - } - }); - return refreshButton; - + } + ); } private void refreshComboxData() { @@ -251,30 +314,10 @@ public class FormWidgetDetailPane extends FormDockView{ */ private UIButton createDownloadButton() { UIButton downloadButton = new UIButton(); - downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png")); + downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); downloadButton.set4ToolbarButton(); downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template")); downloadButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - initPopMenu(); - } - }); - return downloadButton; - } - - /** - * 初始化下拉面板 - */ - private void initPopMenu() { - UIPopupMenu menu = new UIPopupMenu(); - UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download icon.png")); - UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Install_Template"), BaseUtils.readIcon("/com/fr/design/form/images/install icon.png")); - UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Delete_Template"), BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png")); - menu.add(downloadItem); - menu.add(installItem); - menu.add(deleteItem); - downloadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String url = SiteCenter.getInstance().acquireUrlByKind("reuse.url"); @@ -295,68 +338,58 @@ public class FormWidgetDetailPane extends FormDockView{ } } }); - installItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); - int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select")); - if (returnValue == JFileChooser.APPROVE_OPTION) { - final File chosenFile = fileChooser.getSelectedFile(); - installFromDiskZipFile(chosenFile); - } - } - }); - deleteItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - replaceButtonPanel(true); - deleteFromDiskZipFile(); - } - }); - GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y); + return downloadButton; } - private void deleteFromDiskZipFile() { - deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove")); - deleteButton.setBackground(Color.red); - deleteButton.repaint(); - deleteButton.setPreferredSize(new Dimension(240, 40)); - reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH); - deleteButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (ShareLoader.getLoader().removeModulesFromList()) { - refreshShareMoudule(); - reuWidgetPanel.remove(deleteButton); - elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful")); - refreshDownPanel(false); - replaceButtonPanel(false); - refreshComboxData(); - } else { - JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed")); + /** + * 创建安装模板的按钮 + */ + private UIButton createInstallButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/install icon.png"), + Inter.getLocText("FR-Designer_Install_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter(".reu", "reu")); + int returnValue = fileChooser.showDialog(new UILabel(), Inter.getLocText("FR-Designer_Select")); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + } + } } + ); + } - } - }); - refreshDownPanel(true); - + /** + * 创建删除模板的按钮 + */ + private UIButton createDeleteButton() { + return createToolButton( + BaseUtils.readIcon("/com/fr/design/form/images/delete icon.png"), + Inter.getLocText("FR-Designer_Delete_Template"), + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + replaceButtonPanel(true); + } + } + ); } private void replaceButtonPanel(boolean isEdit) { this.isEdit = isEdit; if (isEdit) { - menutPanel.remove(editPanel); - menutPanel.add(initResetButtonPane(), BorderLayout.EAST); + menutPanelNorthPane.remove(editPanel); + menutPanelNorthPane.add(initResetButtonPane(), BorderLayout.EAST); } else { - menutPanel.remove(resetPanel); - menutPanel.add(initEditButtonPane(), BorderLayout.EAST); + menutPanelNorthPane.remove(resetPanel); + menutPanelNorthPane.add(initEditButtonPane(), BorderLayout.EAST); ShareLoader.getLoader().resetRemovedModuleList(); } - - } private void installFromDiskZipFile(File chosenFile) { @@ -393,8 +426,6 @@ public class FormWidgetDetailPane extends FormDockView{ return ArrayUtils.addAll(new String[] {Inter.getLocText("FR-Designer_AllCategories")}, ShareLoader.getLoader().getModuleCategory()); } - - public void refreshDownPanel(boolean isEdit) { reuWidgetPanel.remove(downPane); downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit)); @@ -409,12 +440,6 @@ public class FormWidgetDetailPane extends FormDockView{ revalidate(); } - - public void setSelectedIndex(int index){ - tabbedPane.setSelectedIndex(index); - } - - /** * 清除数据 */