Browse Source

显示帮助信息改一下方案,通过widget增加description属性实现

master
zack 8 years ago
parent
commit
76856c4e5f
  1. 22
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  2. 2
      designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
  3. 2
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  4. 11
      designer_form/src/com/fr/design/mainframe/JForm.java
  5. 11
      designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java

22
designer_form/src/com/fr/design/designer/creator/XCreator.java

@ -12,10 +12,6 @@ import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.AbstractFormSharableEditor;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.FormSharableEditor;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.stable.StableUtils;
@ -590,24 +586,18 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
}
/**
* 设置共享帮助信息
* 设置描述信息
* @param msg 帮助信息
*/
public void setSharedMsg(String msg){}
public void setXDescrption(String msg){}
/**
* 根据widget设置Xcreator共享信息
* 根据widget设置Xcreator描述信息
* @param widget
*/
public void setShareMsgByWidget(Widget widget){
if (widget != null && (widget instanceof FormSharableEditor)) {
String shareId = ((AbstractFormSharableEditor) widget).getShareId();
ElCaseBindInfo info = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (info != null) {
setSharedMsg(info.getGuideInfo());
}
public void setXDescrption(Widget widget){
if (widget != null) {
setXDescrption(widget.getDescription());
}
}

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

@ -157,7 +157,7 @@ public class XCreatorUtils {
FRContext.getLogger().error("Error to create xcreator!");
creator = new NullCreator(widget, d);
}
creator.setShareMsgByWidget(widget);//设置共享信息
creator.setXDescrption(widget);//设置描述信息
return creator;
}

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

@ -285,7 +285,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
}
@Override
public void setSharedMsg(String msg) {
public void setXDescrption(String msg) {
coverPanel.setHelpMsg(msg);
}
}

11
designer_form/src/com/fr/design/mainframe/JForm.java

@ -36,6 +36,8 @@ import com.fr.file.FILE;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.main.Form;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.WLayout;
@ -51,6 +53,7 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@ -622,7 +625,13 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
} else {
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
//pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
ArrayList<ElCaseBindInfo> elCaseBindInfos = new ArrayList<>();
for (ElCaseBindInfo info :
ShareLoader.getLoader().getAllBindInfos().values()) {
elCaseBindInfos.add(info);
}
pane.add(new ShareWidgetPane(elCaseBindInfos.toArray(new ElCaseBindInfo[elCaseBindInfos.size()])), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane);
}
}

11
designer_form/src/com/fr/design/mainframe/ShareWidgetButton.java

@ -6,9 +6,7 @@ import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.AbstractFormSharableEditor;
import com.fr.form.ui.ElCaseBindInfo;
import com.fr.form.ui.FormSharableEditor;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
@ -120,7 +118,6 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
Object source = e.getSource();
Widget creatorSource = null;
String shareId = StringUtils.EMPTY;
String helpMsg = StringUtils.EMPTY;
if (source instanceof ShareWidgetButton) {
ShareWidgetButton no = (ShareWidgetButton) e.getSource();
if (no == null) {
@ -128,15 +125,10 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
}
shareId = no.getBindInfo().getId();
creatorSource = ShareLoader.getLoader().getElCaseEditorById(shareId);
ElCaseBindInfo info = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (info != null) {
helpMsg = info.getGuideInfo();
}
}
if (creatorSource != null) {
XCreator xCreator = XCreatorUtils.createXCreator(creatorSource);
xCreator.setShareId(shareId);
xCreator.setSharedMsg(helpMsg);
WidgetToolBarPane.getTarget().startDraggingBean(xCreator);
lastPressEvent = null;
this.setBorder(null);
@ -160,9 +152,6 @@ public class ShareWidgetButton extends JPanel implements MouseListener, MouseMot
ShareWidgetButton shareWidgetButton = (ShareWidgetButton) dge.getComponent();
if (shareWidgetButton != null) {
Widget widget = ShareLoader.getLoader().getElCaseEditorById(shareWidgetButton.getBindInfo().getId());
if (widget instanceof FormSharableEditor) {
((AbstractFormSharableEditor) widget).setShareId(shareWidgetButton.getBindInfo().getId());
}
DragAndDropTransferable dragAndDropTransferable = new DragAndDropTransferable(widget);
dge.startDrag(DragSource.DefaultCopyDrop, dragAndDropTransferable, this);
}

Loading…
Cancel
Save