Browse Source

Pull request #5547: REPORT-57935 & REPORT-57969 & REPORT-58048 & REPORT-58034 & REPORT-58089

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

* commit '5e8dd4a0d161d454f22bbef02eab10344849e933':
  REPORT-58067 【主题切换】细节定制-FRM组件样式-标题里多了个“文本”的设置
  REPORT-58035 demo部分模板出现报错
  REPORT-57964 【主题切换】纸张背景配置页,字体显示不全
  REPORT-58000 【主题切换】主题名称超长的展示问题 REPORT-58001 【主题切换】主题超长时应用主题工具栏就不显示主题名称及图标(自适应按钮也不显示了)
  REPORT-58089 【主题切换】单元格样式重名以后变成重命名,会导致多个重命名
  REPORT-58034 【主题切换】模板主题页面,不应该显示☆
  REPORT-58048 【主题切换】细节定制-组件样式-生效范围的提示显示不全
  REPORT-57935 【主题切换】单元格右侧设计面板显示不符合交互图
research/11.0
starryi 3 years ago
parent
commit
4dccf472c8
  1. 4
      designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java
  2. 21
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 5
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java
  4. 6
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeListPane.java
  5. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeManagePane.java
  6. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/dialog/TemplateThemeUsingDialog.java
  7. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java
  8. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ComponentStyleEditPane.java
  9. 5
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java
  10. 168
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/style/StylePane.java
  11. 6
      designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java

4
designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java

@ -234,8 +234,8 @@ public class ComponentTitleStylePane extends AbstractBorderPackerPane {
TitlePacker widgetTitle = style == null ? new WidgetTitle() : style.getTitle();
widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle;
boolean titleVisible = style != null && style.getType() != LayoutBorderStyle.STANDARD;
visibleCheckbox.setSelected(isSupportTitleContent && titleVisible);
titleContentPane.setVisible(titleVisible);
visibleCheckbox.setSelected(isSupportTitleVisible && titleVisible);
titleContentPane.setVisible(isSupportTitleContent && titleVisible);
titleOtherSettingPane.setVisible(isSupportTitleOtherSetting && titleVisible);
this.textContentPane.populateBean(widgetTitle.getTextObject().toString());

21
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -94,6 +94,8 @@ import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.undo.UndoManager;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.util.Set;
import java.util.concurrent.Callable;
@ -103,6 +105,7 @@ import java.util.concurrent.Callable;
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener, ThemedTemplate {
// TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
private static final int PREDEFINED_ICON_WIDTH = 27;
private static final int PREFIX_NUM = 3000;
protected FILE editingFILE = null;
// alex:初始状态为saved,这样不管是新建模板,还是打开模板,如果未做任何操作直接关闭,不提示保存
@ -1420,8 +1423,15 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
protected UIButton createTemplateThemeButton() {
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png"));
button.setToolTipText(Toolkit.i18nText("Fine-Design_Template_Theme_Using_Dialog_Title"));
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")) {
@Override
public Dimension getPreferredSize() {
FontMetrics metrics = getFontMetrics(getFont());
int width = Math.min(metrics.stringWidth(getText()) + PREDEFINED_ICON_WIDTH, 100);
return new Dimension(width, 20);
}
};
button.setToolTipText(getTemplateTheme().getName());
button.setText(getTemplateTheme().getName());
button.setAlignmentX(SwingConstants.LEFT);
button.set4ToolbarButton();
@ -1715,9 +1725,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
protected void setUpTheme4NewTemplate() {
TemplateTheme theme = getUsingTemplateThemeConfig().cachedFetchTheme4NewTemplate();
if (theme != null) {
theme = getUsingTemplateThemeConfig().createNewTheme();
}
TemplateThemeAttrMark themeAttrMark = template.getAttrMark(TemplateThemeAttrMark.XML_TAG);
if (themeAttrMark == null) {
themeAttrMark = new TemplateThemeAttrMark();
@ -1730,6 +1737,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
@Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
ThemedTemplate.super.setTemplateTheme(newTheme, compatible);
templateThemeButton.setText(newTheme.getName());
String name = newTheme.getName();
templateThemeButton.setText(name);
templateThemeButton.setToolTipText(name);
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeBlock.java

@ -49,6 +49,7 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
private final Icon theme4currentTemplateMarkIcon = IOUtils.readIcon("/com/fr/design/form/images/theme4currentTemplate.png");
private final Icon theme4NewTemplateMarkIcon= IOUtils.readIcon("/com/fr/design/form/images/theme4newTemplate.png");
private final Icon profileIcon = IOUtils.readIcon("/com/fr/design/icon/icon_edit.png");
private final boolean displayTheme4NewTemplateMarker;
private UILabel thumbnailLabel;
// UIButton会影响Block的手势监听,这里使用UILabel代替,点击事件也有Block代为处理
@ -59,9 +60,11 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
private MouseAdapter clickListener;
public TemplateThemeBlock(String name,
boolean displayTheme4NewTemplateMarker,
TemplateThemeConfig<T> config,
TemplateThemeProfilePane<T> profilePane) {
this.name = name;
this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker;
this.config = config;
this.profilePane = profilePane;
@ -192,7 +195,7 @@ public class TemplateThemeBlock<T extends TemplateTheme> extends JPanel {
}
}
if (StringUtils.equals(config.getThemeName4NewTemplate(), name)) {
if (displayTheme4NewTemplateMarker && StringUtils.equals(config.getThemeName4NewTemplate(), name)) {
theme4NewTemplateMarkIcon.paintIcon(this, g, 0, 0);
}

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

@ -34,6 +34,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
private final AsyncThemeFetcher<T> asyncThemeFetcher;
private final boolean displayTheme4NewTemplateMarker;
protected final TemplateThemeConfig<T> config;
private final TemplateThemeProfilePane<T> profilePane;
private final JPanel contentListPane;
@ -47,7 +48,8 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
private ChangeListener changeListener;
public TemplateThemeListPane(TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
public TemplateThemeListPane(boolean displayTheme4NewTemplateMarker, TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.displayTheme4NewTemplateMarker = displayTheme4NewTemplateMarker;
this.config = config;
this.profilePane = profilePane;
this.contentListPane = new JPanel();
@ -95,7 +97,7 @@ public class TemplateThemeListPane<T extends TemplateTheme> extends BasicPane {
}
private TemplateThemeBlock<T> createNewTemplateThemeBlock(String name) {
final TemplateThemeBlock<T> block = new TemplateThemeBlock<>(name, config, profilePane);
final TemplateThemeBlock<T> block = new TemplateThemeBlock<>(name, displayTheme4NewTemplateMarker, config, profilePane);
block.addClickListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {

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

@ -75,7 +75,7 @@ public class TemplateThemeManagePane<T extends TemplateTheme> extends BasicPane
public TemplateThemeManagePane(TemplateThemeConfig<T> config, TemplateThemeProfilePane<T> profilePane) {
this.config = config;
this.profilePane = profilePane;
this.themeListPane = new TemplateThemeListPane<>(config, profilePane);
this.themeListPane = new TemplateThemeListPane<>(true, config, profilePane);
this.removeAction = new RemoveThemeAction(false);
this.setTheme4NewTemplateButton = new UIButton(Toolkit.i18nText("Fine-Design_Template_Theme_Manager_Pane_Default_Setting"));
this.asyncThemeFetcher = new AsyncThemeFetcher<>(1, config);

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

@ -37,7 +37,7 @@ public class TemplateThemeUsingDialog<T extends TemplateTheme> extends TemplateT
super(parent, Toolkit.i18nText("Fine-Design_Template_Theme_Using_Dialog_Title"), CONTENT_WIDTH, CONTENT_HEIGHT);
this.currentTemplate = template;
this.themeListPane = new TemplateThemeListPane<>(config, null);
this.themeListPane = new TemplateThemeListPane<>(false, config, null);
JPanel content = createContent();
UIButton openThemeManagerButton = createOpenThemeManagerButton();

4
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/CellStyleListEditPane.java

@ -67,10 +67,12 @@ public class CellStyleListEditPane extends JListControlPane {
allNames[index] = StringUtils.EMPTY;
if (StringUtils.isEmpty(newName)) {
showTipDialogAndReset(i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index);
nameableList.setNameAt(oldName, index);
return;
}
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) {
showTipDialogAndReset(i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index);
nameableList.setNameAt(oldName, index);
return;
}
populateSelectedValue();
@ -249,6 +251,7 @@ public class CellStyleListEditPane extends JListControlPane {
super(i18nText("Fine-Design_Predefined_Cell_New_Style"), ThemedCellStyle.class, updatePane);
}
@Override
public Nameable createNameable(UnrepeatedNameHelper helper) {
ThemedCellStyle cellStyle = new ThemedCellStyle();
cellStyle.setName(menuName);
@ -260,6 +263,7 @@ public class CellStyleListEditPane extends JListControlPane {
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle);
}
@Override
public Object acceptObject2Populate(Object ob) {
if (ob instanceof NameObject) {
ob = ((NameObject) ob).getObject();

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

@ -119,7 +119,7 @@ public class ComponentStyleEditPane extends JPanel {
JPanel tipLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
tipLabelPane.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(0XC6C6C6), 8);
UILabel tipLabel = LabelUtils.createLabel(Toolkit.i18nText("Fine-Design_Template_Theme_Edit_Pane_Component_Style_Tip"), new Color(0XC6C6C6), 10);
tipLabelPane.add(tipLabel);
container.add(tipLabelPane, BorderLayout.NORTH);

5
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/LabelUtils.java

@ -1,8 +1,10 @@
package com.fr.design.mainframe.theme.edit.ui;
import com.fr.design.gui.ilable.UILabel;
import com.fr.general.FRFont;
import java.awt.Color;
import java.awt.Font;
/**
* @author Starryi
@ -20,7 +22,8 @@ public class LabelUtils {
public static UILabel createLabel(String title, Color color, int size) {
UILabel uiLabel = new UILabel(title);
uiLabel.setForeground(color);
uiLabel.setFont(uiLabel.getFont().deriveFont(size));
Font newFont = FRFont.getInstance(uiLabel.getFont().getFontName(), Font.PLAIN, size);
uiLabel.setFont(newFont);
return uiLabel;
}
}

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

@ -1,35 +1,143 @@
package com.fr.design.mainframe.cell.settingpane.style;
import java.util.ArrayList;
import java.util.List;
import com.fr.base.NameStyle;
import com.fr.base.Style;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.dialog.BasicPane;
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 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;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import com.fr.base.Style;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.general.ComparatorUtils;
public class StylePane extends BasicPane {
public static final String[] FOLLOWING_THEME_STRING_ARRAYS = new String[]{
Toolkit.i18nText("Fine-Design_Style_Follow_Theme"),
Toolkit.i18nText("Fine-Design_Style_Not_Follow_Theme"),
};
public static final int DEFAULT_SELECTED_INDEX = 0;
import com.fr.design.mainframe.ElementCasePane;
private final UIButtonGroup<String> followingThemeButtonGroup;
private final CustomStylePane customStylePane;
private final ThemedCellStyleListPane themedCellStyleListPane;
private final CardLayout cardLayout;
private final JComponent[] panes = new JComponent[2];
private JPanel contentPane;
public StylePane() {
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS);
customStylePane = new CustomStylePane();
themedCellStyleListPane = new ThemedCellStyleListPane();
panes[0] = createThemedStylePane();
panes[1] = createCustomStylePane();
cardLayout = new CardLayout();
initializePane();
}
private void initializePane() {
setLayout(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
add(createFollowingThemePane(), BorderLayout.NORTH);
contentPane = createTabbedContentPane();
add(contentPane, BorderLayout.CENTER);
}
private JPanel createFollowingThemePane() {
followingThemeButtonGroup.setSelectedIndex(DEFAULT_SELECTED_INDEX);
followingThemeButtonGroup.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int selectedIndex = followingThemeButtonGroup.getSelectedIndex();
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[selectedIndex]);
if (selectedIndex == 1) {
customStylePane.populateBean(themedCellStyleListPane.updateBean());
} else {
themedCellStyleListPane.populateBean(null);
}
}
});
UILabel uiLabel = new UILabel("样式设置");
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
return TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{ new Component[] { uiLabel, followingThemeButtonGroup} },
new double[] { p }, new double[] { p, f},
IntervalConstants.INTERVAL_L1, 0);
}
protected JPanel createTabbedContentPane() {
JPanel contentPane = new JPanel(cardLayout) {
@Override
public Dimension getPreferredSize() {
int selectedIndex = followingThemeButtonGroup.getSelectedIndex();
if (selectedIndex < 0) {
return super.getPreferredSize();
} else {
return panes[selectedIndex].getPreferredSize();
}
}
};
for (int i = 0; i < FOLLOWING_THEME_STRING_ARRAYS.length; i++) {
contentPane.add(panes[i], FOLLOWING_THEME_STRING_ARRAYS[i]);
}
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[DEFAULT_SELECTED_INDEX]);
return contentPane;
}
private JPanel createThemedStylePane() {
JPanel container = new JPanel(new BorderLayout(0, IntervalConstants.INTERVAL_L1));
UILabel uiLabel = new UILabel("样式选择");
uiLabel.setPreferredSize(new Dimension(uiLabel.getPreferredSize().width, 20));
container.add(uiLabel, BorderLayout.NORTH);
themedCellStyleListPane.setBorder(BorderFactory.createEmptyBorder());
UIScrollPane scrollPane = new UIScrollPane(themedCellStyleListPane);
container.add(scrollPane, BorderLayout.CENTER);
return container;
}
public class StylePane extends UIComboBoxPane<Style> {
private CustomStylePane customStylePane;
private ThemedCellStyleListPane themedCellStyleListPane;
private JPanel createCustomStylePane() {
return customStylePane;
}
@Override
protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Style");
}
@Override
protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0 && themedCellStyleListPane.updateBean() != null) {
customStylePane.populateBean(themedCellStyleListPane.updateBean());
} else {
themedCellStyleListPane.populateBean(null);
public void setSelectedIndex(int index) {
if (0 <= index && index < FOLLOWING_THEME_STRING_ARRAYS.length) {
followingThemeButtonGroup.setSelectedIndex(index);
cardLayout.show(contentPane, FOLLOWING_THEME_STRING_ARRAYS[index]);
}
}
public int getSelectedIndex() {
return followingThemeButtonGroup.getSelectedIndex();
}
public void addPredefinedChangeListener(ChangeListener changeListener) {
themedCellStyleListPane.addChangeListener(changeListener);
}
@ -39,31 +147,41 @@ public class StylePane extends UIComboBoxPane<Style> {
}
public void updateBorder(Object[] selectionCellBorderObjects) {
if (getSelectedIndex() == 0 && customStylePane.isBorderPaneSelected()) {
if (getSelectedIndex() == 1 && customStylePane.isBorderPaneSelected()) {
customStylePane.updateBorder(selectionCellBorderObjects);
}
}
public void dealWithBorder(ElementCasePane ePane) {
if (getSelectedIndex() == 0) {
if (getSelectedIndex() == 1) {
customStylePane.dealWithBorder(ePane);
}
}
public void setSelctedByName(String id) {
jcb.setSelectedIndex(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"),id)? 0 : 1);
setSelectedIndex(ComparatorUtils.equals(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Custom"), id)? 1 : 0);
}
public Style updateStyle(Style style) {
return customStylePane.updateStyle(style);
}
@Override
protected List<FurtherBasicBeanPane<? extends Style>> initPaneList() {
List<FurtherBasicBeanPane<? extends Style>> paneList = new ArrayList<>();
paneList.add(customStylePane = new CustomStylePane());
paneList.add(themedCellStyleListPane = new ThemedCellStyleListPane());
return paneList;
public Style updateBean() {
if (getSelectedIndex() == 0) {
return themedCellStyleListPane.updateBean();
} else {
return customStylePane.updateBean();
}
}
public void populateBean(Style style) {
if (style instanceof NameStyle) {
setSelectedIndex(0);
themedCellStyleListPane.populateBean((NameStyle) style);
} else {
setSelectedIndex(1);
customStylePane.populateBean(style);
}
}
}

6
designer-realize/src/main/java/com/fr/design/report/NewReportBackgroundPane.java

@ -171,10 +171,10 @@ public class NewReportBackgroundPane extends BasicPane {
BorderUtils.createTitleBorder("预览", 12),
BorderFactory.createEmptyBorder(5, 5, 4, 5)
));
titledPane.setPreferredSize(new Dimension(397, 502));
titledPane.setPreferredSize(new Dimension(377, 502));
container.add(titledPane, BorderLayout.WEST);
titledPane.add(previewPane, BorderLayout.WEST);
previewPane.setPreferredSize(new Dimension(387, 480));
previewPane.setPreferredSize(new Dimension(367, 480));
return container;
}
@ -182,7 +182,7 @@ public class NewReportBackgroundPane extends BasicPane {
private JPanel createRightPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
container.setBorder(BorderFactory.createEmptyBorder());
container.setPreferredSize(new Dimension(253, 502));
container.setPreferredSize(new Dimension(273, 502));
container.add(themePane, BorderLayout.NORTH);
return container;
}

Loading…
Cancel
Save