Browse Source

无 jira

final/10.0
hades 3 years ago
parent
commit
b07e44255d
  1. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  2. 10
      designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java
  3. 89
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java
  4. 12
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

4
designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java

@ -226,7 +226,11 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
public void paintBackground(Graphics2D g2d) {
Background background4Painting = getBackground4Painting();
if (background4Painting != null) {
BorderPacker style = toData().getBorderStyle();
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, style.getAlpha()));
background4Painting.paint(g2d, new Rectangle2D.Double(0, 0, getWidth(), getHeight()));
g2d.setComposite(oldComposite);
}
}

10
designer-form/src/main/java/com/fr/design/designer/creator/XLabel.java

@ -19,6 +19,7 @@ import com.fr.form.ui.Label;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background;
import com.fr.general.act.BorderPacker;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.core.PropertyChangeAdapter;
@ -91,8 +92,13 @@ public class XLabel extends XWidgetCreator {
Label label = (Label) data;
Dimension size = this.getSize();
//先画背景,再画标题
if (toData().getBackground() != null) {
toData().getBackground().paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()));
Background background = label.getBackground();
if (background != null) {
Graphics2D g2d = (Graphics2D) g;
Composite oldComposite = g2d.getComposite();
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, label.getBackgroundOpacity()));
background.paint(g, new Rectangle2D.Double(0, 0, size.getWidth(), size.getHeight()));
g2d.setComposite(oldComposite);
}
if (label.getWidgetValue() != null) {
Graphics2D g2d = (Graphics2D) g.create();

89
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

@ -1,10 +1,8 @@
package com.fr.design.gui.xpane;
import com.fr.base.GraphHelper;
import com.fr.base.Utils;
import com.fr.base.svg.IconUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.formula.TinyFormulaPane;
@ -13,7 +11,6 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
@ -105,42 +102,46 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
boolean currentIsRootLayout = currentEditingTemplate != null && !currentEditingTemplate.isJWorkBook() && ((JForm)currentEditingTemplate).isSelectRootPane();
JPanel titlePane = createTitleStylePane();
JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane();
JPanel backgroundPane = createBackgroundStylePane();
if (titlePane != null) {
container.add(titlePane, BorderLayout.NORTH);
if (currentIsRootLayout) {
titlePane.setVisible(false);
}
}
JPanel nextContainerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.add(nextContainerPane, BorderLayout.CENTER);
//界面上表单主体只有背景和透明度可以设置
JPanel mainStylePane = currentIsRootLayout ? createMainStylePane4RootLayout() : createMainStylePane4WidgetLayout();
if (mainStylePane != null) {
container.add(mainStylePane, BorderLayout.CENTER);
if (bodyContentPane != null) {
//界面上表单主体只有背景和透明度可以设置
nextContainerPane.add(bodyContentPane, BorderLayout.NORTH);
}
if (backgroundPane != null) {
nextContainerPane.add(backgroundPane, BorderLayout.CENTER);
if (currentIsRootLayout) {
backgroundPane.setVisible(false);
}
}
this.add(container, BorderLayout.CENTER);
}
protected void initMainComponents() {
protected JPanel createBackgroundStylePane() {
borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane();
cornerSpinner = new UISpinner(0,1000,1,0);
backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane();
}
protected JPanel createMainStylePane4WidgetLayout() {
initMainComponents();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p, p, p, p};
double[] rowSize = {p, p, p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f};
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")), null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo},
{this.borderLineAndImagePane, null},
{this.createMainBackgroundAndOpacityPane(), null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner},
},
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
@ -153,16 +154,23 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
return container;
}
protected JPanel createMainStylePane4RootLayout() {
initMainComponents();
protected JPanel createBodyContentPane() {
backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f};
JPanel bodyBackground = createBackgroundAndOpacityPane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"),
this.backgroundPane,
this.backgroundOpacityPane);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Frame_Style")), null},
{this.createMainBackgroundAndOpacityPane(), null},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Content")), null},
{bodyBackground, null},
},
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
@ -174,11 +182,31 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
return container;
}
protected JPanel createMainBackgroundAndOpacityPane() {
return createBackgroundAndOpacityPane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Background"),
protected JPanel createBodyContentPane4RootLayout() {
backgroundPane = new LayoutBackgroundSpecialPane();
backgroundOpacityPane = new UIPercentDragPane();
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p};
double[] columnSize = {SETTING_LABEL_WIDTH, f};
JPanel bodyBackground = createBackgroundAndOpacityPane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill"),
this.backgroundPane,
this.backgroundOpacityPane);
JPanel contentPane = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{
{bodyBackground, null},
},
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(new BottomLineBorder());
container.add(contentPane, BorderLayout.NORTH);
return container;
}
protected void initTitleComponents() {
@ -489,16 +517,25 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
protected static class BottomLineBorder extends LineBorder {
public BottomLineBorder() {
super(Color.lightGray, 1);
super(new Color(217, 218, 221), 1);
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2d = (Graphics2D) g;
Color oldColor = g2d.getColor();
g2d.setColor(this.lineColor);
GraphHelper.drawLine(g, 0, height, width, height, 1);
Stroke oldStroke = g2d.getStroke();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(getLineColor());
g2d.setStroke(new BasicStroke(getThickness() * 2));
g2d.drawLine(0, height, width, height);
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}

12
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -265,11 +265,13 @@ public class WidgetBoundPane extends BasicPane {
@Override
public void stateChanged(ChangeEvent e) {
if (isLockEnabled() && isLocked()) {
setLocked(false);
aspectRatioBackup = -1;
} else if (aspectRatioBackup > 0) {
double value = mHeightSpinner.getValue() * aspectRatioBackup;
mWidthSpinner.setValue(Math.round(value), false);
if (mHeightSpinner.getValue() == 0) {
setLocked(false);
aspectRatioBackup = -1;
}else if (aspectRatioBackup > 0) {
double value = mHeightSpinner.getValue() * aspectRatioBackup;
mWidthSpinner.setValue(Math.round(value), false);
}
}
}
});

Loading…
Cancel
Save