Browse Source

Merge pull request #12213 in DESIGN/design from bugfix/11.0 to feature/x

* commit '3ac44c646c567841fe85efcae3dae01a57d2d58a':
  REPORT-92333 frm图片控件,默认图片是中文
  EPORT-97225 【H5控件增强】关于文本类控件的新功能,设计器设置项的屏蔽
  格式化处理
  添加注释
  REPORT-95741 关闭自动新建的cpt模板,回到了fvs-tab;预期是打开下一张cpt/frm
feature/x
superman 1 year ago
parent
commit
635d9513fb
  1. 14
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  2. 59
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabUtils.java
  3. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png
  4. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg_en.png
  5. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg_zh.png
  6. BIN
      designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg_zh_TW.png
  7. 289
      designer-base/src/test/java/com/fr/design/file/MultiTemplateTabPaneTest.java
  8. 26
      designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java
  9. 10
      designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java
  10. 3
      designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java
  11. 10
      designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java
  12. 9
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java
  13. 13
      designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java
  14. 2
      designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java

14
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -1108,18 +1108,8 @@ public class MultiTemplateTabPane extends JComponent {
* @return
*/
public int calNextShowJTemplateIndex(int currentIndex) {
//先看是否有可以展示的模板
for (int i = currentIndex; i >= 0; i--) {
if (showJTemplateTab(openedTemplate.get(i))) {
return i;
}
}
for (int i = currentIndex; i >= 0; i--) {
if (!showJTemplateTab(openedTemplate.get(i))) {
return i;
}
}
return -1;
JTemplate jTemplate= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return MultiTemplateTabUtils.calShowTemplateIndex(currentIndex, openedTemplate, jTemplate.getTemplateTabOperatorType());
}

59
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabUtils.java

@ -0,0 +1,59 @@
package com.fr.design.file;
import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import java.util.List;
import java.util.function.Predicate;
public class MultiTemplateTabUtils {
/**
* 计算离currentIndex最近的相同模式的模板index值优先左边
*
* @param currentIndex 当前index
* @param openedTemplate 模板list
* @param type 当前显示模式
* @return
*/
public static int calShowTemplateIndex(int currentIndex, List<JTemplate<?, ?>> openedTemplate, String type) {
if (currentIndex < 0 || currentIndex > openedTemplate.size() - 1) {
return -1;
}
int result = getShowJTemplateTab(currentIndex, openedTemplate, template -> showJTemplateTab(type, template));
if (result != -1) return result;
return getShowJTemplateTab(currentIndex, openedTemplate, template -> !showJTemplateTab(type, template));
}
/**
* 先从左找再从右找离得最近的满足条件的模板
*
* @param currentIndex 当前index
* @param openedTemplate 模板list
* @param predicate
* @return
*/
private static int getShowJTemplateTab(int currentIndex, List<JTemplate<?, ?>> openedTemplate, Predicate<JTemplate<?, ?>> predicate) {
for (int i = currentIndex; i >= 0; i--) {
if (predicate.test(openedTemplate.get(i))) {
return i;
}
}
for (int i = currentIndex + 1; i < openedTemplate.size(); i++) {
if (predicate.test(openedTemplate.get(i))) {
return i;
}
}
return -1;
}
/**
* 是否显示模板
*
* @param type 模板类型
* @param jTemplate 模板
* @return
*/
private static boolean showJTemplateTab(String type, JTemplate<?, ?> jTemplate) {
return ComparatorUtils.equals(type, jTemplate.getTemplateTabOperatorType());
}
}

BIN
designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg_en.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg_zh.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
designer-base/src/main/resources/com/fr/design/images/form/designer/widget/picture_widget_designer_bg_zh_TW.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

289
designer-base/src/test/java/com/fr/design/file/MultiTemplateTabPaneTest.java

@ -0,0 +1,289 @@
package com.fr.design.file;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.BaseUndoState;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.template.info.TemplateProcessInfo;
import com.fr.design.menu.ShortCut;
import com.fr.design.menu.ToolBarDef;
import com.fr.plugin.injectable.PluginModule;
import junit.framework.TestCase;
import org.junit.Assert;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List;
public class MultiTemplateTabPaneTest extends TestCase {
@Override
protected void setUp() throws Exception {
PluginModule.registerAgent(PluginModule.ExtraDesign, new ExtraDesignClassManager());
}
/**
* 当前显示模式A传入index左边(含当前)或右边有模式A的模板返回最近的模式A模板index优先左边
*/
public void test_index_left_has_same_mode_temp() {
//当前显示模式A,传入index左边(含当前)有模式A的模板,返回左边最近的模式A模板index
List<JTemplate<?, ?>> openedTemplateList = new ArrayList<>();
openedTemplateList.add(new A_Mode());
Assert.assertEquals(0, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
openedTemplateList.add(new A_Mode());
Assert.assertEquals(1, MultiTemplateTabUtils.calShowTemplateIndex(1, openedTemplateList, "A_Mode"));
openedTemplateList.add(new B_Mode());
Assert.assertEquals(1, MultiTemplateTabUtils.calShowTemplateIndex(1, openedTemplateList, "A_Mode"));
}
public void test_index_left_has_not_but_right_has_same_mode_temp() {
//当前显示模式A,传入index左边没有但是右边有模式A的模板,返回右边最近的模式A模板index
List<JTemplate<?, ?>> openedTemplateList = new ArrayList<>();
openedTemplateList.add(new B_Mode());
openedTemplateList.add(new A_Mode());
Assert.assertEquals(1, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
openedTemplateList.add(1, new B_Mode());
openedTemplateList.add(new A_Mode());
Assert.assertEquals(2, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
openedTemplateList.add(new A_Mode());
Assert.assertEquals(2, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
}
/**
* 当前显示模式A没有模式A的模板左边(含当前)或者右边有其他模式的模板返回最近的其他模式模式模板index优先左边
*/
public void test_no_same_mode_temp_but_index_left_has_other_mode_temp() {
//当前显示模式A,没有模式A的模板,左边(含当前)有其他模式模板,返回左边最近的其他模式模板index
List<JTemplate<?, ?>> openedTemplateList = new ArrayList<>();
openedTemplateList.add(new B_Mode());
Assert.assertEquals(0, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
openedTemplateList.add(new B_Mode());
Assert.assertEquals(1, MultiTemplateTabUtils.calShowTemplateIndex(1, openedTemplateList, "A_Mode"));
}
public void test_has_no_temp() {
//当前显示模式A,没有模式A的模板,也没有其他模式的模板,返回-1
List<JTemplate<?, ?>> openedTemplateList = new ArrayList<>();
Assert.assertEquals(-1, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
}
public void test_if_index_less_than_zero_or_more_than_open_temp_size() {
//index<0 或者超出openTemplateList.size时,返回-1
List<JTemplate<?, ?>> openedTemplateList = new ArrayList<>();
Assert.assertEquals(-1, MultiTemplateTabUtils.calShowTemplateIndex(-1, openedTemplateList, "A_Mode"));
Assert.assertEquals(-1, MultiTemplateTabUtils.calShowTemplateIndex(0, openedTemplateList, "A_Mode"));
openedTemplateList.add(new A_Mode());
Assert.assertEquals(-1, MultiTemplateTabUtils.calShowTemplateIndex(1, openedTemplateList, "A_Mode"));
}
private class A_Mode extends AbstractTestMode {
public String getTemplateTabOperatorType() {
return "A_Mode";
}
}
private class B_Mode extends AbstractTestMode {
public String getTemplateTabOperatorType() {
return "B_Mode";
}
}
private abstract class AbstractTestMode extends JTemplate {
public AbstractTestMode() {
}
@Override
public void copy() {
}
@Override
public boolean paste() {
return false;
}
@Override
public boolean cut() {
return false;
}
@Override
public AuthorityEditPane createAuthorityEditPane() {
return null;
}
@Override
public JPanel getEastUpPane() {
return null;
}
@Override
public JPanel getEastDownPane() {
return null;
}
@Override
public ToolBarDef[] toolbars4Target() {
return new ToolBarDef[0];
}
@Override
public JPanel[] toolbarPanes4Form() {
return new JPanel[0];
}
@Override
public JComponent[] toolBarButton4Form() {
return new JComponent[0];
}
@Override
public JComponent toolBar4Authority() {
return null;
}
@Override
public int getToolBarHeight() {
return 0;
}
@Override
public void refreshEastPropertiesPane() {
}
@Override
public TargetComponent getCurrentElementCasePane() {
return null;
}
@Override
public JComponent getCurrentReportComponentPane() {
return null;
}
@Override
public TemplateProcessInfo getProcessInfo() {
return null;
}
@Override
public void setJTemplateResolution(int resolution) {
}
@Override
public int getJTemplateResolution() {
return 0;
}
@Override
protected JComponent createCenterPane() {
return null;
}
@Override
public void removeTemplateSelection() {
}
@Override
public void refreshContainer() {
}
@Override
public void removeParameterPaneSelection() {
}
@Override
public void setScale(int resolution) {
}
@Override
public int getScale() {
return 0;
}
@Override
public int selfAdaptUpdate() {
return 0;
}
@Override
protected DesignModelAdapter createDesignModel() {
return null;
}
@Override
public UIMenuItem[] createMenuItem4Preview() {
return new UIMenuItem[0];
}
@Override
protected BaseUndoState<?> createUndoState() {
return null;
}
@Override
public String suffix() {
return null;
}
@Override
public ShortCut[] shortcut4TemplateMenu() {
return new ShortCut[0];
}
@Override
public ShortCut[] shortCuts4Authority() {
return new ShortCut[0];
}
@Override
public boolean isJWorkBook() {
return false;
}
@Override
public HyperlinkGroupPane getHyperLinkPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return null;
}
@Override
public HyperlinkGroupPane getHyperLinkPaneNoPop(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) {
return null;
}
@Override
public void setAuthorityMode(boolean isUpMode) {
}
@Override
public Icon getIcon() {
return null;
}
@Override
public String route() {
return null;
}
@Override
protected void applyUndoState(BaseUndoState baseUndoState) {
}
}
}

26
designer-form/src/main/java/com/fr/design/designer/creator/XNumberEditor.java

@ -6,9 +6,7 @@ package com.fr.design.designer.creator;
import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.design.designer.properties.mobile.NumberEditorMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
import com.fr.design.mainframe.widget.editors.SpinnerMaxNumberEditor;
import com.fr.design.mainframe.widget.editors.SpinnerMinNumberEditor;
@ -94,18 +92,18 @@ public class XNumberEditor extends XWrapperedFieldEditor {
}
@Override
protected JComponent initEditor() {
setBorder(FIELDBORDER);
return this;
}
protected JComponent initEditor() {
setBorder(FIELDBORDER);
return this;
}
@Override
protected String getIconName() {
return "number_field_16.png";
}
@Override
protected String getIconName() {
return "number_field_16.png";
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{new NumberEditorMobilePropertyUI(this)};
}
// @Override
// public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
// return new WidgetPropertyUIProvider[]{new NumberEditorMobilePropertyUI(this)};
// }
}

10
designer-form/src/main/java/com/fr/design/designer/creator/XPassword.java

@ -3,9 +3,7 @@
*/
package com.fr.design.designer.creator;
import com.fr.design.designer.properties.mobile.PasswordMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ibutton.UIPasswordField;
import com.fr.design.mainframe.widget.editors.RegexEditor;
import com.fr.design.mainframe.widget.editors.WidgetValueEditor;
@ -70,8 +68,8 @@ public class XPassword extends XWrapperedFieldEditor {
(CRPropertyDescriptor[]) ArrayUtils.addAll(sup, new CRPropertyDescriptor[]{regex, waterMark});
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{new PasswordMobilePropertyUI(this)};
}
// @Override
// public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
// return new WidgetPropertyUIProvider[]{new PasswordMobilePropertyUI(this)};
// }
}

3
designer-form/src/main/java/com/fr/design/designer/creator/XPicture.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.widget.renderer.PictureRenderer;
import com.fr.design.mainframe.widget.renderer.UrlLinkRenderer;
import com.fr.form.ui.PictureWidget;
import com.fr.general.IOUtils;
import com.fr.general.locale.image.I18nImage;
import com.fr.stable.ArrayUtils;
import java.awt.Dimension;
import java.awt.Image;
@ -59,7 +60,7 @@ public class XPicture extends XWidgetCreator {
imgPanel.setBackgroundImage((Image) value);
imgPanel.setImageDisplayMode(pictureWidget.getShowType());
} else {
imgPanel.setBackgroundImage(IOUtils.readImage("com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png"));
imgPanel.setBackgroundImage(I18nImage.getImage("/com/fr/design/images/form/designer/widget/picture_widget_designer_bg.png"));
imgPanel.setImageDisplayMode(0);
}
this.editor.add(imgPanel, "Center");

10
designer-form/src/main/java/com/fr/design/designer/creator/XTextArea.java

@ -6,9 +6,7 @@ package com.fr.design.designer.creator;
import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution;
import com.fr.base.Style;
import com.fr.design.designer.properties.mobile.TextAreaMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.widget.editors.RegexEditor;
import com.fr.design.mainframe.widget.editors.WidgetValueEditor;
import com.fr.design.mainframe.widget.renderer.RegexCellRencerer;
@ -85,9 +83,9 @@ public class XTextArea extends XWrapperedFieldEditor {
return "text_area_16.png";
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{new TextAreaMobilePropertyUI(this)};
}
// @Override
// public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
// return new WidgetPropertyUIProvider[]{new TextAreaMobilePropertyUI(this)};
// }
}

9
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TextEditorMobileDefinePane.java

@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane;
import com.fr.form.ui.TextEditor;
@ -31,9 +30,9 @@ public class TextEditorMobileDefinePane extends BaseTextEditorMobileDefinePane {
@Override
protected void initSettingPane(JPanel container) {
inputSettingPane = new MobileTextFieldInputSettingPane();
textSettingPane = new MobileTextEditSettingPane();
// textSettingPane = new MobileTextEditSettingPane();
container.add(inputSettingPane);
container.add(textSettingPane);
// container.add(textSettingPane);
}
@ -41,7 +40,7 @@ public class TextEditorMobileDefinePane extends BaseTextEditorMobileDefinePane {
public void populate(FormDesigner designer) {
TextEditor textEditor = (TextEditor) getxCreator().toData();
inputSettingPane.populateBean(textEditor.getMobileScanCodeAttr());
textSettingPane.populateBean(textEditor.getMobileTextEditAttr());
// textSettingPane.populateBean(textEditor.getMobileTextEditAttr());
this.bindListeners2Widgets();
}
@ -49,7 +48,7 @@ public class TextEditorMobileDefinePane extends BaseTextEditorMobileDefinePane {
public void update() {
TextEditor textEditor = (TextEditor) getxCreator().toData();
inputSettingPane.updateBean(textEditor.getMobileScanCodeAttr());
textSettingPane.updateBean(textEditor.getMobileTextEditAttr());
// textSettingPane.updateBean(textEditor.getMobileTextEditAttr());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
}

13
designer-realize/src/main/java/com/fr/design/widget/WidgetMobilePaneFactory.java

@ -4,14 +4,8 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.design.widget.ui.mobile.MultiFileEditorMobilePane;
import com.fr.design.widget.ui.mobile.NumberEditorMobilePane;
import com.fr.design.widget.ui.mobile.PasswordMobilePane;
import com.fr.design.widget.ui.mobile.TextAreaMobilePane;
import com.fr.design.widget.ui.mobile.TextEditorMobilePane;
import com.fr.form.ui.MultiFileEditor;
import com.fr.form.ui.NumberEditor;
import com.fr.form.ui.Password;
import com.fr.form.ui.TextArea;
import com.fr.form.ui.TextEditor;
import com.fr.form.ui.Widget;
import com.fr.general.GeneralContext;
@ -35,9 +29,10 @@ public class WidgetMobilePaneFactory {
static {
mobilePaneMap.put(MultiFileEditor.class, MultiFileEditorMobilePane.class);
mobilePaneMap.put(TextEditor.class, TextEditorMobilePane.class);
mobilePaneMap.put(TextArea.class, TextAreaMobilePane.class);
mobilePaneMap.put(NumberEditor.class, NumberEditorMobilePane.class);
mobilePaneMap.put(Password.class, PasswordMobilePane.class);
// 此版本不发布,先屏蔽入口
// mobilePaneMap.put(TextArea.class, TextAreaMobilePane.class);
// mobilePaneMap.put(NumberEditor.class, NumberEditorMobilePane.class);
// mobilePaneMap.put(Password.class, PasswordMobilePane.class);
mobilePluginPaneMap.putAll(ExtraDesignClassManager.getInstance().getCellWidgetMobileOptionsMap());
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {

2
designer-realize/src/main/java/com/fr/design/widget/ui/mobile/TextEditorMobilePane.java

@ -37,7 +37,7 @@ public class TextEditorMobilePane extends WidgetMobilePane {
settingPane = new MobileTextFieldInputSettingPane();
textSettingPane = new MobileTextEditSettingPane();
container.add(settingPane);
container.add(textSettingPane);
// container.add(textSettingPane);
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH);
}

Loading…
Cancel
Save