Browse Source

REPORT-842 报表块组件支持圆角边框

master
kerry 8 years ago
parent
commit
7a1a7f9926
  1. 5
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  2. 4
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  3. 2
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  4. 29
      designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java

5
designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -27,8 +27,7 @@ import com.fr.stable.StringUtils;
*/ */
public class XBorderStyleWidgetCreator extends XWidgetCreator{ public class XBorderStyleWidgetCreator extends XWidgetCreator{
private int cornerSize = 15; private int noneSize = 0;
private int noneSize = 0;
protected static final Dimension BORDER_PREFERRED_SIZE = new Dimension(250, 150); protected static final Dimension BORDER_PREFERRED_SIZE = new Dimension(250, 150);
@ -59,7 +58,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
protected void initBorderStyle() { protected void initBorderStyle() {
LayoutBorderStyle style = toData().getBorderStyle(); LayoutBorderStyle style = toData().getBorderStyle();
if (style != null && style.getBorder() != Constants.LINE_NONE) { if (style != null && style.getBorder() != Constants.LINE_NONE) {
this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.isCorner() ? cornerSize : noneSize)); this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.isCorner() ? style.getRoundRadius() : noneSize));
} else { } else {
this.setBorder(DEFALUTBORDER); this.setBorder(DEFALUTBORDER);
} }

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

@ -84,7 +84,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
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("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.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")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@ -94,7 +94,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
} }
}), }),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class) new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setRendererClass(PaddingMarginCellRenderer.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("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))

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

@ -75,7 +75,7 @@ public class XWAbsoluteBodyLayout extends XWAbsoluteLayout {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")), .getLocText("FR-Designer_Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( WLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {

29
designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java

@ -19,6 +19,7 @@ import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.style.BackgroundNoImagePane; import com.fr.design.gui.style.BackgroundNoImagePane;
import com.fr.design.gui.style.BackgroundSpecialPane; import com.fr.design.gui.style.BackgroundSpecialPane;
import com.fr.design.gui.style.FRFontPane; import com.fr.design.gui.style.FRFontPane;
@ -67,7 +68,8 @@ public class LayoutBorderPane extends BasicPane {
private UIComboBox borderStyleCombo; private UIComboBox borderStyleCombo;
//边框粗细 //边框粗细
private LineComboBox currentLineCombo; private LineComboBox currentLineCombo;
//边框圆角
private UISpinner borderCornerSpinner;
//边框颜色 //边框颜色
private UIColorButton currentLineColorPane; private UIColorButton currentLineColorPane;
//主体背景 //主体背景
@ -136,7 +138,17 @@ public class LayoutBorderPane extends BasicPane {
this.currentLineCombo = currentLineCombo; this.currentLineCombo = currentLineCombo;
} }
public UIColorButton getCurrentLineColorPane() {
public UISpinner getBorderCornerSpinner() {
return borderCornerSpinner;
}
public void setBorderCornerSpinner(UISpinner borderCornerSpinner) {
this.borderCornerSpinner = borderCornerSpinner;
}
public UIColorButton getCurrentLineColorPane() {
return currentLineColorPane; return currentLineColorPane;
} }
@ -337,6 +349,7 @@ public class LayoutBorderPane extends BasicPane {
this.borderStyleCombo = new UIComboBox(BORDER_STYLE); this.borderStyleCombo = new UIComboBox(BORDER_STYLE);
this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY); this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY);
this.currentLineColorPane = new UIColorButton(null); this.currentLineColorPane = new UIColorButton(null);
this.borderCornerSpinner = new UISpinner(0,1000,1,0);
currentLineColorPane.setUI(getButtonUI(currentLineColorPane)); currentLineColorPane.setUI(getButtonUI(currentLineColorPane));
currentLineColorPane.set4ToolbarButton(); currentLineColorPane.set4ToolbarButton();
currentLineColorPane.setPreferredSize(new Dimension(20,20)); currentLineColorPane.setPreferredSize(new Dimension(20,20));
@ -356,6 +369,7 @@ public class LayoutBorderPane extends BasicPane {
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Render_Style")), borderStyleCombo}, {new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Render_Style")), borderStyleCombo},
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Border_Line")), currentLineCombo}, {new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Border_Line")), currentLineCombo},
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Border_Color")), buttonPane}, {new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Border_Color")), buttonPane},
{new UILabel(Inter.getLocText("plugin-ChartF_Radius")+":"),borderCornerSpinner},
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Body_Background")), backgroundPane}, {new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Body_Background")), backgroundPane},
{new UILabel(""),new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Alpha"))}, {new UILabel(""),new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Alpha"))},
{new UILabel(""),transparencyPane}, {new UILabel(""),transparencyPane},
@ -373,6 +387,7 @@ public class LayoutBorderPane extends BasicPane {
protected JPanel initBodyRightTopPane(){ protected JPanel initBodyRightTopPane(){
this.borderTypeCombo = new UIComboBox(BORDER_TYPE); this.borderTypeCombo = new UIComboBox(BORDER_TYPE);
this.borderStyleCombo = new UIComboBox(BORDER_STYLE); this.borderStyleCombo = new UIComboBox(BORDER_STYLE);
this.borderCornerSpinner = new UISpinner(0,1000,1,0);
this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY); this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY);
this.currentLineColorPane = new UIColorButton(null); this.currentLineColorPane = new UIColorButton(null);
@ -490,11 +505,12 @@ public class LayoutBorderPane extends BasicPane {
LayoutBorderStyle style = new LayoutBorderStyle(); LayoutBorderStyle style = new LayoutBorderStyle();
style.setType(borderTypeCombo.getSelectedIndex()); style.setType(borderTypeCombo.getSelectedIndex());
style.setBorderStyle(borderStyleCombo.getSelectedIndex()); style.setBorderStyle(borderStyleCombo.getSelectedIndex());
style.setRoundRadius((int)borderCornerSpinner.getValue());
style.setBorder(currentLineCombo.getSelectedLineStyle()); style.setBorder(currentLineCombo.getSelectedLineStyle());
style.setColor(currentLineColorPane.getColor()); style.setColor(currentLineColorPane.getColor());
style.setBackground(backgroundPane.update()); style.setBackground(backgroundPane.update());
style.setAlpha((float)(numberDragPane.updateBean()/maxNumber)); style.setAlpha((float)(numberDragPane.updateBean()/maxNumber));
style.setCorner(true);
WidgetTitle title = style.getTitle() == null ? new WidgetTitle() : style.getTitle(); WidgetTitle title = style.getTitle() == null ? new WidgetTitle() : style.getTitle();
title.setTextObject(formulaPane.updateBean()); title.setTextObject(formulaPane.updateBean());
FRFont frFont = title.getFrFont(); FRFont frFont = title.getFrFont();
@ -557,6 +573,13 @@ public class LayoutBorderPane extends BasicPane {
paintPreviewPane(); paintPreviewPane();
} }
}); });
this.borderCornerSpinner.setValue(borderStyle.getRoundRadius());
this.borderCornerSpinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
paintPreviewPane();
}
});
this.currentLineCombo.setSelectedLineStyle(borderStyle.getBorder()); this.currentLineCombo.setSelectedLineStyle(borderStyle.getBorder());
this.currentLineCombo.addItemListener(new ItemListener() { this.currentLineCombo.addItemListener(new ItemListener() {
@Override @Override

Loading…
Cancel
Save