Browse Source

组件复用传dev

master
xiaoxia 8 years ago
parent
commit
f069d1eaae
  1. 3
      designer/src/com/fr/design/parameter/ParameterDefinitePane.java
  2. 2
      designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java
  3. 77
      designer_base/src/com/fr/env/RemoteEnv.java
  4. 44
      designer_form/src/com/fr/design/mainframe/ComponentTree.java
  5. 206
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java
  6. 3
      designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java
  7. 3
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  8. 21
      designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java
  9. 9
      designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

3
designer/src/com/fr/design/parameter/ParameterDefinitePane.java

@ -20,9 +20,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.AuthorityToolBarPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import com.fr.design.menu.*;
import com.fr.design.module.DesignModuleFactory;
@ -246,7 +244,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
isdelayItem.setSelected(reportParameterAttr.isDelayPlaying());
isshowWindowItem.setSelected(reportParameterAttr.isShowWindow());
isEditing = true;
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height);
ParameterBridge bridge = paraDesignEditor.getParaComponent();
if (parameterUI != null) {
bridge.setDelayDisplayContent(reportParameterAttr.isDelayPlaying());

2
designer_base/src/com/fr/design/extra/WebManagerPaneFactory.java

@ -26,7 +26,7 @@ public class WebManagerPaneFactory {
}
public BasicPane createPluginPane() {
if (StableUtils.getMajorJavaVersion() == 8) {
if (StableUtils.getMajorJavaVersion() != 8) {
return new ShopManagerPane(new ShopPaneConfig() {
@Override
String getMainJS() {

77
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -31,6 +31,10 @@ import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginLoader;
<<<<<<< HEAD
import com.fr.share.ShareConstants;
=======
>>>>>>> 86c666e44132d7f8fa1727a6d78965b2423ce510
import com.fr.stable.*;
import com.fr.stable.file.XMLFileManagerProvider;
import com.fr.stable.project.ProjectConstants;
@ -1535,6 +1539,7 @@ public class RemoteEnv implements Env {
para.put("op", "fr_remote_design");
para.put("cmd", "design_save_resource");
para.put("resource", mgr.fileName());
para.put("class_name", mgr.getClass().getName());
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
@ -2107,7 +2112,11 @@ public class RemoteEnv implements Env {
@Override
public File[] loadREUFile() throws Exception {
File target = new File(CacheManager.getProviderInstance().getCacheDirectory(),
<<<<<<< HEAD
ShareConstants.DIR_SHARE_CACHE);
=======
"fr_share");
>>>>>>> 86c666e44132d7f8fa1727a6d78965b2423ce510
StableUtils.deleteFile(target);
StableUtils.mkdirs(target);
File cacheDir = null;
@ -2122,7 +2131,11 @@ public class RemoteEnv implements Env {
HttpClient client = createHttpMethod(para);
InputStream input = client.getResponseStream();
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip");
<<<<<<< HEAD
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE);
=======
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "fr_share");
>>>>>>> 86c666e44132d7f8fa1727a6d78965b2423ce510
StableUtils.deleteFile(cacheDir);
StableUtils.mkdirs(cacheDir);
StableUtils.makesureFileExist(zip);
@ -2146,4 +2159,68 @@ public class RemoteEnv implements Env {
}
return new File[0];
}
<<<<<<< HEAD
@Override
public boolean installREUFile(File reuFile) {
// if (reuFile == null) {
// return false;
// }
// try {
// HashMap<String, String> para = new HashMap<String, String>();
// para.put("op", "fr_remote_design");
// para.put("cmd", "design_install_reufile");
// para.put("current_uid", this.createUserID());
// para.put("currentUsername", this.getUser());
// para.put("reuFileName", reuFile.getName());
//
// HttpClient client = createHttpMethod(para);
// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile)));
// InputStream input = execute4InputStream(client);
// return ComparatorUtils.equals(stream2String(input), "true");
// } catch (Exception e) {
// return false;
// }
return false;
}
@Override
public boolean removeREUFilesByName(String fileName) {
if (StringUtils.isEmpty(fileName)) {
return true;
}
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_remove_reufile");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
para.put("reuFileName", fileName);
HttpClient client = createHttpMethod(para);
InputStream input = execute4InputStream(client);
return ComparatorUtils.equals(stream2String(input), "true");
} catch (Exception e) {
return false;
}
}
@Override
public String getSharePath() {
try {
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_get_share_path");
para.put("current_uid", this.createUserID());
para.put("currentUsername", this.getUser());
HttpClient client = createHttpMethod(para);
InputStream input = execute4InputStream(client);
return stream2String(input);
} catch (Exception e) {
return StringUtils.EMPTY;
}
}
=======
>>>>>>> 86c666e44132d7f8fa1727a6d78965b2423ce510
}

44
designer_form/src/com/fr/design/mainframe/ComponentTree.java

@ -37,30 +37,6 @@ public class ComponentTree extends JTree {
this.setTransferHandler(new TreeTransferHandler());
this.refreshTreeRoot();
addTreeSelectionListener(designer);
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (e.isPopupTrigger()) {
popupMenu(e);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) {
popupMenu(e);
}
}
@Override
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
popupMenu(e);
}
}
});
setEditable(true);
}
@ -121,20 +97,6 @@ public class ComponentTree extends JTree {
scrollPathToVisible(treepath);
}
private void popupMenu(MouseEvent e) {
TreePath path = this.getSelectionPath();
if (path == null) {
return;
}
Component component = (Component) path.getLastPathComponent();
if (!(component instanceof XCreator)) {
return;
}
ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, (XCreator) component);
JPopupMenu menu = adapter.getContextPopupMenu(e);
menu.show(this, e.getX(), e.getY());
}
/**
* 刷新
*/
@ -241,12 +203,14 @@ public class ComponentTree extends JTree {
creator.notShowInComponentTree(path);
}
//绝对布局作为body的时候不显示自适应布局父层
if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class)
&& (parent.getParent() != null)
if (((XCreator) parent).acceptType(XWAbsoluteBodyLayout.class)) {
if ((parent.getParent() != null)
&& ((XCreator)parent.getParent()).acceptType(XWFitLayout.class)){
parent = parent.getParent().getParent();
continue;
}
}
parent = parent.getParent();
}
Object[] components = path.toArray();

206
designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

@ -11,12 +11,13 @@ import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.FRLogger;
import com.fr.general.Inter;
import com.fr.general.SiteCenter;
import com.fr.share.ShareConstants;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -40,16 +41,20 @@ import java.net.URISyntaxException;
public class FormWidgetDetailPane extends FormDockView{
private UITabbedPane tabbedPane;
private UIScrollPane downPanel;
private UIScrollPane downPane;
private JPanel reuWidgetPanel;
private UIComboBox comboBox;
private ElCaseBindInfo[] elCaseBindInfoList;
private UIButton downloadButton;
private UIButton refreshButton;
private UIButton deleteButton;
private UIButton resetButton;
private JPanel editPanel;
private JPanel resetPanel;
private JPanel menutPanel;
private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26;
private SwingWorker sw;
//组件面板是否可以编辑
private boolean isEdit;
public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) {
@ -109,8 +114,6 @@ public class FormWidgetDetailPane extends FormDockView{
sw.execute();
}
initReuWidgetPanel();
createRefreshButton();
createDownloadButton();
initMenuPanel();
tabbedPane = new UITabbedPane();
tabbedPane.setOpaque(true);
@ -126,38 +129,74 @@ public class FormWidgetDetailPane extends FormDockView{
* 初始化组件共享和复用面板
*/
private void initReuWidgetPanel() {
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false));
reuWidgetPanel.add(downPanel);
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, false));
reuWidgetPanel.add(downPane);
}
/**
* 初始化菜单栏面板
*/
private void initMenuPanel() {
JPanel menutPane = new JPanel();
menutPane.setLayout(FRGUIPaneFactory.createBorderLayout());
menutPane.setBorder(BorderFactory.createEmptyBorder(3, 8, 3, 3));
menutPane.setPreferredSize(new Dimension(240, 48));
menutPane.add(new UILabel(Inter.getLocText("FR-Designer_LocalWidget"),
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"),
SwingConstants.HORIZONTAL), BorderLayout.WEST);
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
buttonPanel.add(refreshButton, BorderLayout.WEST);
buttonPanel.add(downloadButton, BorderLayout.EAST);
menutPane.add(buttonPanel, BorderLayout.EAST);
menutPane.add(new JPanel(), BorderLayout.CENTER);
menutPanel.add(initEditButtonPane(), BorderLayout.EAST);
menutPanel.add(new JPanel(), BorderLayout.CENTER);
comboBox = new UIComboBox(getFormCategories());
comboBox.setPreferredSize(new Dimension(240, 30));
initComboBoxSelectedListener();
menutPane.add(comboBox, BorderLayout.SOUTH);
reuWidgetPanel.add(menutPane, BorderLayout.NORTH);
menutPanel.add(comboBox, BorderLayout.SOUTH);
reuWidgetPanel.add(menutPanel, BorderLayout.NORTH);
}
/**
* 创建菜单栏按钮面板
*/
private JPanel initEditButtonPane() {
editPanel = new JPanel();
editPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
editPanel.add(createRefreshButton(), BorderLayout.WEST);
editPanel.add(createDownloadButton(), BorderLayout.EAST);
return editPanel;
}
/**
* 创建取消删除面板
*/
private JPanel initResetButtonPane() {
resetPanel = new JPanel();
resetButton = new UIButton(Inter.getLocText("FR-Designer_Reset"));
resetPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
resetButton.set4ToolbarButton();
resetButton.setOpaque(true);
resetButton.setBackground(new Color(184, 220, 242));
resetButton.setForeground(Color.WHITE);
resetButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
refreshDownPanel(false);
replaceButtonPanel(false);
reuWidgetPanel.remove(deleteButton);
}
});
resetPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
resetPanel.add(resetButton, BorderLayout.CENTER);
return resetPanel;
}
private void initComboBoxSelectedListener() {
comboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
ShareLoader.getLoader().resetRemovedModuleList();
int filterIndex = comboBox.getSelectedIndex();
if (filterIndex == 0) {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
@ -165,14 +204,17 @@ public class FormWidgetDetailPane extends FormDockView{
String filterName = comboBox.getSelectedItem().toString();
elCaseBindInfoList = ShareLoader.getLoader().getFilterBindInfoList(filterName);
}
refreshDownPanel(false);
refreshDownPanel(isEdit);
}
});
}
private void createRefreshButton() {
refreshButton = new UIButton();
/**
* 创建刷新按钮
*/
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();
@ -187,6 +229,7 @@ public class FormWidgetDetailPane extends FormDockView{
protected Object doInBackground() throws Exception {
ShareLoader.getLoader().refreshModule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshComboxData();
refreshDownPanel(false);
return null;
}
@ -194,20 +237,33 @@ public class FormWidgetDetailPane extends FormDockView{
sw.execute();
}
});
return refreshButton;
}
private void refreshComboxData() {
comboBox.setSelectedIndex(0);
comboBox.setModel(new DefaultComboBoxModel(getFormCategories()));
}
/**
* 创建下载模板的按钮
*/
private void createDownloadButton() {
downloadButton = new UIButton();
private UIButton createDownloadButton() {
UIButton downloadButton = new UIButton();
downloadButton.setIcon(BaseUtils.readIcon("/com/fr/design/form/images/showmenu.png"));
downloadButton.set4ToolbarButton();
downloadButton.setToolTipText(Inter.getLocText("FR-Designer_Download_Template"));
downloadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
<<<<<<< HEAD
initPopMenu();
}
});
return downloadButton;
}
=======
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"));
@ -263,15 +319,67 @@ public class FormWidgetDetailPane extends FormDockView{
});
GUICoreUtils.showPopupMenu(menu, tabbedPane, tabbedPane.getX() + OFFSET_X, OFFSET_Y);
>>>>>>> 86c666e44132d7f8fa1727a6d78965b2423ce510
/**
* 初始化下拉面板
*/
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");
if (StringUtils.isEmpty(url)) {
FRContext.getLogger().info("The URL is empty!");
return;
}
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException exp) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer_Set_default_browser"));
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (URISyntaxException exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
} catch (Exception exp) {
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp);
FRContext.getLogger().error("Can not open the browser for URL: " + url);
}
}
});
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);
}
private void deleteFromDiskZipFile() {
deleteButton = new UIButton(Inter.getLocText("FR-Designer-CommitTab_Remove"));
deleteButton.setOpaque(true);
deleteButton.setBackground(Color.red);
deleteButton.repaint();
deleteButton.setPreferredSize(new Dimension(240, 40));
reuWidgetPanel.add(deleteButton, BorderLayout.SOUTH);
deleteButton.addActionListener(new ActionListener() {
@ -283,10 +391,10 @@ public class FormWidgetDetailPane extends FormDockView{
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Successful"));
refreshDownPanel(false);
replaceButtonPanel(false);
refreshComboxData();
} else {
reuWidgetPanel.remove(deleteButton);
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Removed_Failed"));
refreshDownPanel(false);
}
}
@ -295,6 +403,17 @@ public class FormWidgetDetailPane extends FormDockView{
}
<<<<<<< HEAD
private void replaceButtonPanel(boolean isEdit) {
this.isEdit = isEdit;
if (isEdit) {
menutPanel.remove(editPanel);
menutPanel.add(initResetButtonPane(), BorderLayout.EAST);
} else {
menutPanel.remove(resetPanel);
menutPanel.add(initEditButtonPane(), BorderLayout.EAST);
ShareLoader.getLoader().resetRemovedModuleList();
=======
private void installFromDiskZipFile(File chosenFile) {
try {
ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile);
@ -305,8 +424,29 @@ public class FormWidgetDetailPane extends FormDockView{
} catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error"));
FRLogger.getLogger().error(e.getMessage(), e);
>>>>>>> 86c666e44132d7f8fa1727a6d78965b2423ce510
}
}
private void installFromDiskZipFile(File chosenFile) {
if (chosenFile != null && chosenFile.getName().endsWith(ShareConstants.SUFFIX_MODULE)) {
try {
if (ShareLoader.getLoader().installModuleFromDiskZipFile(chosenFile)) {
refreshShareMoudule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false);
refreshComboxData();
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_OK"));
} else {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error"));
}
} catch (IOException e) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Share_Module_Error"));
FRLogger.getLogger().error(e.getMessage(), e);
}
}
}
private void refreshShareMoudule() {
@ -321,15 +461,15 @@ public class FormWidgetDetailPane extends FormDockView{
* 获取报表块组件分类
*/
public String[] getFormCategories() {
return ShareConstants.WIDGET_CATEGORIES;
return ArrayUtils.addAll(new String[] {Inter.getLocText("FR-Designer_AllCategories")}, ShareLoader.getLoader().getModuleCategory());
}
public void refreshDownPanel(boolean isEdit) {
reuWidgetPanel.remove(downPanel);
downPanel = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit));
reuWidgetPanel.add(downPanel);
reuWidgetPanel.remove(downPane);
downPane = new UIScrollPane(new ShareWidgetPane(elCaseBindInfoList, isEdit));
reuWidgetPanel.add(downPane);
repaintContainer();
}

3
designer_form/src/com/fr/design/mainframe/ShareWidgetPane.java

@ -1,8 +1,8 @@
package com.fr.design.mainframe;
import com.fr.form.ui.ElCaseBindInfo;
import javax.swing.*;
import java.awt.*;
@ -25,5 +25,4 @@ public class ShareWidgetPane extends JPanel {
this.setPreferredSize(new Dimension(240, rowCount * 80));
}
}
}

3
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -38,7 +38,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
private EventPropertyTable eventTable;
private List<AbstractPropertyTable> widgetPropertyTables;
private FormDesigner designer;
private ComponentTree componentTree;
private JPanel wsp;
private MobileWidgetTable mobileWidgetTable;
private MobileBodyWidgetTable mobileBodyWidgetTable;
@ -122,8 +121,6 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
clearDockingView();
return;
}
componentTree = new ComponentTree(designer);
widgetPropertyTables = new ArrayList<AbstractPropertyTable>();
propertyTable = new WidgetPropertyTable(designer);
designer.addDesignerEditListener(new WidgetPropertyDesignerAdapter(propertyTable));

21
designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java

@ -15,6 +15,7 @@ import com.fr.design.designer.beans.*;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.mainframe.ComponentTree;
import com.sun.java.swing.plaf.motif.*;
import com.sun.java.swing.plaf.windows.*;
@ -116,7 +117,6 @@ public class UITreeComboBox extends JComboBox{
JLabel lb = (JLabel)r.getTreeCellRendererComponent(
tree, value, isSelected, false, false, index,
cellHasFocus);
return lb;
}
return super.getListCellRendererComponent(list, value, index,
@ -129,7 +129,7 @@ public class UITreeComboBox extends JComboBox{
@Override
public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED || evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
TreePath[] paths = tree.getSelectedTreePath();
if (tree != null && paths.length > 0) {
tree.setAndScrollSelectionPath(paths[0]);
@ -137,6 +137,18 @@ public class UITreeComboBox extends JComboBox{
MenuSelectionManager.defaultManager().clearSelectedPath();
}
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED) {
tree.refreshUI();
TreePath[] paths = tree.getSelectedTreePath();
if (tree != null && paths.length > 0) {
tree.setAndScrollSelectionPath(paths[0]);
setSelectedItem(paths[0]);
MenuSelectionManager.defaultManager().clearSelectedPath();
}
} else if (evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED) {
tree.refreshUI();
setSelectedItem(null);
MenuSelectionManager.defaultManager().clearSelectedPath();
} else {
tree.refreshUI();
repaint();
@ -192,13 +204,12 @@ class TreePopup extends JPopupMenu implements ComboPopup{
public TreePopup(JComboBox comboBox){
this.comboBox = (UITreeComboBox)comboBox;
setBorder(BorderFactory.createLineBorder(Color.black));
setLayout(new BorderLayout());
setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());
JTree tree = this.comboBox.getTree();
if(tree != null){
scrollPane = new JScrollPane(tree);
scrollPane.setBorder(null);
scrollPane = new UIScrollPane(tree);
scrollPane.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 0));
add(scrollPane, BorderLayout.CENTER);
}
}

9
designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

@ -33,6 +33,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
private static final int GAP_H = 4;
private static final int GAP_V = 6;
private static final int GAP_BV = 4;
private static final int BUTTON_HEIGHT = 20;
private static final int WIDTH = 225;
private static final int L_H = 18;
@ -48,12 +49,12 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
return new Dimension(super.getPreferredSize().width, 18);
}
};
label.setText(Inter.getLocText("Following_parameters_are_not_generated")+":");
label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":");
label.setHorizontalAlignment(SwingConstants.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
this.add(label);
addAll = new UIButton(Inter.getLocText("Add-all"));
addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all"));
this.add(addAll);
}
@ -132,7 +133,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
layoutContainer(parent);
int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (20 + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height);
int h= ((parameterSelectedLabellist.size() == 0) ? L_H : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height);
return new Dimension(w, h);
}
@ -160,7 +161,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
x += (dim.width + GAP_H);
}
addAll.setBounds(0, y + GAP_V+ 20, width, addAll.getPreferredSize().height);
addAll.setBounds(0, y + GAP_V + BUTTON_HEIGHT, width, addAll.getPreferredSize().height);
}
}

Loading…
Cancel
Save