From 2fc18dc59f04b13f2529e06aa79685efc6402ea2 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 26 Oct 2016 23:52:03 +0800 Subject: [PATCH] rt --- .../mainframe/FormWidgetDetailPane.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java index ef3a1e708e..7fa96cb4b2 100644 --- a/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java @@ -5,11 +5,13 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.io.File; import java.util.*; import java.util.List; import javax.swing.*; import javax.swing.border.LineBorder; +import javax.swing.filechooser.FileNameExtensionFilter; import com.fr.base.BaseUtils; import com.fr.design.actions.file.WebPreviewUtils; @@ -167,7 +169,13 @@ public class FormWidgetDetailPane extends FormDockView{ public void actionPerformed(ActionEvent e) { UIPopupMenu menu = new UIPopupMenu(); UIMenuItem downloadItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem installItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + UIMenuItem deleteItem = new UIMenuItem(Inter.getLocText("FR-Designer_Download_Template"), BaseUtils.readIcon("/com/fr/design/form/images/download.png")); + menu.add(downloadItem); + menu.add(installItem); + menu.add(deleteItem); + downloadItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -177,12 +185,36 @@ public class FormWidgetDetailPane extends FormDockView{ dlg.setVisible(true); } }); + installItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setFileFilter(new FileNameExtensionFilter("zip", "zip")); + int returnValue = fileChooser.showDialog(new JLabel(), "选择"); + if (returnValue == JFileChooser.APPROVE_OPTION) { + final File chosenFile = fileChooser.getSelectedFile(); + installFromDiskZipFile(chosenFile); + + } + } + }); + + deleteItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + + } + }); GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, tabbedPane.getY() + OFFSET_Y); } }); } + private void installFromDiskZipFile(File chosenFile) { + } + /** * 获取报表块组件分类 */