|
|
|
@ -32,16 +32,16 @@ import java.beans.IntrospectionException;
|
|
|
|
|
import java.beans.PropertyDescriptor; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ |
|
|
|
|
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider { |
|
|
|
|
private UILabel imageLable; |
|
|
|
|
private FormDesigner designer; |
|
|
|
|
private static BufferedImage DEFAULT_BACKGROUND; |
|
|
|
|
private boolean isHovering = false; |
|
|
|
|
|
|
|
|
|
static{ |
|
|
|
|
try{ |
|
|
|
|
static { |
|
|
|
|
try { |
|
|
|
|
DEFAULT_BACKGROUND = BaseUtils.readImageWithCache("com/fr/base/images/report/elementcase.png"); |
|
|
|
|
}catch (Throwable e) { |
|
|
|
|
} catch (Throwable e) { |
|
|
|
|
//IBM jdk 1.5.0_22 并发下读取图片有时会异常(EOFException), 这个图片反正只有设计器用到, 捕获住
|
|
|
|
|
DEFAULT_BACKGROUND = CoreGraphHelper.createBufferedImage(0, 0); |
|
|
|
|
} |
|
|
|
@ -110,7 +110,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CRPropertyDescriptor[] getExtraTableEditor(){ |
|
|
|
|
public CRPropertyDescriptor[] getExtraTableEditor() { |
|
|
|
|
CRPropertyDescriptor[] extraTableEditor = resolveCompatible(); |
|
|
|
|
CRPropertyDescriptor reportFitEditor = getReportFitEditor(); |
|
|
|
|
if (reportFitEditor == null) { |
|
|
|
@ -134,7 +134,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
editor.setReportFitAttr(null); |
|
|
|
|
} |
|
|
|
|
ReportFitAttr reportFit = editor.getReportFitAttr(); |
|
|
|
|
if(fitAttr != null){ |
|
|
|
|
if (fitAttr != null) { |
|
|
|
|
reportFit = fitAttr.fitInBrowser() ? editor.getReportFitAttr() : fitAttr; |
|
|
|
|
} |
|
|
|
|
ReportFitAttr reportFitAttr = editor.getReportFitAttr() == null ? fitAttr : reportFit; |
|
|
|
@ -200,7 +200,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
/** |
|
|
|
|
* 从data中获取到图片背景, 并设置到Label上 |
|
|
|
|
*/ |
|
|
|
|
private UILabel initImageBackground(){ |
|
|
|
|
private UILabel initImageBackground() { |
|
|
|
|
UILabel imageLable = new UILabel(); |
|
|
|
|
BufferedImage image = toData().getECImage(); |
|
|
|
|
if (image == null) { |
|
|
|
@ -214,7 +214,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
/** |
|
|
|
|
* 设置指定Label的背景 |
|
|
|
|
*/ |
|
|
|
|
private void setLabelBackground(Image image, UILabel imageLable){ |
|
|
|
|
private void setLabelBackground(Image image, UILabel imageLable) { |
|
|
|
|
ImageIcon icon = new ImageIcon(image); |
|
|
|
|
imageLable.setIcon(icon); |
|
|
|
|
imageLable.setOpaque(true); |
|
|
|
@ -223,7 +223,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void paintBorder(Graphics g, Rectangle bounds){ |
|
|
|
|
public void paintBorder(Graphics g, Rectangle bounds) { |
|
|
|
|
if (!isHovering) { |
|
|
|
|
super.paintBorder(g, bounds); |
|
|
|
|
} |
|
|
|
@ -250,7 +250,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
* 该组件是否可以拖入参数面板 |
|
|
|
|
* @return 是则返回true |
|
|
|
|
*/ |
|
|
|
|
public boolean canEnterIntoParaPane(){ |
|
|
|
|
public boolean canEnterIntoParaPane() { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -274,16 +274,27 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
toData().setElementCase(el); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void setBackground(BufferedImage image){ |
|
|
|
|
toData().setECImage(image); |
|
|
|
|
setEditorIcon(image); |
|
|
|
|
public void setBackground(BufferedImage image) { |
|
|
|
|
toData().getElementCaseImage().adjustImageBytes(image); |
|
|
|
|
setEditorIcon(toData().getECImage() == null ? DEFAULT_BACKGROUND : toData().getECImage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setEditorIcon(BufferedImage image){ |
|
|
|
|
public void updateECImage() { |
|
|
|
|
XElementCase self = this; |
|
|
|
|
self.toData().getElementCaseImage().updateImage(() -> { |
|
|
|
|
self.setEditorIcon(self.toData().getECImage() == null ? DEFAULT_BACKGROUND : self.toData().getECImage()); |
|
|
|
|
if (self.designer != null) { |
|
|
|
|
self.designer.repaint(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setEditorIcon(BufferedImage image) { |
|
|
|
|
setLabelBackground(image, imageLable); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Dimension getSize(){ |
|
|
|
|
public Dimension getSize() { |
|
|
|
|
return new Dimension(this.getWidth(), this.getHeight()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -292,21 +303,21 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
* @param editingMouseListener 事件处理器 |
|
|
|
|
* @param e 点击事件 |
|
|
|
|
*/ |
|
|
|
|
public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ |
|
|
|
|
public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e) { |
|
|
|
|
super.respondClick(editingMouseListener, e); |
|
|
|
|
editingMouseListener.refreshTopXCreator(); |
|
|
|
|
if (this.isShareConfigButtonFocus()) { |
|
|
|
|
CoverReportPane.showShareConfig(((XCreator)this.getParent()).toData()); |
|
|
|
|
CoverReportPane.showShareConfig(((XCreator) this.getParent()).toData()); |
|
|
|
|
} else { |
|
|
|
|
switchTab(e, editingMouseListener); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){ |
|
|
|
|
private void switchTab(MouseEvent e, EditingMouseListener editingMouseListener) { |
|
|
|
|
FormDesigner designer = editingMouseListener.getDesigner(); |
|
|
|
|
if (e.getButton() == MouseEvent.BUTTON1 && |
|
|
|
|
(e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)){ |
|
|
|
|
(e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR)) { |
|
|
|
|
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e); |
|
|
|
|
//切换设计器
|
|
|
|
|
designer.switchTab(component); |
|
|
|
@ -315,14 +326,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { |
|
|
|
|
return new WidgetPropertyUIProvider[]{ new ElementCasePropertyUI(this)}; |
|
|
|
|
return new WidgetPropertyUIProvider[]{new ElementCasePropertyUI(this)}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* data属性改变触发其他操作 |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
public void firePropertyChange(){ |
|
|
|
|
public void firePropertyChange() { |
|
|
|
|
initStyle(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -330,7 +341,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
|
|
|
|
|
* 是否支持设置可用 |
|
|
|
|
* return boolean |
|
|
|
|
*/ |
|
|
|
|
public boolean supportSetEnable(){ |
|
|
|
|
public boolean supportSetEnable() { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|