Browse Source

Pull request #5086: REPORT-55554 & REPORT-55715

Merge in DESIGN/design from ~STARRYI/design:bug-final/10.0 to final/10.0

* commit '006ae3f93654c74121787bf120021014d4ce1aa6':
  REPORT-55715 【组件背景分离】组件复用-颜色选择器和设计器里其他地方的颜色选择器不太一样,看起来有点奇怪
  REPORT-55554 【组件背景分离】组件复用-mac上,组件标题的默认字体 和 单元格默认字体 不是一个字体;windows这边是一致的,都是宋体
final/10.0
Kara 3 years ago
parent
commit
69cf0d43b9
  1. 38
      designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java
  2. 9
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java

38
designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java

@ -10,16 +10,20 @@ import java.awt.RenderingHints;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import javax.swing.AbstractButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.AbstractBorder; import javax.swing.border.AbstractBorder;
import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener; import javax.swing.event.AncestorListener;
import javax.swing.plaf.ButtonUI;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.Constants; import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.design.style.background.BackgroundJComponent; import com.fr.design.style.background.BackgroundJComponent;
import com.fr.stable.Constants;
/** /**
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
@ -29,7 +33,7 @@ import com.fr.design.style.background.BackgroundJComponent;
public abstract class AbstractSelectBox<T> extends AbstractPopBox implements MouseListener { public abstract class AbstractSelectBox<T> extends AbstractPopBox implements MouseListener {
private static final long serialVersionUID = 2355250206956896774L; private static final long serialVersionUID = 2355250206956896774L;
private UIToggleButton triggleButton; private UIButton triggleButton;
protected void initBox(int preWidth) { protected void initBox(int preWidth) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -37,8 +41,34 @@ public abstract class AbstractSelectBox<T> extends AbstractPopBox implements Mou
displayComponent = new BackgroundJComponent(); displayComponent = new BackgroundJComponent();
displayComponent.setEmptyBackground(); displayComponent.setEmptyBackground();
displayComponent.setBorder(new TriggleLineBorder()); displayComponent.setBorder(new TriggleLineBorder());
triggleButton = new UIToggleButton(UIConstants.ARROW_DOWN_ICON); triggleButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
@Override
public ButtonUI getUI() {
return new UIButtonUI() {
@Override
protected boolean isPressed(AbstractButton b) {
return model.isArmed() && model.isPressed();
}
@Override
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS);
} else if (isRollOver(b)) {
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER);
} else if (b.isNormalPainted()) {
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL);
}
}
};
}
};
triggleButton.setPreferredSize(new Dimension(20, 20)); triggleButton.setPreferredSize(new Dimension(20, 20));
triggleButton.setRoundBorder(true, Constants.LEFT);
JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
displayPane.add(displayComponent, BorderLayout.CENTER); displayPane.add(displayComponent, BorderLayout.CENTER);

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

@ -215,6 +215,15 @@ public class LayoutStylePane extends BasicBeanPane<LayoutBorderStyle> {
titleTextPane = new TinyFormulaPane(); titleTextPane = new TinyFormulaPane();
titleFontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); titleFontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
TitlePacker title = style.getTitle();
if (title != null) {
FRFont frFont = title.getFrFont();
if (frFont != null) {
String fontFamily = frFont.getFamily();
// 使用style中默认的字体初始化titleFontFamilyComboBox,保证UI和数据的一致性
this.titleFontFamilyComboBox.setSelectedItem(fontFamily);
}
}
titleFontFamilyComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family")); titleFontFamilyComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family"));
titleFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); titleFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);

Loading…
Cancel
Save