Browse Source

Merge pull request #816 in BA/design from ~ZACK/design:release to release

* commit 'c247eeac6a60cd0468fb78e451fe307a2feaef50':
  无JIRA任务  屏蔽新翻页
master
superman 8 years ago
parent
commit
789f00bbb6
  1. 160
      designer_form/src/com/fr/design/designer/creator/XElementCase.java

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

@ -10,9 +10,11 @@ import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider; import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarEditor; import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.form.FormElementCaseContainerProvider; import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider; import com.fr.form.FormElementCaseProvider;
import com.fr.form.FormProvider; import com.fr.form.FormProvider;
@ -34,8 +36,8 @@ import java.beans.PropertyDescriptor;
import java.util.Set; import java.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
private CoverReportPane coverPanel; private CoverReportPane coverPanel;
private FormDesigner designer; private FormDesigner designer;
//缩略图 //缩略图
private BufferedImage thumbnailImage; private BufferedImage thumbnailImage;
@ -64,30 +66,23 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
/** /**
* 是否支持设置标题 * 是否支持设置标题
* @return 是返回true * @return 是返回true
*/ */
public boolean hasTitleStyle() { public boolean hasTitleStyle() {
return true; return true;
} }
/** /**
* 返回组件属性值 * 返回组件属性值
* @return 返回组件属性值 * @return 返回组件属性值
* @throws IntrospectionException 异常 * @throws IntrospectionException 异常
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{ CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{
new CRPropertyDescriptor("widgetName", this.data.getClass()) new CRPropertyDescriptor("widgetName", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Widget_Name")), .setI18NName(Inter.getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("visible", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Widget-Visible")).setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
makeVisible(toData().isVisible());}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setI18NName( WLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
@ -97,12 +92,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public void propertyChange() { public void propertyChange() {
initStyle(); initStyle();
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Layout_Padding")) .setI18NName(Inter.getLocText("FR-Layout_Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("ToolBars", this.data.getClass()).setEditorClass(ElementCaseToolBarEditor.class) new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
@ -149,30 +143,30 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return "text_field_16.png"; return "text_field_16.png";
} }
/** /**
* 返回组件默认名 * 返回组件默认名
* @return 组件类名(小写) * @return 组件类名(小写)
*/ */
public String createDefaultName() { public String createDefaultName() {
return "report"; return "report";
} }
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
if (editor == null) { if (editor == null) {
setBorder(DEFALUTBORDER); setBorder(DEFALUTBORDER);
editor = new JPanel(); editor = new JPanel();
editor.setBackground(null); editor.setBackground(null);
editor.setLayout(null); editor.setLayout(null);
imageLable = initImageBackground(); imageLable = initImageBackground();
coverPanel = new CoverReportPane(); coverPanel = new CoverReportPane();
coverPanel.setPreferredSize(imageLable.getPreferredSize()); coverPanel.setPreferredSize(imageLable.getPreferredSize());
coverPanel.setBounds(imageLable.getBounds()); coverPanel.setBounds(imageLable.getBounds());
editor.add(coverPanel); editor.add(coverPanel);
coverPanel.setVisible(false); coverPanel.setVisible(false);
editor.add(imageLable); editor.add(imageLable);
} }
return editor; return editor;
} }
@ -185,7 +179,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
BufferedImage image = getThumbnailImage(); BufferedImage image = getThumbnailImage();
setLabelBackground(image, imageLable); setLabelBackground(image, imageLable);
return imageLable; return imageLable;
} }
/** /**
@ -194,16 +188,16 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
private void setLabelBackground(Image image, UILabel imageLable){ private void setLabelBackground(Image image, UILabel imageLable){
ImageIcon icon = new ImageIcon(image); ImageIcon icon = new ImageIcon(image);
imageLable.setIcon(icon); imageLable.setIcon(icon);
imageLable.setOpaque(true); imageLable.setOpaque(true);
imageLable.setLayout(null); imageLable.setLayout(null);
imageLable.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight()); imageLable.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());
} }
/** /**
* 是否展现覆盖的pane * 是否展现覆盖的pane
* @param display 是否 * @param display 是否
*/ */
public void displayCoverPane(boolean display){ public void displayCoverPane(boolean display){
coverPanel.setVisible(display); coverPanel.setVisible(display);
coverPanel.setBounds(1, 1, (int) editor.getBounds().getWidth(), (int) editor.getBounds().getHeight()); coverPanel.setBounds(1, 1, (int) editor.getBounds().getWidth(), (int) editor.getBounds().getHeight());
editor.repaint(); editor.repaint();
@ -216,41 +210,41 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
coverPanel.destroyHelpDialog(); coverPanel.destroyHelpDialog();
} }
public JComponent getCoverPane(){ public JComponent getCoverPane(){
return coverPanel; return coverPanel;
} }
/** /**
* 初始化大小 * 初始化大小
* @return 尺寸 * @return 尺寸
*/ */
public Dimension initEditorSize() { public Dimension initEditorSize() {
return BORDER_PREFERRED_SIZE; return BORDER_PREFERRED_SIZE;
} }
/** /**
* 是否是报表块 * 是否是报表块
* @return * @return
*/ */
public boolean isReport() { public boolean isReport() {
return true; return true;
} }
/** /**
* 该组件是否可以拖入参数面板 * 该组件是否可以拖入参数面板
* @return 是则返回true * @return 是则返回true
*/ */
public boolean canEnterIntoParaPane(){ public boolean canEnterIntoParaPane(){
return false; return false;
} }
/** /**
* 返回报表块对应的widget * 返回报表块对应的widget
* @return 返回ElementCaseEditor * @return 返回ElementCaseEditor
*/ */
public ElementCaseEditor toData() { public ElementCaseEditor toData() {
return ((ElementCaseEditor) data); return ((ElementCaseEditor) data);
} }
public FormElementCaseProvider getElementCase() { public FormElementCaseProvider getElementCase() {
return toData().getElementCase(); return toData().getElementCase();
@ -301,14 +295,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){ private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){
FormDesigner designer = editingMouseListener.getDesigner(); FormDesigner designer = editingMouseListener.getDesigner();
if (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR){ if (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR){
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e); FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e);
//切换设计器 //切换设计器
designer.switchTab(component); designer.switchTab(component);
} }
} }
@Override @Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() { public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {

Loading…
Cancel
Save