Browse Source

REPORT-55149【组件背景分离】组件复用-图表块没看到内边距设置项

【问题原因】
实现表单图表控件支持内边距
【改动思路】
【review建议】
feature/10.0
Starryi 3 years ago
parent
commit
26f2825ccb
  1. 17
      designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java
  2. 9
      designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java
  3. 4
      designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java
  4. 57
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ChartEditorDefinePane.java

17
designer-form/src/main/java/com/fr/design/designer/beans/events/DesignerEditor.java

@ -1,5 +1,6 @@
package com.fr.design.designer.beans.events;
import com.fr.form.ui.PaddingMargin;
import com.fr.stable.core.PropertyChangeAdapter;
import com.fr.stable.core.PropertyChangeListener;
import com.fr.design.utils.gui.LayoutUtils;
@ -76,6 +77,22 @@ public class DesignerEditor<T extends JComponent> implements PropertyChangeListe
}
}
public void paintEditor(Graphics g, Dimension size, PaddingMargin margin) {
if (this.comp != null) {
int marginLeft = margin != null ? margin.getLeft() : 0;
int marginTop = margin != null ? margin.getTop() : 0;
int marginRight = margin != null ? margin.getRight() : 0;
int marginBottom = margin != null ? margin.getBottom() : 0;
int horizonMargin = marginLeft + marginRight;
int verticalMargin = marginTop + marginBottom;
comp.setSize(new Dimension(size.width - 2 - horizonMargin, size.height - 2 - verticalMargin));
LayoutUtils.layoutContainer(comp);
Graphics clipg = g.create(1 + marginLeft, 1 + marginTop, size.width, size.height);
this.comp.paint(clipg);
}
}
public T getEditorTarget() {
return comp;
}

9
designer-form/src/main/java/com/fr/design/designer/creator/XChartEditor.java

@ -20,6 +20,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.module.DesignModuleFactory;
import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.Widget;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -228,9 +229,13 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* 渲染Painter
*/
public void paint(Graphics g) {
designerEditor.paintEditor(g, this.getSize());
Dimension size = getSize();
PaddingMargin margin = toData().getMargin();
designerEditor.paintEditor(g, size, margin);
if (coverPanel != null) {
coverPanel.setSize(this.getSize());
int horizonMargin = margin != null ? margin.getLeft() + margin.getRight() : 0;
int verticalMargin = margin != null ? margin.getTop() + margin.getBottom() : 0;
coverPanel.setSize(size.width - horizonMargin, size.height - verticalMargin);
}
super.paint(g);
if (isEditing) {

4
designer-form/src/main/java/com/fr/design/widget/FormWidgetDefinePaneFactoryBase.java

@ -24,7 +24,7 @@ import com.fr.design.widget.ui.designer.TreeComboBoxEditorDefinePane;
import com.fr.design.widget.ui.designer.TreeEditorDefinePane;
import com.fr.design.widget.ui.designer.UserEditorDefinePane;
import com.fr.design.widget.ui.designer.WidgetDefinePane;
import com.fr.design.widget.ui.designer.layout.BorderStyleWidgetDefinePane;
import com.fr.design.widget.ui.designer.layout.ChartEditorDefinePane;
import com.fr.design.widget.ui.designer.layout.ElementEditorDefinePane;
import com.fr.design.widget.ui.designer.layout.FRAbsoluteBodyLayoutDefinePane;
import com.fr.design.widget.ui.designer.layout.FRAbsoluteLayoutDefinePane;
@ -107,7 +107,7 @@ public class FormWidgetDefinePaneFactoryBase {
defineMap.put(FormSubmitButton.class, new Appearance(FreeButtonDefinePane.class, WidgetConstants.BUTTON + ""));
defineMap.put(WFitLayout.class, new Appearance(FRFitLayoutDefinePane.class, "wFitLayout"));
if (StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class) != null) {
defineMap.put(StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class), new Appearance(BorderStyleWidgetDefinePane.class, "chartEditor"));
defineMap.put(StableFactory.getMarkedClass(BridgeMark.CHART_EDITOR, AbstractBorderStyleWidget.class), new Appearance(ChartEditorDefinePane.class, "chartEditor"));
}
defineMap.put(WAbsoluteLayout.class, new Appearance(FRAbsoluteLayoutDefinePane.class, "wAbsoluteLayout"));

57
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/ChartEditorDefinePane.java

@ -0,0 +1,57 @@
package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.PropertyGroupPane;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEditor;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.ComparatorUtils;
import javax.swing.*;
import java.awt.*;
/**
* Created by ibm on 2017/8/7.
*/
public class ChartEditorDefinePane extends WTitleLayoutDefinePane<ChartEditor> {
private PaddingBoundPane paddingBoundPane;
public ChartEditorDefinePane(XCreator xCreator) {
super(xCreator);
}
protected JPanel createCenterPane() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
paddingBoundPane = new PaddingBoundPane();
Component[][] components = new Component[][]{
new Component[]{paddingBoundPane, null},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
centerPane.add(panel, BorderLayout.NORTH);
return centerPane;
}
protected ChartEditor updateSubBean() {
ChartEditor chartEditor = (ChartEditor) creator.toData();
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout_Padding_Duplicate"))) {
paddingBoundPane.update(chartEditor);
}
return chartEditor;
}
protected void populateSubBean(ChartEditor ob) {
paddingBoundPane.populate(ob);
}
}
Loading…
Cancel
Save