Browse Source

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

fbp/release
Anner 2 months ago
parent
commit
b243d185f7
  1. 37
      designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java
  2. 3
      designer-base/src/main/java/com/fine/theme/utils/FineUIStyle.java
  3. 4
      designer-base/src/main/java/com/fr/design/condition/ConditionAttributesPane.java
  4. 8
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java
  5. 17
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java
  6. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java
  7. 25
      designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java
  8. 6
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  9. 28
      designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java
  10. 7
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberDragPane.java
  11. 11
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  12. 135
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  13. 18
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  14. 9
      designer-base/src/main/java/com/fr/design/utils/ColorUtils.java
  15. 23
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  16. 1
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLaf.properties
  17. 21
      designer-base/src/main/resources/com/fine/theme/light/ui/laf/FineLightLaf.properties
  18. 119
      designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js
  19. 46
      designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java
  20. 7
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java
  21. 3
      designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java
  22. 10
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  23. 10
      designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java

37
designer-base/src/main/java/com/fine/theme/light/ui/FineComboCheckBoxUI.java

@ -0,0 +1,37 @@
package com.fine.theme.light.ui;
import com.formdev.flatlaf.ui.FlatComboBoxUI;
import javax.swing.JComponent;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
/**
* {@link com.fr.design.gui.icombocheckbox.UIComboCheckBox} UI 样式
*
* @author lemon
* @since 12.0
* Created on 2024/09/27
*/
public class FineComboCheckBoxUI extends FlatComboBoxUI {
public FineComboCheckBoxUI() {
super();
}
/**
* 创建UI
*/
public static ComponentUI createUI(JComponent c) {
return new FineComboCheckBoxUI();
}
@Override
public void installUI(JComponent c) {
super.installUI(c);
c.setBackground(UIManager.getColor("ComboCheckBox.background"));
c.setBorder(UIManager.getBorder("ComboCheckBox.border"));
}
}

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

@ -41,6 +41,7 @@ public interface FineUIStyle {
String POPUP_MENU_TOOL_BAR = "popupMenuToolBar"; String POPUP_MENU_TOOL_BAR = "popupMenuToolBar";
String POPUP_MENU_DROPDOWN = "dropdownPopupMenu"; String POPUP_MENU_DROPDOWN = "dropdownPopupMenu";
String TRANSPARENT_TEXT_FIELD = "transparentTextField"; String TRANSPARENT_TEXT_FIELD = "transparentTextField";
String OFFET_LEFT_TEXT_FIELD = "offsetLeftText";
String TRANSPARENT_BACKGROUND = "transparentBackground"; String TRANSPARENT_BACKGROUND = "transparentBackground";
String PURE_LIST = "pureList"; String PURE_LIST = "pureList";
String NO_BORDER_LIST = "noBorderList"; String NO_BORDER_LIST = "noBorderList";
@ -51,9 +52,11 @@ public interface FineUIStyle {
String DEFAULT_TABLE = "defaultTable"; String DEFAULT_TABLE = "defaultTable";
String WHITE_BUTTON = "whiteButton"; String WHITE_BUTTON = "whiteButton";
String ORIGINAL_BUTTON = "originalButton"; String ORIGINAL_BUTTON = "originalButton";
String PLAIN_ARROW_BUTTON = "plainArrowButton";
String GRAY_BUTTON = "grayButton"; String GRAY_BUTTON = "grayButton";
String DETAIL_LABEL = "detailLabel"; String DETAIL_LABEL = "detailLabel";
String WIDGET_EVENT_LABEL = "widgetEventLabel"; String WIDGET_EVENT_LABEL = "widgetEventLabel";
String HYPER_LINK_LABEL = "hyperLinkLabel";
/** /**

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

@ -2,7 +2,6 @@ package com.fr.design.condition;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.fr.common.annotations.Open; import com.fr.common.annotations.Open;
@ -90,7 +89,8 @@ public abstract class ConditionAttributesPane<T> extends BasicBeanPane<T> {
this.add(FineUIUtils.wrapComponentWithTitle(column( this.add(FineUIUtils.wrapComponentWithTitle(column(
10, 10,
row(cell(addItemPane), flex()), row(cell(addItemPane), flex()),
cell(selectedItemScrollPane).weight(1).with(it -> it.setBorder(new FineRoundBorder())), cell(selectedItemScrollPane).weight(1).with(
it -> it.setBorder(FineBorderFactory.createWrappedRoundBorder())),
fix(10) fix(10)
).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")), BorderLayout.NORTH); ).getComponent(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Property")), BorderLayout.NORTH);
} }

8
designer-base/src/main/java/com/fr/design/data/datapane/connect/ItemEditableComboBoxPanel.java

@ -2,8 +2,8 @@ package com.fr.design.data.datapane.connect;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
@ -55,16 +55,16 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
itemComboBox.setEnabled(true); itemComboBox.setEnabled(true);
this.add(itemComboBox, BorderLayout.CENTER); this.add(itemComboBox, BorderLayout.CENTER);
refreshButton = new UIButton(new LazyIcon("refresh")); refreshButton = new UIButton(new LazyIcon("refresh"));
FineUIStyle.setStyle(refreshButton, FineUIStyle.ORIGINAL_BUTTON);
JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 0 ,4); JPanel jPanel = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 0 ,4);
editButton = initEditButton(editButton, buttonSize); editButton = initEditButton(editButton, buttonSize);
editButton.setBorder(null); FineUIStyle.setStyle(editButton, FineUIStyle.ORIGINAL_BUTTON);
editButton.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); editButton.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255)));
jPanel.add(editButton); jPanel.add(editButton);
jPanel.add(refreshButton); jPanel.add(refreshButton);
jPanel.setOpaque(true); jPanel.setOpaque(true);
this.add(jPanel, BorderLayout.EAST); this.add(jPanel, BorderLayout.EAST);
refreshButton.setPreferredSize(buttonSize); refreshButton.setPreferredSize(buttonSize);
refreshButton.setBorder(null);
refreshButton.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255))); refreshButton.setBackground(FlatUIUtils.getUIColor("default.background", new Color(246, 248, 250, 255)));
refreshButton.addActionListener(new ActionListener() { refreshButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -74,7 +74,7 @@ public abstract class ItemEditableComboBoxPanel extends JPanel {
} }
protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) { protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) {
editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/control-center2.png")); editButton = new UIButton(new LazyIcon("edit"));
editButton.setPreferredSize(buttonSize); editButton.setPreferredSize(buttonSize);
editButton.addActionListener(new ActionListener() { editButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {

17
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java

@ -1,7 +1,6 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting; package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.ui.FlatUIUtils;
import com.fr.data.desensitize.base.DesensitizationTableData; import com.fr.data.desensitize.base.DesensitizationTableData;
@ -14,7 +13,6 @@ import com.fr.design.data.datapane.preview.desensitization.view.rule.Desensitiza
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -39,7 +37,6 @@ import javax.swing.UIManager;
import javax.swing.event.CellEditorListener; import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
@ -57,6 +54,8 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* 处理TableDataDesensitizationTablePane中TableEditPane的Model * 处理TableDataDesensitizationTablePane中TableEditPane的Model
* *
@ -367,12 +366,6 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
} }
}); });
setBoxStyle();
}
private void setBoxStyle() {
this.rolesCheckBox.setBorder(new FineRoundBorder());
FineUIStyle.setStyle(this.rolesCheckBox.getEditor(), FineUIStyle.TRANSPARENT_TEXT_FIELD);
} }
@Override @Override
@ -433,7 +426,9 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
protected void setLayoutAndAddComponents() { protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(getLabel(), BorderLayout.EAST); JPanel pane = getClickPane();
pane.setOpaque(false);
this.add(pane, BorderLayout.CENTER);
} }
@Override @Override
@ -457,7 +452,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
// 规则状态 // 规则状态
this.ruleStatusLabel = new UILabel(); this.ruleStatusLabel = new UILabel();
this.ruleStatusLabel.setOpaque(true); this.ruleStatusLabel.setOpaque(true);
FineUIStyle.setStyle(ruleStatusLabel, FineUIStyle.LABEL_WARNING_TIP); setStyle(ruleStatusLabel, FineUIStyle.LABEL_WARNING_TIP);
} }
/** /**

11
designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java

@ -6,6 +6,7 @@ import com.fr.datacenters.tabledata.bean.DCTableDataBean;
import com.fr.datacenters.tabledata.filter.DCFilter; import com.fr.datacenters.tabledata.filter.DCFilter;
import com.fr.datacenters.tabledata.parameter.DCParameter; import com.fr.datacenters.tabledata.parameter.DCParameter;
import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
@ -135,6 +136,16 @@ public class DCTableDataJSBridge {
}).setVisible(true); }).setVisible(true);
} }
/**
* 当前所有数据集名称
*/
@JSBridge
public void getDatasetNames(final JsFunction callback) {
JxUIPane.DEFAULT_EXECUTOR.submit(() ->
callback.invoke(window, EmbedJson.encode(
DesignTableDataManager.getAllDSNames(DesignTableDataManager.getEditingTableDataSource()))));
}
/** /**
* 解析公式参数 * 解析公式参数
*/ */

25
designer-base/src/main/java/com/fr/design/env/HttpWorkspaceConnector.java vendored

@ -5,19 +5,19 @@ import com.fanruan.workplace.http.HttpServiceMap;
import com.fanruan.workplace.http.RepositoryManager; import com.fanruan.workplace.http.RepositoryManager;
import com.fanruan.workplace.http.info.Stub; import com.fanruan.workplace.http.info.Stub;
import com.fanruan.workplace.network.RemoteNetworkRepository; import com.fanruan.workplace.network.RemoteNetworkRepository;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.engine.exception.RemoteDesignConnectionException;
import com.fr.workspace.engine.exception.RemoteDesignNoAuthException;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient;
import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean; import com.fr.decision.webservice.bean.authentication.LoginRequestInfoBean;
import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean; import com.fr.decision.webservice.bean.authentication.LoginResponseInfoBean;
import com.fr.stable.StringUtils;
import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceClient;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.connect.WorkspaceConnector; import com.fr.workspace.connect.WorkspaceConnector;
import com.fr.workspace.engine.exception.RemoteDesignConnectionException;
import com.fr.workspace.engine.exception.RemoteDesignNoAuthException;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import com.fr.workspace.server.repository.authority.RemoteAuthoritySource;
import com.fr.workspace.server.repository.compatible.register.CompatibleRegister;
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.Map; import java.util.Map;
@ -72,13 +72,18 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
Stub<?> stub = entry.getValue(); Stub<?> stub = entry.getValue();
stub.clearProxy(); stub.clearProxy();
} }
LoginResponseInfoBean bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo)); Map<String, Object> loginConfigMap = RemoteAuthorityRepository.getInstance().getLoginConfigMap();
long timeout = Long.parseLong(String.valueOf(loginConfigMap.get(RemoteAuthoritySource.LOGIN_TIMEOUT)));
boolean rememberLogin = (boolean) loginConfigMap.get(RemoteAuthoritySource.SUPPORT_REMEMBER_LOGIN);
LoginResponseInfoBean bean = RemoteAuthorityRepository.getInstance().login(createLoginBean(connectionInfo, rememberLogin));
WorkspaceConnection connection = new WorkspaceConnection( WorkspaceConnection connection = new WorkspaceConnection(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
connectionInfo.getUserName(), connectionInfo.getUserName(),
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(),
InetAddress.getLocalHost().getHostAddress()); InetAddress.getLocalHost().getHostAddress());
client.updateConnection(connection); client.updateConnection(connection);
client.setRememberLogin(rememberLogin);
client.setTimeout(timeout);
try { try {
return RemoteNetworkRepository.getInstance().testConnect(); return RemoteNetworkRepository.getInstance().testConnect();
} catch (RemoteDesignNoAuthException e) { } catch (RemoteDesignNoAuthException e) {
@ -88,12 +93,12 @@ public class HttpWorkspaceConnector implements WorkspaceConnector {
} }
} }
private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo) { private LoginRequestInfoBean createLoginBean(WorkspaceConnectionInfo connectionInfo, boolean rememberLogin) {
LoginRequestInfoBean bean = new LoginRequestInfoBean(); LoginRequestInfoBean bean = new LoginRequestInfoBean();
bean.setUsername(connectionInfo.getUserName()); bean.setUsername(connectionInfo.getUserName());
bean.setPassword(connectionInfo.getPassword()); bean.setPassword(connectionInfo.getPassword());
bean.setEncrypted(false); bean.setEncrypted(false);
bean.setValidity(-2); bean.setValidity(rememberLogin ? -2 : -1);
return bean; return bean;
} }
} }

6
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -1,10 +1,9 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle; import com.fine.theme.utils.FineUIStyle;
import com.fine.theme.utils.FineUIUtils; import com.fine.theme.utils.FineUIUtils;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -29,7 +28,6 @@ import javax.swing.DefaultListModel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ListModel; import javax.swing.ListModel;
import javax.swing.ListSelectionModel; import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.event.ListDataEvent; import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener; import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
@ -102,7 +100,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
@Override @Override
protected void initLeftPane(JPanel leftPane) { protected void initLeftPane(JPanel leftPane) {
leftPane.add(new UIScrollPane(contentPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0)), BorderLayout.CENTER); leftPane.add(new UIScrollPane(contentPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 0)), BorderLayout.CENTER);
leftPane.setBorder(new FineRoundBorder()); leftPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
} }

28
designer-base/src/main/java/com/fr/design/gui/frpane/FineTabbedPane.java

@ -43,7 +43,7 @@ public class FineTabbedPane extends Box {
private final UIButtonGroup<String> tabGroup; private final UIButtonGroup<String> tabGroup;
private final Map<String, JComponent> tabComponents; private final Map<String, JComponent> tabComponents;
private final int[] tabLayout; private final int[] tabLayout;
private final boolean useFitTab ; private final boolean useFitTab;
private FineTabbedPane(Map<String, JComponent> tabComponents, float headRatio, int[] tabLayout, boolean useFitTab) { private FineTabbedPane(Map<String, JComponent> tabComponents, float headRatio, int[] tabLayout, boolean useFitTab) {
this.headRatio = headRatio; this.headRatio = headRatio;
@ -142,35 +142,45 @@ public class FineTabbedPane extends Box {
initCoreComponents(); initCoreComponents();
setMatchParentSize(true); setMatchParentSize(true);
float flexRatio = (1 - headRatio) / 2; float flexRatio = (1 - headRatio) / 2;
int headHeight = FlatUIUtils.getUIInt("Component.defaultHeight",24) * tabLayout.length / 2; int headHeight = FlatUIUtils.getUIInt("Component.defaultHeight", 24) * tabLayout.length / 2;
Component component = useFitTab ? row(flex(), cell(tabGroup), flex()).getComponent() : row(flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio)).getComponent(); Component tabRow = useFitTab ? row(flex(), cell(tabGroup), flex()).getComponent() : row(flex(flexRatio), cell(tabGroup).weight(headRatio), flex(flexRatio)).getComponent();
Component backgroundComp = createBackGroundComp();
add( add(
column( column(
cell(component), cell(tabRow),
flex() cell(centerPane).with(it -> it.setBorder(new ScaledEmptyBorder(10, 10, 10, 10))).weight(1)
), ),
column( column(
fix(headHeight), fix(headHeight),
cell(centerPane).with(it -> it.setBorder(new ScaledEmptyBorder(headHeight + 10, 10, 10, 10))).weight(1) cell(backgroundComp).weight(1)
) )
); );
fillBackgroundColor(); fillBackgroundColor();
} }
private Component createBackGroundComp() {
JPanel pane = new JPanel();
pane.putClientProperty(PANEL_TYPE, ROUNDED_PANEL);
pane.setBackground(getFillColor());
return pane;
}
private void initCoreComponents() { private void initCoreComponents() {
cards = new CardLayout(); cards = new CardLayout();
centerPane = new JPanel(cards); centerPane = new JPanel(cards);
centerPane.putClientProperty(PANEL_TYPE, ROUNDED_PANEL);
tabComponents.forEach((key, value) -> { tabComponents.forEach((key, value) -> {
value.setOpaque(false); value.setOpaque(false);
centerPane.add(value, key); centerPane.add(value, key);
}); });
} }
private Color getFillColor() {
return FineUIUtils.getUIColor("FineTabbedPane.background", "fill.gray");
}
private void fillBackgroundColor() { private void fillBackgroundColor() {
Color fillColor = FineUIUtils.getUIColor("FineTabbedPane.background", "fill.gray");
Color defaultColor = FineUIUtils.getUIColor("default.background", "Component.background"); Color defaultColor = FineUIUtils.getUIColor("default.background", "Component.background");
ColorUtils.syncBackgroundIfAbsent(centerPane, fillColor, defaultColor); ColorUtils.syncBackgroundIfAbsent(centerPane, getFillColor(), defaultColor);
} }
private void initListeners() { private void initListeners() {

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

@ -14,13 +14,12 @@ import java.awt.Dimension;
import static com.fine.swing.ui.layout.Layouts.cell; 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.fix;
import static com.fine.swing.ui.layout.Layouts.flex;
public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNameObserver { public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNameObserver {
private static final long serialVersionUID = -8681716725163358249L; private static final long serialVersionUID = -8681716725163358249L;
private static double DRAG_BAR_WEIGHT = 0.64; private static double DRAG_BAR_WEIGHT = 0.6;
private static double SPINNER_WIGHT = 0.36; private static double SPINNER_WIGHT = 0.4;
private UISlider dragBar; private UISlider dragBar;
private UISpinner spinner; private UISpinner spinner;
private boolean isEditing = false; private boolean isEditing = false;
@ -49,7 +48,7 @@ public class UINumberDragPane extends BasicBeanPane<Double> implements GlobalNam
spinner.setValue(dragBar.getValue()); spinner.setValue(dragBar.getValue());
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(Layouts.row( this.add(Layouts.row(
cell(dragBar).weight(DRAG_BAR_WEIGHT), fix(2), cell(spinner).weight(SPINNER_WIGHT) cell(dragBar).weight(DRAG_BAR_WEIGHT), fix(8), cell(spinner).weight(SPINNER_WIGHT)
).getComponent()); ).getComponent());
dragBar.addChangeListener(e -> { dragBar.addChangeListener(e -> {
if (globalNameListener != null && shouldResponseNameListener()) { if (globalNameListener != null && shouldResponseNameListener()) {

11
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -31,6 +31,10 @@ import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
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.row;
public class UICheckListPopup extends UIPopupMenu { public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
private List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>(); private List<JCheckBox> checkBoxList = new ArrayList<JCheckBox>();
@ -120,15 +124,12 @@ public class UICheckListPopup extends UIPopupMenu {
} }
private void addOneCheckValue(Object checkValue) { private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkPane = new JPanel(new BorderLayout());
checkPane.setPreferredSize(FineUIScale.scale(new Dimension(144, CHECKBOX_HEIGHT)));
final JCheckBox temp = createCheckbox(); final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString()); final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setPreferredSize(FineUIScale.scale(new Dimension(100, 20)));
checkPane.setBackground(Color.WHITE); checkPane.setBackground(Color.WHITE);
checkPane.add(temp); checkPane.add(row(fix(4), cell(temp), cell(label)).getComponent());
checkPane.add(label);
if (labelNeedToolTips) { if (labelNeedToolTips) {
// 设置每项Label的tooltips为其省略前的内容 // 设置每项Label的tooltips为其省略前的内容
label.setToolTipText(checkValue.toString()); label.setToolTipText(checkValue.toString());

135
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -2,19 +2,20 @@ package com.fr.design.gui.icombocheckbox;
import com.fine.theme.icon.LazyIcon; import com.fine.theme.icon.LazyIcon;
import com.fine.theme.light.ui.FineRoundBorder; import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIUtils;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.event.GlobalNameListener; import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.HoverAware; import com.fr.design.event.HoverAware;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; 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.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JComboBox;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -36,6 +37,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.fine.theme.utils.FineUIStyle.OFFET_LEFT_TEXT_FIELD;
import static com.fine.theme.utils.FineUIStyle.PLAIN_ARROW_BUTTON;
import static com.fine.theme.utils.FineUIStyle.TRANSPARENT_TEXT_FIELD;
import static com.fine.theme.utils.FineUIStyle.setStyle;
/** /**
* 设计器下拉复选框组件 * 设计器下拉复选框组件
* 支持全选半选 * 支持全选半选
@ -43,10 +49,10 @@ import java.util.Map;
* 可以省略显示 * 可以省略显示
* *
* @author * @author
* @since * @since Created on
* Created on
*/ */
public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNameObserver, HoverAware { public class UIComboCheckBox extends JComboBox implements UIObserver, GlobalNameObserver, HoverAware {
private static final String UI_CLASS_ID = "ComboCheckBoxUI";
//下拉框的值 //下拉框的值
private Object[] values; private Object[] values;
//已经选中的值 //已经选中的值
@ -55,8 +61,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
private UICheckListPopup popup; private UICheckListPopup popup;
private UITextField editor; private UITextField editor;
private final JPanel clickPane = new JPanel(new BorderLayout());
private UIButton arrowButton; private UIButton arrowButton;
private UILabel label;
//选中的值之间显示的分隔符 //选中的值之间显示的分隔符
private String valueSperator; private String valueSperator;
private static final String DEFAULT_VALUE_SPERATOR = ","; private static final String DEFAULT_VALUE_SPERATOR = ",";
@ -71,6 +77,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private String placeHolder = StringUtils.EMPTY; private String placeHolder = StringUtils.EMPTY;
private boolean rollOver; private boolean rollOver;
private boolean popupVisible = false;
public UIComboCheckBox(Object[] value) { public UIComboCheckBox(Object[] value) {
this(value, DEFAULT_VALUE_SPERATOR, true); this(value, DEFAULT_VALUE_SPERATOR, true);
@ -123,19 +130,22 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
private void initComponent() { private void initComponent() {
this.popup = new UICheckListPopup(values, supportSelectAll); this.popup = new UICheckListPopup(values, supportSelectAll) {
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
size.width = UIComboCheckBox.this.getWidth();
return size;
}
};
this.popup.setBorder(new FineRoundBorder());
this.popup.addActionListener(new PopupAction()); this.popup.addActionListener(new PopupAction());
this.editor = createEditor(); initClickPane();
this.arrowButton = createArrowButton();
this.label = new UILabel(getIcon());
label.setPreferredSize(FineUIScale.scale(new Dimension(24, 24)));
setLayoutAndAddComponents(); setLayoutAndAddComponents();
setText(); setText();
addPopupListener(this); addPopupListener(this);
setBackground(Color.WHITE);
setOpaque(true);
} }
/** /**
@ -152,8 +162,8 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
return popup; return popup;
} }
public UITextField getEditor() { public JPanel getClickPane() {
return editor; return clickPane;
} }
public String getPlaceHolder() { public String getPlaceHolder() {
@ -164,31 +174,37 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
this.placeHolder = placeHolder; this.placeHolder = placeHolder;
} }
public UIButton getArrowButton() { private void initClickPane() {
return arrowButton; editor = new TextField();
} editor.setEditable(false);
setStyle(editor, OFFET_LEFT_TEXT_FIELD);
public UILabel getLabel() { arrowButton = new UIButton(getIcon());
return label; setStyle(arrowButton, PLAIN_ARROW_BUTTON);
}
private UIButton createArrowButton() { clickPane.add(editor, BorderLayout.CENTER);
final UIButton arrowBtn = new UIButton(); clickPane.add(arrowButton, BorderLayout.EAST);
arrowBtn.setNormalPainted(false);
arrowBtn.setPreferredSize(FineUIScale.scale(new Dimension(20, 5)));
arrowBtn.setIcon(getIcon());
arrowBtn.setExtraPainted(false);
addPopupListener(arrowBtn);
return arrowBtn; addPopupListener(editor);
addPopupListener(arrowButton);
addHoverStatusListener(editor);
addHoverStatusListener(arrowButton);
} }
private UITextField createEditor() { protected void addHoverStatusListener(JComponent component) {
UITextField editor = new TextField(); component.addMouseListener(new MouseAdapter() {
editor.setEditable(false); @Override
addPopupListener(editor); public void mouseEntered(MouseEvent e) {
rollOver = true;
repaint();
}
return editor; @Override
public void mouseExited(MouseEvent e) {
rollOver = popup.isVisible();
repaint();
}
});
} }
/** /**
@ -202,18 +218,6 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
togglePopup(); togglePopup();
} }
@Override
public void mouseEntered(MouseEvent e) {
rollOver = true;
repaint();
}
@Override
public void mouseExited(MouseEvent e) {
rollOver = false;
repaint();
}
}); });
} }
@ -240,7 +244,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
@Override @Override
public boolean isHovered() { public boolean isHovered() {
return rollOver || this.popup.isShowing(); return rollOver;
} }
private class PopupAction implements ActionListener { private class PopupAction implements ActionListener {
@ -258,10 +262,32 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private void togglePopup() { private void togglePopup() {
if (this.arrowButton.isEnabled()) { if (this.arrowButton.isEnabled()) {
popup.setBorder(new FineRoundBorder()); if (popupVisible) {
popup.setPreferredSize(new Dimension(getWidth(), this.popup.getPreferredSize().height)); hidePopup();
popup.show(this, 0, getHeight()); } else {
showPopup();
}
}
}
/**
* 展示 popup
*/
public void showPopup() {
this.popup.show(this, 0, getHeight());
arrowButton.setIcon(new LazyIcon("up_arrow"));
arrowButton.repaint();
popupVisible = true;
} }
/**
* 隐藏 popup
*/
public void hidePopup() {
popup.setVisible(false);
arrowButton.setIcon(new LazyIcon("down_arrow"));
arrowButton.repaint();
popupVisible = false;
} }
/** /**
@ -301,6 +327,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
/** /**
* 为为添加placeholder * 为为添加placeholder
*
* @param editor * @param editor
*/ */
protected void setEditorPlaceHolder(UITextField editor) { protected void setEditorPlaceHolder(UITextField editor) {
@ -335,7 +362,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
for (int i = 1; i <= chars.length; i++) { for (int i = 1; i <= chars.length; i++) {
//如果原文本+省略号长度超过文本框 //如果原文本+省略号长度超过文本框
if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getPreferredSize().getWidth()) { if (fontMetrics.charsWidth(chars, 0, i) + omitLength > textEditor.getWidth()) {
//从第i-1的位置截断再拼上省略号 //从第i-1的位置截断再拼上省略号
omitText = text.substring(0, i - 2) + OMIT_TEXT; omitText = text.substring(0, i - 2) + OMIT_TEXT;
break; break;
@ -466,8 +493,14 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
} }
@Override
public String getUIClassID() {
return UI_CLASS_ID;
}
/** /**
* 简单的测试demo * 简单的测试demo
*
* @param args * @param args
*/ */
public static void main(String args[]) { public static void main(String args[]) {

18
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -1,29 +1,23 @@
package com.fr.design.mainframe.authority; package com.fr.design.mainframe.authority;
import com.fanruan.config.impl.data.ConnectionConfigProviderFactory;
import com.fanruan.config.impl.data.TableDataConfigProviderFactory;
import com.fr.base.CloneCollector;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.user.UserAuthority; import com.fr.workspace.server.authority.user.UserAuthority;
import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository; import com.fr.workspace.server.repository.authority.RemoteAuthorityRepository;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
@ -31,6 +25,7 @@ public class JTemplateAuthorityChecker {
JTemplate<?, ?> jTemplate; JTemplate<?, ?> jTemplate;
Set<String> authConnectionNames; Set<String> authConnectionNames;
Set<String> authDatasetNames; Set<String> authDatasetNames;
Set<String> templateDatasetNames;
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>(); Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>();
Set<String> authFailConnectionNames = new HashSet<>(); Set<String> authFailConnectionNames = new HashSet<>();
Set<String> authFailDatasetNames = new HashSet<>(); Set<String> authFailDatasetNames = new HashSet<>();
@ -45,7 +40,12 @@ public class JTemplateAuthorityChecker {
} }
private void initAuthNames() { private void initAuthNames() {
// 无需获取所有数据集和数据连接了,当前只能获取自己有权限的 // 无需获取所有服务器数据集和数据连接了,因为当前只能获取自己有权限的,只要拿一下模板数据集就行
templateDatasetNames = new HashSet<>();
Iterator<String> tableDataNameIterator = jTemplate.getTarget().getTableDataNameIterator();
while (tableDataNameIterator.hasNext()) {
templateDatasetNames.add(tableDataNameIterator.next());
}
Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName()); Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName());
if (authNamesMap != null) { if (authNamesMap != null) {
//有权限的数据连接名称 //有权限的数据连接名称
@ -87,6 +87,8 @@ public class JTemplateAuthorityChecker {
} }
} }
} }
// 排除模板数据集的部分
authFailDatasetNames.removeAll(templateDatasetNames);
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s));
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0;
} }

9
designer-base/src/main/java/com/fr/design/utils/ColorUtils.java

@ -7,6 +7,8 @@ import javax.swing.JScrollPane;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.event.ContainerAdapter;
import java.awt.event.ContainerEvent;
import java.util.Arrays; import java.util.Arrays;
/** /**
@ -53,6 +55,13 @@ public class ColorUtils {
if (components != null) { if (components != null) {
Arrays.stream(components).forEach((e) -> syncBackgroundIfAbsent(e, replaceColor, defaultColor)); Arrays.stream(components).forEach((e) -> syncBackgroundIfAbsent(e, replaceColor, defaultColor));
} }
container.addContainerListener(new ContainerAdapter() {
@Override
public void componentAdded(ContainerEvent e) {
Component addedComponent = e.getChild();
syncBackgroundIfAbsent(addedComponent, replaceColor, defaultColor);
}
});
} }
} }

23
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -1,11 +1,12 @@
package com.fr.design.web; package com.fr.design.web;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper; import com.fr.base.GraphHelper;
import com.fr.base.Icon; import com.fr.base.Icon;
import com.fr.base.IconManager; import com.fr.base.IconManager;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -90,7 +91,7 @@ public class CustomIconPane extends BasicPane {
UILabel iconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")); UILabel iconLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon"));
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel noNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel noNamePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
noNamePane.setBorder(new FineRoundBorder()); noNamePane.setBorder(FineBorderFactory.createWrappedRoundBorder());
noNamePane.setBackground(Color.WHITE); noNamePane.setBackground(Color.WHITE);
iconPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); iconPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
@ -419,7 +420,7 @@ public class CustomIconPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon")); UIButton browseButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom_Icon_SelectIcon"));
browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button")); browseButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Click_this_button"));
nameTextField = new UITextField(20); nameTextField = new UITextField();
nameTextField.setPreferredSize(FineUIScale.createScaleDimension(172, 24)); nameTextField.setPreferredSize(FineUIScale.createScaleDimension(172, 24));
browseButton.addActionListener(e -> onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this))); browseButton.addActionListener(e -> onBrowseButtonClicked(SwingUtilities.getWindowAncestor(EditIconDialog.this)));
@ -446,16 +447,14 @@ public class CustomIconPane extends BasicPane {
showImageLabel = new UILabel(); showImageLabel = new UILabel();
showImageLabel.setPreferredSize(FineUIScale.createScaleDimension(50, 50)); showImageLabel.setPreferredSize(FineUIScale.createScaleDimension(50, 50));
JPanel centerPane = column(10, JPanel centerPane = column(LayoutConstants.VERTICAL_GAP,
row( row(40,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")).weight(1.2), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":")),
cell(nameTextField).weight(3) cell(nameTextField)
), ),
row( row(40,
cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")).weight(1.2), cell(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":")),
row( row(cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1)).weight(1)
cell(showImageLabel), column(fix(13), cell(browseButton), fix(13)).weight(1)
).weight(3)
) )
).getComponent(); ).getComponent();
this.add(centerPane, BorderLayout.WEST); this.add(centerPane, BorderLayout.WEST);

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

@ -5,6 +5,7 @@ CheckBoxUI=com.fine.theme.light.ui.FineCheckBoxUI
CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI
ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI ComboBoxUI=com.fine.theme.light.ui.FineComboBoxUI
ComboCheckBoxUI=com.fine.theme.light.ui.FineComboCheckBoxUI
DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI DesktopIconUI=com.formdev.flatlaf.ui.FlatDesktopIconUI
DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI DesktopPaneUI=com.formdev.flatlaf.ui.FlatDesktopPaneUI
CalendarPaneUI=com.fine.theme.light.ui.FineCalendarPaneUI CalendarPaneUI=com.fine.theme.light.ui.FineCalendarPaneUI

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

@ -324,6 +324,10 @@ ComboBox.comboHeight = 24
ComboBox.selectBox.button.height = 22 ComboBox.selectBox.button.height = 22
ComboBox.renderInset = 0,6,0,6 ComboBox.renderInset = 0,6,0,6
#---- ComboCheckBox ----
ComboCheckBox.background = $fill.normal
ComboCheckBox.border = com.fine.theme.light.ui.FineRoundBorder
#---- Component ---- #---- Component ----
Component.focusWidth = 0 Component.focusWidth = 0
@ -1276,6 +1280,15 @@ chart.selectedBorderColor = #2576EF
borderWidth : 0; \ borderWidth : 0; \
disabledBackground : fade($Button.background,0%); disabledBackground : fade($Button.background,0%);
[style]Button.plainArrowButton=\
background : fade($Button.background,0%); \
margin: 4,4,4,4; \
borderWidth : 0; \
disabledBackground : fade($Button.background,0%); \
hoverBackground : null; \
selectedBackground : null; \
pressedBackground : null
[style]CombinationButton.primary = \ [style]CombinationButton.primary = \
background : @BrandColor; \ background : @BrandColor; \
arc : 3 arc : 3
@ -1328,6 +1341,11 @@ chart.selectedBorderColor = #2576EF
[style]TextField.transparentTextField=\ [style]TextField.transparentTextField=\
background: fade(@background, 0%); \ background: fade(@background, 0%); \
border: null; border: null;
[style]TextField.offsetLeftText=\
background: fade(@background, 0%); \
border: 0,6,0,0;
[style]PopupMenu.dropdownPopupMenu=\ [style]PopupMenu.dropdownPopupMenu=\
background: fade(@background, 0%); \ background: fade(@background, 0%); \
borderInsets: 0,0,0,0; borderInsets: 0,0,0,0;
@ -1427,3 +1445,6 @@ chart.selectedBorderColor = #2576EF
[style]Label.widgetEventLabel = \ [style]Label.widgetEventLabel = \
foreground: $List.wrapper.text.fontColor; \ foreground: $List.wrapper.text.fontColor; \
background: $fill.normal; background: $fill.normal;
[style]Label.hyperLinkLabel = \
foreground: $brand.normal;

119
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

46
designer-base/src/test/java/com/fr/design/gui/storybook/components/ComboCheckBoxStoryBoard.java

@ -0,0 +1,46 @@
package com.fr.design.gui.storybook.components;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.storybook.StoryBoard;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.ArrayUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.flex;
public class ComboCheckBoxStoryBoard extends StoryBoard {
public ComboCheckBoxStoryBoard() {
super("下拉多选框");
add(
cell(new UILabel("普通状态")).with(this::h3),
cell(getComboCheckBox(ArrayUtils.toArray("测试1", "测试2", "测试3", "测试4"))),
cell(new UILabel("长文字状态")).with(this::h3),
cell(getComboCheckBox(ArrayUtils.toArray("测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1测试长文字1",
"测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2测试长文字2",
"测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3测试长文字3",
"测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4测试长文字4"))),
flex()
);
}
private UIComboCheckBox getComboCheckBox(Object[] array) {
return new UIComboCheckBox(array, true) {
protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel pane = getClickPane();
pane.setOpaque(false);
this.add(pane, BorderLayout.CENTER);
}
};
}
}

7
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/model/DesensitizationCellPane.java

@ -292,12 +292,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
protected void setLayoutAndAddComponents() { protected void setLayoutAndAddComponents() {
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白 // 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UITextField editor = getEditor(); this.add(getClickPane(), BorderLayout.CENTER);
UIButton arrowButton = getArrowButton();
setStyle(editor, TRANSPARENT_TEXT_FIELD);
setStyle(arrowButton, PLAIN_BUTTON);
this.add(editor, BorderLayout.CENTER);
this.add(arrowButton, BorderLayout.EAST);
} }
@Override @Override

3
designer-realize/src/main/java/com/fr/design/report/ReportEnginePane.java

@ -2,6 +2,7 @@ package com.fr.design.report;
import com.fanruan.cloud.FanruanCloud; import com.fanruan.cloud.FanruanCloud;
import com.fine.theme.utils.FineUIScale; import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder; import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
@ -221,7 +222,7 @@ public class ReportEnginePane extends BasicBeanPane<LayerReportAttr> {
UILabel downExplainLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Report_Detail_Reference")); UILabel downExplainLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Report_Detail_Reference"));
downExplainLabel.setForeground(new Color(0, 0, 0)); downExplainLabel.setForeground(new Color(0, 0, 0));
JLabel helper = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Community_Help")); JLabel helper = new FRExplainLabel(Toolkit.i18nText("Fine-Design_Report_Community_Help"));
helper.setForeground(new Color(1, 159, 222)); FineUIStyle.setStyle(helper, FineUIStyle.HYPER_LINK_LABEL);
helper.addMouseListener(new MouseAdapter() { helper.addMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {

10
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java

@ -1,12 +1,11 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction; import com.fr.design.actions.insert.cell.BiasCellAction;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane; import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -16,7 +15,6 @@ import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -39,11 +37,7 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
} }
}); });
editButton.setOpaque(false); editButton.setOpaque(false);
content.add(TableLayoutHelper.createGapTableLayoutPane(new Component[][]{ return FineLayoutBuilder.asBorderLayoutWrapped(editButton);
new Component[]{EMPTY_LABEL, editButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}, HGAP, VGAP), BorderLayout.CENTER);
return content;
} }
@Override @Override

10
designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -1,5 +1,6 @@
package com.fr.quickeditor.cellquick; package com.fr.quickeditor.cellquick;
import com.fine.theme.utils.FineLayoutBuilder;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.SubReportCellAction; import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -10,9 +11,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.row;
/** /**
* 单元格元素子报表编辑器 * 单元格元素子报表编辑器
* *
@ -31,11 +29,7 @@ public class CellSubReportEditor extends CellQuickEditor {
public JComponent createCenterBody() { public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
subReportButton = new UIButton(); subReportButton = new UIButton();
content.add(row( return FineLayoutBuilder.asBorderLayoutWrapped(subReportButton);
cell(EMPTY_LABEL).weight(1.2),
cell(subReportButton).weight(3)
).getComponent());
return content;
} }
@Override @Override

Loading…
Cancel
Save