plough 8 years ago
parent
commit
2829bd754b
  1. 7
      designer_form/src/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  2. 36
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  3. 2
      designer_form/src/com/fr/design/designer/creator/XWAbsoluteBodyLayout.java
  4. 39
      designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java

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

@ -27,9 +27,6 @@ import com.fr.stable.StringUtils;
*/ */
public class XBorderStyleWidgetCreator extends XWidgetCreator{ public class XBorderStyleWidgetCreator extends XWidgetCreator{
private int cornerSize = 15;
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);
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) {
@ -59,7 +56,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.getBorderRadius()));
} else { } else {
this.setBorder(DEFALUTBORDER); this.setBorder(DEFALUTBORDER);
} }
@ -109,7 +106,7 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
//标题的边框样式目前是取对应的控件的边框样式 //标题的边框样式目前是取对应的控件的边框样式
title.setBorder(style.getBorder()); title.setBorder(style.getBorder());
title.setColor(style.getColor()); title.setColor(style.getColor());
title.setCorner(style.isCorner()); // title.setCorner(style.isCorner());
WidgetTitle wTitle = style.getTitle(); WidgetTitle wTitle = style.getTitle();
//设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个 //设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个

36
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,26 +94,13 @@ 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"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
resolveCompatible(propertyTableEditor);
//这边有个插件兼容问题,之后还是要改回process才行
Set<FormElementCaseEditorProvider> set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING);
for (FormElementCaseEditorProvider provider : set) {
if (provider == null) {
continue;
}
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
FormProvider formProvider = designer.getTarget();
ElementCaseEditorProvider elementCaseEditorProvider = this.toData();
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider);
propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
}
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING); FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING);
if (processor == null) { if (processor == null) {
return propertyTableEditor; return propertyTableEditor;
@ -131,10 +118,25 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (editor.getReportFitAttr() == null) { if (editor.getReportFitAttr() == null) {
editor.setReportFitInPc(processor.getFitStateInPC(fitAttr)); editor.setReportFitInPc(processor.getFitStateInPC(fitAttr));
} }
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor); return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
} }
private void resolveCompatible (CRPropertyDescriptor[] propertyTableEditor) {
//这边有个插件兼容问题,之后还是要改回process才行
Set<FormElementCaseEditorProvider> set = ExtraDesignClassManager.getInstance().getArray(AbstractFormElementCaseEditorProvider.MARK_STRING);
for (FormElementCaseEditorProvider provider : set) {
if (provider == null) {
continue;
}
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
FormProvider formProvider = designer.getTarget();
ElementCaseEditorProvider elementCaseEditorProvider = this.toData();
PropertyDescriptor[] extraEditor = provider.createPropertyDescriptor(this.data.getClass(), formProvider, elementCaseEditorProvider);
propertyTableEditor = (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
}
}
@Override @Override
protected String getIconName() { protected String getIconName() {
return "text_field_16.png"; return "text_field_16.png";

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() {

39
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;
@ -57,6 +58,7 @@ public class LayoutBorderPane extends BasicPane {
private static final int RIGHTANGLE_BORDERS = 1; private static final int RIGHTANGLE_BORDERS = 1;
private static final int ROUNDED_BORDERS = 2; private static final int ROUNDED_BORDERS = 2;
private static final int MAX_WIDTH = 220; private static final int MAX_WIDTH = 220;
private static final int NO_RADIUS = 0;
private LayoutBorderStyle borderStyle = new LayoutBorderStyle(); private LayoutBorderStyle borderStyle = new LayoutBorderStyle();
@ -67,7 +69,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 +139,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 +350,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));
@ -349,13 +363,14 @@ public class LayoutBorderPane extends BasicPane {
transparencyPane.add(new UILabel(" %"), BorderLayout.EAST); transparencyPane.add(new UILabel(" %"), BorderLayout.EAST);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p,p,p,p,p,p,p}; double[] rowSize = {p,p,p,p,p,p,p,p};
double[] columnSize = { p, MAX_WIDTH}; double[] columnSize = { p, MAX_WIDTH};
JPanel rightTopContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{ JPanel rightTopContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Frame_Style")), borderTypeCombo}, {new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Frame_Style")), borderTypeCombo},
{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 +388,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 +506,11 @@ 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.setBorderRadius((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));
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.getBorderRadius());
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
@ -751,9 +774,9 @@ public class LayoutBorderPane extends BasicPane {
public void populate(LayoutBorderStyle style) { public void populate(LayoutBorderStyle style) {
if(style.getBorder() == Constants.LINE_NONE) { if(style.getBorder() == Constants.LINE_NONE) {
group.setSelected(noBorder.getModel(), true); group.setSelected(noBorder.getModel(), true);
} else if(style.isCorner()) { } else if(style.getBorderRadius() != NO_RADIUS) {
group.setSelected(RoundedBorder.getModel(), true); group.setSelected(RoundedBorder.getModel(), true);
} else { } else {
group.setSelected(normalBorder.getModel(), true); group.setSelected(normalBorder.getModel(), true);
} }
} }
@ -794,7 +817,7 @@ public class LayoutBorderPane extends BasicPane {
} else { } else {
borderStyle.setColor(currentLineColorPane.getColor()); borderStyle.setColor(currentLineColorPane.getColor());
borderStyle.setBorder(currentLineCombo.getSelectedLineStyle()); borderStyle.setBorder(currentLineCombo.getSelectedLineStyle());
borderStyle.setCorner(border != RIGHTANGLE_BORDERS); borderStyle.setBorderRadius((int)borderCornerSpinner.getValue());
} }
layoutBorderPreviewPane.repaint(); layoutBorderPreviewPane.repaint();

Loading…
Cancel
Save