Browse Source

REPORT-134742 & REPORT-135139 fix: 日期控件翻新,动态 tab 页标题宽度调整

fbp/merge
lemon 5 months ago
parent
commit
62e8ea70c1
  1. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java
  3. 243
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  4. 2
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  5. 3
      designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg
  6. 3
      designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg
  7. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json
  8. 14
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

12
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -706,11 +706,21 @@ public class PreviewTablePane extends BasicPane {
};
previewPane.setLayout(FRGUIPaneFactory.createBorderLayout());
if (nameDataModels.length > 0) {
previewPane.add(tabbedPane.withHeadRatio(0.8f).withTabLayout(buildTabLayout(nameDataModels)).build(), BorderLayout.CENTER);
int[] tabLayout = buildTabLayout(nameDataModels);
float headRatio = buildHeadRatio(tabLayout);
previewPane.add(tabbedPane.withHeadRatio(headRatio).withTabLayout(tabLayout).build(), BorderLayout.CENTER);
}
previewPane.showWindow(new JFrame()).setVisible(true);
}
private static float buildHeadRatio(int[] tabLayout) {
float maxLen = 0.8f;
if (tabLayout.length == 1) {
return (float) tabLayout[0] / TAB_MAX_COUNT_WITH_LINE;
}
return maxLen;
}
private static int[] buildTabLayout(NameDataModel[] nameDataModels) {
int length = nameDataModels.length;
int size = (length + TAB_MAX_COUNT_WITH_LINE - 1) / TAB_MAX_COUNT_WITH_LINE;

7
designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java

@ -12,6 +12,8 @@ import java.awt.Toolkit;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import static com.fine.theme.utils.FineUIScale.scale;
/**
* Created with IntelliJ IDEA.
* User: 小灰灰
@ -25,6 +27,7 @@ public class CalendarNumberField extends UINumberField {
public CalendarNumberField(double maxValue) {
super(2, 0, 0, maxValue);
this.setHorizontalAlignment(CENTER);
this.setBorderPainted(false);
addFocusListener(new FocusAdapter() {
@Override
@ -96,7 +99,7 @@ public class CalendarNumberField extends UINumberField {
}
public Dimension getPreferredSize() {
return new Dimension(24, 11);
return scale(new Dimension(24, 24));
}
public boolean shouldResponseChangeListener() {
@ -104,7 +107,7 @@ public class CalendarNumberField extends UINumberField {
}
public Insets getInsets() {
return new Insets(0, 6, 0, 4);
return new Insets(0, 0, 0, 0);
}
}

243
designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java

@ -1,10 +1,12 @@
package com.fr.design.gui.date;
import com.fanruan.product.ProductConstantsBase;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.BaseUtils;
import com.fr.base.background.GradientBackground;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.carton.MonthlyCartonFile;
import com.fr.design.carton.SwitchForSwingChecker;
import com.fr.design.constants.UIConstants;
@ -13,13 +15,11 @@ 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.general.GeneralUtils;
import com.fr.stable.Constants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.JComponent;
@ -34,14 +34,11 @@ import javax.swing.event.EventListenerList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@ -55,6 +52,10 @@ import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.fix;
import static com.fine.swing.ui.layout.Layouts.flex;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.theme.utils.FineUIScale.scale;
public class UICalendarPanel extends JPanel {
@ -75,6 +76,10 @@ public class UICalendarPanel extends JPanel {
protected Color background;
protected Color foreground;
protected Color hoverBackground;
protected Color pressedBackground;
protected Color defaultBackground;
private Calendar calendar = null;
private UILabel monthLabel = null;
private DayPane days = null;
@ -86,6 +91,9 @@ public class UICalendarPanel extends JPanel {
private final Color LABEL_FORGE_GROUND = new Color(0x6F6F6);
private MouseListener todayListener;
private UIDayLabel lbToday;
private int dateButtonArc;
private int dateButtonWidth;
private int dateButtonHeight;
/**
* 一个int类型用于判断日历是否是专门用于处理卡顿的设计器反馈箱中的日历
* 0表示是
@ -126,17 +134,23 @@ public class UICalendarPanel extends JPanel {
this.isTimePicker = isTimerPicker;
calendar = Calendar.getInstance();
selectedBackground = UIManager.getColor(
"ComboBox.selectionBackground");
hoverBackground = UIManager.getColor("Calendar.hoverBackground");
pressedBackground = UIManager.getColor("Calendar.pressedBackground");
selectedBackground = UIManager.getColor("Calendar.selectedBackground");
defaultBackground = UIManager.getColor("Calendar.defaultBackground");
selectedForeground = UIManager.getColor(
"ComboBox.selectionForeground");
background = UIManager.getColor("ComboBox.background");
foreground = UIManager.getColor("ComboBox.foreground");
dateButtonArc = UIManager.getInt("Calendar.dateButton.arc");
dateButtonWidth = UIManager.getInt("Calendar.dateButton.width");
dateButtonHeight = UIManager.getInt("Calendar.dateButton.height");
dayBttListener = createDayBttListener();
//renderer this
setPreferredSize(scale(new Dimension(218, 179)));
setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE));
setBorder(new LineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK)));
@ -144,7 +158,6 @@ public class UICalendarPanel extends JPanel {
add(BorderLayout.NORTH, createNorthPane());
add(BorderLayout.CENTER, createCenterPane());
if (isTimerPicker) {
setPreferredSize(scale(new Dimension(218, 209)));
add(BorderLayout.SOUTH, createSouthPane());
updateHMS();
}
@ -159,21 +172,12 @@ public class UICalendarPanel extends JPanel {
private JPanel createNorthPane() {
JPanel pNorth = FRGUIPaneFactory.createX_AXISBoxInnerContainer_S_Pane();
pNorth.setBackground(new Color(0xFFFFFF));
pNorth.setPreferredSize(scale(new Dimension(1, 22)));
pNorth.setPreferredSize(new Dimension(pNorth.getPreferredSize().width, scale(40)));
pNorth.add(Box.createHorizontalStrut(5));
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")
}));
pNorth.add(createSkipButton(Calendar.YEAR, -1, new LazyIcon("drag_left")));
pNorth.add(Box.createHorizontalStrut(11));
UILabel monthMinus = createSkipButton(Calendar.MONTH, -1, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce_hover.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/month_reduce_click.png")
});
monthMinus.setPreferredSize(scale(new Dimension(20, 20)));
UIButton monthMinus = createSkipButton(Calendar.MONTH, -1, new LazyIcon("left_arrow"));
pNorth.add(monthMinus);
monthLabel = new UILabel("", UILabel.CENTER);
monthLabel.setBackground(new Color(0xFFFFFF));
@ -183,20 +187,11 @@ public class UICalendarPanel extends JPanel {
pNorth.add(monthLabel);
pNorth.add(Box.createHorizontalGlue());
UILabel monthPlus = createSkipButton(Calendar.MONTH, 1, new Icon[]{
BaseUtils.readIcon("/com/fr/design/images/calender/month_add.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/month_add_hover.png"),
BaseUtils.readIcon("/com/fr/design/images/calender/month_add_click.png")
});
monthPlus.setPreferredSize(scale(new Dimension(20, 20)));
UIButton monthPlus = createSkipButton(Calendar.MONTH, 1, new LazyIcon("right_arrow"));
monthPlus.setHorizontalAlignment(SwingConstants.RIGHT);
pNorth.add(monthPlus);
pNorth.add(Box.createHorizontalStrut(11));
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")
}));
pNorth.add(createSkipButton(Calendar.YEAR, 1, new LazyIcon("drag_right")));
pNorth.add(Box.createHorizontalStrut(5));
return pNorth;
@ -205,9 +200,8 @@ public class UICalendarPanel extends JPanel {
private JPanel createCenterPane() {
//星期日 星期一 星期二 星期三 星期四 星期五 星期六
JPanel pWeeks = new JPanel(new GridLayout(1, 7, 1, 0));
pWeeks.setPreferredSize(scale(new Dimension(216, 22)));
pWeeks.setBackground(new Color(0xFFFFFF));
JPanel pWeeks = new JPanel(new GridLayout(1, 7, 9, 0));
pWeeks.setBackground(defaultBackground);
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"),
@ -219,27 +213,30 @@ public class UICalendarPanel extends JPanel {
label.setForeground(new Color(0x4D4C4C));
label.setFont(FONT_BLACK);
label.setText(strWeeks[i]);
label.setPreferredSize(scale(new Dimension(dateButtonWidth, dateButtonHeight)));
pWeeks.add(label);
}
pWeeks.setBorder(new ScaledEmptyBorder(3, 9, 3, 9));
//中间放日期的面板
days = new DayPane();
days.setOpaque(true);
days.setPreferredSize(scale(new Dimension(216, 115)));
days.setPreferredSize(scale(new Dimension(pWeeks.getPreferredSize().width, 165)));
JPanel pCenter = FRGUIPaneFactory.createBorderLayout_S_Pane();
pCenter.setOpaque(true);
pCenter.add(pWeeks, BorderLayout.NORTH);
pCenter.add(days, BorderLayout.CENTER);
//显示今天的日期,直接单击图标跳到今天
GradientPane pToday = new GradientPane(new GradientBackground(new Color(0x097BDA), new Color(0x40A3EE), GradientBackground.TOP2BOTTOM), false);
pToday.setPreferredSize(scale(new Dimension(216, 18)));
GradientPane pToday = new GradientPane(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM), false);
pToday.setPreferredSize(new Dimension(pToday.getPreferredSize().width, scale(30)));
pToday.setLayout(new BorderLayout());
lbToday = new UIDayLabel(new Date(), false);
lbToday.setForeground(new Color(0x000000));
pToday.setBorder(FineBorderFactory.createDefaultTopBorder());
todayListener = createTodayListener(pToday, lbToday);
lbToday.addMouseListener(todayListener);
pToday.setBackground(new Color(0xF0F0F0));
pToday.setBackground(defaultBackground);
pToday.add(lbToday, BorderLayout.CENTER);
pCenter.add(pToday, BorderLayout.SOUTH);
return pCenter;
@ -247,23 +244,15 @@ public class UICalendarPanel extends JPanel {
private JPanel createSouthPane() {
JPanel sPane = new JPanel();
sPane.setPreferredSize(scale(new Dimension(216, 30)));
sPane.setBackground(Color.WHITE);
sPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 6));
sPane.setLayout(new BorderLayout());
UILabel timeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Time") + ":");
timeLabel.setBorder(new ScaledEmptyBorder(0, 9, 0, 5));
timeLabel.setFont(FONT_UI);
sPane.add(timeLabel);
hms = new HMSPane();
sPane.add(hms);
UILabel gap = new UILabel();
gap.setPreferredSize(scale(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 scale(new Dimension(32, 18));
return scale(new Dimension(48, 24));
}
public Insets getInsets() {
@ -282,8 +271,8 @@ public class UICalendarPanel extends JPanel {
}
});
sPane.add(okButton);
sPane.add(row(12, cell(timeLabel), cell(hms), flex(), cell(okButton)).getComponent());
sPane.setBorder(new ScaledEmptyBorder(10, 12, 10, 12));
return sPane;
}
@ -301,38 +290,22 @@ public class UICalendarPanel extends JPanel {
* @param amount int
* @return UILabel
*/
protected UILabel createSkipButton(final int field, final int amount, final Icon[] icons) {
if (icons.length != 3) {
return new UILabel();
}
UILabel label = new UILabel();
label.setIcon(icons[0]);
label.setRequestFocusEnabled(false);
label.addMouseListener(createSkipListener(label, field, amount, icons));
return label;
protected UIButton createSkipButton(final int field, final int amount, final Icon icon) {
UIButton button = new UIButton();
FineUIStyle.setStyle(button, FineUIStyle.ORIGINAL_BUTTON);
button.setIcon(icon);
button.setRequestFocusEnabled(false);
button.addMouseListener(createSkipListener(field, amount));
return button;
}
protected MouseListener createSkipListener(final UILabel label, final int field,
final int amount, final Icon[] icons) {
protected MouseListener createSkipListener(final int field, final int amount) {
return new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
label.setIcon(icons[1]);
calendar.add(field, amount);
updateDays();
resetHMSPaneSelectedNumberField();
}
public void mouseEntered(MouseEvent e) {
label.setIcon(icons[1]);
}
public void mouseExited(MouseEvent e) {
label.setIcon(icons[0]);
}
public void mousePressed(MouseEvent e) {
label.setIcon(icons[2]);
}
};
}
@ -432,20 +405,20 @@ public class UICalendarPanel extends JPanel {
}
for (int i = 0; i < TOTAL_DAYS_COUNT; i++) {
setupCalendar.add(Calendar.DATE, 1);
GradientPane gp = new GradientPane(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM), true);
GradientPane gp = new GradientPane(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM), true, true);
gp.setIndex(i);
gp.setLayout(new BorderLayout());
gp.setBorder(null);
UIDayLabel label = new UIDayLabel(setupCalendar.getTime());
label.setHorizontalAlignment(SwingConstants.RIGHT);
label.setBorder(new ScaledEmptyBorder(0, 0, 0, 9));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setPreferredSize(new Dimension(dateButtonWidth, dateButtonHeight));
if ("1".equals(label.getText())) {
isCurrentMonth = !isCurrentMonth;
}
setUIDayLabel(label, isCurrentMonth, setupCalendar, logSet);
//当前选择的日期
if (setupCalendar.get(Calendar.DAY_OF_MONTH) == selectedCalendar.get(Calendar.DAY_OF_MONTH) && isCurrentMonth) {
gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM));
gp.setGradientBackground(new GradientBackground(selectedBackground, selectedBackground, GradientBackground.TOP2BOTTOM));
gp.add(label, BorderLayout.CENTER);
days.add(gp);
days.setSelectedIndex(i);
@ -456,6 +429,7 @@ public class UICalendarPanel extends JPanel {
days.add(gp);
}
}
days.setBorder(new ScaledEmptyBorder(3, 9, 3, 9));
days.validate();
}
@ -470,27 +444,24 @@ public class UICalendarPanel extends JPanel {
return new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
jp.setBorder(BorderFactory.createLineBorder(new Color(0x3868AA)));
jp.setPaintGradientBackground(true);
jp.repaint();
label.setForeground(new Color(0xFFFFFF));
jp.setBackground(pressedBackground);
}
@Override
public void mouseExited(MouseEvent e) {
jp.setBackground(new Color(0xF0F0F0));
jp.setBackground(defaultBackground);
}
@Override
public void mouseEntered(MouseEvent e) {
jp.setBackground(new Color(0xC8DDEE));
jp.setBackground(hoverBackground);
}
@Override
public void mouseReleased(MouseEvent e) {
jp.setBackground(new Color(0xF0F0F0));
label.setForeground(new Color(0x000000));
jp.setBorder(null);
jp.setBackground(defaultBackground);
jp.setPaintGradientBackground(false);
jp.repaint();
if (isTimePicker) {
@ -513,9 +484,9 @@ public class UICalendarPanel extends JPanel {
UIDayLabel com = (UIDayLabel) e.getComponent();
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(0xFFFFFF), new Color(0xFFFFFF), GradientBackground.TOP2BOTTOM));
}
gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM));
gp.setGradientBackground(new GradientBackground(pressedBackground, pressedBackground, GradientBackground.TOP2BOTTOM));
days.setSelectedIndex(gp.getIndex());
}
}
@ -540,7 +511,7 @@ public class UICalendarPanel extends JPanel {
if (gp.getIndex() == days.selectedIndex) {
return;
}
gp.setGradientBackground(new GradientBackground(new Color(0xFFFFFF), new Color(0xEAF4FC), GradientBackground.TOP2BOTTOM));
gp.setGradientBackground(new GradientBackground(hoverBackground, hoverBackground, GradientBackground.TOP2BOTTOM));
days.setFloatIndex(gp.getIndex());
}
@ -551,7 +522,7 @@ public class UICalendarPanel extends JPanel {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() != days.selectedIndex) {
gp.setGradientBackground(new GradientBackground(new Color(0xFEFEFE), new Color(0xF3F2F3), GradientBackground.TOP2BOTTOM));
gp.setGradientBackground(new GradientBackground(defaultBackground, defaultBackground, GradientBackground.TOP2BOTTOM));
}
days.setFloatIndex(-1);
days.repaint();
@ -600,6 +571,7 @@ public class UICalendarPanel extends JPanel {
private int index;
private boolean isGradientBackground;
private boolean roundPane = false;
private GradientBackground gradientBackground;
public GradientPane() {
@ -612,7 +584,18 @@ public class UICalendarPanel extends JPanel {
this.isGradientBackground = isGradientBackground;
}
public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground, boolean roundPane) {
super();
this.gradientBackground = gradientBackground;
this.isGradientBackground = isGradientBackground;
this.roundPane = roundPane;
}
public void paint(Graphics g) {
if (roundPane) {
RoundRectangle2D rect = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), dateButtonArc, dateButtonArc);
g.setClip(rect);
}
super.paint(g);
if (isGradientBackground && gradientBackground != null) {
gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight()));
@ -646,65 +629,30 @@ public class UICalendarPanel extends JPanel {
private class DayPane extends JPanel {
private Color floatColor = new Color(0xC5E2F9);
private Color selectedColor = new Color(0x41A3EE);
private int floateIndex;
private int selectedIndex;
public DayPane() {
floateIndex = -1;
selectedIndex = -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)));
this.setLayout(new GridLayout(6, 7, scale(9), scale(3)));
this.setBackground(defaultBackground);
}
public void paint(Graphics g) {
super.paint(g);
int width = UICalendarPanel.WIDTH;
int height = UICalendarPanel.HEIGHT;
Color oldColor = g.getColor();
g.setColor(new Color(0xDADADA));
int start_x = UICalendarPanel.START_X;
int start_y = UICalendarPanel.START_Y;
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++) {
g.drawLine(0, start_y, getWidth(), start_y);
start_y += height;
}
if (floateIndex > -1) {
g.setColor(floatColor);
paintChindPane(g, floateIndex);
}
if (selectedIndex > -1) {
g.setColor(selectedColor);
paintChindPane(g, selectedIndex);
g.setColor(selectedBackground);
}
g.setColor(oldColor);
}
private void paintChindPane(Graphics g, int index) {
if (index % 7 == 0) {
int y1 = index / 7 * UICalendarPanel.HEIGHT;
g.drawLine(0, y1, UICalendarPanel.START_X, y1);
g.drawLine(0, y1 + UICalendarPanel.HEIGHT, UICalendarPanel.START_X, y1 + UICalendarPanel.HEIGHT);
g.drawLine(UICalendarPanel.START_X, y1, UICalendarPanel.START_X, y1 + UICalendarPanel.HEIGHT);
} else if (index % 7 == 6) {
int y1 = index / 7 * UICalendarPanel.HEIGHT;
g.drawLine(scale(185), y1, scale(216), y1);
g.drawLine(scale(185), y1 + UICalendarPanel.HEIGHT, scale(216), y1 + UICalendarPanel.HEIGHT);
g.drawLine(scale(185), y1, scale(185), y1 + UICalendarPanel.HEIGHT);
} else {
int x1 = index % 7 * UICalendarPanel.WIDTH - 1;
int y1 = index / 7 * UICalendarPanel.HEIGHT;
g.drawRect(x1, y1, UICalendarPanel.WIDTH, UICalendarPanel.HEIGHT);
}
}
public void setFloatIndex(int index) {
this.floateIndex = index;
repaint();
@ -733,9 +681,8 @@ public class UICalendarPanel extends JPanel {
private CalendarNumberField selectedNumberField;
public HMSPane() {
this.setPreferredSize(scale(new Dimension(101, 18)));
this.setLayout(new BorderLayout(0, 0));
this.setBackground(null);
this.setOpaque(false);
initComponents();
initListener();
@ -757,22 +704,11 @@ public class UICalendarPanel extends JPanel {
}
private void initComponents() {
JPanel jp = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 2));
jp.setBackground(null);
jp.setBorder(null);
hField = new CalendarNumberField(23);
mField = new CalendarNumberField(59);
sField = new CalendarNumberField(59);
selectedNumberField = hField;
jp.add(hField);
jp.add(createGapLabel());
jp.add(mField);
jp.add(createGapLabel());
jp.add(sField);
this.add(jp, BorderLayout.CENTER);
preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
public boolean shouldResponseChangeListener() {
return false;
@ -786,10 +722,11 @@ public class UICalendarPanel extends JPanel {
};
nextButton.setRoundBorder(true, Constants.LEFT);
JPanel arrowPane = new JPanel();
arrowPane.setPreferredSize(scale(new Dimension(11, 18)));
arrowPane.setPreferredSize(scale(new Dimension(12, 24)));
arrowPane.setLayout(new GridLayout(2, 1));
arrowPane.add(preButton);
arrowPane.add(nextButton);
this.add(row(cell(hField), cell(createGapLabel()), cell(mField), cell(createGapLabel()), cell(sField), fix(4)).getComponent(), BorderLayout.CENTER);
this.add(arrowPane, BorderLayout.EAST);
}
@ -834,13 +771,8 @@ public class UICalendarPanel extends JPanel {
});
}
private UILabel createGapLabel() {
UILabel uiLabel = new UILabel(":");
uiLabel.setHorizontalAlignment(SwingConstants.CENTER);
uiLabel.setBackground(null);
uiLabel.setBorder(null);
uiLabel.setPreferredSize(scale(new Dimension(6, 10)));
return uiLabel;
private JPanel createGapLabel() {
return row(fix(4), cell(new UILabel(":")), fix(4)).getComponent();
}
public Insets getInsets() {
@ -849,17 +781,6 @@ public class UICalendarPanel extends JPanel {
public void paint(Graphics g) {
super.paint(g);
paintBorder(g);
}
public void paintBorder(Graphics 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);
} else {
GUIPaintUtils.drawBorder(g2d, 0, 0, 101, 18, true, 3);
}
}
public void populate(Calendar calendar) {

2
designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java

@ -3,7 +3,6 @@ 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.text.SimpleDateFormat;
import java.util.Date;
@ -31,7 +30,6 @@ public class UIDayLabel extends UILabel {
setHorizontalAlignment(UILabel.CENTER);
setFont(DesignUtils.getDefaultGUIFont().applySize(scale(12)));
this.date = date;
setPreferredSize(scale(new Dimension(30, 18)));
if (isSmallLabel) {
setText(dayFormat.format(date));
} else {

3
designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg

@ -0,0 +1,3 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M19.8033 24.4853C19.4128 24.8758 18.7796 24.8758 18.3891 24.4853L9.90381 16L18.3891 7.51473C18.7796 7.12421 19.4128 7.12419 19.8033 7.51473C20.1938 7.90527 20.1938 8.53842 19.8033 8.92894L12.7322 16L19.8033 23.0711C20.1938 23.4616 20.1938 24.0948 19.8033 24.4853Z" fill="#0A1C38" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 413 B

3
designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg

@ -0,0 +1,3 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.1967 7.51474C12.5872 7.12421 13.2204 7.12422 13.6109 7.51474L22.0962 16L13.6109 24.4853C13.2204 24.8758 12.5872 24.8758 12.1967 24.4853C11.8062 24.0948 11.8062 23.4616 12.1967 23.0711L19.2678 16L12.1967 8.92895C11.8062 8.53843 11.8062 7.90526 12.1967 7.51474Z" fill="#0A1C38" fill-opacity="0.9"/>
</svg>

After

Width:  |  Height:  |  Size: 413 B

2
designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json

@ -29,6 +29,8 @@
"drag_right": "drag_right.svg",
"down_arrow": "down_arrow.svg",
"up_arrow": "up_arrow.svg",
"left_arrow": "left_arrow.svg",
"right_arrow": "right_arrow.svg",
"select": "select.svg",
"recycle": "recycle.svg",
"time": "time.svg",

14
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties

@ -410,6 +410,15 @@ Label.strongHintColor = #FF0000
Label.warningColor = #F1393C
Label.secondaryColor = #0A1C38A8
# ---- Calendar ----
Calendar.hoverBackground = #E6E9EF
Calendar.pressedBackground = #DADEE7
Calendar.selectedBackground = #2576EF
Calendar.defaultBackground = $fill.normal
Calendar.dateButton.arc = 6
Calendar.dateButton.width = 24
Calendar.dateButton.height = 24
#---- HelpButton ----
HelpButton.questionMarkColor = @accentCheckmarkColor
@ -1401,8 +1410,9 @@ chart.selectedBorderColor = #2576EF
background: $fill.normal
[style]Button.originalButton = \
border: 4,4,4,4; \
background: null;
borderColor: null; \
background: null; \
hoverBorderColor: null;
[style]Label.detailLabel = \
foreground: fade(@foreground, 90%); \

Loading…
Cancel
Save