Browse Source

Pull request #5550: REPORT-58062 【主题切换】细节定制-单元格样式-样式数量较多,菜单栏中选择时没有滚动条

Merge in DESIGN/design from ~STARRYI/design:feature/x to feature/x

* commit 'fbde5db5db35ff023e9eca58ce02c2de2227c8c2':
  REPORT-58062 【主题切换】细节定制-单元格样式-样式数量较多,菜单栏中选择时没有滚动条
research/11.0
starryi 3 years ago
parent
commit
a34bb63832
  1. 26
      designer-realize/src/main/java/com/fr/design/actions/cell/CellStyleAttrAction.java
  2. 22
      designer-realize/src/main/java/com/fr/design/actions/cell/CustomCellStyleAction.java
  3. 7
      designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java
  4. 5
      designer-realize/src/main/java/com/fr/design/actions/cell/StyleAction.java
  5. 4
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java
  6. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  7. 41
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  8. 9
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java
  9. 25
      designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java
  10. 4
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java

26
designer-realize/src/main/java/com/fr/design/actions/cell/CellStyleAttrAction.java

@ -0,0 +1,26 @@
package com.fr.design.actions.cell;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.IOUtils;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/8/26
*/
public class CellStyleAttrAction extends CellAttributeTableAction {
public CellStyleAttrAction() {
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_format/cell.png"));
}
@Override
protected String getID() {
return Toolkit.i18nText("Fine-Design_Form_Widget_Style");
}
}

22
designer-realize/src/main/java/com/fr/design/actions/cell/CustomCellStyleAction.java

@ -0,0 +1,22 @@
package com.fr.design.actions.cell;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.CellElementPropertyPane;
import java.awt.event.ActionEvent;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/8/26
*/
public class CustomCellStyleAction extends CellStyleAttrAction {
@Override
public void actionPerformed(ActionEvent e) {
CellElementPropertyPane.getInstance().GoToPane(
Toolkit.i18nText("Fine-Design_Report_Engine_Style"),
Toolkit.i18nText("Fine-Design_Report_Engine_Custom")
);
}
}

7
designer-realize/src/main/java/com/fr/design/actions/cell/GlobalStyleMenuDef.java

@ -28,6 +28,13 @@ import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.util.List;
/**
* 11.beta.1
* REPORT-51919 主题切换
* REPORT-58062 主题切换细节定制-单元格样式-样式数量较多菜单栏中选择时没有滚动条
* 模版主题化后该菜单列表废弃点击工具栏-单元格-样式菜单将直接跳转到右侧栏单元格样式面板
* @deprecated
*/
public class GlobalStyleMenuDef extends MenuDef {
private static final int MAX_LENTH = 12;
private ElementCasePane ePane;

5
designer-realize/src/main/java/com/fr/design/actions/cell/StyleAction.java

@ -12,6 +12,11 @@ import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.menu.KeySetUtils;
/**
* 11.beta.1
* REPORT-51919 主题切换
* @deprecated
*/
public class StyleAction extends UpdateAction {
public StyleAction() {

4
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -5,9 +5,9 @@ import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
import com.fr.design.actions.cell.CellStyleAttrAction;
import com.fr.design.actions.cell.CellWidgetAttrAction;
import com.fr.design.actions.cell.ConditionAttributesAction;
import com.fr.design.actions.cell.GlobalStyleMenuDef;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.core.ActionFactory;
@ -201,7 +201,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
MenuDef menuDef = new MenuDef(KeySetUtils.CELL.getMenuKeySetName(), KeySetUtils.CELL.getMnemonic());
menuDef.addShortCut(new CellExpandAttrAction());
menuDef.addShortCut(new GlobalStyleMenuDef(this));
menuDef.addShortCut(new CellStyleAttrAction());
// 单元格形态
menuDef.addShortCut(DeprecatedActionManager.getPresentMenu(this));

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -70,7 +70,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public void updateBeans() {
Object[] selectionCellBorderObjects = BorderUtils.createCellBorderObject(elementCasePane);
if (stylePane.getSelectedIndex() == 1) {
if (stylePane.getSelectedIndex() == 0) {
Style s = stylePane.updateBean();
TemplateElementCase elementCase = elementCasePane.getEditingElementCase();
int cellRectangleCount = cs.getCellRectangleCount();

41
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java

@ -8,17 +8,15 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.ComparatorUtils;
import com.teamdev.jxbrowser.deps.org.checkerframework.checker.guieffect.qual.UI;
import com.fr.log.FineLoggerFactory;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
@ -69,8 +67,22 @@ public class StylePane extends BasicPane {
int selectedIndex = followingThemeButtonGroup.getSelectedIndex();
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]);
if (selectedIndex == 1) {
customStylePane.populateBean(themedCellStyleListPane.updateBean());
// 对于同一个单元格,跟随主题切换到自定义,若跟随主题面板有选中项,则自定义中的配置与其保持一致,否则自定义中配置保持不变
NameStyle lastSelectedNameStyle = themedCellStyleListPane.updateBean();
if (lastSelectedNameStyle != null) {
Style lastSelectedRealStyle = lastSelectedNameStyle.getRealStyle();
try {
lastSelectedRealStyle = (Style) lastSelectedRealStyle.clone();
if (lastSelectedRealStyle != null) {
customStylePane.populateBean(lastSelectedRealStyle);
}
} catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
}
}
} else {
// 对于同一个单元格,自定义切换到跟随主题,跟随主题应当清除选中项,即没有选中任何主题中的单元格样式,
// 因为还未选中,所以自定义中的配置保持不变,此时若用户切换会自定义,配置应当与之前一样
themedCellStyleListPane.populateBean(null);
}
}
@ -153,10 +165,8 @@ public class StylePane extends BasicPane {
}
public void dealWithBorder(ElementCasePane ePane) {
if (getSelectedIndex() == 1) {
customStylePane.dealWithBorder(ePane);
}
}
public void setSelctedByName(String id) {
setSelectedIndex(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"), id)? 1 : 0);
@ -168,16 +178,27 @@ public class StylePane extends BasicPane {
public Style updateBean() {
if (getSelectedIndex() == 0) {
return themedCellStyleListPane.updateBean();
} else {
return customStylePane.updateBean();
NameStyle nameStyle = themedCellStyleListPane.updateBean();
if (nameStyle != null) {
// 只有当前样式面板是跟随主题面板,且跟随主题面板中存在选中项,才使用该样式设置单元格
return nameStyle;
}
}
return customStylePane.updateBean();
}
public void populateBean(Style style) {
if (style instanceof NameStyle) {
NameStyle nameStyle = (NameStyle) style;
setSelectedIndex(0);
themedCellStyleListPane.populateBean((NameStyle) style);
themedCellStyleListPane.populateBean(nameStyle);
Style realStyle = nameStyle.getRealStyle();
try {
realStyle = (Style) realStyle.clone();
customStylePane.populateBean(realStyle);
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
} else {
setSelectedIndex(1);
customStylePane.populateBean(style);

9
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/ThemedCellStyleListPane.java

@ -7,6 +7,7 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.settings.ThemedCellStyle;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerBean;
import com.fr.design.mainframe.DesignerContext;
@ -111,6 +112,10 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
@Override
public void populateBean(NameStyle ob) {
refreshBeanElement();
if (ob == null) {
styleList.setSelectedIndex(-1);
return;
}
for (int i = 0; i < defaultListModel.getSize(); i++) {
if (ComparatorUtils.equals(ob, defaultListModel.get(i))) {
styleList.setSelectedIndex(i);
@ -121,7 +126,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
@Override
public NameStyle updateBean() {
return (NameStyle) styleList.getSelectedValue();
return styleList.getSelectedValue();
}
/**
@ -130,7 +135,7 @@ public class ThemedCellStyleListPane extends FurtherBasicBeanPane<NameStyle> imp
* @return 标题
*/
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Predefined_Style");
return Toolkit.i18nText("Fine-Design_Report_Predefined_Style");
}
/**

25
designer-realize/src/main/java/com/fr/grid/selection/CellSelection.java

@ -10,13 +10,11 @@ import com.fr.config.ServerPreferenceConfig;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
import com.fr.design.actions.cell.CellStyleAttrAction;
import com.fr.design.actions.cell.CellWidgetAttrAction;
import com.fr.design.actions.cell.CleanAuthorityAction;
import com.fr.design.actions.cell.ConditionAttributesAction;
import com.fr.design.actions.cell.EditCellAction;
import com.fr.design.actions.cell.GlobalStyleMenuDef;
import com.fr.design.actions.cell.GlobalStyleMenuDef.GlobalStyleSelection;
import com.fr.design.actions.cell.StyleAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.edit.CopyAction;
import com.fr.design.actions.edit.CutAction;
@ -29,7 +27,6 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
@ -470,26 +467,8 @@ public class CellSelection extends Selection {
}
popup.add(new EditCellAction(ePane).createMenuItem());
popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu());
// richer:add global style menu
popup.add(new CellExpandAttrAction().createMenuItem());
if (!ServerPreferenceConfig.getInstance().hasStyle()) {
UIMenu styleMenu = new UIMenu(KeySetUtils.GLOBAL_STYLE.getMenuName());
styleMenu.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png"));
Iterator iterato = ServerPreferenceConfig.getInstance().getStyleNameIterator();
while (iterato.hasNext()) {
String name = (String) iterato.next();
name = GlobalStyleMenuDef.judgeChina(name);
NameStyle nameStyle = NameStyle.getInstance(name);
UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem();
useMenuItem.setNameStyle(nameStyle);
styleMenu.add(useMenuItem);
}
styleMenu.addSeparator();
styleMenu.add(new GlobalStyleMenuDef.CustomStyleAction(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom")));
popup.add(styleMenu);
} else {
popup.add(new StyleAction().createMenuItem());
}
popup.add(new CellStyleAttrAction().createMenuItem());
popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu());
popup.add(new CellAttributeAction().createMenuItem());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();

4
designer-realize/src/main/java/com/fr/poly/creator/ECBlockPane.java

@ -8,9 +8,9 @@ import com.fr.design.DesignState;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.cell.CellAttributeAction;
import com.fr.design.actions.cell.CellExpandAttrAction;
import com.fr.design.actions.cell.CellStyleAttrAction;
import com.fr.design.actions.cell.CellWidgetAttrAction;
import com.fr.design.actions.cell.ConditionAttributesAction;
import com.fr.design.actions.cell.GlobalStyleMenuDef;
import com.fr.design.actions.columnrow.InsertColumnAction;
import com.fr.design.actions.columnrow.InsertRowAction;
import com.fr.design.actions.core.ActionFactory;
@ -151,7 +151,7 @@ public class ECBlockPane extends PolyElementCasePane {
menuDef.addShortCut(new CellExpandAttrAction());
menuDef.addShortCut(new CellWidgetAttrAction());
menuDef.addShortCut(new GlobalStyleMenuDef(this));
menuDef.addShortCut(new CellStyleAttrAction());
menuDef.addShortCut(new ConditionAttributesAction());
// 单元格形态

Loading…
Cancel
Save