diff --git a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java index 5a3fb62b5..1908751c6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java @@ -1,12 +1,14 @@ package com.fr.design.gui.date; import com.fr.design.gui.itextfield.UINumberField; - +import com.fr.design.utils.DesignUtils; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; -import java.awt.*; +import java.awt.Dimension; +import java.awt.Insets; +import java.awt.Toolkit; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; @@ -21,7 +23,7 @@ public class CalendarNumberField extends UINumberField { private static final int NUM_TEN = 10; - public CalendarNumberField( double maxValue) { + public CalendarNumberField(double maxValue) { super(2, 0, 0, maxValue); this.setBorderPainted(false); addFocusListener(new FocusAdapter() { @@ -30,12 +32,12 @@ public class CalendarNumberField extends UINumberField { setValue(getIntValue()); } }); - this.setFont(new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"),0,12)); + this.setFont(DesignUtils.getDefaultGUIFont()); } public void setValue(int value) { if (value < 0) { - value = (int)getMaxValue(); + value = (int) getMaxValue(); } if (value > getMaxValue()) { value = 0; @@ -43,7 +45,7 @@ public class CalendarNumberField extends UINumberField { this.setText(getValueText(value)); } - public int getIntValue () { + public int getIntValue() { if (this.getText().length() == 0) { return 0; } @@ -61,8 +63,7 @@ public class CalendarNumberField extends UINumberField { } - - public void setFieldDocument(){ + public void setFieldDocument() { setDocument(new NumberDocument()); } @@ -89,14 +90,15 @@ public class CalendarNumberField extends UINumberField { super.insertString(offset, s, a); } - private boolean isOverMaxOrMinValue( String strNew) { - return (Double.parseDouble(strNew)getMaxValue()); + private boolean isOverMaxOrMinValue(String strNew) { + return (Double.parseDouble(strNew) < getMinValue() || Double.parseDouble(strNew) > getMaxValue()); } } public Dimension getPreferredSize() { return new Dimension(24, 11); } + public boolean shouldResponseChangeListener() { return false; } diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java index c21b740c4..fbbe38ce4 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java @@ -7,8 +7,8 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUIPaintUtils; - import com.fr.stable.Constants; import com.fr.stable.StringUtils; @@ -45,8 +45,8 @@ import java.util.Calendar; import java.util.Date; public class UICalendarPanel extends JPanel { - private static final Font FONT_SONG = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"),0,12); - private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"),0,12); + private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(12); + private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, 12); private static final int WEEKDAY_COUNT = 7; private static final int TOTAL_DAYS_COUNT = 42; @@ -108,13 +108,13 @@ public class UICalendarPanel extends JPanel { } // << < yyyy/MM/dd > >> - private JPanel createNorthPane () { + private JPanel createNorthPane() { JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane(); pNorth.setBackground(new Color(0xFFFFFF)); pNorth.setPreferredSize(new Dimension(1, 22)); pNorth.add(Box.createHorizontalStrut(5)); - pNorth.add(createSkipButton(Calendar.YEAR, -1 , new Icon[] { + pNorth.add(createSkipButton(Calendar.YEAR, -1, new Icon[]{ BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_hover.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_reduce_click.png") @@ -130,7 +130,7 @@ public class UICalendarPanel extends JPanel { monthLabel = new UILabel("", UILabel.CENTER); monthLabel.setBackground(new Color(0xFFFFFF)); monthLabel.setForeground(new Color(0x000000)); - monthLabel.setFont(FONT_SONG); + monthLabel.setFont(FONT_UI); pNorth.add(Box.createHorizontalGlue()); pNorth.add(monthLabel); pNorth.add(Box.createHorizontalGlue()); @@ -144,7 +144,7 @@ public class UICalendarPanel extends JPanel { monthPlus.setHorizontalAlignment(SwingConstants.RIGHT); pNorth.add(monthPlus); pNorth.add(Box.createHorizontalStrut(11)); - pNorth.add(createSkipButton(Calendar.YEAR, 1 , new Icon[] { + pNorth.add(createSkipButton(Calendar.YEAR, 1, new Icon[]{ BaseUtils.readIcon("/com/fr/design/images/calender/year_add.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_add_hover.png"), BaseUtils.readIcon("/com/fr/design/images/calender/year_add_click.png") @@ -161,9 +161,9 @@ public class UICalendarPanel extends JPanel { pWeeks.setPreferredSize(new Dimension(216, 22)); pWeeks.setBackground(new Color(0xFFFFFF)); pWeeks.setOpaque(true); - String[] strWeeks = new String[] {StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"),com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat") + String[] strWeeks = new String[]{StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Sun"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Mon"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tue"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Wed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Thu"), + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Fri"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Sat") }; for (int i = 1; i <= WEEKDAY_COUNT; i++) { UILabel label = new UILabel(); @@ -197,32 +197,32 @@ public class UICalendarPanel extends JPanel { return pCenter; } - private JPanel createSouthPane () { + private JPanel createSouthPane() { JPanel sPane = new JPanel(); sPane.setPreferredSize(new Dimension(216, 30)); sPane.setBackground(Color.WHITE); sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6)); UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":"); - timeLabel.setBorder(BorderFactory.createEmptyBorder(0,9,0,5)); - timeLabel.setFont(FONT_SONG); + timeLabel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 5)); + timeLabel.setFont(FONT_UI); sPane.add(timeLabel); hms = new HMSPane(); sPane.add(hms); UILabel gap = new UILabel(); - gap.setPreferredSize(new Dimension(26,1)); + gap.setPreferredSize(new Dimension(26, 1)); sPane.add(gap); UIButton okButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OK")) { public Dimension getPreferredSize() { - return new Dimension(32,18); + return new Dimension(32, 18); } public Insets getInsets() { return new Insets(0, 0, 0, 0); } }; - okButton.setFont(FONT_SONG); + okButton.setFont(FONT_UI); okButton.setVerticalAlignment(SwingConstants.CENTER); okButton.addActionListener(new ActionListener() { @@ -248,11 +248,12 @@ public class UICalendarPanel extends JPanel { /** * 创建上一月,下一月,上一年,下一年"按钮" - * @param field int + * + * @param field int * @param amount int * @return UILabel */ - protected UILabel createSkipButton(final int field, final int amount,final Icon[] icons) { + protected UILabel createSkipButton(final int field, final int amount, final Icon[] icons) { if (icons.length != 3) { return new UILabel(); } @@ -274,11 +275,11 @@ public class UICalendarPanel extends JPanel { } public void mouseEntered(MouseEvent e) { - label.setIcon(icons[1]); + label.setIcon(icons[1]); } public void mouseExited(MouseEvent e) { - label.setIcon(icons[0]); + label.setIcon(icons[0]); } public void mousePressed(MouseEvent e) { @@ -311,7 +312,7 @@ public class UICalendarPanel extends JPanel { gp.setBorder(null); UIDayLabel label = new UIDayLabel(setupCalendar.getTime()); label.setHorizontalAlignment(SwingConstants.RIGHT); - label.setBorder(BorderFactory.createEmptyBorder(0,0,0,9)); + label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 9)); label.addMouseListener(dayBttListener); if ("1".equals(label.getText())) { isCurrentMonth = !isCurrentMonth; @@ -328,7 +329,7 @@ public class UICalendarPanel extends JPanel { days.setSelectedIndex(i); this.selectedDate = label.getDate(); this.calendar.setTime(this.selectedDate); - }else { + } else { gp.add(label, BorderLayout.CENTER); days.add(gp); } @@ -337,7 +338,7 @@ public class UICalendarPanel extends JPanel { } public void updateHMS() { - if (hms != null){ + if (hms != null) { hms.populate(this.calendar); hms.validate(); } @@ -388,9 +389,9 @@ public class UICalendarPanel extends JPanel { public void mousePressed(MouseEvent e) { if (isEnabled()) { UIDayLabel com = (UIDayLabel) e.getComponent(); - GradientPane gp = (GradientPane)com.getParent(); + GradientPane gp = (GradientPane) com.getParent(); if (days.selectedIndex != -1) { - ((GradientPane)days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); + ((GradientPane) days.getComponent(days.selectedIndex)).setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); } gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM)); days.setSelectedIndex(gp.getIndex()); @@ -413,7 +414,7 @@ public class UICalendarPanel extends JPanel { public void mouseEntered(MouseEvent e) { if (isEnabled()) { JComponent com = (JComponent) e.getComponent(); - GradientPane gp = (GradientPane)com.getParent(); + GradientPane gp = (GradientPane) com.getParent(); if (gp.getIndex() == days.selectedIndex) { return; } @@ -426,7 +427,7 @@ public class UICalendarPanel extends JPanel { public void mouseExited(MouseEvent e) { if (isEnabled()) { JComponent com = (JComponent) e.getComponent(); - GradientPane gp = (GradientPane)com.getParent(); + GradientPane gp = (GradientPane) com.getParent(); if (gp.getIndex() != days.selectedIndex) { gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM)); } @@ -489,7 +490,7 @@ public class UICalendarPanel extends JPanel { this.isGradientBackground = isGradientBackground; } - public void paint(Graphics g){ + public void paint(Graphics g) { super.paint(g); if (isGradientBackground && gradientBackground != null) { gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight())); @@ -509,7 +510,7 @@ public class UICalendarPanel extends JPanel { this.index = i; } - public int getIndex () { + public int getIndex() { return this.index; } @@ -530,12 +531,12 @@ public class UICalendarPanel extends JPanel { public DayPane() { floateIndex = -1; selectedIndex = -1; - this.setLayout(new GridLayout(6,7,1,1)); + this.setLayout(new GridLayout(6, 7, 1, 1)); this.setBackground(new Color(0xFFFFFF)); this.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, new Color(0xDADADA))); } - public void paint (Graphics g) { + public void paint(Graphics g) { super.paint(g); int width = 31; int height = 19; @@ -543,11 +544,11 @@ public class UICalendarPanel extends JPanel { g.setColor(new Color(0xDADADA)); int start_x = 30; int start_y = 19; - for (int i = 0; i < 6; i ++) { + for (int i = 0; i < 6; i++) { g.drawLine(start_x, 0, start_x, getHeight()); start_x += width; } - for (int i = 0; i < 5; i ++){ + for (int i = 0; i < 5; i++) { g.drawLine(0, start_y, getWidth(), start_y); start_y += height; } @@ -558,25 +559,25 @@ public class UICalendarPanel extends JPanel { } if (selectedIndex > -1) { g.setColor(selectedColor); - paintChindPane(g,selectedIndex); + paintChindPane(g, selectedIndex); } g.setColor(oldColor); } private void paintChindPane(Graphics g, int index) { - if (index%7 == 0 ) { - int y1 = index/7*19; - g.drawLine(0,y1,30,y1); - g.drawLine(0,y1 + 19, 30, y1 +19); - g.drawLine(30, y1, 30 ,y1 + 19); - }else if (index%7 == 6) { - int y1 = index/7*19; - g.drawLine(185,y1,216,y1); - g.drawLine(185,y1 + 19, 216, y1 +19); - g.drawLine(185, y1, 185 ,y1 + 19); + if (index % 7 == 0) { + int y1 = index / 7 * 19; + g.drawLine(0, y1, 30, y1); + g.drawLine(0, y1 + 19, 30, y1 + 19); + g.drawLine(30, y1, 30, y1 + 19); + } else if (index % 7 == 6) { + int y1 = index / 7 * 19; + g.drawLine(185, y1, 216, y1); + g.drawLine(185, y1 + 19, 216, y1 + 19); + g.drawLine(185, y1, 185, y1 + 19); } else { - int x1 = index%7*31 -1; - int y1 = index/7*19; + int x1 = index % 7 * 31 - 1; + int y1 = index / 7 * 19; g.drawRect(x1, y1, 31, 19); } } @@ -599,7 +600,7 @@ public class UICalendarPanel extends JPanel { } - private class HMSPane extends JPanel{ + private class HMSPane extends JPanel { private boolean isRolOver; private UIButton preButton; private UIButton nextButton; @@ -608,7 +609,7 @@ public class UICalendarPanel extends JPanel { private CalendarNumberField sField; private CalendarNumberField selectedNumberField; - public HMSPane () { + public HMSPane() { this.setPreferredSize(new Dimension(101, 18)); this.setLayout(new BorderLayout(0, 0)); this.setBackground(null); @@ -633,7 +634,7 @@ public class UICalendarPanel extends JPanel { } private void initComponents() { - JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT,0,2)); + JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2)); jp.setBackground(null); jp.setBorder(null); @@ -649,13 +650,13 @@ public class UICalendarPanel extends JPanel { jp.add(sField); this.add(jp, BorderLayout.CENTER); - preButton = new UIButton(UIConstants.ARROW_UP_ICON){ + preButton = new UIButton(UIConstants.ARROW_UP_ICON) { public boolean shouldResponseChangeListener() { return false; } }; preButton.setRoundBorder(true, Constants.LEFT); - nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON){ + nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) { public boolean shouldResponseChangeListener() { return false; } @@ -673,7 +674,7 @@ public class UICalendarPanel extends JPanel { MouseAdapter backgroundAdapter = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { - HMSPane.this.selectedNumberField = (CalendarNumberField)e.getComponent(); + HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent(); } @Override @@ -710,17 +711,17 @@ public class UICalendarPanel extends JPanel { }); } - private UILabel createGapLabel () { + private UILabel createGapLabel() { UILabel uiLabel = new UILabel(":"); uiLabel.setHorizontalAlignment(SwingConstants.CENTER); uiLabel.setBackground(null); uiLabel.setBorder(null); - uiLabel.setPreferredSize(new Dimension(6,10)); + uiLabel.setPreferredSize(new Dimension(6, 10)); return uiLabel; } public Insets getInsets() { - return new Insets(1,3,1,0); + return new Insets(1, 3, 1, 0); } public void paint(Graphics g) { @@ -729,7 +730,7 @@ public class UICalendarPanel extends JPanel { } public void paintBorder(Graphics g) { - Graphics2D g2d = (Graphics2D)g; + Graphics2D g2d = (Graphics2D) g; if (isRolOver) { Shape shape = new RoundRectangle2D.Double(1, 1, 86, 15, UIConstants.ARC, UIConstants.ARC); GUIPaintUtils.paintBorderShadow(g2d, 3, shape, UIConstants.HOVER_BLUE, Color.WHITE); @@ -738,7 +739,7 @@ public class UICalendarPanel extends JPanel { } } - public void populate(Calendar calendar){ + public void populate(Calendar calendar) { this.hField.setValue(calendar.get(Calendar.HOUR_OF_DAY)); this.mField.setValue(calendar.get(Calendar.MINUTE)); this.sField.setValue(calendar.get(Calendar.SECOND)); @@ -751,15 +752,15 @@ public class UICalendarPanel extends JPanel { } } - public static void main(String[] args){ + public static void main(String[] args) { JFrame frame = new JFrame(); UICalendarPanel calendarPanel = new UICalendarPanel(); final UITextField field = new UITextField(); field.setPreferredSize(new Dimension(120, 25)); - calendarPanel.addDateChangeListener(new ChangeListener(){ - public void stateChanged(ChangeEvent e){ - Date selectedDate = (Date)e.getSource(); + calendarPanel.addDateChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + Date selectedDate = (Date) e.getSource(); SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd"); field.setText(f.format(selectedDate)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java index 0ba64b3f6..06f30e1ae 100644 --- a/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java +++ b/designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java @@ -1,14 +1,13 @@ package com.fr.design.gui.date; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.utils.DesignUtils; import java.awt.Dimension; -import java.awt.Font; import java.text.SimpleDateFormat; import java.util.Date; - public class UIDayLabel extends UILabel { private Date date = null; @@ -28,13 +27,13 @@ public class UIDayLabel extends UILabel { public UIDayLabel(Date date, boolean isSmallLabel) { setHorizontalAlignment(UILabel.CENTER); - setFont(new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Song_TypeFace"), 0, 12)); + setFont(DesignUtils.getDefaultGUIFont()); this.date = date; setPreferredSize(new Dimension(30, 18)); if (isSmallLabel) { setText(dayFormat.format(date)); } else { - setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today")+":" + dateFormat.format(new Date())); + setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today") + ":" + dateFormat.format(new Date())); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java index 7d12a013e..3f5fff689 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/ReportletPane.java @@ -1,16 +1,18 @@ package com.fr.design.gui.itree.filetree; -import com.fr.base.FRContext; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.itextarea.UITextArea; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.filetree.IOFileNodeFilter; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -32,7 +34,7 @@ public class ReportletPane extends BasicPane { textPane.setEditable(false); textPane.setLineWrap(true); - textPane.setFont(FRContext.getDefaultValues().getFRFont().deriveFont(Font.BOLD, 12)); + textPane.setFont(DesignUtils.getDefaultGUIFont().applyStyle(Font.BOLD)); textPane.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Schedule_The_Selected_File_Must_Be_End_With_Filter")); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @@ -41,6 +43,7 @@ public class ReportletPane extends BasicPane { switchButton = new UIButton("switch"); centerPane.add(GUICoreUtils.createBorderPane(switchButton, BorderLayout.WEST), BorderLayout.NORTH); switchButton.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { switchCardPane(t_panel.isVisible()); } @@ -50,12 +53,12 @@ public class ReportletPane extends BasicPane { centerPane.add(cardPane, BorderLayout.CENTER); cardPane.setLayout(card = new CardLayout()); templateReportletTree = new TemplateFileTree(); - IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class",".frm",".form"}); + IOFileNodeFilter filter = new IOFileNodeFilter(new String[]{".cpt", ".class", ".frm", ".form"}); templateReportletTree.setFileNodeFilter(filter); cardPane.add(t_panel = new JScrollPane(templateReportletTree), "TEMPLATE"); classReportletTree = new ClassFileTree(); cardPane.add(c_panel = new JScrollPane(classReportletTree), "CLASS"); - + this.refreshEnv(); } @@ -75,8 +78,9 @@ public class ReportletPane extends BasicPane { /** * 检查是否符合规范 * - * @throws Exception 抛错 + * @throws Exception 抛错 */ + @Override public void checkValid() throws Exception { String path = this.getSelectedReportletPath(); if (path == null) { @@ -89,7 +93,7 @@ public class ReportletPane extends BasicPane { * 刷新Env */ public void refreshEnv() { - + this.templateReportletTree.refreshEnv(); this.classReportletTree.refreshEnv(); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 76422555f..66a77e1c2 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -1,7 +1,6 @@ package com.fr.design.mainframe; import com.fr.base.FRContext; - import com.fr.base.svg.IconUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; @@ -16,9 +15,9 @@ import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.menu.SnapChatUtil; import com.fr.design.notification.SnapChat; import com.fr.design.ui.util.UIUtil; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUIPaintUtils; -import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; @@ -1251,7 +1250,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { super.paint(g); Image button; g.setColor(new Color(69, 135, 255)); - g.setFont(FRFont.getInstance().applySize(14)); + g.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); if (buttonType.equals(NO_BUTTON)) { return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java b/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java index 487d18a56..0c17adcd4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JSliderPane.java @@ -13,9 +13,9 @@ import com.fr.design.gui.ispinner.UISpinnerUI; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; - import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.JButton; @@ -37,7 +37,6 @@ import java.awt.Component; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; @@ -60,7 +59,6 @@ public class JSliderPane extends JPanel { private static final double ONEPOINTEIGHT = 1.8; private static final int SIX = 6; private static final int TEN = 10; - private static final int FONT_SIZE = 12; private static final int SPINNER_WIDTH = 45; private static final int SPINNER_HEIGHT = 20; private static final int HALF_HUNDRED = 50; @@ -194,9 +192,9 @@ public class JSliderPane extends JPanel { fiveTenButton = new UIRadioButton("50%"); twoFiveButton = new UIRadioButton("25%"); selfAdaptButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Self_Adapt_Button")); - selfAdaptButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); + selfAdaptButton.setFont(DesignUtils.getDefaultGUIFont()); customButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Scale_Custom_Button")); - customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); + customButton.setFont(DesignUtils.getDefaultGUIFont()); twoHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener); sevenFiveButton.addItemListener(radioButtonItemListener); @@ -265,7 +263,7 @@ public class JSliderPane extends JPanel { JPanel spinnerPanel = new JPanel(new FlowLayout()); spinnerPanel.add(showValSpinner); UILabel percent = new UILabel("%"); - percent.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); + percent.setFont(DesignUtils.getDefaultGUIFont()); spinnerPanel.add(percent); spinnerPanel.setBackground(BACK_COLOR); return spinnerPanel; diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java index 9a627ab2c..894a8ebda 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XButton.java @@ -14,11 +14,11 @@ import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.mainframe.widget.editors.ShortCutTextEditor; import com.fr.design.mainframe.widget.renderer.FontCellRenderer; import com.fr.design.mainframe.widget.renderer.IconCellRenderer; +import com.fr.design.utils.DesignUtils; import com.fr.form.parameter.FormSubmitButton; import com.fr.form.ui.Button; import com.fr.form.ui.FreeButton; import com.fr.general.Background; - import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; @@ -29,7 +29,6 @@ import java.awt.AlphaComposite; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; @@ -41,14 +40,13 @@ import java.beans.IntrospectionException; */ public class XButton extends XWidgetCreator { - public final static Background DEFAULTBG = new GradientBackground(new Color(247,247,247),new Color(210,210,210), GradientBackground.TOP2BOTTOM); - public final static Font DEFAULTFT = new Font("Song_TypeFace",0,12); + public final static Background DEFAULTBG = new GradientBackground(new Color(247, 247, 247), new Color(210, 210, 210), GradientBackground.TOP2BOTTOM); public final static Color DEFAULTFOREGROUNDCOLOR = Color.BLACK; - private Background bg; - private UILabel contentLabel; + private Background bg; + private UILabel contentLabel; public XButton(Button widget, Dimension initSize) { - this(new FreeButton(widget),initSize); + this(new FreeButton(widget), initSize); } public XButton(FreeButton widget, Dimension initSize) { @@ -56,143 +54,146 @@ public class XButton extends XWidgetCreator { } public XButton(FormSubmitButton widget, Dimension initSize) { - super(widget, initSize); + super(widget, initSize); } - public Background getContentBackground() { - return bg; - } + public Background getContentBackground() { + return bg; + } - public void setContentBackground(Background bg) { - this.bg = bg; - } + public void setContentBackground(Background bg) { + this.bg = bg; + } - public UILabel getContentLabel() { - return contentLabel; - } + public UILabel getContentLabel() { + return contentLabel; + } - public void setContentLabel(UILabel contentLabel) { - this.contentLabel = contentLabel; - } + public void setContentLabel(UILabel contentLabel) { + this.contentLabel = contentLabel; + } /** - *根据下拉框选择返回按钮样式的默认设置或自定义设置列表 - * @return 列表 - * @throws IntrospectionException 抛错 + * 根据下拉框选择返回按钮样式的默认设置或自定义设置列表 + * + * @return 列表 + * @throws IntrospectionException 抛错 */ - @Override - public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { - CRPropertyDescriptor[] crp = ((FreeButton) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle(); - - return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), crp); - } - - protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException{ - CRPropertyDescriptor[] crPropertyDescriptors = { - new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( - ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass( - ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass( - ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( - ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font")) - .setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) - .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("hotkeys", this.data.getClass()) - .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setEditorClass(ShortCutTextEditor.class) - - }; + @Override + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + CRPropertyDescriptor[] crp = ((FreeButton) data).isCustomStyle() ? getisCustomStyle() : getisnotCustomStyle(); + + return (CRPropertyDescriptor[]) ArrayUtils.addAll(super.supportedDescriptor(), crp); + } + + protected CRPropertyDescriptor creatNonListenerStyle(int i) throws IntrospectionException { + CRPropertyDescriptor[] crPropertyDescriptors = { + new CRPropertyDescriptor("text", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( + ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("initialBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Initial")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("overBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Over")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("clickBackground", this.data.getClass()).setEditorClass( + ImgBackgroundEditor.class).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Background_Click")).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("font", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font")) + .setEditorClass(FontEditor.class).setRendererClass(FontCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) + .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("hotkeys", this.data.getClass()) + .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setEditorClass(ShortCutTextEditor.class) + + }; return crPropertyDescriptors[i]; } - protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException{ - return new CRPropertyDescriptor[]{ - creatNonListenerStyle(0) .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - setButtonText(((FreeButton) data).getText()); - } - }), - - creatNonListenerStyle(1) .setPropertyChangeListener(new PropertyChangeAdapter() { - @Override - public void propertyChange() { - checkButonType(); - } - }), - creatNonListenerStyle(2).setPropertyChangeListener( - new PropertyChangeAdapter() { - @Override - public void propertyChange() { - bg = ((FreeButton) data).getInitialBackground(); - } - }), - creatNonListenerStyle(3), - creatNonListenerStyle(4), - creatNonListenerStyle(5) .setPropertyChangeListener( - new PropertyChangeAdapter() { - @Override - public void propertyChange() { - FreeButton button = (FreeButton) data; - if (button.getFont() != null) { - contentLabel.setFont(button.getFont().applyResolutionNP( - FontTransformUtil.getDesignerFontResolution())); - contentLabel.setForeground(button.getFont().getForeground()); - } - } - }), - creatNonListenerStyle(6), - creatNonListenerStyle(7) - - }; - } + + protected CRPropertyDescriptor[] getisCustomStyle() throws IntrospectionException { + return new CRPropertyDescriptor[]{ + creatNonListenerStyle(0).setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + setButtonText(((FreeButton) data).getText()); + } + }), + + creatNonListenerStyle(1).setPropertyChangeListener(new PropertyChangeAdapter() { + @Override + public void propertyChange() { + checkButonType(); + } + }), + creatNonListenerStyle(2).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + bg = ((FreeButton) data).getInitialBackground(); + } + }), + creatNonListenerStyle(3), + creatNonListenerStyle(4), + creatNonListenerStyle(5).setPropertyChangeListener( + new PropertyChangeAdapter() { + @Override + public void propertyChange() { + FreeButton button = (FreeButton) data; + if (button.getFont() != null) { + contentLabel.setFont(button.getFont().applyResolutionNP( + FontTransformUtil.getDesignerFontResolution())); + contentLabel.setForeground(button.getFont().getForeground()); + } + } + }), + creatNonListenerStyle(6), + creatNonListenerStyle(7) + + }; + } protected CRPropertyDescriptor[] getisnotCustomStyle() throws IntrospectionException { - return new CRPropertyDescriptor[]{ - new CRPropertyDescriptor("text", this.data.getClass()) - .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - setButtonText(((FreeButton) data).getText()); - } - }), - new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( - ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setPropertyChangeListener(new PropertyChangeAdapter() { - - @Override - public void propertyChange() { - checkButonType(); - } - }), - new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) - .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( - XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), - new CRPropertyDescriptor("hotkeys", this.data.getClass()).setI18NName( - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) - .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") - .setEditorClass(ShortCutTextEditor.class) - - - }; + return new CRPropertyDescriptor[]{ + new CRPropertyDescriptor("text", this.data.getClass()) + .setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + setButtonText(((FreeButton) data).getText()); + } + }), + new CRPropertyDescriptor("customStyle", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Style")).setEditorClass( + ButtonTypeEditor.class).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setPropertyChangeListener(new PropertyChangeAdapter() { + + @Override + public void propertyChange() { + checkButonType(); + } + }), + new CRPropertyDescriptor("iconName", this.data.getClass()).setI18NName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")) + .setEditorClass(IconEditor.class).setRendererClass(IconCellRenderer.class).putKeyValue( + XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced"), + new CRPropertyDescriptor("hotkeys", this.data.getClass()).setI18NName( + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")) + .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Fine-Design_Basic_Advanced") + .setEditorClass(ShortCutTextEditor.class) + + + }; } + @Override protected JComponent initEditor() { if (editor == null) { @@ -202,110 +203,114 @@ public class XButton extends XWidgetCreator { return editor; } - protected UILabel initContentLabel() { - return new UILabel(); - } + protected UILabel initContentLabel() { + return new UILabel(); + } - @Override - public void paintComponent(Graphics g) { - super.paintComponent(g); + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); //不可见时,按钮.4f透明 - AlphaComposite composite = this.data.isVisible() ? (AlphaComposite)((Graphics2D)g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER,HALF_OPACITY); - ((Graphics2D)g).setComposite(composite); - Dimension panelSize = (contentLabel).getSize(); - if(bg != null) { - bg.paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight())); - } - } - - public void setButtonText(String text) { - contentLabel.setText(text); - } - - private void checkButonType() { - UILabel l = contentLabel; - FreeButton button = (FreeButton) data; - - if (!button.isCustomStyle()) { - l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148))); - bg = DEFAULTBG; - contentLabel.setFont(DEFAULTFT); + AlphaComposite composite = this.data.isVisible() ? (AlphaComposite) ((Graphics2D) g).getComposite() : AlphaComposite.getInstance(AlphaComposite.SRC_OVER, HALF_OPACITY); + ((Graphics2D) g).setComposite(composite); + Dimension panelSize = (contentLabel).getSize(); + if (bg != null) { + bg.paint(g, new Rectangle2D.Double(0, 0, panelSize.getWidth(), panelSize.getHeight())); + } + } + + public void setButtonText(String text) { + contentLabel.setText(text); + } + + private void checkButonType() { + UILabel l = contentLabel; + FreeButton button = (FreeButton) data; + + if (!button.isCustomStyle()) { + l.setBorder(BorderFactory.createLineBorder(new Color(148, 148, 148))); + bg = DEFAULTBG; + contentLabel.setFont(DesignUtils.getDefaultGUIFont()); contentLabel.setForeground(DEFAULTFOREGROUNDCOLOR); editor.setLayout(new BorderLayout()); - editor.add(l, BorderLayout.CENTER); - } else { - l.setBorder(null); - editor.setLayout(new BorderLayout()); - editor.add(l,BorderLayout.CENTER); + editor.add(l, BorderLayout.CENTER); + } else { + l.setBorder(null); + editor.setLayout(new BorderLayout()); + editor.add(l, BorderLayout.CENTER); if (button.getFont() != null) { contentLabel.setFont(button.getFont().applyResolutionNP( - FontTransformUtil.getDesignerFontResolution())); + FontTransformUtil.getDesignerFontResolution())); contentLabel.setForeground(button.getFont().getForeground()); } - l.setBounds(0, 0, button.getButtonWidth() == 0 ? this.getWidth() : button.getButtonWidth(), button - .getButtonHeight() == 0 ? this.getHeight() : button.getButtonHeight()); - bg = button.getInitialBackground(); - } - } + l.setBounds(0, 0, button.getButtonWidth() == 0 ? this.getWidth() : button.getButtonWidth(), button + .getButtonHeight() == 0 ? this.getHeight() : button.getButtonHeight()); + bg = button.getInitialBackground(); + } + } @Override - protected void initXCreatorProperties() { - super.initXCreatorProperties(); - checkButonType(); - UILabel l = contentLabel; - FreeButton button = (FreeButton) data; - l.setText(button.getText()); - if (button.isCustomStyle() && button.getFont() != null) { - l.setFont(button.getFont().applyResolutionNP(FontTransformUtil.getDesignerFontResolution())); - l.setForeground(button.getFont().getForeground()); - } - - l.setVerticalAlignment(SwingConstants.CENTER); - l.setHorizontalAlignment(SwingConstants.CENTER); - if (button.getButtonHeight() > 0 && button.getButtonWidth() > 0) { - this.setSize(button.getButtonWidth(), button.getButtonHeight()); - l.setSize(button.getButtonWidth(), button.getButtonHeight()); - XLayoutContainer parent; - if ((parent = XCreatorUtils.getParentXLayoutContainer(this)) instanceof XWAbsoluteLayout) { - ((XWAbsoluteLayout) parent).toData().setBounds(toData(), getBounds()); - } - } - l.setEnabled(button.isEnabled()); - } + protected void initXCreatorProperties() { + super.initXCreatorProperties(); + checkButonType(); + UILabel l = contentLabel; + FreeButton button = (FreeButton) data; + l.setText(button.getText()); + if (button.isCustomStyle() && button.getFont() != null) { + l.setFont(button.getFont().applyResolutionNP(FontTransformUtil.getDesignerFontResolution())); + l.setForeground(button.getFont().getForeground()); + } + + l.setVerticalAlignment(SwingConstants.CENTER); + l.setHorizontalAlignment(SwingConstants.CENTER); + if (button.getButtonHeight() > 0 && button.getButtonWidth() > 0) { + this.setSize(button.getButtonWidth(), button.getButtonHeight()); + l.setSize(button.getButtonWidth(), button.getButtonHeight()); + XLayoutContainer parent; + if ((parent = XCreatorUtils.getParentXLayoutContainer(this)) instanceof XWAbsoluteLayout) { + ((XWAbsoluteLayout) parent).toData().setBounds(toData(), getBounds()); + } + } + l.setEnabled(button.isEnabled()); + } /** * 初始化按钮的Size - * @return 尺寸 + * + * @return 尺寸 */ - public Dimension initEditorSize() { - FreeButton button = (FreeButton) data; - if (checkbutton(button)) { - return new Dimension(button.getButtonWidth(), button.getButtonHeight()); - } - return super.initEditorSize(); - } - private boolean checkbutton(FreeButton button){ - return (button.isCustomStyle() && button.getButtonHeight() > 0 && button.getButtonWidth() > 0) ; + @Override + public Dimension initEditorSize() { + FreeButton button = (FreeButton) data; + if (checkbutton(button)) { + return new Dimension(button.getButtonWidth(), button.getButtonHeight()); + } + return super.initEditorSize(); + } + + private boolean checkbutton(FreeButton button) { + return (button.isCustomStyle() && button.getButtonHeight() > 0 && button.getButtonWidth() > 0); } + @Override protected String getIconName() { return "button_16.png"; } - /** - * data属性改变触发其他操作 - * - */ - public void firePropertyChange(){ - FreeButton button = (FreeButton) data; - setButtonText(button.getText()); - checkButonType(); - if (button.getFont() != null) { - contentLabel.setFont(button.getFont().applyResolutionNP( - FontTransformUtil.getDesignerFontResolution())); - contentLabel.setForeground(button.getFont().getForeground()); - } - - } + /** + * data属性改变触发其他操作 + */ + @Override + public void firePropertyChange() { + FreeButton button = (FreeButton) data; + setButtonText(button.getText()); + checkButonType(); + if (button.getFont() != null) { + contentLabel.setFont(button.getFont().applyResolutionNP( + FontTransformUtil.getDesignerFontResolution())); + contentLabel.setForeground(button.getFont().getForeground()); + } + + } } diff --git a/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java b/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java index 140e294e0..aa4120d41 100644 --- a/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java +++ b/designer-form/src/main/java/com/fr/design/widget/ui/designer/RadioDefinePane.java @@ -1,50 +1,48 @@ package com.fr.design.widget.ui.designer; -import com.fr.base.FRContext; import com.fr.design.designer.creator.XCreator; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.form.ui.Radio; -import com.fr.general.FRFont; - -import javax.swing.*; -import java.awt.*; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Font; /** * @deprecated */ @Deprecated public class RadioDefinePane extends AbstractDataModify { - public RadioDefinePane(XCreator xCreator) { - super(xCreator); - iniComoponents(); - } - - private void iniComoponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - UILabel infoLabel = new UILabel(); - FRFont frFont = FRContext.getDefaultValues().getFRFont(); - infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); - infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( - "Fine-Design_Report_No_Editor_Property_Definition") + "."); - infoLabel.setHorizontalAlignment(SwingConstants.CENTER); - - this.add(infoLabel, BorderLayout.CENTER); - } - - @Override - public String title4PopupWindow() { - return "radio"; - } - - @Override - public void populateBean(Radio cellWidget) { - } - - @Override - public Radio updateBean() { - return (Radio)creator.toData(); - } + public RadioDefinePane(XCreator xCreator) { + super(xCreator); + iniComoponents(); + } + + private void iniComoponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + UILabel infoLabel = new UILabel(); + infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD)); + infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( + "Fine-Design_Report_No_Editor_Property_Definition") + "."); + infoLabel.setHorizontalAlignment(SwingConstants.CENTER); + + this.add(infoLabel, BorderLayout.CENTER); + } + + @Override + public String title4PopupWindow() { + return "radio"; + } + + @Override + public void populateBean(Radio cellWidget) { + } + + @Override + public Radio updateBean() { + return (Radio) creator.toData(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/condition/FontPane.java b/designer-realize/src/main/java/com/fr/design/condition/FontPane.java index 0049c9dd7..48fccc48b 100644 --- a/designer-realize/src/main/java/com/fr/design/condition/FontPane.java +++ b/designer-realize/src/main/java/com/fr/design/condition/FontPane.java @@ -7,13 +7,13 @@ import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.design.style.FRFontPane; import com.fr.design.style.FRFontPreviewArea; -import com.fr.general.FRFont; - +import com.fr.design.utils.DesignUtils; import com.fr.report.cell.cellattr.highlight.FRFontHighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.SwingUtilities; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -60,7 +60,7 @@ public class FontPane extends ConditionAttrSingleConditionPane this.add(frFontPreviewPane); this.add(editFRFontButton); this.add(this.fontScopeComboBox); - this.frFontPreviewPane.setFontObject(FRFont.getInstance()); + this.frFontPreviewPane.setFontObject(DesignUtils.getDefaultGUIFont()); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java index 4cebe741c..3946c9cbc 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/AlphaFineConstants.java @@ -1,6 +1,7 @@ package com.fr.design.mainframe.alphafine; import com.fr.base.extension.FileExtension; +import com.fr.design.utils.DesignUtils; import com.fr.general.CloudCenter; import java.awt.Color; @@ -73,15 +74,15 @@ public class AlphaFineConstants { public static final String HIGH_LIGHT_COLOR = "rgb(51,148,240)"; - public static final Font SMALL_FONT = new Font("Song_TypeFace", 0, 10); + public static final Font SMALL_FONT = DesignUtils.getDefaultGUIFont().applySize(10); - public static final Font MEDIUM_FONT = new Font("Song_TypeFace", 0, 12); + public static final Font MEDIUM_FONT = DesignUtils.getDefaultGUIFont().applySize(12); public static final Font MEDIUM_FONT_ANOTHER = new Font("HiraginoSansGB-W3", 0, 12); - public static final Font LARGE_FONT = new Font("Song_TypeFace", 0, 18); + public static final Font LARGE_FONT = DesignUtils.getDefaultGUIFont().applySize(18); - public static final Font GREATER_FONT = new Font("Song_TypeFace", 0, 20); + public static final Font GREATER_FONT = DesignUtils.getDefaultGUIFont().applySize(20); public static final String IMAGE_URL = "/com/fr/design/mainframe/alphafine/images/"; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java index 738ecf4ef..29a8c1e08 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/preview/NoResultPane.java @@ -3,10 +3,14 @@ package com.fr.design.mainframe.alphafine.preview; import com.bulenkov.iconloader.IconLoader; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.alphafine.AlphaFineConstants; -import com.fr.general.FRFont; +import com.fr.design.utils.DesignUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; /** * Created by XiaXiang on 2017/8/14. @@ -23,7 +27,7 @@ public class NoResultPane extends JPanel { image.setBorder(BorderFactory.createEmptyBorder(100, 0, 0, 0)); UILabel description = new UILabel(title); description.setForeground(AlphaFineConstants.MEDIUM_GRAY); - description.setFont(FRFont.getInstance("SimSun", Font.PLAIN, 14)); + description.setFont(DesignUtils.getDefaultGUIFont().applySize(14)); description.setBorder(BorderFactory.createEmptyBorder(0, 0, 135, 0)); description.setHorizontalAlignment(SwingConstants.CENTER); add(image, BorderLayout.CENTER); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java index 82f8a8484..b37c048e9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/BBSLoginDialog.java @@ -8,16 +8,24 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ipasswordfield.UIPassWordField; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.general.*; +import com.fr.general.CloudCenter; +import com.fr.general.ComparatorUtils; import com.fr.general.http.HttpClient; import com.fr.log.FineLoggerFactory; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; -import javax.swing.*; - -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Desktop; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; @@ -37,7 +45,7 @@ public class BBSLoginDialog extends UIDialog { private static final int DIALOG_WIDTH = 400; private static final int DIALOG_HEIGHT = 200; - private static final Font DEFAULT_FONT = FRFont.getInstance(FRFont.DEFAULT_FONTNAME, 0, 14); + private static final Font DEFAULT_FONT = DesignUtils.getDefaultGUIFont().applySize(14); private static final int TIME_OUT = 10000; private static final int BUTTON_WIDTH = 90; diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java index 4062e0dbe..f1897e148 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportColumnsPane.java @@ -12,6 +12,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.FRFont; import com.fr.general.IOUtils; @@ -32,7 +33,6 @@ import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -59,7 +59,6 @@ public class ReportColumnsPane extends BasicPane{ com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Columns_Repeat_Column") }; - private static final String FONT_NAME = "simsun"; private static final int FONT_SIZE = 14; private UIButtonGroup onOffButtonGroup; @@ -109,7 +108,7 @@ public class ReportColumnsPane extends BasicPane{ onOffButtonGroup.addActionListener(onOffListener); UILabel uiLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns")); - FRFont uiLableFont = FRFont.getInstance(FONT_NAME, Font.PLAIN, FONT_SIZE); + FRFont uiLableFont = DesignUtils.getDefaultGUIFont().applySize(FONT_SIZE); uiLabel.setFont(uiLableFont); uiLabel.setHorizontalAlignment(SwingConstants.CENTER); int uiLabelWidth = GraphHelper.getWidth(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportColumns_Columns"), uiLableFont); diff --git a/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java b/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java index fa19c38f8..26acc7751 100644 --- a/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java +++ b/designer-realize/src/main/java/com/fr/design/report/RichTextPane.java @@ -1,12 +1,12 @@ package com.fr.design.report; import com.fr.base.BaseFormula; -import com.fr.base.FRContext; import com.fr.base.Style; import com.fr.design.cell.editor.RichTextToolBar; import com.fr.design.dialog.BasicPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; import com.fr.log.FineLoggerFactory; @@ -37,7 +37,7 @@ public class RichTextPane extends BasicPane { //12号字体有个奇怪的bug, 字体下部分渲染会截断一部分, 换其他字体没问题, 字体改大小也没问题. //直接弄个jtexarea放到jframe里也有同样问题, 不知道是字体渲染bug还是jdk问题 - public static final FRFont DEFAUL_FONT = FRContext.getDefaultValues().getFRFont().applySize(13); + public static final FRFont DEFAUL_FONT = DesignUtils.getDefaultGUIFont().applySize(13); private RichTextEditingPane textPane; //用于populate时动态更新按钮 diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java index 5de31c110..7239a39c1 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/RadioDefinePane.java @@ -1,48 +1,46 @@ package com.fr.design.widget.ui; -import com.fr.base.FRContext; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.form.ui.Radio; -import com.fr.general.FRFont; - -import javax.swing.*; -import java.awt.*; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Font; /** * @deprecated */ @Deprecated public class RadioDefinePane extends AbstractDataModify { - public RadioDefinePane() { - this.iniComoponents(); - } - - private void iniComoponents() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - - UILabel infoLabel = new UILabel(); - FRFont frFont = FRContext.getDefaultValues().getFRFont(); - infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); - infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( - "Fine-Design_Report_No_Editor_Property_Definition") + "."); - infoLabel.setHorizontalAlignment(SwingConstants.CENTER); - - this.add(infoLabel, BorderLayout.CENTER); - } - - @Override - protected String title4PopupWindow() { - return "radio"; - } - - @Override - public void populateBean(Radio cellWidget) { - } - - @Override - public Radio updateBean() { - return new Radio(); - } + public RadioDefinePane() { + this.iniComoponents(); + } + + private void iniComoponents() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + + UILabel infoLabel = new UILabel(); + infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD)); + infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( + "Fine-Design_Report_No_Editor_Property_Definition") + "."); + infoLabel.setHorizontalAlignment(SwingConstants.CENTER); + + this.add(infoLabel, BorderLayout.CENTER); + } + + @Override + protected String title4PopupWindow() { + return "radio"; + } + + @Override + public void populateBean(Radio cellWidget) { + } + + @Override + public Radio updateBean() { + return new Radio(); + } } diff --git a/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java b/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java index a9e5ee3d0..455bf0b12 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/ui/UserEditorDefinePane.java @@ -1,14 +1,13 @@ package com.fr.design.widget.ui; -import com.fr.base.FRContext; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.utils.DesignUtils; import com.fr.form.ui.NameWidget; -import com.fr.general.FRFont; - -import javax.swing.*; -import java.awt.*; +import javax.swing.SwingConstants; +import java.awt.BorderLayout; +import java.awt.Font; public class UserEditorDefinePane extends AbstractDataModify { private NameWidget nWidget; @@ -20,8 +19,7 @@ public class UserEditorDefinePane extends AbstractDataModify { this.setLayout(FRGUIPaneFactory.createBorderLayout()); UILabel infoLabel = new UILabel(); - FRFont frFont = FRContext.getDefaultValues().getFRFont(); - infoLabel.setFont(new Font(frFont.getFamily(), Font.BOLD, 24)); + infoLabel.setFont(DesignUtils.getDefaultGUIFont().applySize(24).applyStyle(Font.BOLD)); infoLabel.setText(com.fr.design.i18n.Toolkit.i18nText( "Fine-Design_Report_Widget_User_Defined_Editor") + "."); infoLabel.setHorizontalAlignment(SwingConstants.CENTER); diff --git a/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java index 3e3211259..5dc414088 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java @@ -8,6 +8,7 @@ import com.fr.design.constants.UIConstants; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.utils.DesignUtils; import com.fr.quickeditor.FloatQuickEditor; import com.fr.report.ReportHelper; import com.fr.stable.StringUtils; @@ -20,7 +21,6 @@ import javax.swing.event.DocumentListener; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.Font; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -77,7 +77,7 @@ public class FloatStringQuickEditor extends FloatQuickEditor { } private void initTextField() { - stringTextField.setFont(new Font("Dialog", Font.PLAIN, 12)); + stringTextField.setFont(DesignUtils.getDefaultGUIFont()); stringTextField.setOpaque(true); stringTextField.setLineWrap(true); stringTextField.setWrapStyleWord(true);