Browse Source

无JIRA任务 组件共享的一些交互改进和验收的bug修改

master
zack 8 years ago
parent
commit
9af3093423
  1. 13
      designer_base/src/com/fr/design/mainframe/HelpDialogHandler.java
  2. 44
      designer_base/src/com/fr/design/mainframe/HelpDialogManager.java
  3. 1
      designer_base/src/com/fr/design/mainframe/UndoStateEdit.java
  4. 7
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  5. 13
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  6. 97
      designer_form/src/com/fr/design/mainframe/CoverPane.java
  7. 54
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  8. 17
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.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();
}
}
}

1
designer_base/src/com/fr/design/mainframe/UndoStateEdit.java

@ -50,6 +50,7 @@ public class UndoStateEdit extends AbstractUndoableEdit {
}
}
if (this.old != null) {
HelpDialogManager.getInstance().destroyDialog();
this.old.applyState();
}
if (BaseUtils.isAuthorityEditing()) {

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.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChart;
import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.module.DesignModuleFactory;
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.Widget;
import com.fr.design.form.util.XCreatorConstants;
@ -237,7 +232,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null);
editor.setOpaque(false);
coverPanel = new CoverReportPane();
coverPanel = new CoverPane();
coverPanel.setPreferredSize(this.getPreferredSize());
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.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.CoverReportPane;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
@ -201,6 +198,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
editor.repaint();
}
/**
* 销毁帮助提示框
*/
public void destroyHelpDialog(){
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){
return coverPanel;
}
@ -280,6 +284,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e);
}else {
coverPanel.destroyHelpDialog();
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);
}
}

54
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.general.FRScreen;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -16,15 +15,13 @@ import java.awt.*;
import java.awt.event.MouseEvent;
/**
* Created with IntelliJ IDEA.
* User: zx
* Date: 14-7-24
* Time: 上午9:09
* 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧
* Coder: zack
* Date: 2016/11/2
* Time: 11:32
*/
public class CoverReportPane extends JPanel {
private UIButton editButton;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
private JComponent controlButton = new JComponent() {
protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
@ -39,28 +36,13 @@ public class CoverReportPane extends JPanel {
private ElementCaseHelpDialog helpDialog = null;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverReportPane() {
this(StringUtils.EMPTY);
}
public CoverReportPane(String helpMsg) {
super();
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);
if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) {
WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() {
@ -98,6 +80,7 @@ public class CoverReportPane extends JPanel {
int rY = 165 + e.getY();//165是设计器最上面几个面板的高度
helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
helpDialog.showWindow();
HelpDialogManager.getInstance().setPane(this);
} else {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint();
@ -125,6 +108,7 @@ public class CoverReportPane extends JPanel {
@Override
public void layoutContainer(Container parent) {
UIButton editButton = getEditButton();
int width = parent.getParent().getWidth();
int height = parent.getParent().getHeight();
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() {
if (helpDialog != null) {
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);
}
}
}

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

@ -256,7 +256,7 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseMoved(MouseEvent e) {
XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay();
setCoverPaneNotDisplay(e, false);
if(processTopLayoutMouseMove(component, e)){
return;
@ -320,8 +320,17 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.repaint();
}
private void setCoverPaneNotDisplay(){
if (xElementCase != null){
private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) {
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);
}
if (xChartEditor != null){
@ -525,7 +534,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getDefaultCursor());
}
setCoverPaneNotDisplay();
setCoverPaneNotDisplay(e, true);
cancelPromptWidgetForbidEnter();
}

Loading…
Cancel
Save