Browse Source

Merge pull request #448 in BA/design from ~ZACK/design:dev to dev

* commit '5ed311f92a8b4ad89d8ebb1dce4abae4db864b4b':
  无JIRA任务 组件共享异步加载组件
  无JIRA任务  严格限制dialog的交互之后ctrl z撤销之前必须先关闭帮助弹框,这边就直接删掉了
  无JIRA任务  组件共享的一些交互改进和验收的bug修改
master
superman 8 years ago
parent
commit
8f7bb328bf
  1. 13
      designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java
  2. 44
      designer_base/src/com/fr/design/mainframe/HelpDialogManager.java
  3. 7
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  4. 13
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  5. 97
      designer_form/src/com/fr/design/mainframe/CoverPane.java
  6. 52
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  7. 15
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  8. 58
      designer_form/src/com/fr/design/mainframe/FormWidgetDetailPane.java

13
designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java

@ -0,0 +1,13 @@
package com.fr.design.mainframe;
/**
* Coder: zack
* Date: 2016/11/3
* Time: 10:43
*/
public interface HelpDialogHandler {
/**
* 销毁
*/
void destroyHelpDialog();
}

44
designer_base/src/com/fr/design/mainframe/HelpDialogManager.java

@ -0,0 +1,44 @@
package com.fr.design.mainframe;
/**
* 帮助信息的面板由于需要滚动条所以采用了很挫的dialog做dialog很多情况下不能主动关闭这边控制一下
* Coder: zack
* Date: 2016/11/2
* Time: 16:34
*/
public class HelpDialogManager {
private static HelpDialogManager THIS;
private HelpDialogHandler handler;
private HelpDialogManager() {
}
public HelpDialogHandler getPane() {
return handler;
}
public void setPane(HelpDialogHandler dialog) {
if (dialog == this.handler) {
return;
}
//只允许一个dialog存在
if (this.handler != null) {
handler.destroyHelpDialog();
}
this.handler = dialog;
}
public static HelpDialogManager getInstance() {
if (THIS == null) {
THIS = new HelpDialogManager();
}
return THIS;
}
public void destroyDialog() {
if (handler != null) {
handler.destroyHelpDialog();
}
}
}

7
designer_form/src/com/fr/design/designer/creator/XChartEditor.java

@ -2,26 +2,21 @@ package com.fr.design.designer.creator;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import javax.swing.*; import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null); editor.setLayout(null);
editor.setOpaque(false); editor.setOpaque(false);
coverPanel = new CoverReportPane(); coverPanel = new CoverPane();
coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setPreferredSize(this.getPreferredSize());
coverPanel.setBounds(this.getBounds()); coverPanel.setBounds(this.getBounds());

13
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -9,10 +9,7 @@ import com.fr.design.fun.FormElementCaseEditorProvider;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
@ -201,6 +198,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
editor.repaint(); editor.repaint();
} }
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){ public JComponent getCoverPane(){
return coverPanel; return coverPanel;
} }
@ -280,6 +284,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (this.isHelpBtnOnFocus()) { if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e); coverPanel.setMsgDisplay(e);
}else { }else {
coverPanel.destroyHelpDialog();
switchTab(e,editingMouseListener); switchTab(e,editingMouseListener);
} }
} }

97
designer_form/src/com/fr/design/mainframe/CoverPane.java

@ -0,0 +1,97 @@
package com.fr.design.mainframe;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created with IntelliJ IDEA.
* User: zx
* Date: 14-7-24
* Time: 上午9:09
*/
public class CoverPane extends JPanel {
private UIButton editButton;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverPane() {
setLayout(getCoverLayout());
setBackground(null);
setOpaque(false);
editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(60, 24);
}
};
editButton.setBorderPainted(false);
editButton.setExtraPainted(false);
editButton.setBackground(new Color(176, 196, 222));
add(editButton);
}
public AlphaComposite getComposite() {
return composite;
}
public void setComposite(AlphaComposite composite) {
this.composite = composite;
}
public UIButton getEditButton() {
return editButton;
}
public void setEditButton(UIButton editButton) {
this.editButton = editButton;
}
protected LayoutManager getCoverLayout() {
return new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return parent.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return null;
}
@Override
public void layoutContainer(Container parent) {
int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight();
int preferWidth = editButton.getPreferredSize().width;
int preferHeight = editButton.getPreferredSize().height;
editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight);
}
@Override
public void addLayoutComponent(String name, Component comp) {
}
};
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(composite);
g2d.setColor(Color.white);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g);
}
}

52
designer_form/src/com/fr/design/mainframe/CoverReportPane.java

@ -8,7 +8,6 @@ import com.fr.design.icon.IconPathConstants;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -16,15 +15,13 @@ import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
/** /**
* Created with IntelliJ IDEA. * 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧
* User: zx * Coder: zack
* Date: 14-7-24 * Date: 2016/11/2
* Time: 上午9:09 * Time: 11:32
*/ */
public class CoverReportPane extends JPanel { public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private UIButton editButton;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
private JComponent controlButton = new JComponent() { private JComponent controlButton = new JComponent() {
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND); g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel {
private ElementCaseHelpDialog helpDialog = null; private ElementCaseHelpDialog helpDialog = null;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverReportPane() { public CoverReportPane() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
} }
public CoverReportPane(String helpMsg) { public CoverReportPane(String helpMsg) {
super();
this.helpMsg = helpMsg; this.helpMsg = helpMsg;
setLayout(getCoverLayout());
setBackground(null);
setOpaque(false);
editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(60, 24);
}
};
editButton.setBorderPainted(false);
editButton.setExtraPainted(false);
editButton.setBackground(new Color(176, 196, 222));
add(editButton);
add(controlButton); add(controlButton);
if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) { if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) {
WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() { WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() {
@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel {
int rY = 165 + e.getY();//165是设计器最上面几个面板的高度 int rY = 165 + e.getY();//165是设计器最上面几个面板的高度
helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY); helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
helpDialog.showWindow(); helpDialog.showWindow();
HelpDialogManager.getInstance().setPane(this);
} else { } else {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint(); controlButton.repaint();
@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel {
@Override @Override
public void layoutContainer(Container parent) { public void layoutContainer(Container parent) {
UIButton editButton = getEditButton();
int width = parent.getParent().getWidth(); int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight(); int height = parent.getParent().getHeight();
int preferWidth = editButton.getPreferredSize().width; int preferWidth = editButton.getPreferredSize().width;
@ -139,17 +123,6 @@ public class CoverReportPane extends JPanel {
}; };
} }
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(composite);
g2d.setColor(Color.white);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.setComposite(oldComposite);
super.paint(g);
}
public void destroyHelpDialog() { public void destroyHelpDialog() {
if (helpDialog != null) { if (helpDialog != null) {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
@ -159,4 +132,11 @@ public class CoverReportPane extends JPanel {
} }
} }
@Override
public void setVisible(boolean aFlag) {
super.setVisible(aFlag);
if (aFlag) {
HelpDialogManager.getInstance().setPane(this);
}
}
} }

15
designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -256,7 +256,7 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
XCreator component = designer.getComponentAt(e); XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay(); setCoverPaneNotDisplay(e, false);
if(processTopLayoutMouseMove(component, e)){ if(processTopLayoutMouseMove(component, e)){
return; return;
@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.repaint(); designer.repaint();
} }
private void setCoverPaneNotDisplay(){ private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) {
if (xElementCase != null) { if (xElementCase != null) {
int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue();
int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue();
Rectangle rect = new Rectangle(x, y, xElementCase.getWidth(), xElementCase.getHeight());
if (rect.contains(e.getPoint())) {
return;
}
if(isLinkedHelpDialog){
xElementCase.destroyHelpDialog();
}
xElementCase.displayCoverPane(false); xElementCase.displayCoverPane(false);
} }
if (xChartEditor != null){ if (xChartEditor != null){
@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getDefaultCursor()); designer.setCursor(Cursor.getDefaultCursor());
} }
setCoverPaneNotDisplay(); setCoverPaneNotDisplay(e, true);
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }

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

@ -1,47 +1,35 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.*;
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.io.IOException;
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.base.BaseUtils;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.PluginWebBridge; import com.fr.design.extra.PluginWebBridge;
import com.fr.design.extra.ShopDialog; import com.fr.design.extra.ShopDialog;
import com.fr.design.extra.WebManagerPaneFactory; import com.fr.design.extra.WebManagerPaneFactory;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIPreviewButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.itoolbar.UILargeToolbar;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
import com.fr.form.share.ShareLoader; import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo; import com.fr.form.ui.ElCaseBindInfo;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.*;
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.io.IOException;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
* User: zx * User: zx
@ -60,6 +48,7 @@ public class FormWidgetDetailPane extends FormDockView{
private UIButton deleteButton; private UIButton deleteButton;
private static final int OFFSET_X = 140; private static final int OFFSET_X = 140;
private static final int OFFSET_Y = 26; private static final int OFFSET_Y = 26;
private SwingWorker sw;
public static FormWidgetDetailPane getInstance() { public static FormWidgetDetailPane getInstance() {
if (HOLDER.singleton == null) { if (HOLDER.singleton == null) {
@ -105,7 +94,19 @@ public class FormWidgetDetailPane extends FormDockView{
reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); reuWidgetPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
reuWidgetPanel.setBorder(null); reuWidgetPanel.setBorder(null);
if (elCaseBindInfoList == null) { if (elCaseBindInfoList == null) {
elCaseBindInfoList = new ElCaseBindInfo[0];
if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList(); elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false);
return null;
}
};
sw.execute();
} }
initReuWidgetPanel(); initReuWidgetPanel();
createRefreshButton(); createRefreshButton();
@ -178,8 +179,19 @@ public class FormWidgetDetailPane extends FormDockView{
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
refreshShareMoudule(); if (sw != null) {
sw.cancel(true);
}
sw = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
ShareLoader.getLoader().refreshModule();
elCaseBindInfoList = ShareLoader.getLoader().getAllBindInfoList();
refreshDownPanel(false); refreshDownPanel(false);
return null;
}
};
sw.execute();
} }
}); });

Loading…
Cancel
Save