Browse Source

Pull request #13556: REPORT-111995 【UI翻新】滚动面板补充storyboard&解决控件面板一些问题

Merge in DESIGN/design from ~LEVY.XIE/design:newui to newui

* commit '2e06f2d7f185ac8aff95b1031837cd31829a92ad':
  REPORT-111995 【UI翻新】滚动面板补充storyboard&解决控件面板一些问题
newui
Levy.Xie-解安森 10 months ago
parent
commit
fc87a0c8f9
  1. 14
      designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java
  2. 77
      designer-base/src/test/java/com/fr/design/gui/storybook/components/UIScrollPaneStoryBoard.java
  3. 20
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonGroupDictPane.java
  4. 4
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

14
designer-base/src/main/java/com/fine/theme/utils/FineUIUtils.java

@ -381,7 +381,7 @@ public class FineUIUtils {
} }
/** /**
* 创建一个UIScrollPane的装饰层内部的ScrollPane仅当悬浮时显示滚动条 * 基于组件创建一个UIScrollPane的装饰层内部的ScrollPane仅当悬浮时显示滚动条
* *
* @param c 组件 * @param c 组件
* @return UIScrollPane的装饰层 * @return UIScrollPane的装饰层
@ -391,4 +391,16 @@ public class FineUIUtils {
new CollapsibleScrollBarLayerUI()); new CollapsibleScrollBarLayerUI());
} }
/**
* 基于组件创建一个UIScrollPane的装饰层内部的ScrollPane仅当悬浮时显示滚动条
*
* @param c 组件
* @param verticalPolicy 滚动条垂直显示策略
* @param horizontalPolicy 滚动条水平显示策略
* @return UIScrollPane的装饰层
*/
public static JLayer<UIScrollPane> createCollapsibleScrollBarLayer(Component c, int verticalPolicy, int horizontalPolicy) {
return new JLayer<>(new UIScrollPane(c, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER),
new CollapsibleScrollBarLayerUI(verticalPolicy, horizontalPolicy));
}
} }

77
designer-base/src/test/java/com/fr/design/gui/storybook/components/UIScrollPaneStoryBoard.java

@ -0,0 +1,77 @@
package com.fr.design.gui.storybook.components;
import com.fine.swing.ui.layout.Column;
import com.fine.theme.light.ui.FineRoundBorder;
import com.fine.theme.utils.FineUIUtils;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.storybook.StoryBoard;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants;
import java.awt.Dimension;
import java.util.Collections;
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;
/**
* 滚动面板
*
* @author Levy.Xie
* @since 11.0
* Created on 2024/01/25
*/
public class UIScrollPaneStoryBoard extends StoryBoard {
public UIScrollPaneStoryBoard() {
super("滚动面板");
add(
row(20,
column(
cell(new UILabel("滚动条常驻显示")).with(this::h2),
cell(new UILabel("水平/纵向")).with(this::h2),
cell(new UIScrollPane(createMultiLabelPane())).with(this::setFixSize),
cell(new UILabel("水平")).with(this::h3),
cell(new UIScrollPane(createMultiLabelPane(),
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED))
.with(this::setFixSize),
cell(new UILabel("纵向")).with(this::h3),
cell(new UIScrollPane(createMultiLabelPane(),
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER))
.with(this::setFixSize)
).weight(1),
column(
cell(new UILabel("滚动条悬浮显示")).with(this::h2),
cell(new UILabel("水平/纵向")).with(this::h3),
cell(FineUIUtils.createCollapsibleScrollBarLayer(createMultiLabelPane())).with(it -> setFixSize(it.getView())),
cell(new UILabel("水平")).with(this::h3),
cell(FineUIUtils.createCollapsibleScrollBarLayer(createMultiLabelPane(),
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
)).with(it -> setFixSize(it.getView())),
cell(new UILabel("纵向")).with(this::h3),
cell(FineUIUtils.createCollapsibleScrollBarLayer(createMultiLabelPane(),
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER
)).with(it -> setFixSize(it.getView())
)
).weight(1)
)
);
}
private JPanel createMultiLabelPane() {
Column column = new Column();
for (int i = 0; i < 10; i++) {
column.add(new UILabel(String.join(" ", Collections.nCopies(20, "test"))));
}
return column;
}
private void setFixSize(JComponent component) {
component.setPreferredSize(new Dimension(component.getWidth(), 100));
component.setBorder(new FineRoundBorder());
}
}

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

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fine.swing.ui.layout.Row;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
@ -22,7 +23,7 @@ import static com.fr.design.constants.LayoutConstants.VERTICAL_GAP;
public class ButtonGroupDictPane extends JPanel { public class ButtonGroupDictPane extends JPanel {
private UIBasicSpinner columnSpinner; private UIBasicSpinner columnSpinner;
private UICheckBox adaptiveCheckbox; private UICheckBox adaptiveCheckbox;
private UILabel columnLabel; private Row columnSettingRow;
public ButtonGroupDictPane() { public ButtonGroupDictPane() {
this.initComponents(); this.initComponents();
@ -35,27 +36,26 @@ public class ButtonGroupDictPane extends JPanel {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true); adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true);
UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")); UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary"));
this.columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width); UILabel columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width);
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1)); columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
columnSettingRow = row(
cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)
).getComponent();
this.add(column(VERTICAL_GAP, this.add(column(VERTICAL_GAP,
cell(adaptiveCheckbox), cell(adaptiveCheckbox),
row( cell(columnSettingRow)
cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)
)
).getComponent()); ).getComponent());
} }
public void populate(ButtonGroup buttonGroup) { public void populate(ButtonGroup buttonGroup) {
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive()); adaptiveCheckbox.setSelected(buttonGroup.isAdaptive());
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); columnSettingRow.setVisible(!adaptiveCheckbox.isSelected());
columnLabel.setVisible(!adaptiveCheckbox.isSelected());
columnSpinner.setValue(buttonGroup.getColumnsInRow()); columnSpinner.setValue(buttonGroup.getColumnsInRow());
} }
public void update(ButtonGroup buttonGroup) { public void update(ButtonGroup buttonGroup) {
columnSpinner.setVisible(!adaptiveCheckbox.isSelected()); columnSettingRow.setVisible(!adaptiveCheckbox.isSelected());
columnLabel.setVisible(!adaptiveCheckbox.isSelected());
buttonGroup.setAdaptive(adaptiveCheckbox.isSelected()); buttonGroup.setAdaptive(adaptiveCheckbox.isSelected());
buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue())); buttonGroup.setColumnsInRow((Integer)(columnSpinner.getValue()));
} }

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

@ -5,6 +5,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
@ -162,7 +163,8 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
validatePane.add(contentPane); validatePane.add(contentPane);
} }
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Validate"), 280, 20, validatePane); UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Validate"), 280, 20, validatePane);
this.add(uiExpandablePane, BorderLayout.CENTER); uiExpandablePane.setBorder(FineBorderFactory.createDefaultTopBorder());
corePane.add(uiExpandablePane);
} }

Loading…
Cancel
Save