Browse Source

代码修改

research/10.0
kerry 6 years ago
parent
commit
2d878197dc
  1. 4
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileStyleDefinePane.java
  2. 35
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java
  3. 13
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  4. 33
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java
  5. 17
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java

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

@ -80,11 +80,13 @@ public class DefaultMobileStyleDefinePane extends MobileTemplateStyleDefinePane
WCardTagLayout cardTagLayout = DefaultMobileStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();
g2d.setFont(frFont);
int fontHeight = fm.getHeight();
int ascentHeight = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String widgetName = cardSwitchButton.getText();
int width = fm.stringWidth(widgetName);
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2);
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight);
if (i == 0) {
g2d.setStroke(new BasicStroke(2.0f));
g2d.drawLine(0, panelHeight - 1, eachWidth, panelHeight - 1);

35
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DownMenuStyleDefinePane.java

@ -5,6 +5,7 @@ import com.fr.base.IconManager;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
@ -15,15 +16,18 @@ import com.fr.general.cardtag.mobile.DownMenuStyle;
import com.fr.general.cardtag.mobile.LineDescription;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.util.ArrayList;
public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
@ -36,6 +40,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
}
protected void createExtraConfPane(JPanel centerPane) {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
UITitleSplitLine iconSplitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"), 520);
iconSplitLine.setPreferredSize(new Dimension(520, 20));
centerPane.add(iconSplitLine);
@ -51,8 +57,8 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
JPanel selectIconContainePane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectIconLabel, selectIconConfigPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
initIconContainPane.setPreferredSize(new Dimension(240, 50));
selectIconContainePane.setPreferredSize(new Dimension(240, 50));
centerPane.add(initIconContainPane);
centerPane.add(selectIconContainePane);
panel.add(initIconContainPane);
panel.add(selectIconContainePane);
UITitleSplitLine splitLine = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Spit_Line"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
splitLinePane = new LinePane();
@ -62,6 +68,7 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
updatePreviewPane();
}
});
centerPane.add(panel);
centerPane.add(splitLine);
centerPane.add(splitLinePane);
}
@ -122,8 +129,10 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
}
public class DownMenuStylePreviewPane extends MobileTemplatePreviewPane {
private LineDescription splitLine;
private static final int ICON_OFFSET = 16;
private static final int GAP = 6;
private static final String PAINT_ICON = "fund_white";
private LineDescription splitLine;
public DownMenuStylePreviewPane() {
this.setBackground(Color.decode("#3888EE"));
@ -145,21 +154,31 @@ public class DownMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
WCardTagLayout cardTagLayout = DownMenuStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setFont(frFont);
int fontHeight = fm.getHeight();
int ascent = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground());
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String widgetName = cardSwitchButton.getText();
int width = fm.stringWidth(widgetName);
if(i == 0){
Color oldColor = g2d.getColor();
g2d.setColor(this.getSelectColor());
g2d.fillRect(0, 0 ,eachWidth, panelHeight);
g2d.setColor(oldColor);
}
String iconName = PAINT_ICON;
g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - 18) / 2, 6, null);
g2d.drawString(widgetName, (eachWidth - width) / 2, panelHeight / 2 + 9);
g2d.drawImage(IconManager.getIconManager().getIconImage(iconName), (eachWidth - ICON_OFFSET) / 2, (panelHeight - ICON_OFFSET - GAP - fontHeight) / 2, null);
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight + ICON_OFFSET + GAP - fontHeight) / 2 + ascent);
Stroke oldStroke = g2d.getStroke();
if (splitLine.getLineStyle() != 0) {
g2d.setColor(splitLine.getColor());
g2d.setStroke(GraphHelper.getStroke(splitLine.getLineStyle()));
g2d.drawLine(eachWidth, 0, eachWidth, panelHeight);
}
g2d.setStroke(oldStroke);
g2d.translate(eachWidth, 0);
}

13
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -142,13 +142,12 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
});
UILabel fillLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Fill"));
fillLabel.setPreferredSize(new Dimension(55, 20));
JPanel boxFlowPane = GUICoreUtils.createBoxFlowInnerContainerPane(10, 0);
boxFlowPane.add(fillLabel);
boxFlowPane.add(initialColorBox);
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{fillLabel, initialColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel.setPreferredSize(new Dimension(240, 20));
initialColorBox.setPreferredSize(new Dimension(157, 20));
boxFlowPane.setPreferredSize(new Dimension(500, 20));
boxFlowPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 20));
return boxFlowPane;
jPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
return jPanel;
}
protected JPanel createFontConfPane() {
@ -180,7 +179,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
@Override
public void populateBean(MobileTemplateStyle ob) {
centerPane.setVisible(ob.isCustom());
custom.setSelectedItem(ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") :
custom.setSelectedItem(!ob.isCustom() ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default") :
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Engine_Custom"));
initialColorBox.setSelectObject(ob.getInitialColor());
fontConfPane.populate(ob.getTabFontConfig().getFont());

33
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SliderStyleDefinePane.java

@ -1,8 +1,10 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.base.GraphHelper;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.mainframe.widget.preview.MobileTemplatePreviewPane;
@ -12,12 +14,15 @@ import com.fr.general.FRFont;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import com.fr.general.cardtag.mobile.SliderStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
@ -53,6 +58,8 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
protected void createExtraConfPane(JPanel centerPane) {
JPanel panel = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 5, 20));
UITitleSplitLine dotIndicator = new UITitleSplitLine(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Dot_Indicator"), 520);
dotIndicator.setPreferredSize(new Dimension(520, 20));
centerPane.add(dotIndicator);
@ -79,9 +86,9 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
initDotColorPane.setPreferredSize(new Dimension(240, 20));
selectDotColorPane.setPreferredSize(new Dimension(240, 20));
centerPane.add(initDotColorPane);
centerPane.add(selectDotColorPane);
panel.add(initDotColorPane);
panel.add(selectDotColorPane);
centerPane.add(panel);
}
@Override
@ -105,6 +112,9 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
public class SliderStylePreviewPane extends MobileTemplatePreviewPane {
private static final int CIRCLE_SIZE = 6;
private static final int GAP = 4;
private static final int OFFSET_X = 10;
private Color initDotColor;
private Color selectDotColor;
@ -119,23 +129,28 @@ public class SliderStyleDefinePane extends MobileTemplateStyleDefinePane {
@Override
public void paint(Graphics g) {
super.paint(g);
Dimension dimension = this.getSize();
int panelHeight = dimension.height;
Graphics2D g2d = (Graphics2D) g.create();
FRFont frFont = this.getTabFontConfig().getFont();
g2d.setFont(frFont);
g2d.setColor(frFont.getForeground());
g2d.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Title"), 10, 18);
FontMetrics fm = GraphHelper.getFontMetrics(frFont);
int fontHeight = fm.getHeight();
int ascent = fm.getAscent();
g2d.drawString(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Slider_Title"), OFFSET_X, (panelHeight - fontHeight - GAP - CIRCLE_SIZE) / 2 + ascent);
WCardTagLayout cardTagLayout = SliderStyleDefinePane.this.getTagLayout();
g2d.translate(10, 25);
g2d.translate(OFFSET_X, (panelHeight + fontHeight + GAP - CIRCLE_SIZE) / 2);
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
if (i == 0) {
g2d.setColor(selectDotColor);
g2d.fillOval(0, 0, 6, 6);
g2d.translate(9, 0);
g2d.fillOval(0, 0, CIRCLE_SIZE, CIRCLE_SIZE);
g2d.translate(CIRCLE_SIZE + GAP, 0);
continue;
}
g2d.setColor(initDotColor);
g2d.fillOval(0, 0, 6, 6);
g2d.translate(9, 0);
g2d.fillOval(0, 0, CIRCLE_SIZE, CIRCLE_SIZE);
g2d.translate(CIRCLE_SIZE + GAP, 0);
}
}

17
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UpMenuStyleDefinePane.java

@ -21,7 +21,6 @@ import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@ -29,6 +28,7 @@ import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Stroke;
public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
private UIRadioButton gapFix;
@ -177,23 +177,34 @@ public class UpMenuStyleDefinePane extends StyleDefinePaneWithSelectConf {
WCardTagLayout cardTagLayout = UpMenuStyleDefinePane.this.getTagLayout();
int eachWidth = panelWidth / cardTagLayout.getWidgetCount();
g2d.setFont(frFont);
int fontHeight = fm.getHeight();
int ascentHeight = fm.getAscent();
for (int i = 0; i < cardTagLayout.getWidgetCount(); i++) {
g2d.setColor(i == 0 ? selectFontColor : frFont.getForeground());
CardSwitchButton cardSwitchButton = cardTagLayout.getSwitchButton(i);
String widgetName = cardSwitchButton.getText();
int width = fm.stringWidth(widgetName);
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight) / 2);
if(i == 0){
Color oldColor = g2d.getColor();
g2d.setColor(this.getSelectColor());
g2d.fillRect(0, 0 ,eachWidth, panelHeight);
g2d.setColor(oldColor);
}
g2d.drawString(widgetName, (eachWidth - width) / 2, (panelHeight - fontHeight) / 2 + ascentHeight);
Stroke oldStroke = g2d.getStroke();
if (i == 0) {
g2d.setColor(this.underLine.getColor());
g2d.setStroke(new BasicStroke(2.0f));
g2d.setStroke(GraphHelper.getStroke(underLine.getLineStyle()));
int underLineX = this.isGapFix ? (eachWidth - width) / 2 : 0;
int underLineWidth = this.isGapFix ? width : eachWidth;
g2d.drawLine(underLineX, panelHeight - 1, underLineX + underLineWidth, panelHeight - 1);
}
if (bottomBorder.getLineStyle() != 0) {
g2d.setColor(bottomBorder.getColor());
g2d.setStroke(GraphHelper.getStroke(bottomBorder.getLineStyle()));
g2d.drawLine(eachWidth, 0, eachWidth, panelHeight);
}
g2d.setStroke(oldStroke);
g2d.translate(eachWidth, 0);
}

Loading…
Cancel
Save