Browse Source

REPORT-2021 tab布局字体、字号无法修改

master
zhouping 8 years ago
parent
commit
dd44bda245
  1. 10
      designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  2. 51
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

10
designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -47,7 +47,6 @@ public class XCardSwitchButton extends XButton {
//设置的图片类型
private static final String COLORBACKGROUNDTYPE = "ColorBackground";
private static final String DEFAULTTYPE = "default";
private static final String DEFAULT_FONT_NAME = "SimSun";
//默认颜色
public static final Color NORMAL_GRAL = new Color(236,236,236);
@ -66,7 +65,6 @@ public class XCardSwitchButton extends XButton {
private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57;
private static final int FONT_SIZE = 9;
private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout;
@ -321,10 +319,7 @@ public class XCardSwitchButton extends XButton {
// 标题部分
WidgetTitle title = style.getTitle();
FRFont font = button.getFont();
if (font == null) {
font = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
FRFont font = title.getFrFont();
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
UILabel label = this.getContentLabel();
label.setFont(newFont);
@ -403,9 +398,6 @@ public class XCardSwitchButton extends XButton {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont();
if (frFont == null) {
frFont = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
UILabel label = temp.getContentLabel();
label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution()));

51
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -1,11 +1,5 @@
package com.fr.design.designer.creator.cardlayout;
import java.awt.*;
import java.beans.IntrospectionException;
import javax.swing.border.Border;
import com.fr.base.ScreenResolution;
import com.fr.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
@ -16,24 +10,24 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor;
import com.fr.design.mainframe.widget.editors.FontEditor;
import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.beans.IntrospectionException;
/**
* @author focus
@ -45,14 +39,10 @@ public class XWTabFitLayout extends XWFitLayout {
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236);
private static final String DEFAULT_FONT_NAME = "SimSun";
public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12);
public final static FRFont DEFAULT_FRFT = FRFont.getInstance(DEFAULT_FONT_NAME, 0, 9);
private Dimension referDim;
private Background initialBackground;
private Background overBackground;
private Background clickBackground;
private FRFont font;
private XCardSwitchButton xCardSwitchButton;
public Dimension getReferDim() {
@ -87,15 +77,6 @@ public class XWTabFitLayout extends XWFitLayout {
this.clickBackground = clickBackground;
}
@Override
public FRFont getFont() {
return font;
}
public void setFont(FRFont font) {
this.font = font;
}
public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton;
}
@ -162,21 +143,7 @@ public class XWTabFitLayout extends XWFitLayout {
cardSwitchButton.setClickBackground(clickBackground);
}
}
),
//字体
creatNonListenerStyle(4).setPropertyChangeListener(
new PropertyChangeAdapter() {
@Override
public void propertyChange() {
font = ((WTabFitLayout) data).getFont();
CardSwitchButton cardSwitchButton = (CardSwitchButton) xCardSwitchButton.toData();
cardSwitchButton.setFont(font);
UILabel uiLabel = xCardSwitchButton.getLabel();
uiLabel.setFont(font.applyResolutionNP(ScreenResolution.getScreenResolution()));
uiLabel.setForeground(font.getForeground());
xCardSwitchButton.setLabel(uiLabel);
}
}),
)
};
}
@ -208,9 +175,6 @@ public class XWTabFitLayout extends XWFitLayout {
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(Inter.getLocText("FR-Designer_FRFont"))
.setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue(
XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
return crPropertyDescriptors[i];
@ -235,20 +199,15 @@ public class XWTabFitLayout extends XWFitLayout {
if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.getLabel().setFont(DEFAULTFT);
cardSwitchButton.setInitialBackground(null);
cardSwitchButton.setClickBackground(null);
cardSwitchButton.setOverBackground(null);
cardSwitchButton.setFont(DEFAULT_FRFT);
} else {
Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true);
if (font != null) {
cardSwitchButton.setFont(font);
}
if (this.initialBackground != null){
this.xCardSwitchButton.setSelectBackground(this.initialBackground);
cardSwitchButton.setInitialBackground(this.initialBackground);

Loading…
Cancel
Save