plough 8 years ago
parent
commit
2829bd754b
  1. 9
      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

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

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

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())
.setI18NName(Inter.getLocText("Form-Widget_Name")),
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")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@ -94,26 +94,13 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
}
}),
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"),
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
//这边有个插件兼容问题,之后还是要改回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);
}
resolveCompatible(propertyTableEditor);
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getSingle(FormElementCaseEditorProcessor.MARK_STRING);
if (processor == null) {
return propertyTableEditor;
@ -131,10 +118,25 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
if (editor.getReportFitAttr() == null) {
editor.setReportFitInPc(processor.getFitStateInPC(fitAttr));
}
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
protected String getIconName() {
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
.getLocText("FR-Designer_Form-Widget_Name")),
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")
.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.icontainer.UIScrollPane;
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.BackgroundSpecialPane;
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 ROUNDED_BORDERS = 2;
private static final int MAX_WIDTH = 220;
private static final int NO_RADIUS = 0;
private LayoutBorderStyle borderStyle = new LayoutBorderStyle();
@ -67,7 +69,8 @@ public class LayoutBorderPane extends BasicPane {
private UIComboBox borderStyleCombo;
//边框粗细
private LineComboBox currentLineCombo;
//边框圆角
private UISpinner borderCornerSpinner;
//边框颜色
private UIColorButton currentLineColorPane;
//主体背景
@ -136,7 +139,17 @@ public class LayoutBorderPane extends BasicPane {
this.currentLineCombo = currentLineCombo;
}
public UIColorButton getCurrentLineColorPane() {
public UISpinner getBorderCornerSpinner() {
return borderCornerSpinner;
}
public void setBorderCornerSpinner(UISpinner borderCornerSpinner) {
this.borderCornerSpinner = borderCornerSpinner;
}
public UIColorButton getCurrentLineColorPane() {
return currentLineColorPane;
}
@ -337,6 +350,7 @@ public class LayoutBorderPane extends BasicPane {
this.borderStyleCombo = new UIComboBox(BORDER_STYLE);
this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY);
this.currentLineColorPane = new UIColorButton(null);
this.borderCornerSpinner = new UISpinner(0,1000,1,0);
currentLineColorPane.setUI(getButtonUI(currentLineColorPane));
currentLineColorPane.set4ToolbarButton();
currentLineColorPane.setPreferredSize(new Dimension(20,20));
@ -349,13 +363,14 @@ public class LayoutBorderPane extends BasicPane {
transparencyPane.add(new UILabel(" %"), BorderLayout.EAST);
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};
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_Render_Style")), borderStyleCombo},
{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("plugin-ChartF_Radius")+":"),borderCornerSpinner},
{new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Body_Background")), backgroundPane},
{new UILabel(""),new UILabel(Inter.getLocText("FR-Designer-Widget-Style_Alpha"))},
{new UILabel(""),transparencyPane},
@ -373,6 +388,7 @@ public class LayoutBorderPane extends BasicPane {
protected JPanel initBodyRightTopPane(){
this.borderTypeCombo = new UIComboBox(BORDER_TYPE);
this.borderStyleCombo = new UIComboBox(BORDER_STYLE);
this.borderCornerSpinner = new UISpinner(0,1000,1,0);
this.currentLineCombo = new LineComboBox(BORDER_LINE_STYLE_ARRAY);
this.currentLineColorPane = new UIColorButton(null);
@ -490,11 +506,11 @@ public class LayoutBorderPane extends BasicPane {
LayoutBorderStyle style = new LayoutBorderStyle();
style.setType(borderTypeCombo.getSelectedIndex());
style.setBorderStyle(borderStyleCombo.getSelectedIndex());
style.setBorderRadius((int)borderCornerSpinner.getValue());
style.setBorder(currentLineCombo.getSelectedLineStyle());
style.setColor(currentLineColorPane.getColor());
style.setBackground(backgroundPane.update());
style.setAlpha((float)(numberDragPane.updateBean()/maxNumber));
WidgetTitle title = style.getTitle() == null ? new WidgetTitle() : style.getTitle();
title.setTextObject(formulaPane.updateBean());
FRFont frFont = title.getFrFont();
@ -557,6 +573,13 @@ public class LayoutBorderPane extends BasicPane {
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.addItemListener(new ItemListener() {
@Override
@ -751,9 +774,9 @@ public class LayoutBorderPane extends BasicPane {
public void populate(LayoutBorderStyle style) {
if(style.getBorder() == Constants.LINE_NONE) {
group.setSelected(noBorder.getModel(), true);
} else if(style.isCorner()) {
group.setSelected(RoundedBorder.getModel(), true);
} else {
} else if(style.getBorderRadius() != NO_RADIUS) {
group.setSelected(RoundedBorder.getModel(), true);
} else {
group.setSelected(normalBorder.getModel(), true);
}
}
@ -794,7 +817,7 @@ public class LayoutBorderPane extends BasicPane {
} else {
borderStyle.setColor(currentLineColorPane.getColor());
borderStyle.setBorder(currentLineCombo.getSelectedLineStyle());
borderStyle.setCorner(border != RIGHTANGLE_BORDERS);
borderStyle.setBorderRadius((int)borderCornerSpinner.getValue());
}
layoutBorderPreviewPane.repaint();

Loading…
Cancel
Save