Browse Source

Merge pull request #690 in DESIGN/design from ~KERRY/design_10.0:release/10.0 to release/10.0

* commit 'bc5b9fa6be762fef04345165e30d9631d51ea401':
  MOBILE-18837【RN】表单》tabpane》移动端样式模板设为默认,tabpane一些字体属性不生效
bugfix/10.0
kerry 6 years ago
parent
commit
572a518581
  1. 15
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java
  3. 5
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

15
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java

@ -7,7 +7,10 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle; import com.fr.general.cardtag.mobile.DefaultMobileTemplateStyle;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.TabFontConfig;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
@ -41,17 +44,17 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
@Override @Override
public MobileTemplateStyle updateBean() { public MobileTemplateStyle updateBean() {
return new DefaultMobileTemplateStyle(); return getDefaultTemplateStyle();
} }
public MobileTemplateStyle updateConfig(){ public MobileTemplateStyle updateConfig(){
return new DefaultMobileTemplateStyle(); return getDefaultTemplateStyle();
} }
@Override @Override
protected MobileTemplateStyle getDefaultTemplateStyle() { protected MobileTemplateStyle getDefaultTemplateStyle() {
return new DefaultMobileTemplateStyle(); return new DefaultMobileTemplateStyle(new TabFontConfig(getTagLayout().getTitleFont()));
} }
@Override @Override
@ -74,6 +77,10 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR); this.setBackground(DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR);
} }
public Color getInitialColor() {
return DefaultMobileTemplateStyle.DEFAULT_INITIAL_COLOR;
}
public void repaint() { public void repaint() {
super.repaint(); super.repaint();
} }
@ -94,11 +101,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
int fontHeight = fm.getHeight(); int fontHeight = fm.getHeight();
int ascentHeight = fm.getAscent(); int ascentHeight = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) { for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setColor(frFont.getForeground());
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i); CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth); String displayName = calculateDisplayName(cardSwitchButton.getText(), fm, eachWidth);
int width = fm.stringWidth(displayName); int width = fm.stringWidth(displayName);
g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight); g2d.drawString(displayName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight);
if (i == 0) { if (i == 0) {
g2d.setColor(Color.BLACK);
g2d.setStroke(new BasicStroke(2.0f)); g2d.setStroke(new BasicStroke(2.0f));
g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1); g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1);
} }

5
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TemplateStyleDefinePaneFactory.java

@ -24,9 +24,10 @@ public class TemplateStyleDefinePaneFactory {
public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) { public static BasicBeanPane<MobileTemplateStyle> createDefinePane(String style, WCardTagLayout tagLayout) {
StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style); StyleDefinePaneUI styleDefinePaneUI = defineMap.get(style);
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = styleDefinePaneUI.getaClass(); if(styleDefinePaneUI == null){
if (clazz == null) { styleDefinePaneUI = defineMap.get(DefaultMobileTemplateStyle.STYLE_NAME);
} }
Class<? extends BasicBeanPane<MobileTemplateStyle>> clazz = styleDefinePaneUI.getaClass();
BasicBeanPane<MobileTemplateStyle> quickPane = null; BasicBeanPane<MobileTemplateStyle> quickPane = null;
try { try {
quickPane = Reflect.on(clazz).create(tagLayout).get(); quickPane = Reflect.on(clazz).create(tagLayout).get();

5
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -115,6 +115,7 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
templateStyleEditor.setValue(ob.getTemplateStyle()); templateStyleEditor.setValue(ob.getTemplateStyle());
FRFont frFont = layoutBorderStyle.getTitle().getFrFont(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont();
if (frFont != null) { if (frFont != null) {
ob.setTitleFont(frFont);
frFontPane.populateBean(frFont); frFontPane.populateBean(frFont);
} }
} }
@ -126,8 +127,10 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart(); XWCardLayout xCardLayout = ((XWCardMainBorderLayout) topLayout).getCardPart();
LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle(); LayoutBorderStyle layoutBorderStyle = xCardLayout.toData().getBorderStyle();
FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont(); FRFont frFont = layoutBorderStyle.getTitle().getFrFont() == null ? FRFont.getInstance() : layoutBorderStyle.getTitle().getFrFont();
layoutBorderStyle.getTitle().setFrFont(frFontPane.update(frFont)); FRFont titleFont = frFontPane.update(frFont);
layoutBorderStyle.getTitle().setFrFont(titleFont);
WCardTagLayout layout = (WCardTagLayout) creator.toData(); WCardTagLayout layout = (WCardTagLayout) creator.toData();
layout.setTitleFont(titleFont);
boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType(); boolean isHori = displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.TOP_POSITION.getType() || displayPositionGroup.getSelectedIndex() == WTabDisplayPosition.BOTTOM_POSITION.getType();
if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"))) { if (ComparatorUtils.equals(getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Tab_Style_Template"))) {
layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex())); layout.setDisplayPosition(WTabDisplayPosition.parse(displayPositionGroup.getSelectedIndex()));

Loading…
Cancel
Save