Browse Source

Merge remote-tracking branch 'origin/fbp/release' into fbp/release

fbp/merge
Destiny.Lin 3 months ago
parent
commit
8225ac7de7
  1. 59
      designer-base/src/main/java/com/fine/theme/light/ui/FineCalendarPaneUI.java
  2. 140
      designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java
  3. 1
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  4. 10
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  5. 7
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  6. 32
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  7. 5
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  8. 12
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  9. 10
      designer-base/src/main/java/com/fr/design/gui/date/CalendarNumberField.java
  10. 495
      designer-base/src/main/java/com/fr/design/gui/date/UICalendarPanel.java
  11. 3
      designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java
  12. 74
      designer-base/src/main/java/com/fr/design/gui/date/UIDayLabel.java
  13. 9
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java
  14. 2
      designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java
  15. 49
      designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java
  16. 54
      designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java
  17. 14
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  18. 50
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  19. 10
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  20. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  21. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  22. 51
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/DebugModeMenuDef.java
  23. 19
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  24. 46
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java
  25. 109
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java
  26. 8
      designer-base/src/main/java/com/fr/widgettheme/designer/WidgetThemeDisplayConfigPane.java
  27. 3
      designer-base/src/main/resources/com/fine/theme/icon/left_arrow.svg
  28. 3
      designer-base/src/main/resources/com/fine/theme/icon/right_arrow.svg
  29. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json
  30. 2
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties
  31. 20
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  32. 118
      designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js
  33. 32
      designer-base/src/test/java/com/fr/design/gui/storybook/components/UICalendarPaneStoryBoard.java
  34. 21
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFloatPositionPane.java
  35. 2
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java
  36. 34
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java
  37. 32
      designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java
  38. 7
      designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java
  39. 12
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  40. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  41. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java
  42. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java
  43. 5
      designer-form/src/main/java/com/fr/design/widget/ui/designer/CustomWritableRepeatEditorPane.java
  44. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  45. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  46. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java
  47. 30
      designer-realize/src/main/java/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java
  48. 5
      designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java
  49. 6
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  50. 20
      designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java
  51. 4
      designer-realize/src/main/java/com/fr/design/widget/ui/WritableRepeatEditorPane.java

59
designer-base/src/main/java/com/fine/theme/light/ui/FineCalendarPaneUI.java

@ -0,0 +1,59 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.gui.date.UICalendarPanel;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.PanelUI;
import java.awt.Color;
/**
* {@link UICalendarPanel} UI 样式
*
* @author lemon
* @since 12.0
* Created on 2024/09/22
*/
public class FineCalendarPaneUI extends PanelUI {
protected Color defaultBackground;
/**
* @param shared
* @since 2
*/
protected FineCalendarPaneUI() {
super();
}
/**
* 创建UI
*
* @param c 组件
* @return ComponentUI
*/
public static ComponentUI createUI(JComponent c) {
return FlatUIUtils.createSharedUI(FineCalendarPaneUI.class, FineCalendarPaneUI::new);
}
/**
* @param c the component where this UI delegate is being installed
*/
public void installUI(JComponent c) {
super.installUI(c);
defaultBackground = UIManager.getColor("Calendar.background");
//renderer this
c.setBackground(defaultBackground);
c.setBorder(new LineBorder(FlatUIUtils.getUIColor("defaultBorderColor", Color.BLACK)));
}
@Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
}
}

140
designer-base/src/main/java/com/fine/theme/light/ui/FineDayLabelUI.java

@ -0,0 +1,140 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatLabelUI;
import com.formdev.flatlaf.ui.FlatRoundBorder;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.design.gui.date.UIDayLabel;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import java.awt.Color;
import java.awt.Component;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
* {@link UIDayLabel} UI 样式
*
* @author lemon
* @since 12.0
* Created on 2024/09/22
*/
public class FineDayLabelUI extends FlatLabelUI {
protected Color defaultBackground;
protected Color selectedBackground;
protected Color hoverBackground;
protected Color pressedBackground;
protected Color otherMonthForeground;
protected int arc;
/**
* @since 2
*/
protected FineDayLabelUI() {
super(false);
}
/**
* 创建UI
*
* @param c 组件
* @return ComponentUI
*/
public static ComponentUI createUI(JComponent c) {
return FlatUIUtils.createSharedUI(FineDayLabelUI.class, FineDayLabelUI::new);
}
/**
* @param c the component where this UI delegate is being installed
*/
public void installUI(JComponent c) {
super.installUI(c);
selectedBackground = UIManager.getColor("Calendar.day.selectedBackground");
hoverBackground = UIManager.getColor("Calendar.day.hoverBackground");
pressedBackground = UIManager.getColor("Calendar.day.pressedBackground");
defaultBackground = UIManager.getColor("Calendar.background");
otherMonthForeground = UIManager.getColor("Calendar.dayOtherMonth.foreground");
arc = UIManager.getInt("Calendar.day.arc");
}
@Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
}
/**
* UICalendarPanel paint, 目前只对 {@link UIDayLabel} 样式自定义其余使用默认样式
*
* @param g the <code>Graphics</code> context in which to paint
* @param c the component being painted;
* this argument is often ignored,
* but might be used if the UI object is stateless
* and shared by multiple components
*/
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
if (c instanceof UIDayLabel) {
paintDayLabel((UIDayLabel) c);
}
}
private void paintDayLabel(UIDayLabel label) {
if (!label.isSmallLabel()) {
label.setBackground(getBackgroundColor(label));
return;
}
label.setBorder(new DayLabelRoundedBorder());
if (!label.isCurrentMonth()) {
label.setForeground(otherMonthForeground);
}
}
private Color getBackgroundColor(UIDayLabel dayLabel) {
if (dayLabel.isSelected()) {
return selectedBackground;
}
if (dayLabel.isHovered()) {
return hoverBackground;
}
if (dayLabel.isPressed()) {
return pressedBackground;
}
return defaultBackground;
}
/**
* {@link UIDayLabel} border 样式
*/
private class DayLabelRoundedBorder extends FlatRoundBorder {
public DayLabelRoundedBorder() {
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2 = (Graphics2D) g.create();
try {
FlatUIUtils.setRenderingHints(g2);
g2.setColor(getBackgroundColor((UIDayLabel) c));
g2.fillRoundRect(0, 0, width, height, arc, arc);
// 避免文字被背景色覆盖
UIDayLabel dayLabel = (UIDayLabel) c;
g2.setColor(dayLabel.getForeground());
FontMetrics metrics = g2.getFontMetrics(dayLabel.getFont());
int x1 = (width - metrics.stringWidth(dayLabel.getText())) / 2;
int y1 = ((height - metrics.getHeight()) / 2) + metrics.getAscent();
g2.drawString(dayLabel.getText(), x1, y1);
} finally {
g2.dispose();
}
}
}
}

1
designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java

@ -51,6 +51,7 @@ public interface FineUIStyle {
String DEFAULT_TABLE = "defaultTable";
String WHITE_BUTTON = "whiteButton";
String ORIGINAL_BUTTON = "originalButton";
String GRAY_BUTTON = "grayButton";
String DETAIL_LABEL = "detailLabel";
String WIDGET_EVENT_LABEL = "widgetEventLabel";

10
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -159,7 +159,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
private boolean rowHeaderVisible = true;
private boolean verticalScrollBarVisible = true;
private boolean horizontalScrollBarVisible = true;
private Color gridLineColor = Color.lightGray; // line color.
private Color gridLineColor = new Color(230, 233, 239); // line color.
private Color paginationLineColor = Color.black; // line color of paper
private boolean supportCellEditorDef = false;
private boolean isDragPermited = false;
@ -2167,10 +2167,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
this.setUndoLimit(reader.getAttrAsInt("undoLimit", 5));
this.setStartWithEmptyFile(reader.getAttrAsBoolean("startWithEmptyFile", false));
this.setDefaultStringToFormula(reader.getAttrAsBoolean("defaultStringToFormula", false));
if ((tmpVal = reader.getAttrAsString("gridLineColor", null)) != null) {
if ((tmpVal = reader.getAttrAsString("uiGridLineColor", null)) != null) {
this.setGridLineColor(new Color(Integer.parseInt(tmpVal)));
}
if ((tmpVal = reader.getAttrAsString("paginationLineColor", null)) != null) {
if ((tmpVal = reader.getAttrAsString("uiPaginationLineColor", null)) != null) {
this.setPaginationLineColor(new Color(Integer.parseInt(tmpVal)));
}
}
@ -2602,8 +2602,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
.attr("horizontalScrollBarVisible", this.isHorizontalScrollBarVisible())
.attr("supportCellEditorDef", this.isSupportCellEditorDef())
.attr("isDragPermited", this.isDragPermited())
.attr("gridLineColor", this.getGridLineColor().getRGB())
.attr("paginationLineColor", this.getPaginationLineColor().getRGB())
.attr("uiGridLineColor", this.getGridLineColor().getRGB())
.attr("uiPaginationLineColor", this.getPaginationLineColor().getRGB())
.attr("undoLimit", this.getUndoLimit())
.attr("startWithEmptyFile", this.isStartWithEmptyFile())
.end();

7
designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java

@ -5,10 +5,10 @@ import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.common.annotations.Open;
import com.fr.design.actions.UpdateAction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef;
@ -19,7 +19,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -73,13 +72,11 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setLayout(new BorderLayout());
toolBar.setBorder(new FineRoundBorder());
toolBar.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
toolbarDef.updateToolBar(toolBar);
addItemPane.add(toolBar, BorderLayout.WEST);
addItemPane.setBorder(new FineRoundBorder());
addItemPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
addItemPane.setPreferredSize(new Dimension(addItemPane.getPreferredSize().width, FineUIScale.scale(24)));
selectedItemPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();

32
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -13,6 +13,8 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.MapCompareUtils;
import com.fr.design.data.datapane.preview.ConnectionInfoBeanHelper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.editlock.EditLockUtils;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
@ -26,6 +28,7 @@ import com.fr.license.database.DBTypes;
import com.fr.license.database.DataBaseTypePointManager;
import com.fr.license.exception.DataBaseNotSupportedException;
import com.fr.log.FineLoggerFactory;
import com.fr.report.LockItem;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
@ -36,6 +39,7 @@ import com.fr.workspace.server.entity.connection.ConnectionBean;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import org.jetbrains.annotations.NotNull;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import java.awt.Window;
import java.util.ArrayList;
@ -366,18 +370,24 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
}
}
public static void showDialog(Window parent) {
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());
final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() {
@Override
public void complete() {
populate(connectionMap);
}
};
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionMap));
connectionListDialog.setVisible(true);
try {
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());
final ConnectionManagerPane connectionManagerPane = new ConnectionManagerPane() {
@Override
public void complete() {
populate(connectionMap);
}
};
final BasicDialog connectionListDialog = connectionManagerPane.showLargeWindow(parent, null);
connectionListDialog.addDialogActionListener(new ConnectionListDialogActionAdapter(connectionManagerPane, connectionListDialog, connectionMap));
connectionListDialog.setVisible(true);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Remote_Data_Error"),
Toolkit.i18nText("Fine-Design_Basic_Error"), JOptionPane.ERROR_MESSAGE);
EditLockUtils.unlock(LockItem.CONNECTION);
}
}
@Override

5
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -1,13 +1,13 @@
package com.fr.design.data.datapane.connect;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.core.db.TableProcedure;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.tabledata.tabledatapane.loading.SwitchableTableDataPane;
@ -175,7 +175,8 @@ public class ConnectionTableProcedurePane extends BasicPane {
UILabel searchLabel = new UILabel(new LazyIcon("search"));
searchLabel.setBorder(new ScaledEmptyBorder(0, 3, 0, 3));
searchField.setBorder(null);
panel.add(row(cell(searchLabel), cell(searchField).weight(1)).with(it -> it.setBorder(new FineRoundBorder())).getComponent());
panel.add(row(cell(searchLabel), cell(searchField).weight(1)).with(
it -> it.setBorder(FineBorderFactory.createWrappedRoundBorder())).getComponent());
panel.setBackground(FlatUIUtils.getUIColor("background.normal", Color.WHITE));
return panel;
}

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;

10
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.createScaleDimension;
/**
* Created with IntelliJ IDEA.
* User: 小灰灰
@ -19,12 +21,13 @@ import java.awt.event.FocusEvent;
* Time: 上午11:06
* To change this template use File | Settings | File Templates.
*/
public class CalendarNumberField extends UINumberField {
class CalendarNumberField extends UINumberField {
private static final int NUM_TEN = 10;
public CalendarNumberField(double maxValue) {
super(2, 0, 0, maxValue);
this.setHorizontalAlignment(CENTER);
this.setBorderPainted(false);
addFocusListener(new FocusAdapter() {
@Override
@ -32,7 +35,6 @@ public class CalendarNumberField extends UINumberField {
setValue(getIntValue());
}
});
this.setFont(DesignUtils.getDefaultGUIFont());
}
public void setValue(int value) {
@ -96,7 +98,7 @@ public class CalendarNumberField extends UINumberField {
}
public Dimension getPreferredSize() {
return new Dimension(24, 11);
return createScaleDimension(24, 24);
}
public boolean shouldResponseChangeListener() {
@ -104,7 +106,7 @@ public class CalendarNumberField extends UINumberField {
}
public Insets getInsets() {
return new Insets(0, 6, 0, 4);
return new Insets(0, 0, 0, 0);
}
}

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

@ -1,53 +1,41 @@
package com.fr.design.gui.date;
import com.fanruan.product.ProductConstantsBase;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
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;
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.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;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
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;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.geom.RoundRectangle2D;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@ -55,25 +43,24 @@ 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.createScaleDimension;
import static com.fine.theme.utils.FineUIScale.scale;
import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.setStyle;
public class UICalendarPanel extends JPanel {
private static final Font FONT_UI = DesignUtils.getDefaultGUIFont().applySize(scale(12));
private static final Font FONT_BLACK = new Font(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Black_Font"), Font.PLAIN, scale(12));
private static final String UI_CLASS_ID = "CalendarPaneUI";
private static final int WEEKDAY_COUNT = 7;
private static final int TOTAL_DAYS_COUNT = 42;
private static final int WIDTH = scale(31);
private static final int HEIGHT = scale(19);
private static final int START_X = scale(30);
private static final int START_Y = scale(19);
protected final Insets defaultInsets = new Insets(0, 6, 0, 6);
//卡顿日志所在地址
private static final String JOURNAL_FILE_PATH = StableUtils.pathJoin(ProductConstantsBase.getEnvHome(), "journal_log");
protected Color selectedBackground;
protected Color selectedForeground;
protected Color background;
protected Color foreground;
private Calendar calendar = null;
private UILabel monthLabel = null;
@ -83,9 +70,11 @@ public class UICalendarPanel extends JPanel {
private boolean isSupportDateChangeListener = false;
private java.util.Date selectedDate = null;
private boolean isTimePicker;
private final Color LABEL_FORGE_GROUND = new Color(0x6F6F6);
private MouseListener todayListener;
private UIDayLabel lbToday;
private static final int WEEK_LABEL_WIDTH = 24;
private static final int WEEK_LABEL_HEIGHT = 24;
private final int ICON_WIDTH = 12;
/**
* 一个int类型用于判断日历是否是专门用于处理卡顿的设计器反馈箱中的日历
* 0表示是
@ -125,26 +114,12 @@ public class UICalendarPanel extends JPanel {
this.selectedDate = selectedDate;
this.isTimePicker = isTimerPicker;
calendar = Calendar.getInstance();
selectedBackground = UIManager.getColor(
"ComboBox.selectionBackground");
selectedForeground = UIManager.getColor(
"ComboBox.selectionForeground");
background = UIManager.getColor("ComboBox.background");
foreground = UIManager.getColor("ComboBox.foreground");
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)));
setLayout(FRGUIPaneFactory.createBorderLayout());
add(BorderLayout.NORTH, createNorthPane());
add(BorderLayout.CENTER, createCenterPane());
if (isTimerPicker) {
setPreferredSize(scale(new Dimension(218, 209)));
add(BorderLayout.SOUTH, createSouthPane());
updateHMS();
}
@ -158,45 +133,23 @@ public class UICalendarPanel extends JPanel {
// << < yyyy/MM/dd > >>
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.setOpaque(false);
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));
monthLabel.setForeground(new Color(0x000000));
monthLabel.setFont(FONT_UI);
pNorth.add(Box.createHorizontalGlue());
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,10 +158,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));
pWeeks.setOpaque(true);
JPanel pWeeks = new JPanel(new GridLayout(1, 7, 9, 0));
pWeeks.setOpaque(false);
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")
@ -216,61 +167,47 @@ public class UICalendarPanel extends JPanel {
for (int i = 1; i <= WEEKDAY_COUNT; i++) {
UILabel label = new UILabel();
label.setHorizontalAlignment(UILabel.CENTER);
label.setForeground(new Color(0x4D4C4C));
label.setFont(FONT_BLACK);
label.setText(strWeeks[i]);
label.setPreferredSize(createScaleDimension(WEEK_LABEL_WIDTH, WEEK_LABEL_HEIGHT));
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.setOpaque(false);
days.setPreferredSize(new Dimension(pWeeks.getPreferredSize().width, scale(165)));
JPanel pCenter = FRGUIPaneFactory.createBorderLayout_S_Pane();
pCenter.setOpaque(true);
pCenter.setOpaque(false);
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)));
pToday.setLayout(new BorderLayout());
lbToday = new UIDayLabel(new Date(), false);
lbToday.setForeground(new Color(0x000000));
todayListener = createTodayListener(pToday, lbToday);
lbToday.setPreferredSize(new Dimension(lbToday.getPreferredSize().width, scale(30)));
lbToday.setBorder(FineBorderFactory.createDefaultTopBorder());
todayListener = createTodayListener(lbToday);
lbToday.addMouseListener(todayListener);
pToday.setBackground(new Color(0xF0F0F0));
pToday.add(lbToday, BorderLayout.CENTER);
pCenter.add(pToday, BorderLayout.SOUTH);
pCenter.add(lbToday, BorderLayout.SOUTH);
return pCenter;
}
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.setOpaque(false);
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 createScaleDimension(48, 24);
}
public Insets getInsets() {
return new Insets(0, 0, 0, 0);
}
};
okButton.setFont(FONT_UI);
okButton.setVerticalAlignment(SwingConstants.CENTER);
okButton.addActionListener(new ActionListener() {
@ -282,18 +219,11 @@ public class UICalendarPanel extends JPanel {
}
});
sPane.add(okButton);
sPane.add(row(cell(timeLabel).weight(36), cell(hms).weight(180), flex(), cell(okButton).weight(48)).getComponent());
sPane.setBorder(new ScaledEmptyBorder(10, 12, 10, 12));
return sPane;
}
public void resetHMSPaneSelectedNumberField() {
if (this.hms != null) {
this.hms.selectedNumberField = this.hms.hField;
this.hms.nextButton.requestFocus();
}
}
/**
* 创建上一月,下一月,上一年,下一年"按钮"
*
@ -301,37 +231,20 @@ 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]);
}
};
}
@ -383,10 +296,6 @@ public class UICalendarPanel extends JPanel {
}
} else {
label.addMouseListener(dayBttListener);
label.setEnabled(isCurrentMonth);
}
if (!isCurrentMonth) {
label.setForeground(LABEL_FORGE_GROUND);
}
}
/**
@ -432,30 +341,23 @@ 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);
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.setIndex(i);
if ("1".equals(label.getText())) {
isCurrentMonth = !isCurrentMonth;
}
setUIDayLabel(label, isCurrentMonth, setupCalendar, logSet);
label.setCurrentMonth(isCurrentMonth);
days.add(label);
//当前选择的日期
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.add(label, BorderLayout.CENTER);
days.add(gp);
days.setSelectedIndex(i);
label.setSelected(true);
this.selectedDate = label.getDate();
this.calendar.setTime(this.selectedDate);
} else {
gp.add(label, BorderLayout.CENTER);
days.add(gp);
}
}
days.setBorder(new ScaledEmptyBorder(3, 9, 3, 9));
days.validate();
}
@ -466,33 +368,11 @@ public class UICalendarPanel extends JPanel {
}
}
protected MouseListener createTodayListener(final GradientPane jp, final UIDayLabel label) {
protected MouseListener createTodayListener(final UIDayLabel label) {
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));
}
@Override
public void mouseExited(MouseEvent e) {
jp.setBackground(new Color(0xF0F0F0));
}
@Override
public void mouseEntered(MouseEvent e) {
jp.setBackground(new Color(0xC8DDEE));
}
@Override
public void mouseReleased(MouseEvent e) {
jp.setBackground(new Color(0xF0F0F0));
label.setForeground(new Color(0x000000));
jp.setBorder(null);
jp.setPaintGradientBackground(false);
jp.repaint();
if (isTimePicker) {
UICalendarPanel.this.setSelectedDate(label.getDate());
updateDays();
@ -501,7 +381,6 @@ public class UICalendarPanel extends JPanel {
UICalendarPanel.this.setSelectedDate(label.getDate());
UICalendarPanel.this.isSupportDateChangeListener = false;
}
resetHMSPaneSelectedNumberField();
}
};
}
@ -511,12 +390,11 @@ public class UICalendarPanel extends JPanel {
public void mousePressed(MouseEvent e) {
if (isEnabled()) {
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));
}
gp.setGradientBackground(new GradientBackground(new Color(0x097BD9), new Color(0x41A3EE), GradientBackground.TOP2BOTTOM));
days.setSelectedIndex(gp.getIndex());
days.setSelectedIndex(com.getIndex());
com.setHovered(false);
com.setPressed(true);
com.getParent().validate();
com.getParent().repaint();
}
}
@ -530,31 +408,30 @@ public class UICalendarPanel extends JPanel {
UICalendarPanel.this.setSelectedDate(com.getDate());
UICalendarPanel.this.isSupportDateChangeListener = false;
}
resetHMSPaneSelectedNumberField();
}
public void mouseEntered(MouseEvent e) {
if (isEnabled()) {
JComponent com = (JComponent) e.getComponent();
GradientPane gp = (GradientPane) com.getParent();
if (gp.getIndex() == days.selectedIndex) {
UIDayLabel com = (UIDayLabel) e.getComponent();
com.setHovered(true);
if (com.getIndex() == days.selectedIndex) {
return;
}
gp.setGradientBackground(new GradientBackground(new Color(0xFFFFFF), new Color(0xEAF4FC), GradientBackground.TOP2BOTTOM));
days.setFloatIndex(gp.getIndex());
days.setFloatIndex(com.getIndex());
com.getParent().validate();
com.getParent().repaint();
}
}
public void mouseExited(MouseEvent e) {
if (isEnabled()) {
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));
}
UIDayLabel com = (UIDayLabel) e.getComponent();
com.setHovered(false);
com.setPressed(false);
days.setFloatIndex(-1);
days.repaint();
com.getParent().validate();
com.getParent().repaint();
}
}
};
@ -596,127 +473,34 @@ public class UICalendarPanel extends JPanel {
return selectedDate;
}
private class GradientPane extends JPanel {
private int index;
private boolean isGradientBackground;
private GradientBackground gradientBackground;
public GradientPane() {
}
public GradientPane(GradientBackground gradientBackground, boolean isGradientBackground) {
super();
this.gradientBackground = gradientBackground;
this.isGradientBackground = isGradientBackground;
}
public void paint(Graphics g) {
super.paint(g);
if (isGradientBackground && gradientBackground != null) {
gradientBackground.paint(g, new Rectangle(this.getWidth(), this.getHeight()));
}
paintChildren(g);
}
public void setPaintGradientBackground(boolean flag) {
this.isGradientBackground = flag;
}
public void setGradientBackground(GradientBackground gradientBackground) {
this.gradientBackground = gradientBackground;
}
public void setIndex(int i) {
this.index = i;
}
public int getIndex() {
return this.index;
}
public void setForeground(Color c) {
super.setForeground(c);
if (getComponentCount() > 0) {
getComponent(0).setForeground(c);
}
}
}
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)));
}
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(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();
}
public void setSelectedIndex(int index) {
if (this.selectedIndex != -1 && this.selectedIndex < getComponentCount()) {
this.getComponent(selectedIndex).setForeground(Color.black);
}
if (index != -1 && index < getComponentCount()) {
this.getComponent(index).setForeground(Color.WHITE);
}
this.selectedIndex = index;
repaint();
}
@ -725,17 +509,13 @@ public class UICalendarPanel extends JPanel {
private class HMSPane extends JPanel {
private boolean isRolOver;
private UIButton preButton;
private UIButton nextButton;
private CalendarNumberField hField;
private CalendarNumberField mField;
private CalendarNumberField sField;
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,49 +537,68 @@ 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;
this.add(row(cell(combineFieldArrowPane(hField)), cell(createGapLabel()), cell(combineFieldArrowPane(mField)),
cell(createGapLabel()), cell(combineFieldArrowPane(sField)), fix(4)).getComponent(), BorderLayout.CENTER);
}
private JPanel combineFieldArrowPane(CalendarNumberField field) {
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
Insets insets = FineUIUtils.getUIInsets("InputTextField.borderInsets", defaultInsets);
field.setBorder(new ScaledEmptyBorder(insets.top, insets.left, insets.bottom, insets.right));
UIButton preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH));
UIButton nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH));
JPanel arrowPane = createArrowPane(preButton, nextButton);
panel.add(field, BorderLayout.CENTER);
panel.add(arrowPane, BorderLayout.EAST);
panel.setBorder(new FineRoundBorder());
jp.add(hField);
jp.add(createGapLabel());
jp.add(mField);
jp.add(createGapLabel());
jp.add(sField);
nextButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
field.setValue(field.getIntValue() - 1);
field.requestFocus();
field.selectAll();
this.add(jp, BorderLayout.CENTER);
preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
public boolean shouldResponseChangeListener() {
return false;
}
};
preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
public boolean shouldResponseChangeListener() {
return false;
});
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
field.setValue(field.getIntValue() + 1);
field.requestFocus();
field.selectAll();
}
};
nextButton.setRoundBorder(true, Constants.LEFT);
});
return panel;
}
private JPanel createArrowPane(UIButton preButton, UIButton nextButton) {
JPanel arrowPane = new JPanel();
arrowPane.setPreferredSize(scale(new Dimension(11, 18)));
arrowPane.setPreferredSize(createScaleDimension(12, 24));
arrowPane.setLayout(new GridLayout(2, 1));
arrowPane.add(preButton);
arrowPane.add(nextButton);
this.add(arrowPane, BorderLayout.EAST);
arrowPane.setOpaque(false);
return arrowPane;
}
private void initListener() {
MouseAdapter backgroundAdapter = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
HMSPane.this.selectedNumberField = (CalendarNumberField) e.getComponent();
private UIButton createArrowButton(Icon icon) {
UIButton arrowButton = new UIButton(icon) {
public boolean shouldResponseChangeListener() {
return false;
}
};
setStyle(arrowButton, STYLE_TEXT);
return arrowButton;
}
private void initListener() {
MouseAdapter backgroundAdapter = new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
isRolOver = false;
@ -815,32 +614,10 @@ public class UICalendarPanel extends JPanel {
hField.addMouseListener(backgroundAdapter);
mField.addMouseListener(backgroundAdapter);
sField.addMouseListener(backgroundAdapter);
nextButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
HMSPane.this.selectedNumberField.setValue(HMSPane.this.selectedNumberField.getIntValue() - 1);
HMSPane.this.selectedNumberField.requestFocus();
HMSPane.this.selectedNumberField.selectAll();
}
});
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
HMSPane.this.selectedNumberField.setValue(HMSPane.this.selectedNumberField.getIntValue() + 1);
HMSPane.this.selectedNumberField.requestFocus();
HMSPane.this.selectedNumberField.selectAll();
}
});
}
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 +626,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) {
@ -875,21 +641,8 @@ public class UICalendarPanel extends JPanel {
}
}
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();
SimpleDateFormat f = new SimpleDateFormat("yyyy/MM/dd");
field.setText(f.format(selectedDate));
}
});
frame.getContentPane().setLayout(FRGUIPaneFactory.createCenterFlowLayout());
frame.getContentPane().add(field);
frame.getContentPane().add(calendarPanel);
frame.setVisible(true);
@Override
public String getUIClassID() {
return UI_CLASS_ID;
}
}

3
designer-base/src/main/java/com/fr/design/gui/date/UIDatePicker.java

@ -235,9 +235,6 @@ public class UIDatePicker extends UIComboBox implements Serializable {
if (willHide || UIDatePicker.this.isEnabled() == false) {
return;
}
if (calendarPanel != null) {
calendarPanel.resetHMSPaneSelectedNumberField();
}
super.show();
}

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

@ -1,18 +1,48 @@
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;
import static com.fine.theme.utils.FineUIScale.scale;
/**
* 日期控件day label
*
* @author lemon
* @since 12.0
* Created on 2024/09/22
*/
public class UIDayLabel extends UILabel {
private static final String UI_CLASS_ID = "DayLabelUI";
private Date date = null;
private int index;
private boolean pressed = false;
private boolean hovered = false;
private boolean selected = false;
private boolean currentMonth = false;
private boolean smallLabel = false;
public boolean isHovered() {
return hovered;
}
public boolean isPressed() {
return pressed;
}
public boolean isSelected() {
return selected;
}
public boolean isCurrentMonth() {
return currentMonth;
}
public boolean isSmallLabel() {
return smallLabel;
}
/**
* 日期格式TODAY/TIP用
@ -28,11 +58,11 @@ public class UIDayLabel extends UILabel {
}
public UIDayLabel(Date date, boolean isSmallLabel) {
setOpaque(false);
setHorizontalAlignment(UILabel.CENTER);
setFont(DesignUtils.getDefaultGUIFont().applySize(scale(12)));
this.date = date;
setPreferredSize(scale(new Dimension(30, 18)));
if (isSmallLabel) {
this.smallLabel = isSmallLabel;
if (smallLabel) {
setText(dayFormat.format(date));
} else {
setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Today") + ":" + dateFormat.format(new Date()));
@ -44,8 +74,38 @@ public class UIDayLabel extends UILabel {
return date;
}
public void setHovered(boolean hovered) {
this.hovered = hovered;
}
public void setPressed(boolean pressed) {
this.pressed = pressed;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
public void setCurrentMonth(boolean currentMonth) {
this.currentMonth = currentMonth;
}
public void setDate(Date date) {
this.date = date;
}
public void setIndex(int i) {
this.index = i;
}
public int getIndex() {
return this.index;
}
@Override
public String getUIClassID() {
return UI_CLASS_ID;
}
}

9
designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java

@ -1,6 +1,7 @@
package com.fr.design.gui.frpane;
import com.fine.swing.ui.layout.Layouts;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
@ -12,11 +13,14 @@ import java.awt.BorderLayout;
import java.awt.Dimension;
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;
public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNameObserver {
private static final long serialVersionUID = -8681716725163358249L;
private static double DRAG_BAR_WEIGHT = 0.64;
private static double SPINNER_WIGHT = 0.36;
private UISlider dragBar;
private UISpinner spinner;
private boolean isEditing = false;
@ -38,13 +42,14 @@ public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNam
public UINumberDragPane(double minValue, double maxValue, double dierta) {
dragBar = new UISlider((int) minValue, (int) maxValue);
dragBar.setPaintLabels(true);
dragBar.setMajorTickSpacing((int) maxValue - (int) minValue);
dragBar.setMajorTickSpacing(minValue < 0 ? (int) maxValue : (int) maxValue - (int) minValue);
spinner = createUISpinner(minValue, maxValue, dierta);
spinner.getTextField().setBorder(new ScaledEmptyBorder(0, 0, 0, 0));
spinner.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_StyleAlignment_Text_Rotation"));
spinner.setValue(dragBar.getValue());
this.setLayout(new BorderLayout());
this.add(Layouts.row(
cell(dragBar).weight(0.7), flex(0.1), cell(spinner).weight(0.7)
cell(dragBar).weight(DRAG_BAR_WEIGHT), fix(2), cell(spinner).weight(SPINNER_WIGHT)
).getComponent());
dragBar.addChangeListener(e -> {
if (globalNameListener != null && shouldResponseNameListener()) {

2
designer-base/src/main/java/com/fr/design/gui/style/TextFormatPane.java

@ -132,7 +132,7 @@ public class TextFormatPane extends AbstractBasicStylePane implements GlobalName
cell(textField),
row(
cell(new UILabel(Toolkit.i18nText("Fine-Design_Report_Base_Option"))).weight(LEFT_WEIGHT),
row(cell(roundingBox)).weight(RIGHT_WEIGHT)
cell(roundingBox).weight(RIGHT_WEIGHT)
),
cell(previewLabel)
).getComponent());

49
designer-base/src/main/java/com/fr/design/hyperlink/popup/MobilePopupRegularPane.java

@ -1,11 +1,13 @@
package com.fr.design.hyperlink.popup;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.stable.StringUtils;
import javax.swing.*;
@ -13,6 +15,11 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.flex;
public class MobilePopupRegularPane extends BasicPane {
private String label;
@ -35,13 +42,15 @@ public class MobilePopupRegularPane extends BasicPane {
private void initComponent() {
this.setLayout(new BorderLayout());
this.add(this.createRadioButtonGroupPane(), BorderLayout.NORTH);
spinnerGroupPane = this.createSpinnerPane();
this.add(spinnerGroupPane, BorderLayout.CENTER);
this.add(column(LayoutConstants.VERTICAL_GAP,
cell(this.createRadioButtonGroupPane()),
row(flex(1), cell(spinnerGroupPane).weight(3))
).getComponent());
}
private JPanel createRadioButtonGroupPane() {
radiosPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
radiosPane = new JPanel(new BorderLayout());
customRadio = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Custom"));
customRadio.addActionListener(radioActionListener);
@ -52,10 +61,8 @@ public class MobilePopupRegularPane extends BasicPane {
radioButtons.add(customRadio);
radioButtons.add(autoRadio);
radiosPane.add(customRadio);
radiosPane.add(autoRadio);
return MobilePopupUIUtils.createLeftTileRightContentPanel(this.label, radiosPane, Color.GRAY, 20);
radiosPane.add(row(30, cell(customRadio), cell(autoRadio), flex()).getComponent());
return row(cell(new UILabel(this.label, FineUIStyle.LABEL_SECONDARY)).weight(1), cell(radiosPane).weight(3)).getComponent();
}
private ActionListener radioActionListener = new ActionListener() {
@ -66,40 +73,32 @@ public class MobilePopupRegularPane extends BasicPane {
};
private JPanel createSpinnerPane() {
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 5));
spinnerPane.setBorder(BorderFactory.createEmptyBorder(0, MobilePopupUIUtils.Left_Title_width, 0, 0));
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 0));
spinnerPane.setBorder(new ScaledEmptyBorder(0, 0, 0, 0));
widthSpinner = new UISpinner(0, 100, 1, 95);
widthSpinnerPane = this.createSpinnerLabelPane(widthSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Width"));
heightSpinner = new UISpinner(0, 100, 1, 95);
heightSpinnerPane = this.createSpinnerLabelPane(heightSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Height"));
spinnerPane.add(widthSpinnerPane);
spinnerPane.add(heightSpinnerPane);
spinnerPane.add(row(cell(widthSpinnerPane), cell(heightSpinnerPane)).getComponent());
return spinnerPane;
}
private JPanel createSpinnerLabelPane(UISpinner spinner, String labelText) {
JPanel spinnerLabelPane = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5));
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 2,0));
JPanel spinnerLabelPane = new JPanel(new BorderLayout());
UILabel percent = new UILabel("%");
spinnerPane.add(spinner);
spinnerPane.add(percent);
UILabel label = new UILabel(labelText);
label.setHorizontalAlignment(SwingConstants.CENTER);
spinnerLabelPane.add(spinnerPane);
spinnerLabelPane.add(label);
spinnerLabelPane.add(column(LayoutConstants.VGAP_SMALL,
row(cell(spinner).weight(1), cell(percent)).weight(1),
cell(label)
).getComponent());
return spinnerLabelPane;
}
private void resetSpinnerGroupPane(boolean showHeightSpinnerPane) {
spinnerGroupPane.removeAll();
spinnerGroupPane.add(widthSpinnerPane);
if(showHeightSpinnerPane) {
if (showHeightSpinnerPane) {
spinnerGroupPane.add(heightSpinnerPane);
}
spinnerGroupPane.revalidate();

54
designer-base/src/main/java/com/fr/design/hyperlink/popup/StyleSettingPane.java

@ -1,6 +1,8 @@
package com.fr.design.hyperlink.popup;
import com.fine.theme.utils.FineUIStyle;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UINumberDragPane;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
@ -57,14 +59,11 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
JPanel typePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
popupTypeLabel = new UILabel("");
UILabel typeLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Type"));
typePane.add(row(44,
cell(typeLabel),
cell(popupTypeLabel)
).getComponent());
typePane.add(row(cell(typeLabel).weight(1), row(cell(popupTypeLabel), flex()).weight(6)).getComponent());
return typePane;
}
private JPanel createStylePane() {
private JPanel createStylePane() {
JPanel stylePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
stylePane.add(column(10,
cell(this.createBorderSettingPane()),
@ -82,14 +81,11 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
borderColor = new NewColorSelectBox(100);
borderRadiusSpinner = new UISpinner(0, maxBorderRadius, 1, 20);
UILabel borderLabel = new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Border"));
borderPane.add(row(44,
column(10,
cell(borderLabel).weight(0.3),
flex().weight(0.7)),
column(10,
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), borderType, Color.GRAY, 64)),
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), borderColor, Color.GRAY, 64)),
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), borderRadiusSpinner, Color.GRAY, 64)))
borderPane.add(column(LayoutConstants.VERTICAL_GAP,
row(cell(borderLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderType).weight(2), flex(3)),
row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderColor).weight(2), flex(3)),
row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(borderRadiusSpinner).weight(2), flex(3))
).getComponent());
return borderPane;
}
@ -99,39 +95,31 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
bgPane.setLayout(new BorderLayout());
bgColor = new NewColorSelectBox(100);
JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.numberDragPane = new UINumberDragPane(0,100);
this.numberDragPane = new UINumberDragPane(0, 100);
transparencyPane.add(numberDragPane, BorderLayout.CENTER);
transparencyPane.add(new UILabel(" %"), BorderLayout.EAST);
JLabel bgLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Background"));
bgPane.add(row(44,
column(10,
cell(bgLabel).weight(0.6),
flex().weight(0.4)),
column(10,
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), bgColor, Color.GRAY, 64)),
cell(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), transparencyPane, Color.GRAY, 64))
)
bgPane.add(column(LayoutConstants.VERTICAL_GAP,
row(cell(bgLabel).weight(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(bgColor).weight(2), flex(3)),
row(flex(1), cell(new UILabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), FineUIStyle.LABEL_SECONDARY)).weight(1), cell(transparencyPane).weight(3), flex(2))
).getComponent());
return bgPane;
}
private JPanel createPopupSizePane() {
JPanel sizePane = new JPanel(new BorderLayout());
mobileRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Mobile_Rules"));
padRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Pad_Rules"));
JLabel sizeLabel = new JLabel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Size"));
sizePane.add(row(20,
column(10,
cell(sizeLabel).weight(0.16),
flex().weight(0.84)),
column(10,
cell(mobileRegularPane),
cell(padRegularPane)
)
sizePane.add(column(LayoutConstants.VERTICAL_GAP,
row(
column(LayoutConstants.VERTICAL_GAP, cell(sizeLabel), flex()).weight(1),
cell(mobileRegularPane).weight(4), flex(2)
),
row(flex(1), cell(padRegularPane).weight(4), flex(2))
).getComponent());
return sizePane;
}
@ -204,7 +192,7 @@ public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> {
private void updateBackgroundSettingBean(MobilePopupHyperlink link) {
link.setBgColor(bgColor.getSelectObject());
link.setBgOpacity((float)(numberDragPane.updateBean() / maxNumber));
link.setBgOpacity((float) (numberDragPane.updateBean() / maxNumber));
}
private void populatePopupSizeBean(MobilePopupHyperlink link) {

14
designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java

@ -2,11 +2,9 @@ package com.fr.design.javascript;
import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.svg.IconUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.DesignerEnvManager;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.KeyWords;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
@ -27,7 +25,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.js.JavaScriptImpl;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
@ -42,8 +39,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
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.swing.ui.layout.Layouts.cell;
@ -51,10 +46,9 @@ public class JSContentPane extends BasicPane {
protected RSyntaxTextArea contentTextArea;
private UILabel funNameLabel = new UILabel();
private AutoCompletion ac;
private static final Dimension FUNCTION_NAME_LABEL_SIZE = new Dimension(300, 80);
private String[] defaultArgs;
private int titleWidth = 180;
private JPanel labelPane = new JPanel();
private JPanel labelPane = new JPanel(FRGUIPaneFactory.createScaledBorderLayout(10, 0));
private NewJavaScriptImplPane newJavaScriptImplPane = null;
private JavaScriptImpl javaScript;
private JSImplUpdateAction jsImplUpdateAction;
@ -189,17 +183,15 @@ public class JSContentPane extends BasicPane {
}.execute();
}
});
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
labelPane.add(label,BorderLayout.CENTER);
JPanel jsParaPane = new JPanel(new BorderLayout());
funNameLabel.setBackground(FineUIUtils.getUIColor("background.normal", "background.normal"));
UIScrollPane scrollPane = new UIScrollPane(funNameLabel);
scrollPane.setOpaque(true);
scrollPane.setBorder(new UIRoundedBorder(UIConstants.TITLED_BORDER_COLOR, 1, UIConstants.ARC));
jsParaPane.add(row(4,
cell(scrollPane).weight(1),
cell(labelPane)
).getComponent());
).with(it -> it.setBorder(new ScaledEmptyBorder(0, 0, 0, 10))).getComponent());
return jsParaPane;
}

50
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -1,8 +1,11 @@
package com.fr.design.javascript;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.svg.IconUtils;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.gui.autocomplete.AutoCompleteExtraRefreshComponent;
import com.fr.design.gui.autocomplete.BasicCompletion;
import com.fr.design.gui.autocomplete.CompletionCellRenderer;
@ -53,7 +56,6 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
@ -71,7 +73,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener {
@ -140,7 +141,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
//js函数声明面板
JPanel jsParaPane = createJSParaPane();
jsParaPane.setPreferredSize(new Dimension(650, 80));
jsParaPane.setPreferredSize(FineUIScale.createScaleDimension(650, 80));
//右上角的搜索提示面板
JPanel tipsPane = createTipsPane();
@ -153,7 +154,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
UIScrollPane contentTextAreaPanel = createContentTextAreaPanel();
initContextAreaListener();
contentTextAreaPanel.setPreferredSize(new Dimension(850, 250));
contentTextAreaPanel.setPreferredSize(FineUIScale.createScaleDimension(850, 250));
//js函数结束标签
UILabel endBracketsLabel = new UILabel();
endBracketsLabel.setText("}");
@ -173,7 +174,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
//函数分类和函数说明面板==================================
JPanel functionNameAndDescriptionPanel = createInterfaceAndDescriptionPanel();
functionNameAndDescriptionPanel.setPreferredSize(new Dimension(880, 220));
functionNameAndDescriptionPanel.setPreferredSize(FineUIScale.createScaleDimension(880, 220));
this.add(functionNameAndDescriptionPanel, BorderLayout.SOUTH);
}
@ -423,27 +424,27 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
JPanel mainPane = new JPanel(card);
initHelpDocumentList();
UIScrollPane helpDOCScrollPane = new UIScrollPane(helpDOCList);
helpDOCScrollPane.setPreferredSize(new Dimension(200, 200));
helpDOCScrollPane.setPreferredSize(FineUIScale.createScaleDimension(200, 200));
helpDOCScrollPane.setBorder(null);
mainPane.add(helpDOCScrollPane, DOC_LIST_CARD);
UILabel imageLabel = new UILabel();
imageLabel.setIcon(IconUtils.readIcon("com/fr/design/javascript/jsapi/images/connectFailed.svg"));
imageLabel.setPreferredSize(new Dimension(180, 65));
imageLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 65));
JPanel imagePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
imagePane.setBorder(BorderFactory.createEmptyBorder(0, 42, 0, 0));
imagePane.setBorder(new ScaledEmptyBorder(0, 42, 0, 0));
imagePane.add(imageLabel);
imagePane.setBackground(Color.WHITE);
UILabel failedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Net_Connect_Failed"), 0);
failedLabel.setPreferredSize(new Dimension(180, 20));
failedLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 20));
UILabel reloadLabel = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Reload"), 0);
reloadLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
reloadLabel.setPreferredSize(new Dimension(180, 20));
reloadLabel.setPreferredSize(FineUIScale.createScaleDimension(180, 20));
reloadLabel.setForeground(Color.blue);
JPanel labelPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, 0, 0, 0);
labelPane.setBorder(BorderFactory.createEmptyBorder(35, 45, 0, 0));
labelPane.setBorder(new ScaledEmptyBorder(35, 45, 0, 0));
labelPane.setBackground(Color.WHITE);
labelPane.add(imagePane);
labelPane.add(failedLabel);
@ -505,7 +506,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof HelpDocument) {
this.setText(((HelpDocument) value).getName());
this.setForeground(Color.BLUE);
this.setForeground(FlatUIUtils.getUIColor("brand.normal", Color.BLUE));
}
return this;
}
@ -544,10 +545,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void initDescriptionArea(JPanel descriptionPanel) {
descriptionTextArea = new UITextArea();
descriptionTextArea.setBorder(null);
UIScrollPane descriptionScrollPane = new UIScrollPane(descriptionTextArea);
descriptionScrollPane.setPreferredSize(new Dimension(300, 200));
descriptionScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
descriptionScrollPane.setPreferredSize(FineUIScale.createScaleDimension(300, 200));
descriptionPanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Interface_Description"), descriptionScrollPane), BorderLayout.CENTER);
descriptionTextArea.setBackground(Color.white);
descriptionTextArea.setBackground(FlatUIUtils.getUIColor("fill.normal", Color.WHITE));
descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true);
descriptionTextArea.setEditable(false);
@ -580,10 +583,12 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void initInterfaceModuleTree(JPanel interfacePanel) {
moduleTree = new JTree();
FineUIStyle.setStyle(moduleTree, FineUIStyle.PURE_TREE);
UIScrollPane moduleTreePane = new UIScrollPane(moduleTree);
moduleTreePane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
moduleTreePane.setBorder(FineBorderFactory.createWrappedRoundBorder());
interfacePanel.add(this.createNamePane(Toolkit.i18nText("Fine-Design_Module"), moduleTreePane), BorderLayout.WEST);
moduleTreePane.setPreferredSize(new Dimension(180, 200));
moduleTreePane.setPreferredSize(FineUIScale.createScaleDimension(180, 200));
moduleTree.setRootVisible(false);
moduleTree.setShowsRootHandles(true);
@ -647,13 +652,14 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void initInterfaceNameList(JPanel interfacePanel) {
interfaceNameList = new JList(new DefaultListModel());
FineUIStyle.setStyle(interfaceNameList, FineUIStyle.PURE_LIST);
UIScrollPane interfaceNamePanelScrollPane = new UIScrollPane(interfaceNameList);
interfaceNamePanelScrollPane.setPreferredSize(new Dimension(180, 200));
interfaceNamePanelScrollPane.setPreferredSize(FineUIScale.createScaleDimension(180, 200));
interfacePanel.add(
this.createNamePane(Toolkit.i18nText("Fine-Design_Interface") + ":", interfaceNamePanelScrollPane),
BorderLayout.CENTER);
interfaceNamePanelScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
interfaceNamePanelScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
initInterfaceNameModule();
initInterfaceNameListSelectionListener();
initInterfaceNameListMouseListener();
@ -856,8 +862,8 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
popupMenu = new JPopupMenu();
JScrollPane tipsScrollPane = new JScrollPane(tipsList);
popupMenu.add(tipsScrollPane);
tipsScrollPane.setPreferredSize(new Dimension(220, 146));
tipsScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
tipsScrollPane.setPreferredSize(FineUIScale.createScaleDimension(220, 146));
tipsScrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
}
private void popTips() {

10
designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java

@ -13,13 +13,11 @@ import com.fr.design.hyperlink.AbstractHyperLinkPane;
import com.fr.design.javascript.jsapi.JSImplPopulateAction;
import com.fr.design.javascript.jsapi.JSImplUpdateAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.js.JavaScriptImpl;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
@ -30,7 +28,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.cell;
@ -76,12 +73,11 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
cell(FineUIUtils.wrapComponentWithTitle(importedJsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"))).weight(0.5),
cell(FineUIUtils.wrapComponentWithTitle(parameterPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Parameter"))).weight(0.5)
).getComponent());
topPane.setPreferredSize(new Dimension(super.getPreferredSize().width, 150));
this.setLayout(new BorderLayout());
this.add(column(10,
cell(topPane).weight(0.5),
cell(FineUIUtils.wrapComponentWithTitle(jsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript"))).weight(0.5)
).getComponent());
this.add(topPane, BorderLayout.NORTH);
this.add(FineUIUtils.wrapComponentWithTitle(jsPane, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript")), BorderLayout.CENTER);
this.reLayoutForChart();
}

2
designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java

@ -51,8 +51,8 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Template_Background"), reportBodyStyleSettingPane);
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane());
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane());
initializePane();
refreshExtraAdvancedPane();
initializePane();
}
@Override

6
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -361,7 +361,11 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
}
protected void buildTabPane() {
uiTabbedPane = tabPaneBuilder.withHeadRatio(0.6f).build();
if (WidgetThemeDesignerUtils.enableWidgetEnhance()) {
uiTabbedPane = tabPaneBuilder.withHeadRatio(1.0f).build();
} else {
uiTabbedPane = tabPaneBuilder.withHeadRatio(0.6f).build();
}
uiTabbedPane.setBorder(new ScaledEmptyBorder(10, 5, 10, 1));
}
}

51
designer-base/src/main/java/com/fr/design/mainframe/toolbar/DebugModeMenuDef.java

@ -0,0 +1,51 @@
package com.fr.design.mainframe.toolbar;
import com.fanruan.gui.UiInspector;
import com.fine.theme.light.ui.laf.FineDarkLaf;
import com.fine.theme.light.ui.laf.FineLightLaf;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.MenuDef;
import com.fr.design.remote.ui.debug.RemoteDesignNetWorkAction;
import java.awt.event.ActionEvent;
/**
* 调试模式菜单
*
* @author vito
* @since 11.0
* Created on 2024/9/24
*/
public class DebugModeMenuDef extends MenuDef {
public DebugModeMenuDef() {
super("Debug");
addLookAndFeelMenu();
addRemotePane();
}
private void addUIInspect() {
this.addShortCut(new UpdateAction() {
@Override
public void actionPerformed(ActionEvent e) {
new UiInspector().showInspector(DesignerContext.getDesignerFrame());
}
});
}
private void addLookAndFeelMenu() {
MenuDef lookAndFeel = new MenuDef("Look And Feel", 'L');
lookAndFeel.addShortCut(
new LookAndFeelAction(new FineLightLaf()),
new LookAndFeelAction(new FineDarkLaf()),
new LookAndFeelAction(new UILookAndFeel())
);
this.addShortCut(lookAndFeel);
}
private void addRemotePane() {
this.addShortCut(new RemoteDesignNetWorkAction());
}
}

19
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -3,8 +3,6 @@
*/
package com.fr.design.mainframe.toolbar;
import com.fine.theme.light.ui.laf.FineDarkLaf;
import com.fine.theme.light.ui.laf.FineLightLaf;
import com.fr.base.FRContext;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignState;
@ -34,7 +32,6 @@ import com.fr.design.actions.file.SwitchExistEnv;
import com.fr.design.actions.help.AboutAction;
import com.fr.design.actions.help.FineUIAction;
import com.fr.design.actions.help.TutorialAction;
import com.fr.design.actions.help.WebDemoAction;
import com.fr.design.actions.help.alphafine.AlphaFineAction;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.actions.server.ConnectionListAction;
@ -49,7 +46,6 @@ import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
import com.fr.design.fun.PluginManagerProvider;
import com.fr.design.fun.TableDataPaneProcessor;
import com.fr.design.gui.UILookAndFeel;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UICombinationButton;
import com.fr.design.gui.ilable.UILabel;
@ -66,9 +62,7 @@ import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.remote.action.RemoteDesignAuthManagerAction;
import com.fr.design.update.actions.SoftwareUpdateAction;
import com.fr.design.utils.ThemeUtils;
import com.fr.env.detect.ui.EnvDetectorAction;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext;
import com.fr.general.locale.LocaleAction;
@ -298,7 +292,7 @@ public abstract class ToolBarMenuDock {
// 当前仅UI开发者模式显示外观配置选项
if (DesignerUIModeConfig.getInstance().isUIDevMode()) {
menuList.add(createLookAndFeel());
menuList.add(new DebugModeMenuDef());
}
// 添加全部UpdateAction到actionmanager中
@ -668,17 +662,6 @@ public abstract class ToolBarMenuDock {
return menuDef;
}
public MenuDef createLookAndFeel() {
MenuDef menuDef = new MenuDef("外观", 'H');
menuDef.addShortCut(
new LookAndFeelAction(new FineLightLaf()),
new LookAndFeelAction(new FineDarkLaf()),
new LookAndFeelAction(new UILookAndFeel())
);
insertMenu(menuDef, "laf");
return menuDef;
}
public MenuDef createCommunityMenuDef() {

46
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkAction.java

@ -0,0 +1,46 @@
package com.fr.design.remote.ui.debug;
import com.fine.theme.utils.FineUIScale;
import com.fr.design.actions.UpdateAction;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.workspace.WorkContext;
import javax.swing.JDialog;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
/**
* 远程设计网络调试
*
* @author vito
* @since 11.0
* Created on 2024/9/24
*/
public class RemoteDesignNetWorkAction extends UpdateAction {
public static final String TITLE = "Remote Design NetWork";
public RemoteDesignNetWorkAction() {
setName(TITLE);
}
@Override
public void actionPerformed(ActionEvent e) {
if (WorkContext.getCurrent().isLocal()) {
return;
}
JDialog jDialog = new JDialog(DesignerContext.getDesignerFrame(), TITLE);
jDialog.setSize(calculatePaneDimension());
jDialog.add(new RemoteDesignNetWorkTablePane());
GUICoreUtils.centerWindow(jDialog);
jDialog.setVisible(true);
}
private static Dimension calculatePaneDimension() {
DesignerFrame parent = DesignerContext.getDesignerFrame();
return new Dimension((int) (FineUIScale.unscale(parent.getWidth()) * 0.8),
(int) (FineUIScale.unscale(parent.getHeight()) * 0.6));
}
}

109
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java

@ -0,0 +1,109 @@
package com.fr.design.remote.ui.debug;
import com.fanruan.workplace.http.debug.RequestInfo;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.workspace.WorkContext;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import static com.fanruan.workplace.http.debug.RemoteDesignDebugEvent.REMOTE_HTTP_REQUEST;
/**
* 远程设计网络调试面板
*
* @author vito
* @since 11.0
* Created on 2024/9/24
*/
public class RemoteDesignNetWorkTablePane extends JPanel {
private static final int K = 1024;
private static final int TWO = 2;
private JTable uiTable;
private DefaultTableModel model;
public RemoteDesignNetWorkTablePane() {
setLayout(new BorderLayout());
setBorder(new ScaledEmptyBorder(10, 10, 10, 10));
initComponent();
initListener();
}
private void initComponent() {
model = new DefaultTableModel();
model.addColumn("status");
model.addColumn("time");
model.addColumn("path");
model.addColumn("cost");
model.addColumn("request size");
model.addColumn("response size");
model.addColumn("request");
model.addColumn("response");
uiTable = new JTable(model);
add(new JScrollPane(uiTable), BorderLayout.CENTER);
}
private void initListener() {
EventDispatcher.listen(REMOTE_HTTP_REQUEST, new Listener<RequestInfo>() {
@Override
public void on(Event event, RequestInfo requestInfo) {
model.addRow(new Object[]{
requestInfo.getStatus(),
dateFormat(requestInfo.getDate()),
requestInfo.getPath().substring(WorkContext.getCurrent().getPath().length() - 1),
requestInfo.getConsume() + "ms",
simpleSize(requestInfo.getRequestSize()),
simpleSize(requestInfo.getResponseSize()),
requestInfo.getSendBody(),
requestInfo.getReturnBody(),
});
adjustColumnWidths(uiTable);
}
});
}
private static void adjustColumnWidths(JTable table) {
for (int column = 0; column < table.getColumnCount() - TWO; column++) {
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = 20;
int maxWidth = tableColumn.getMaxWidth();
tableColumn.setMinWidth(0);
// 从最后一行来调整大小
int row = table.getRowCount() - 1;
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component component = table.prepareRenderer(cellRenderer, row, column);
int width = component.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, Math.min(width, maxWidth));
tableColumn.setPreferredWidth(preferredWidth);
}
}
private static String dateFormat(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(date);
}
private static String simpleSize(long bytes) {
if (bytes < 0) {
return bytes + "";
} else if (bytes < K) {
return bytes + " B";
} else {
DecimalFormat df = new DecimalFormat("#.00");
return df.format((float) bytes / K) + " K";
}
}
}

8
designer-base/src/main/java/com/fr/widgettheme/designer/WidgetThemeDisplayConfigPane.java

@ -1,5 +1,7 @@
package com.fr.widgettheme.designer;
import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -9,6 +11,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.widgettheme.control.attr.WidgetDisplayEnhanceMarkAttr;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import java.awt.BorderLayout;
import java.awt.Color;
@ -39,9 +42,8 @@ public class WidgetThemeDisplayConfigPane extends BasicPane {
northPane.add(row(cell(widgetEnhance)).getComponent());
JPanel southPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Widget_Display_Enhance_Tip"));
label.setForeground(Color.GRAY);
southPane.add(label);
JTextArea tipText = FineUIUtils.createAutoWrapTipLabel(Toolkit.i18nText("Fine-Design_Widget_Display_Enhance_Tip"));
southPane.add(tipText);
this.add(column(10, cell(northPane), cell(southPane)).getComponent());
}

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",

2
designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties

@ -7,6 +7,8 @@ ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI
DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI
DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI
CalendarPaneUI=com.fine.theme.light.ui.FineCalendarPaneUI
DayLabelUI=com.fine.theme.light.ui.FineDayLabelUI
EditorPaneUI=com.formdev.flatlaf.ui.FlatEditorPaneUI
FileChooserUI=com.formdev.flatlaf.ui.FlatFileChooserUI
FormattedTextFieldUI=com.formdev.flatlaf.ui.FlatFormattedTextFieldUI

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

@ -410,6 +410,14 @@ Label.strongHintColor = #FF0000
Label.warningColor = #F1393C
Label.secondaryColor = #0A1C38A8
# ---- Calendar ----
Calendar.background = $fill.normal
Calendar.day.selectedBackground = #2576EF
Calendar.day.hoverBackground = #E6E9EF
Calendar.day.pressedBackground = #DADEE7
Calendar.dayOtherMonth.foreground = fade(@foreground, 29%)
Calendar.day.arc = 6
#---- HelpButton ----
HelpButton.questionMarkColor = @accentCheckmarkColor
@ -1401,8 +1409,16 @@ chart.selectedBorderColor = #2576EF
background: $fill.normal
[style]Button.originalButton = \
border: 4,4,4,4; \
background: null;
borderColor: null; \
background: $fill.normal; \
hoverBorderColor: null;
[style]Button.grayButton = \
foreground: fade(@foreground, 29%); \
borderColor: null; \
background: $fill.normal; \
hoverBorderColor: null;
[style]Label.detailLabel = \
foreground: fade(@foreground, 90%); \

118
designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js

File diff suppressed because one or more lines are too long

32
designer-base/src/test/java/com/fr/design/gui/storybook/components/UICalendarPaneStoryBoard.java

@ -0,0 +1,32 @@
package com.fr.design.gui.storybook.components;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fr.design.gui.date.UICalendarPanel;
import com.fr.design.gui.date.UIDatePicker;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.storybook.StoryBoard;
import javax.swing.*;
import java.awt.*;
import java.util.Date;
import static com.fine.swing.ui.layout.Layouts.*;
public class UICalendarPaneStoryBoard extends StoryBoard {
public UICalendarPaneStoryBoard() {
super("日期控件");
UICalendarPanel calendarPanel = new UICalendarPanel(true);
calendarPanel.setSelectedDate(new Date());
add(
cell(new UILabel("日期下拉框")).with(this::h3),
row(cell(new UIDatePicker(2)).with(this::setFixSize), flex()),
cell(new UILabel("日期")).with(this::h3),
row(cell(calendarPanel), flex())
);
}
private void setFixSize(JComponent component) {
component.setPreferredSize(new Dimension(240, component.getHeight()));
component.setBorder(new FineRoundBorder());
}
}

21
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartFloatPositionPane.java

@ -1,11 +1,11 @@
package com.fr.van.chart.designer.component;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.chart.chartattr.Chart;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.stable.StringUtils;
@ -13,11 +13,15 @@ import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
/**
* 悬浮位置 标题和图例用到
*/
public class VanChartFloatPositionPane extends BasicBeanPane<Chart> {
private static final long serialVersionUID = -4773313488161065678L;
private static final int VERTICAL_GAP = 8;
private UISpinner floatPosition_x;
private UISpinner floatPosition_y;
@ -25,24 +29,21 @@ public class VanChartFloatPositionPane extends BasicBeanPane<Chart> {
this.setLayout(new BorderLayout());
this.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_From_UpLeft")), BorderLayout.CENTER);
this.add(createCustomFloatPositionPane(), BorderLayout.SOUTH);
this.add(column(VERTICAL_GAP,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_XY_From_UpLeft"))),
cell(createCustomFloatPositionPane())).getComponent());
}
private JPanel createCustomFloatPositionPane(){
floatPosition_x = new UISpinner(0,100,1,0);
floatPosition_y = new UISpinner(0,100,1,0);
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p,p};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_positionX")+": "),floatPosition_x},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_positionY")+": "),floatPosition_y}
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
return FineLayoutBuilder.compatibleTableLayout(VERTICAL_GAP, components, new double[]{LayoutConstants.LEFT_WEIGHT, LayoutConstants.RIGHT_WEIGHT});
}
public void setFloatPosition_x(double floatPosition_x) {

2
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartHtmlLabelPane.java

@ -151,7 +151,7 @@ public class VanChartHtmlLabelPane extends JPanel {
new Component[]{isCustomWidth, customWidth},
new Component[]{isCustomHeight, customHeight},
};
return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1, 1});
return FineLayoutBuilder.compatibleTableLayout(10, components, new double[]{1.4, 0.6});
}
private void checkWidth() {

34
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartPlotLegendPane.java

@ -32,6 +32,7 @@ import com.fr.van.chart.designer.component.border.VanChartBorderWithRadiusPane;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
@ -153,7 +154,7 @@ public class VanChartPlotLegendPane extends BasicPane {
return FineLayoutBuilder.asBorderLayoutWrapped(column);
}
protected VanChartBackgroundPane creatBackgroundPane(){
protected VanChartBackgroundPane creatBackgroundPane() {
return new VanChartBackgroundWithOutImagePane();
}
@ -252,21 +253,22 @@ public class VanChartPlotLegendPane extends BasicPane {
customFloatPositionButton.setSelected(true);
checkLayoutPaneVisible();
checkDisplayStrategyUse();
if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane();
}
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
}
uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null);
SwingUtilities.invokeLater(() -> {
if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane();
}
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
}
uiBubbleFloatPane.show(VanChartPlotLegendPane.this, null);
});
}
});
}

32
designer-chart/src/main/java/com/fr/van/chart/designer/style/VanChartTitlePane.java

@ -35,6 +35,7 @@ import com.fr.van.chart.designer.component.background.VanChartBackgroundWithOutS
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
@ -220,21 +221,22 @@ public class VanChartTitlePane extends AbstractVanChartScrollPane<VanChart> {
alignmentPane.setSelectedIndex(-1);
customFloatPositionButton.setSelected(true);
checkDisplayStrategyUse();
if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane();
}
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
}
uiBubbleFloatPane.show(VanChartTitlePane.this, null);
SwingUtilities.invokeLater(() -> {
if (customFloatPositionPane == null) {
customFloatPositionPane = new VanChartFloatPositionPane();
}
if (uiBubbleFloatPane == null) {
Point comPoint = customFloatPositionButton.getLocationOnScreen();
Point arrowPoint = new Point(comPoint.x + customFloatPositionButton.getWidth() / 2 - GAP, comPoint.y + customFloatPositionButton.getHeight());
uiBubbleFloatPane = new UIBubbleFloatPane(Constants.TOP, arrowPoint, customFloatPositionPane, WIDTH, HEIGHT) {
@Override
public void updateContentPane() {
parent.attributeChanged();
}
};
}
uiBubbleFloatPane.show(VanChartTitlePane.this, null);
});
}
});
}

7
designer-form/src/main/java/com/fr/design/mainframe/widget/ui/BasicSetVisiblePropertyPane.java

@ -3,6 +3,9 @@ package com.fr.design.mainframe.widget.ui;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.form.ui.Widget;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/**
* Created by kerry on 2017/9/30.
@ -17,12 +20,12 @@ public class BasicSetVisiblePropertyPane extends FormBasicPropertyPane {
protected void initComponent() {
UICheckBox otherOtherConfig = createOtherConfig();
if(otherOtherConfig != null){
corePane.add(otherOtherConfig);
corePane.add(row(cell(otherOtherConfig)).getComponent());
}
visibleCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Widget_Visible"), true);
visibleCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Basic"));
corePane.add(visibleCheckBox);
corePane.add(row(cell(visibleCheckBox)).getComponent());
}
public UICheckBox createOtherConfig(){

12
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -182,9 +182,9 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT),
cell(backgroundPane).weight(RIGHT_WEIGHT)
),
cell(displayReport),
cell(useParamsTemplate),
cell(fireAfterEditor),
row(cell(displayReport)),
row(cell(useParamsTemplate)),
row(cell(fireAfterEditor)),
row(
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position"))).weight(LEFT_WEIGHT),
cell(hAlignmentPane).weight(RIGHT_WEIGHT)
@ -275,9 +275,9 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"))).weight(LEFT_WEIGHT),
cell(backgroundPane).weight(RIGHT_WEIGHT)
),
cell(displayReport),
cell(useParamsTemplate),
cell(fireAfterEditor)
row(cell(displayReport)),
row(cell(useParamsTemplate)),
row(cell(fireAfterEditor))
).getComponent();
}

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java

@ -42,7 +42,7 @@ public class ButtonGroupDictPane extends JPanel {
cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)
).getComponent();
this.add(column(VERTICAL_GAP,
cell(adaptiveCheckbox),
row(cell(adaptiveCheckbox)),
cell(columnSettingRow)
).getComponent());

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxGroupDefinePane.java

@ -13,6 +13,7 @@ import javax.swing.JPanel;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP;
public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup> {
@ -41,7 +42,7 @@ public class CheckBoxGroupDefinePane extends ButtonGroupDefinePane<CheckBoxGroup
checkbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Choose_Type_All"));
returnTypePane = new ReturnTypePane();
return column(VERTICAL_GAP,
cell(checkbox),
row(cell(checkbox)),
cell(returnTypePane)
).getComponent();
}

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/ComboCheckBoxDefinePane.java

@ -13,6 +13,7 @@ import javax.swing.JPanel;
import java.awt.Component;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.column;
import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP;
@ -42,7 +43,8 @@ public class ComboCheckBoxDefinePane extends DictEditorDefinePane<ComboCheckBox>
returnTypePane = new ReturnTypePane();
return column(VERTICAL_GAP,
cell(supportTagCheckBox),cell(returnTypePane)
row(cell(supportTagCheckBox)),
cell(returnTypePane)
).getComponent();
}

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

@ -7,6 +7,9 @@ import com.fr.form.ui.CustomWriteAbleRepeatEditor;
import javax.swing.JPanel;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.cell;
/**
* Author : Shockway
* Date: 13-9-18
@ -24,7 +27,7 @@ public abstract class CustomWritableRepeatEditorPane<T extends CustomWriteAbleRe
public JPanel setValidatePane(){
this.customDataCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Custom_Data"), false);
JPanel otherContentPane = super.setValidatePane();
otherContentPane.add(customDataCheckBox);
otherContentPane.add(row(cell(customDataCheckBox)).getComponent());
return otherContentPane;
}

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java

@ -52,7 +52,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
cell(dicPane[0]).weight(LEFT_WEIGHT),
cell(dicPane[1]).weight(RIGHT_WEIGHT)
),
cell(repeatCheckBox)
row(cell(repeatCheckBox))
).getComponent();
if (waterMarkComponent[0] != null && waterMarkComponent[1] != null) {
panel.add(row(
@ -115,7 +115,7 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
public JPanel setValidatePane(){
directWriteCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Edit"), false);
JPanel otherContentPane = column(LayoutConstants.VERTICAL_GAP).getComponent();
otherContentPane.add(directWriteCheckBox);
otherContentPane.add(row(cell(directWriteCheckBox)).getComponent());
return otherContentPane;
}

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -154,7 +154,7 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
});
validatePane.add(column(VERTICAL_GAP,
cell(allowBlankCheckBox),
row(cell(allowBlankCheckBox)),
cell(errorTipPane)
).getComponent());

4
designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java

@ -82,8 +82,8 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
return column(VERTICAL_GAP,
cell(formWidgetValuePane),
cell(isStyleAlignmentWrapText),
cell(isPageSetupVertically),
row(cell(isStyleAlignmentWrapText)),
row(cell(isPageSetupVertically)),
row(
cell(FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position_Similar"))).weight(LEFT_WEIGHT),
cell(hAlignmentPane).weight(RIGHT_WEIGHT)

30
designer-realize/src/main/java/com/fr/design/dscolumn/SpecifiedGroupAttrPane.java

@ -1,5 +1,7 @@
package com.fr.design.dscolumn;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fine.theme.utils.FineUIUtils;
import com.fr.base.BaseFormula;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.DSColumnLiteConditionPane;
@ -36,6 +38,9 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
/**
* SpecifiedGroupAttrDialog
*/
@ -86,10 +91,11 @@ public class SpecifiedGroupAttrPane extends BasicPane {
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setLayout(FRGUIPaneFactory.createScaledBorderLayout(0, 10));
specifiedComboBox = new UIComboBox(new String[] {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Condition_Group"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Formula_Group")
});
specifiedComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
specifiedComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
@ -101,9 +107,8 @@ public class SpecifiedGroupAttrPane extends BasicPane {
}
});
JPanel northPane = GUICoreUtils.createFlowPane(
new JComponent[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Specified_Grouping") + ":"),
specifiedComboBox}, FlowLayout.LEFT);
JPanel northPane = FineLayoutBuilder.createHorizontalLayout(10,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Specified_Grouping") + ":"), specifiedComboBox);
this.add(northPane, BorderLayout.NORTH);
cardLayout = new CardLayout();
@ -124,6 +129,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
otherComboBox = new UIComboBox(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG-Discard_All_Others"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG_Leave_In_Their_Own_Groups"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG_Put_All_Others_Together")});
otherComboBox.addItemListener(otherItemListener);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_OtherGroup_Name") + ":");
otherTextField = new UITextField(8);
southPane.add(otherComboBox);
@ -132,9 +138,9 @@ public class SpecifiedGroupAttrPane extends BasicPane {
// 公式分组
formulaGroupPane = new FormulaGroupPane();
centerCardPane.add("Condition", conditionsGroupPane);
centerCardPane.add("Formula", formulaGroupPane);
centerCardPane.add("Formula", FineUIUtils.wrapComponentWithTitle(formulaGroupPane,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_D_Dispaly_Divide_Result_Set_into_Groups")));
this.add(centerCardPane, BorderLayout.CENTER);
}
@ -310,7 +316,6 @@ public class SpecifiedGroupAttrPane extends BasicPane {
private JPanel southPane;
public FormulaGroupPane() {
this.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_D_Dispaly_Divide_Result_Set_into_Groups")));
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
JPanel contentPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1);
this.add(contentPane, BorderLayout.NORTH);
@ -319,10 +324,10 @@ public class SpecifiedGroupAttrPane extends BasicPane {
northPane.setLayout(FRGUIPaneFactory.createBorderLayout());
contentPane.add(northPane);
modeComboBox = new UIComboBox(displayModeNames);
modeComboBox.putClientProperty(COMBO_BOX_TYPE, ADAPTIVE_COMBO_BOX);
northPane.add(FineLayoutBuilder.createHorizontalLayout(10,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Display_Modes") + ":"), modeComboBox));
northPane.add(GUICoreUtils.createFlowPane(new JComponent[] { new UILabel(InsertText), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Display_Modes") + ": "),
modeComboBox }, FlowLayout.LEFT), BorderLayout.WEST);
UILabel label = new UILabel("=");
label.setFont(new Font("Dialog", Font.BOLD, 12));
valueField = new UITextField(16);
@ -330,7 +335,6 @@ public class SpecifiedGroupAttrPane extends BasicPane {
UIButton formulaButton = new UIButton("...");
formulaButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Formula") + "...");
formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build();
@ -358,8 +362,8 @@ public class SpecifiedGroupAttrPane extends BasicPane {
}
});
southPane = GUICoreUtils.createFlowPane(new JComponent[] {new UILabel(InsertText), //new UILabel(com.fr.design.i18n.Toolkit.i18nText("I-Message_FunctionGrouper_2")),
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Value") + ": "), label, valueField, formulaButton}, FlowLayout.LEFT);
southPane = FineLayoutBuilder.createHorizontalLayout(10,
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Value") + ": "), label, valueField, formulaButton);
contentPane.add(southPane);
}

5
designer-realize/src/main/java/com/fr/design/javascript/ListenerEditPane.java

@ -73,12 +73,13 @@ public class ListenerEditPane extends BasicBeanPane<Listener> {
nameText = new UITextField();
nameText.setEditable(false);
final List<String> style = new ArrayList<>(Arrays.asList(JS, DBCOMMIT, CUSTOMACTION, EMAIL, MOBILEPOPUP));
styleBox = new UIComboBox(style.toArray());
styleBox.putClientProperty(FineClientProperties.COMBO_BOX_TYPE, FineClientProperties.ADAPTIVE_COMBO_BOX);
boolean workbook = DesignerContext.getDesignerFrame().getSelectedJTemplate().isJWorkBook();
if (workbook) {
style.add(EXPORT);
}
styleBox = new UIComboBox(style.toArray());
styleBox.putClientProperty(FineClientProperties.COMBO_BOX_TYPE, FineClientProperties.ADAPTIVE_COMBO_BOX);
//事件名
JPanel eventName = row(LayoutConstants.HGAP_LARGE,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Event_Name"))),

6
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -4,7 +4,6 @@
package com.fr.design.mainframe;
import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.BaseFormula;
import com.fr.base.DynamicUnitList;
import com.fr.base.Formula;
@ -410,9 +409,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
grid.setDefaultFloatEditor(CellImagePainter.class, new ImageFloatEditor());
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
// todo: 主题化与env.xml内定义的属性优先级问题
grid.setGridLineColor(FlatUIUtils.getUIColor("Center.ZoneBorderColor", designerEnvManager.getGridLineColor()));
grid.setPaginationLineColor(FlatUIUtils.getUIColor("Center.PageLineColor", designerEnvManager.getPaginationLineColor()));
grid.setGridLineColor(designerEnvManager.getGridLineColor());
grid.setPaginationLineColor(designerEnvManager.getPaginationLineColor());
}
private void addExtraCellEditor(Grid grid) {

20
designer-realize/src/main/java/com/fr/design/report/RichTextEditingPane.java

@ -14,12 +14,14 @@ import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.cellattr.core.RichText;
import com.fr.report.cell.cellattr.core.RichTextConverter;
import java.awt.Font;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Element;
import javax.swing.text.Highlighter;
import javax.swing.text.StyledDocument;
@ -27,6 +29,8 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import static com.formdev.flatlaf.util.UIScale.scale;
/**
* 富文本的编辑区域
*
@ -50,6 +54,22 @@ public class RichTextEditingPane extends UITextPane{
public RichTextEditingPane() {
this.addMouseListener(doubleClickFormulaListener);
this.addFocusListener(focusListener);
setDocument(new ScaledStyledDocument());
}
/**
* 支持字体缩放的Document对象
*/
public static class ScaledStyledDocument extends DefaultStyledDocument {
@Override
public Font getFont(AttributeSet a) {
Font font = super.getFont(a);
if (font != null) {
return font.deriveFont(font.getStyle(), scale(font.getSize()));
}
return null;
}
}
/**

4
designer-realize/src/main/java/com/fr/design/widget/ui/WritableRepeatEditorPane.java

@ -5,6 +5,8 @@ import com.fr.form.ui.WriteAbleRepeatEditor;
import javax.swing.JPanel;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
import static com.fine.swing.ui.layout.Layouts.column;
public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor> extends DirectWriteEditorDefinePane<E> {
@ -19,7 +21,7 @@ public abstract class WritableRepeatEditorPane<E extends WriteAbleRepeatEditor>
JPanel contentPane = column(LayoutConstants.VERTICAL_GAP).getComponent();
JPanel otherContentPane = this.setThirdContentPane();
if (otherContentPane != null) {
contentPane.add(otherContentPane);
contentPane.add(row(cell(otherContentPane)).getComponent());
}
return contentPane;
}

Loading…
Cancel
Save