Browse Source

无JIRA任务 组件共享的帮助信息改变交互

master
zack 8 years ago
parent
commit
7a0e32b917
  1. 7
      designer_base/src/com/fr/design/mainframe/HelpDialogManager.java
  2. 2
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  3. 42
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  4. 10
      designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java

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

@ -35,11 +35,4 @@ public class HelpDialogManager {
} }
return THIS; return THIS;
} }
public void destroyDialog() {
if (handler != null) {
handler.destroyHelpDialog();
}
handler = null;
}
} }

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

@ -282,11 +282,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* @param e 点击事件 * @param e 点击事件
*/ */
public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){
HelpDialogManager.getInstance().setPane(coverPanel);
super.respondClick(editingMouseListener, e); super.respondClick(editingMouseListener, e);
if (this.isHelpBtnOnFocus()) { if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e); coverPanel.setMsgDisplay(e);
} else { } else {
coverPanel.destroyHelpDialog();
switchTab(e, editingMouseListener); switchTab(e, editingMouseListener);
} }
} }

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

@ -1,8 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.form.share.ShareConstants; import com.fr.form.share.ShareConstants;
@ -13,6 +11,8 @@ import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
/** /**
* 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧 * 报表块的封面如果后面所有的组件都有帮助信息的话就抽接口吧
@ -43,18 +43,6 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
public CoverReportPane(String helpMsg) { public CoverReportPane(String helpMsg) {
super(); super();
this.helpMsg = helpMsg; this.helpMsg = helpMsg;
add(controlButton);
// if (WidgetPropertyPane.getInstance().getEditingFormDesigner() != null) {
// WidgetPropertyPane.getInstance().getEditingFormDesigner().addDesignerEditListener(new DesignerEditListener() {
// @Override
// public void fireCreatorModified(DesignerEvent evt) {
// if (evt.getCreatorEventID() == (DesignerEvent.CREATOR_DELETED)
// || evt.getCreatorEventID() == (DesignerEvent.CREATOR_RESIZED)) {
// destroyHelpDialog();
// }
// }
// });
// }
} }
public String getHelpMsg() { public String getHelpMsg() {
@ -63,12 +51,16 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
public void setHelpMsg(String helpMsg) { public void setHelpMsg(String helpMsg) {
this.helpMsg = helpMsg; this.helpMsg = helpMsg;
//帮助信息为空就不显示帮助按钮
if (StringUtils.isNotEmpty(helpMsg)) {
add(controlButton);
}
} }
public void setMsgDisplay(MouseEvent e) { public void setMsgDisplay(MouseEvent e) {
if (helpDialog == null) { if (helpDialog == null) {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
controlButton.repaint(); controlButton.setVisible(false);
helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg);
double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue();
int offsetX = 0; int offsetX = 0;
@ -80,12 +72,14 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
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); helpDialog.addWindowListener(new WindowAdapter() {
} else { @Override
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH); public void windowClosed(WindowEvent e) {
controlButton.repaint();
helpDialog.dispose();
helpDialog = null; helpDialog = null;
controlButton.setVisible(true);
}
});
HelpDialogManager.getInstance().setPane(this);
} }
} }
@ -135,8 +129,8 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
@Override @Override
public void setVisible(boolean aFlag) { public void setVisible(boolean aFlag) {
super.setVisible(aFlag); super.setVisible(aFlag);
if (aFlag) { // if (aFlag) {
HelpDialogManager.getInstance().setPane(this); // HelpDialogManager.getInstance().setPane(this);
} // }
} }
} }

10
designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.gui.itextarea.UITextArea;
import com.fr.general.Inter;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -15,7 +16,7 @@ import java.awt.*;
public class ElementCaseHelpDialog extends UIDialog { public class ElementCaseHelpDialog extends UIDialog {
private static final int OUTER_WIDTH = 190; private static final int OUTER_WIDTH = 190;
private static final int OUTER_HEIGHT = 120; private static final int OUTER_HEIGHT = 280;
private String helpMsg; private String helpMsg;
@ -25,7 +26,6 @@ public class ElementCaseHelpDialog extends UIDialog {
public ElementCaseHelpDialog(Frame parent, String helpMsg) { public ElementCaseHelpDialog(Frame parent, String helpMsg) {
super(parent); super(parent);
this.helpMsg = helpMsg; this.helpMsg = helpMsg;
setUndecorated(true);
initHelpArea(); initHelpArea();
JPanel panel = (JPanel) getContentPane(); JPanel panel = (JPanel) getContentPane();
initComponents(panel); initComponents(panel);
@ -37,21 +37,23 @@ public class ElementCaseHelpDialog extends UIDialog {
textArea.setEditable(false); textArea.setEditable(false);
textArea.setBorder(null); textArea.setBorder(null);
helpArea = new UIScrollPane(textArea); helpArea = new UIScrollPane(textArea);
helpArea.setBounds(0, 0, 190, 120); helpArea.setBounds(0, 0, 190, 280);
helpArea.setBorder(null); helpArea.setBorder(null);
} }
private void initComponents(JPanel contentPane) { private void initComponents(JPanel contentPane) {
contentPane.setLayout(new BorderLayout()); contentPane.setLayout(new BorderLayout());
add(helpArea, BorderLayout.CENTER); add(helpArea, BorderLayout.CENTER);
this.applyClosingAction();
this.setTitle(Inter.getLocText("FR-Designer_Help"));
} }
/** /**
* 打开帮助框 * 打开帮助框
*/ */
public void showWindow() { public void showWindow() {
setVisible(true);
this.setResizable(false); this.setResizable(false);
setVisible(true);
} }
/** /**

Loading…
Cancel
Save