Browse Source

报表块共享,帮助信息显示,数据集合并到表单。以及内边距的一个bug改一下

master
zack 8 years ago
parent
commit
477854d2af
  1. 4
      designer_base/src/com/fr/design/data/BasicTableDataTreePane.java
  2. 20
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 2
      designer_base/src/com/fr/design/icon/IconPathConstants.java
  4. BIN
      designer_base/src/com/fr/design/images/control/help_close.png
  5. BIN
      designer_base/src/com/fr/design/images/control/help_open.png
  6. 21
      designer_form/src/com/fr/design/designer/creator/XCreator.java
  7. 1
      designer_form/src/com/fr/design/designer/creator/XCreatorUtils.java
  8. 14
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  9. 88
      designer_form/src/com/fr/design/mainframe/CoverReportPane.java
  10. 28
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java
  11. 73
      designer_form/src/com/fr/design/mainframe/ElementCaseHelpDialog.java
  12. 36
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

4
designer_base/src/com/fr/design/data/BasicTableDataTreePane.java

@ -3,6 +3,7 @@ package com.fr.design.data;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.data.TableDataSource;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
@ -423,4 +424,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH)); this.setSmallIcon(BaseUtils.readIcon(IconPathConstants.TD_CONNECTION_ICON_PATH));
} }
} }
public void addTableData(TableDataSource tableDataSource){
}
} }

20
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -39,6 +39,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
public class TableDataTreePane extends BasicTableDataTreePane { public class TableDataTreePane extends BasicTableDataTreePane {
@ -138,6 +139,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
populate(new TableDataSourceOP(tc)); populate(new TableDataSourceOP(tc));
this.checkButtonEnabled(); this.checkButtonEnabled();
} }
protected void initbuttonGroup() { protected void initbuttonGroup() {
Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/data/datasource.png"), BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")}; Icon[] iconArray = {BaseUtils.readIcon("/com/fr/design/images/data/datasource.png"), BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png")};
final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA}; final Integer[] modeArray = {TEMPLATE_TABLE_DATA, SERVER_TABLE_DATA};
@ -267,4 +269,22 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public TableDataTree getDataTree() { public TableDataTree getDataTree() {
return dataTree; return dataTree;
} }
public void addTableData(TableDataSource tableDataSource) {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
TableDataSource tds = tc.getBook();
Iterator tdIterator = tableDataSource.getTableDataNameIterator();
while (tdIterator.hasNext()) {
String tdName = (String) tdIterator.next();
TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null) {
tds.putTableData(tdName + "-fr-el", td);
} else {
tds.putTableData(tdName, td);
}
}
tc.fireTargetModified();
tc.parameterChanged();
dataTree.refresh();
}
} }

2
designer_base/src/com/fr/design/icon/IconPathConstants.java

@ -1 +1 @@
package com.fr.design.icon; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 6.5.6 * Date: 12-12-18 * Time: 上午9:42 * 用于保存所有图标路径的类 */ public class IconPathConstants { private IconPathConstants() { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/base/images/cell/control/remove.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH ="/com/fr/web/images/form/forbid.png"; } package com.fr.design.icon; /** * Created by IntelliJ IDEA. * Author : Richer * Version: 6.5.6 * Date: 12-12-18 * Time: 上午9:42 * 用于保存所有图标路径的类 */ public class IconPathConstants { private IconPathConstants() { } public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png"; public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png"; public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png"; public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png"; public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png"; public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png"; public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png"; public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png"; public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png"; public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png"; public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png"; public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png"; public static final String TD_REMOVE_ICON_PATH = "/com/fr/base/images/cell/control/remove.png"; public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png"; public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png"; public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png"; public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png"; public static final String FORBID_ICON_PATH ="/com/fr/web/images/form/forbid.png"; }

BIN
designer_base/src/com/fr/design/images/control/help_close.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

BIN
designer_base/src/com/fr/design/images/control/help_open.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 895 B

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

@ -12,6 +12,10 @@ import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.design.utils.gui.LayoutUtils; 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.Widget;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -590,4 +594,21 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo
* @param msg 帮助信息 * @param msg 帮助信息
*/ */
public void setSharedMsg(String msg){} public void setSharedMsg(String msg){}
/**
* 根据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());
}
}
}
} }

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

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

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

@ -35,7 +35,7 @@ import java.beans.PropertyDescriptor;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
private JPanel coverPanel; private CoverReportPane coverPanel;
private FormDesigner designer; private FormDesigner designer;
//缩略图 //缩略图
private BufferedImage thumbnailImage; private BufferedImage thumbnailImage;
@ -182,8 +182,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
*/ */
public void displayCoverPane(boolean display){ public void displayCoverPane(boolean display){
coverPanel.setVisible(display); coverPanel.setVisible(display);
coverPanel.setPreferredSize(editor.getPreferredSize()); coverPanel.setBounds(1, 1, (int) editor.getBounds().getWidth(), (int) editor.getBounds().getHeight());
coverPanel.setBounds(editor.getBounds());
editor.repaint(); editor.repaint();
} }
@ -263,8 +262,12 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
*/ */
public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){
super.respondClick(editingMouseListener, e); super.respondClick(editingMouseListener, e);
if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e);
}else {
switchTab(e,editingMouseListener); switchTab(e,editingMouseListener);
} }
}
private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){ private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){
@ -280,4 +283,9 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new ElementCasePropertyUI(this)}; return new WidgetPropertyUIProvider[]{ new ElementCasePropertyUI(this)};
} }
@Override
public void setSharedMsg(String msg) {
coverPanel.setHelpMsg(msg);
}
} }

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

@ -1,12 +1,19 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; 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.general.FRScreen;
import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.MouseEvent;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -17,15 +24,34 @@ import java.awt.*;
public class CoverReportPane extends JPanel { public class CoverReportPane extends JPanel {
private UIButton editButton; private UIButton editButton;
private Icon controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
private JComponent controlButton = new JComponent() {
protected void paintComponent(Graphics g) {
g.setColor(UIConstants.NORMAL_BACKGROUND);
g.fillArc(0, 0, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW, ShareConstants.SHARE_EL_CONTROL_BUTTON_HW,
0, 360);
controlMode.paintIcon(this, g, 0, 0);
}
};
private String helpMsg;//帮助信息(后续帮助信息可能会变成标配,就直接放这边了)
private ElementCaseHelpDialog helpDialog = null;
private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F); private AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 60 / 100.0F);
public CoverReportPane() { public CoverReportPane() {
setLayout(coverLayout); this(StringUtils.EMPTY);
}
public CoverReportPane(String helpMsg) {
this.helpMsg = helpMsg;
setLayout(getCoverLayout());
setBackground(null); setBackground(null);
setOpaque(false); setOpaque(false);
editButton = new UIButton(Inter.getLocText("Edit"), BaseUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)){ editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon(IconPathConstants.TD_EDIT_ICON_PATH)) {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(60, 24); return new Dimension(60, 24);
@ -35,10 +61,51 @@ public class CoverReportPane extends JPanel{
editButton.setExtraPainted(false); editButton.setExtraPainted(false);
editButton.setBackground(new Color(176, 196, 222)); editButton.setBackground(new Color(176, 196, 222));
add(editButton); add(editButton);
add(controlButton);
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() {
return helpMsg;
} }
private LayoutManager coverLayout = new LayoutManager() { public void setHelpMsg(String helpMsg) {
this.helpMsg = helpMsg;
}
public void setMsgDisplay(MouseEvent e) {
if (helpDialog == null) {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
controlButton.repaint();
helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg);
double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue();
int offsetX = 0;
if (screenValue < FormArea.DEFAULT_SLIDER) {
offsetX = (int) ((1 - screenValue / FormArea.DEFAULT_SLIDER)
* WidgetPropertyPane.getInstance().getEditingFormDesigner().getRootComponent().getWidth() / 2);
}
int rX = WestRegionContainerPane.getInstance().getWidth() + e.getX() + offsetX - 227;//弹出框宽度190加上图标的宽度27加上10的偏移
int rY = 165 + e.getY();//165是设计器最上面几个面板的高度
helpDialog.setLocationRelativeTo(DesignerContext.getDesignerFrame(), rX, rY);
helpDialog.showWindow();
} else {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint();
helpDialog.dispose();
helpDialog = null;
}
}
protected LayoutManager getCoverLayout() {
return new LayoutManager() {
@Override @Override
public void removeLayoutComponent(Component comp) { public void removeLayoutComponent(Component comp) {
@ -61,12 +128,15 @@ public class CoverReportPane extends JPanel{
int preferWidth = editButton.getPreferredSize().width; int preferWidth = editButton.getPreferredSize().width;
int preferHeight = editButton.getPreferredSize().height; int preferHeight = editButton.getPreferredSize().height;
editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight); editButton.setBounds((width - preferWidth) / 2, (height - preferHeight) / 2, preferWidth, preferHeight);
controlButton.setBounds((width - 28), 0, 27, 27);
} }
@Override @Override
public void addLayoutComponent(String name, Component comp) { public void addLayoutComponent(String name, Component comp) {
} }
}; };
}
public void paint(Graphics g) { public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
@ -77,4 +147,14 @@ public class CoverReportPane extends JPanel{
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
super.paint(g); super.paint(g);
} }
public void destroyHelpDialog() {
if (helpDialog != null) {
controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_HELP_ICON_PATH);
controlButton.repaint();
helpDialog.dispose();
helpDialog = null;
}
}
} }

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

@ -1,14 +1,5 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.beans.location.MoveUtils; import com.fr.design.beans.location.MoveUtils;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
@ -29,6 +20,11 @@ import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
import java.awt.*;
import java.awt.event.MouseEvent;
/** /**
* 普通模式下的鼠标点击位置处理器 * 普通模式下的鼠标点击位置处理器
*/ */
@ -292,14 +288,24 @@ public class EditingMouseListener extends MouseInputAdapter {
if (component.isReport()) { if (component.isReport()) {
xElementCase = (XElementCase)component; xElementCase = (XElementCase)component;
UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0); UIButton button = (UIButton)xElementCase.getCoverPane().getComponent(0);
JComponent button1= (JComponent) xElementCase.getCoverPane().getComponent(1);
if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) { if(designer.getCursor().getType() ==Cursor.HAND_CURSOR) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} // component.getParent() 是报表块所在的XWTitleLayout } // component.getParent() 是报表块所在的XWTitleLayout
int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); int minX = button.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue();
int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue();
int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); int minY = button.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue();
if(e.getX() + GAP > minX && e.getX() - GAP < minX + button.getWidth()){ int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue();
if( e.getY() + GAP > minY && e.getY() - GAP < minY + button.getHeight()){ if (e.getX() + GAP - xElementCase.getInsets().left > minX && e.getX() - GAP - xElementCase.getInsets().left < minX + button.getWidth()) {
if (e.getY() + GAP - xElementCase.getInsets().top > minY && e.getY() - GAP - xElementCase.getInsets().top < minY + button.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
}
xElementCase.setHelpBtnOnFocus(false);
if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) {
if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
xElementCase.setHelpBtnOnFocus(true);
} }
} }
xElementCase.displayCoverPane(true); xElementCase.displayCoverPane(true);

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

@ -0,0 +1,73 @@
package com.fr.design.mainframe;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.itextarea.UITextArea;
import javax.swing.*;
import java.awt.*;
/**
* @author zack
* @date 2016-10-14
* @since 8.0
*/
public class ElementCaseHelpDialog extends UIDialog {
private static final int OUTER_WIDTH = 190;
private static final int OUTER_HEIGHT = 120;
private String helpMsg;
private UIScrollPane helpArea;
public ElementCaseHelpDialog(Frame parent, String helpMsg) {
super(parent);
this.helpMsg = helpMsg;
setUndecorated(true);
initHelpArea();
JPanel panel = (JPanel) getContentPane();
initComponents(panel);
setSize(new Dimension(OUTER_WIDTH, OUTER_HEIGHT));
}
private void initHelpArea() {
UITextArea textArea = new UITextArea(helpMsg);
textArea.setEditable(false);
textArea.setBorder(null);
helpArea = new UIScrollPane(textArea);
helpArea.setBounds(0, 0, 190, 120);
helpArea.setBorder(null);
}
private void initComponents(JPanel contentPane) {
contentPane.setLayout(new BorderLayout());
add(helpArea, BorderLayout.CENTER);
}
/**
* 打开帮助框
*/
public void showWindow() {
setVisible(true);
this.setResizable(false);
}
/**
*
*/
@Override
public void checkValid() throws Exception {
}
public void setLocationRelativeTo(JFrame c, int x, int y) {
int dx = 0, dy = 0;
Point compLocation = c.getLocationOnScreen();//获取设计器Jframe坐标作为相对位置原点
setLocation(dx + x, dy + y);
dx = compLocation.x;
dy = compLocation.y + c.getRootPane().getY();//加上底层容器的y坐标(其实就是设计器最上方图标栏的高度)
setLocation(dx + x, dy + y);
}
}

36
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -1,20 +1,8 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.JWindow;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.DesignModelAdapter;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.HoverPainter;
import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.Painter;
@ -25,10 +13,19 @@ import com.fr.design.form.util.XCreatorConstants;
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.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.form.share.ShareLoader;
import com.fr.form.ui.SharableElementCaseEditor;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
/** /**
* 添加模式下鼠标事件处理器 * 添加模式下鼠标事件处理器
*/ */
@ -85,6 +82,12 @@ public class FormCreatorDropTarget extends DropTarget {
//SetSelection时要确保选中的是最顶层的布局 //SetSelection时要确保选中的是最顶层的布局
//tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout //tab布局添加的时候是初始化了XWCardLayout,实际上最顶层的布局是XWCardMainBorderLayout
XCreator addingXCreator = addingModel.getXCreator(); XCreator addingXCreator = addingModel.getXCreator();
if (addingXCreator.isShared()) {
SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(addingXCreator.getShareId());
if (sharableEditor != null) {
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(sharableEditor.getTableDataSource());
}
}
Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();
designer.getSelectionModel().setSelectedCreators( designer.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget}));
@ -204,6 +207,7 @@ public class FormCreatorDropTarget extends DropTarget {
/** /**
* 拖拽进入 * 拖拽进入
*
* @param dtde 事件 * @param dtde 事件
*/ */
public void dragEnter(DropTargetDragEvent dtde) { public void dragEnter(DropTargetDragEvent dtde) {
@ -213,6 +217,7 @@ public class FormCreatorDropTarget extends DropTarget {
/** /**
* 拖拽移动经过 * 拖拽移动经过
*
* @param dtde 事件 * @param dtde 事件
*/ */
public void dragOver(DropTargetDragEvent dtde) { public void dragOver(DropTargetDragEvent dtde) {
@ -222,6 +227,7 @@ public class FormCreatorDropTarget extends DropTarget {
/** /**
* 拖拽事件 * 拖拽事件
*
* @param dtde 事件 * @param dtde 事件
*/ */
public void dropActionChanged(DropTargetDragEvent dtde) { public void dropActionChanged(DropTargetDragEvent dtde) {
@ -229,6 +235,7 @@ public class FormCreatorDropTarget extends DropTarget {
/** /**
* 拖拽离开 * 拖拽离开
*
* @param dte 事件 * @param dte 事件
*/ */
public void dragExit(DropTargetEvent dte) { public void dragExit(DropTargetEvent dte) {
@ -237,6 +244,7 @@ public class FormCreatorDropTarget extends DropTarget {
/** /**
* 拖拽释放 * 拖拽释放
*
* @param dtde 事件 * @param dtde 事件
*/ */
public void drop(DropTargetDropEvent dtde) { public void drop(DropTargetDropEvent dtde) {

Loading…
Cancel
Save