Browse Source

Merge pull request #5176 in DESIGN/design from final/10.0 to persist/10.0

* commit '2fc0b44aace0fe514861c652eaa7d09321876591':
  REPORT-56010 【组件背景分离】组件复用-组件不显示 标题,设置边框后设计期内边框不显示
  REPORT-55850 【组件背景分离】组件复用-Tab组件背景和边框预览不生效
  设计器外双击模板打开,设计器内会额外打开一个空白的cpt
  REPORT-55839 组件复用-禁用tab块的自定义图片边框入口,预期是只面向图表块与报表块
  REPORT-55757 【组件背景分离】组件复用-标题图案预览图,悬浮时出现的遮罩和删除图标,鼠标如果从左边/上边滑出,则删除图标消失;但从右边/下边滑出,删除图标还在
  REPORT-55757 【组件背景分离】组件复用-标题图案预览图,悬浮时出现的遮罩和删除图标,鼠标如果从左边/上边滑出,则删除图标消失;但从右边/下边滑出,删除图标还在
persist/10.0 10.0.18.2021.07.30
superman 3 years ago
parent
commit
58784a38ae
  1. 7
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  2. 4
      designer-form/src/main/java/com/fr/design/designer/creator/XBorderStyleWidgetCreator.java
  3. 7
      designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java
  4. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  5. 39
      designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java
  6. 15
      designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java
  7. 15
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java
  8. 35
      designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java
  9. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

7
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -10,6 +10,7 @@ import com.fr.design.fun.DesignerEnvProcessor;
import com.fr.design.gui.UILookAndFeel; import com.fr.design.gui.UILookAndFeel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.exit.DesignerExiter; import com.fr.exit.DesignerExiter;
import com.fr.file.FileFILE; import com.fr.file.FileFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -205,8 +206,14 @@ public class DesignUtils {
isMatch = isMatch || path.endsWith(suffix); isMatch = isMatch || path.endsWith(suffix);
} }
if (isMatch) { if (isMatch) {
// ui线程作为打开入口
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f));
} }
});
}
} }
} }
reader.close(); reader.close();

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

@ -210,6 +210,10 @@ public class XBorderStyleWidgetCreator extends XWidgetCreator{
reshuffleBorderPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator); reshuffleBorderPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator);
reshuffleBackgroundPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator); reshuffleBackgroundPaintingEffectIfTitleExists(titleParent, titleCreator, bodyXCreator);
} else {
titleParent.setBorder(null);
titleParent.setBorderImage4Painting(null, 0.0);
titleParent.setBackground4Painting(null, 0.0);
} }
} }
} }

7
designer-form/src/main/java/com/fr/design/designer/creator/XWTitleLayout.java

@ -62,6 +62,13 @@ public class XWTitleLayout extends DedicateLayoutContainer {
this.bodyBackgroundOpacity4Painting = opacity; this.bodyBackgroundOpacity4Painting = opacity;
} }
@Override
protected void initBorderAndBackgroundStyle() {
setBorder(null);
setBorderImage4Painting(null, 0.0);
setBackground4Painting(null, 0.0);
}
@Override @Override
protected void initXCreatorProperties() { protected void initXCreatorProperties() {
super.initXCreatorProperties(); super.initXCreatorProperties();

5
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -415,7 +415,10 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
*/ */
@Override @Override
public void firePropertyChange(){ public void firePropertyChange(){
return; XWCardLayout cardLayout = this.getCardPart();
if (cardLayout != null && cardLayout.toData() != null) {
cardLayout.initStyle();
}
} }

39
designer-form/src/main/java/com/fr/design/gui/xpane/BorderLineAndImagePane.java

@ -98,13 +98,13 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
private int[] ninePoint = new int[] {-1, -1, -1, -1}; private int[] ninePoint = new int[] {-1, -1, -1, -1};
public BorderLineAndImagePane() { public BorderLineAndImagePane(boolean supportBorderImage) {
this.initComponents(); this.initComponents(supportBorderImage);
this.initLayout(); this.initLayout();
} }
private void initComponents() { private void initComponents(boolean supportBorderImage) {
borderLineCombo = new BorderLineAndImageComboBox(); borderLineCombo = new BorderLineAndImageComboBox(supportBorderImage);
borderColorPane = new NewColorSelectBox(145); borderColorPane = new NewColorSelectBox(145);
imagePreviewPane = new ImagePreviewPane() {{ imagePreviewPane = new ImagePreviewPane() {{
setImageStyle(Style.DEFAULT_STYLE); setImageStyle(Style.DEFAULT_STYLE);
@ -386,16 +386,25 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
protected static class BorderLineAndImageComboBox extends LineComboBox { protected static class BorderLineAndImageComboBox extends LineComboBox {
public static final int LINE_PICTURE = -1; public static final int LINE_PICTURE = -1;
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] { public final static int[] BORDER_LINE_AND_IMAGE_STYLE_ARRAY = new int[] {
Constants.LINE_NONE, Constants.LINE_NONE,
LINE_PICTURE, LINE_PICTURE,
Constants.LINE_THIN, //1px Constants.LINE_THIN, //1px
Constants.LINE_MEDIUM, //2px Constants.LINE_MEDIUM, //2px
Constants.LINE_THICK, //3px Constants.LINE_THICK, //3px
}; };
public final static int[] BORDER_LINE_STYLE_ARRAY = new int[] {
Constants.LINE_NONE,
Constants.LINE_THIN, //1px
Constants.LINE_MEDIUM, //2px
Constants.LINE_THICK, //3px
};
private boolean supportBorderImage = false;
public BorderLineAndImageComboBox() { public BorderLineAndImageComboBox(boolean supportBorderImage) {
super(BORDER_LINE_STYLE_ARRAY); super(supportBorderImage ? BORDER_LINE_AND_IMAGE_STYLE_ARRAY : BORDER_LINE_STYLE_ARRAY);
this.supportBorderImage = supportBorderImage;
} }
@Override @Override
@ -407,17 +416,29 @@ public class BorderLineAndImagePane extends JPanel implements UIObserver {
} }
public boolean isSelectedBorderLine() { public boolean isSelectedBorderLine() {
return getSelectedIndex() > 1; Object object = getSelectedItem();
if (object != null) {
int value = (int) object;
return value > 0;
}
return false;
} }
public boolean isSelectedBorderImage() { public boolean isSelectedBorderImage() {
return getSelectedIndex() == 1; Object object = getSelectedItem();
if (object != null) {
int value = (int) object;
return value == LINE_PICTURE;
}
return false;
} }
public void selectBorderImage() { public void selectBorderImage() {
if (supportBorderImage) {
this.setSelectedIndex(1); this.setSelectedIndex(1);
} }
} }
}
private class NinePointImageTweakDialogPane extends BasicPane { private class NinePointImageTweakDialogPane extends BasicPane {
public final NinePointLinePreviewPane previewPane = new NinePointLinePreviewPane(); public final NinePointLinePreviewPane previewPane = new NinePointLinePreviewPane();

15
designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutStylePane.java

@ -3,9 +3,7 @@
*/ */
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.form.ui.LayoutBorderStyle; import javax.swing.JPanel;
import javax.swing.*;
/** /**
* CardTagLayoutBorderPane Pane. * CardTagLayoutBorderPane Pane.
@ -14,14 +12,13 @@ public class CardTagLayoutStylePane extends LayoutStylePane {
@Override @Override
protected JPanel createTitleStylePane(){ protected JPanel createTitleStylePane(){
return null; JPanel panel = super.createTitleStylePane();
panel.setVisible(false);
return panel;
} }
@Override @Override
public void updateTitle(LayoutBorderStyle style) { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) {
return super.createBackgroundStylePane(false);
} }
@Override
protected void populateTitle() { }
} }

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

@ -88,7 +88,14 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
//标题背景透明度 //标题背景透明度
protected UIPercentDragPane titleBackgroundOpacityPane; protected UIPercentDragPane titleBackgroundOpacityPane;
private boolean supportBorderImage = false;
public LayoutStylePane() { public LayoutStylePane() {
this(false);
}
public LayoutStylePane(boolean supportBorderImage) {
this.supportBorderImage = supportBorderImage;
this.initLayout(); this.initLayout();
} }
@ -103,7 +110,7 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
JPanel titlePane = createTitleStylePane(); JPanel titlePane = createTitleStylePane();
JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane(); JPanel bodyContentPane = currentIsRootLayout ? createBodyContentPane4RootLayout() : createBodyContentPane();
JPanel backgroundPane = createBackgroundStylePane(); JPanel backgroundPane = createBackgroundStylePane(true);
if (titlePane != null) { if (titlePane != null) {
container.add(titlePane, BorderLayout.NORTH); container.add(titlePane, BorderLayout.NORTH);
@ -128,14 +135,14 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
this.add(container, BorderLayout.CENTER); this.add(container, BorderLayout.CENTER);
} }
protected JPanel createBackgroundStylePane() { protected JPanel createBackgroundStylePane(boolean supportCornerRadius) {
borderStyleCombo = new UIComboBox(BORDER_STYLE); borderStyleCombo = new UIComboBox(BORDER_STYLE);
borderLineAndImagePane = new BorderLineAndImagePane(); borderLineAndImagePane = new BorderLineAndImagePane(this.supportBorderImage);
cornerSpinner = new UISpinner(0,1000,1,0); cornerSpinner = new UISpinner(0,1000,1,0);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] rowSize = {p, p, p, p}; double[] rowSize = supportCornerRadius ? new double[] {p, p, p, p} : new double[]{p, p, p};
double[] columnSize = {SETTING_LABEL_WIDTH, f}; double[] columnSize = {SETTING_LABEL_WIDTH, f};
UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style")); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Background_Style"));

35
designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java

@ -24,7 +24,6 @@ import com.fr.general.Background;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.ImageWithSuffix; import com.fr.general.ImageWithSuffix;
import com.fr.general.act.TitlePacker; import com.fr.general.act.TitlePacker;
import com.fr.report.core.cal.Rect;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.*;
@ -36,7 +35,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D; import java.awt.geom.RoundRectangle2D;
/** /**
@ -97,14 +95,21 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE);
imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2);
imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE); imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE);
deletableImagePreviewPane.add(imageDeleteButton, 0);
deletableImagePreviewPane.add(imagePreviewOverlayPane, 1); JPanel mousePane = new JPanel();
deletableImagePreviewPane.add(imagePreviewPane, 2); mousePane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE);
mousePane.setOpaque(false);
mousePane.setBackground(null);
deletableImagePreviewPane.add(mousePane, 0);
deletableImagePreviewPane.add(imageDeleteButton, 1);
deletableImagePreviewPane.add(imagePreviewOverlayPane, 2);
deletableImagePreviewPane.add(imagePreviewPane, 3);
imagePreviewOverlayPane.setVisible(false); imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false); imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false); imageDeleteButton.setEnabled(false);
deletableImagePreviewPane.addMouseListener(new MouseAdapter() { mousePane.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
super.mouseEntered(e); super.mouseEntered(e);
@ -116,12 +121,27 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
super.mouseExited(e); super.mouseExited(e);
imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false);
}
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
int x = e.getX(); int x = e.getX();
int y = e.getY(); int y = e.getY();
if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { Rectangle bounds = imageDeleteButton.getBounds();
if (bounds.x < x && x < bounds.x + bounds.width && bounds.y < y && y < bounds.y + bounds.height) {
imagePreviewPane.setImageWithSuffix(null);
imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX);
imagePaddingPane.setValue(DEFAULT_INSET_PADDING);
imagePreviewOverlayPane.setVisible(false); imagePreviewOverlayPane.setVisible(false);
imageDeleteButton.setVisible(false); imageDeleteButton.setVisible(false);
imageDeleteButton.setEnabled(false); imageDeleteButton.setEnabled(false);
getComponent(1).setVisible(false);
fireStateChanged();
} }
} }
}); });
@ -151,7 +171,6 @@ public class TitleInsetImagePane extends JPanel implements UIObserver {
IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"), IOUtils.readIcon("/com/fr/design/images/buttonicon/icon_delete_inset.png"),
new Color(51, 51, 52, 178), new Color(51, 51, 52, 178),
2); 2);
imageDeleteButton.setEnabled(false);
imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE)); imageDeleteButton.setPreferredSize(new Dimension(DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE));
imagePreviewPane = new ImagePreviewPane(); imagePreviewPane = new ImagePreviewPane();

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -27,7 +27,7 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
public void initComponent() { public void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane = new LayoutStylePane(); stylePane = new LayoutStylePane(true);
advancePane.add(stylePane, BorderLayout.NORTH); advancePane.add(stylePane, BorderLayout.NORTH);
JPanel centerPane = createCenterPane(); JPanel centerPane = createCenterPane();
if(centerPane!=null){ if(centerPane!=null){

Loading…
Cancel
Save