Browse Source

无JIRA任务 tab布局字体、字号无法修改,release同步到dev

master
zhouping 8 years ago
parent
commit
7d077a4653
  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

@ -48,7 +48,6 @@ public class XCardSwitchButton extends XButton {
//设置的图片类型 //设置的图片类型
private static final String COLOR_BACKGROUND_TYPE = "ColorBackground"; private static final String COLOR_BACKGROUND_TYPE = "ColorBackground";
private static final String DEFAULT_TYPE = "default"; private static final String DEFAULT_TYPE = "default";
private static final String DEFAULT_FONT_NAME = "SimSun";
//默认颜色 //默认颜色
public static final Color NORMAL_GRAL = new Color(236,236,236); public static final Color NORMAL_GRAL = new Color(236,236,236);
@ -67,7 +66,6 @@ public class XCardSwitchButton extends XButton {
private static final int FONT_SIZE_ADJUST = 2; private static final int FONT_SIZE_ADJUST = 2;
private static final int SIDE_OFFSET = 57; private static final int SIDE_OFFSET = 57;
private static final int FONT_SIZE = 9;
private XWCardLayout cardLayout; private XWCardLayout cardLayout;
private XWCardTagLayout tagLayout; private XWCardTagLayout tagLayout;
@ -345,10 +343,7 @@ public class XCardSwitchButton extends XButton {
// 标题部分 // 标题部分
WidgetTitle title = style.getTitle(); WidgetTitle title = style.getTitle();
FRFont font = button.getFont(); FRFont font = title.getFrFont();
if (font == null) {
font = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST); FRFont newFont = FRFont.getInstance(font.getName(),font.getStyle(),font.getSize() + FONT_SIZE_ADJUST);
UILabel label = this.getContentLabel(); UILabel label = this.getContentLabel();
label.setFont(newFont); label.setFont(newFont);
@ -427,9 +422,6 @@ public class XCardSwitchButton extends XButton {
XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i); XCardSwitchButton temp = (XCardSwitchButton) this.tagLayout.getComponent(i);
CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData(); CardSwitchButton cardSwitchButton = (CardSwitchButton) temp.toData();
FRFont frFont = cardSwitchButton.getFont(); FRFont frFont = cardSwitchButton.getFont();
if (frFont == null) {
frFont = FRFont.getInstance(DEFAULT_FONT_NAME, 0, FONT_SIZE);
}
UILabel label = temp.getContentLabel(); UILabel label = temp.getContentLabel();
label.setSize(dimension); label.setSize(dimension);
label.setFont(frFont.applyResolutionNP(ScreenResolution.getScreenResolution())); 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; 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.base.background.ColorBackground;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRTabFitLayoutAdapter;
@ -16,25 +10,25 @@ import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; 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.editors.ImgBackgroundEditor;
import com.fr.design.mainframe.widget.renderer.FontCellRenderer;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.FRFont;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.border.Border;
import java.awt.*;
import java.beans.IntrospectionException;
/** /**
* @author focus * @author focus
@ -46,14 +40,10 @@ public class XWTabFitLayout extends XWFitLayout {
// tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件 // tab布局在拖拽导致的缩放里(含间隔时),如果拖拽宽高大于组件宽高,会导致调整的时候找不到原来的组件
// 这里先将拖拽之前的宽高先做备份 // 这里先将拖拽之前的宽高先做备份
private static final Color NORMAL_GRAL = new Color(236,236,236); 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 Dimension referDim;
private Background initialBackground; private Background initialBackground;
private Background overBackground; private Background overBackground;
private Background clickBackground; private Background clickBackground;
private FRFont font;
private XCardSwitchButton xCardSwitchButton; private XCardSwitchButton xCardSwitchButton;
public Dimension getReferDim() { public Dimension getReferDim() {
@ -88,15 +78,6 @@ public class XWTabFitLayout extends XWFitLayout {
this.clickBackground = clickBackground; this.clickBackground = clickBackground;
} }
@Override
public FRFont getFont() {
return font;
}
public void setFont(FRFont font) {
this.font = font;
}
public XCardSwitchButton getxCardSwitchButton() { public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton; return xCardSwitchButton;
} }
@ -164,21 +145,7 @@ public class XWTabFitLayout extends XWFitLayout {
cardSwitchButton.setClickBackground(clickBackground); 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);
}
}),
}; };
} }
@ -210,9 +177,6 @@ public class XWTabFitLayout extends XWFitLayout {
XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass(
ImgBackgroundEditor.class).setI18NName(Inter.getLocText("FR-Designer_Background-Click")).putKeyValue( 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") XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
}; };
return crPropertyDescriptors[i]; return crPropertyDescriptors[i];
@ -243,20 +207,15 @@ public class XWTabFitLayout extends XWFitLayout {
if (!isStyle) { if (!isStyle) {
this.xCardSwitchButton.setCustomStyle(false); this.xCardSwitchButton.setCustomStyle(false);
this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.getLabel().setFont(DEFAULTFT);
cardSwitchButton.setInitialBackground(null); cardSwitchButton.setInitialBackground(null);
cardSwitchButton.setClickBackground(null); cardSwitchButton.setClickBackground(null);
cardSwitchButton.setOverBackground(null); cardSwitchButton.setOverBackground(null);
cardSwitchButton.setFont(DEFAULT_FRFT);
} else { } else {
Background initialBackground = cardSwitchButton.getInitialBackground(); Background initialBackground = cardSwitchButton.getInitialBackground();
bg = initialBackground == null ? bg : initialBackground; bg = initialBackground == null ? bg : initialBackground;
this.xCardSwitchButton.setSelectBackground(bg); this.xCardSwitchButton.setSelectBackground(bg);
this.xCardSwitchButton.setCustomStyle(true); this.xCardSwitchButton.setCustomStyle(true);
cardSwitchButton.setCustomStyle(true); cardSwitchButton.setCustomStyle(true);
if (font != null) {
cardSwitchButton.setFont(font);
}
if (this.initialBackground != null){ if (this.initialBackground != null){
this.xCardSwitchButton.setSelectBackground(this.initialBackground); this.xCardSwitchButton.setSelectBackground(this.initialBackground);
cardSwitchButton.setInitialBackground(this.initialBackground); cardSwitchButton.setInitialBackground(this.initialBackground);

Loading…
Cancel
Save