Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/release/11.0)

* commit 'ca6353415495a5f98f7fe4347c7673efd7e41afe': (42 commits)
  REPORT-94629 更新注释
  REPORT-94629 优化代码
  REPORT-94629 设计器tab组件操作异常
  REPORT-95367 fix:关闭icon模糊
  修改代码行数
  往前遍历要到0
  REPORT-95401 && REPORT-95218【FVS支持多开】打开多个fvs之后打开frm,再次打开fvs,tab栏自适应异常【FVS支持多开】禁用插件,强制保存fvs模板,可以取消勾选
  REPORT-95362 fix:tab上的toolTip被截断
  添加注释
  代码修改
  REPORT-95197 && REPORT-95194 打开远程工作目录面板,选择远程目录点确定,没有强制要求保存fvs模板
  REPORT-95068【FVS支持多开】兼容问题》release-jar+旧插件,连续打开两张fvs模板,关闭后异常
  REPORT-94999  frm-tab栏与fvs-tab栏切换时,会出现跳到其他模式
  REPORT-94114 11.0.15.1维护版本,同步到persist
  改一下方法名称
  REPORT-94510 决策报表-tab块组件大小设置0-样式设置"菜单式"-预览模板空白
  REPORT-91253 FR源码中存在密钥硬编码
  REPORT-94504 关闭所有模板,当前模板是否有未保存内容没有校验,模板内容有丢失风险
  添加注释
  REPORT-94400【FVS支持多开】来回切换fvs模板,tab栏会晃动
  ...
newui
zheng-郑潇 2 years ago
parent
commit
43c1cb8ec6
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 11
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java
  3. 129
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  4. 31
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  5. 2
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  6. 8
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  7. 11
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  8. 4
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  9. 16
      designer-base/src/main/java/com/fr/design/widget/btn/ButtonConstants.java
  10. 22
      designer-base/src/main/java/com/fr/design/widget/btn/ButtonDetailPane.java
  11. 12
      designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java
  12. 39
      designer-base/src/main/java/com/fr/file/FILEChooserPane.java
  13. 1
      designer-base/src/main/resources/com/fr/design/config/default
  14. 29
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java
  15. 41
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  16. 110
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java
  17. 37
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java
  18. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java
  19. 126
      designer-form/src/main/java/com/fr/design/widget/ui/btn/AbstractExtraButtonPane.java
  20. 16
      designer-form/src/main/java/com/fr/design/widget/ui/btn/FormSubmitButtonDetailPane.java
  21. 3
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  22. 19
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java
  23. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java
  24. 6
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java
  25. 6
      designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java
  26. 22
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java
  27. 16
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefaultButtonDetailPane.java
  28. 17
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java
  29. 17
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java
  30. 21
      designer-realize/src/main/java/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java

2
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -413,7 +413,7 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(true, SwingUtilities.getWindowAncestor(envListPane));
if (!saveSomeTemplatePane.showSavePane()) {
if (!saveSomeTemplatePane.showSavePane(true)) {
// 用户取消保存时,取消切换目录操作
return;
}

11
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java

@ -1,5 +1,6 @@
package com.fr.design.file;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem;
@ -7,7 +8,6 @@ import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.CollectionUtils;
@ -34,9 +34,9 @@ import java.util.Map;
**/
public class MultiTemplateTabMenuFactory {
private static final Icon CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private static final Icon MOUSE_OVER_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png");
private static final Icon MOUSE_PRESS_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png");
private static final Icon CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close");
private static final Icon MOUSE_OVER_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_mouseover.svg");
private static final Icon MOUSE_PRESS_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_press.svg");
private static final int ITEM_SIZE = 25;
@ -100,8 +100,7 @@ public class MultiTemplateTabMenuFactory {
closeOther.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
MultiTemplateTabPane.getInstance().closeAllByOperatorType(currentOperator);
MultiTemplateTabPane.getInstance().closeOtherByOperatorType(currentOperator);
}
});
if (MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(currentOperator).size() <= 1) {

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

@ -44,6 +44,7 @@ import javax.swing.JSeparator;
import javax.swing.MenuElement;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.AWTEvent;
import java.awt.AlphaComposite;
@ -212,6 +213,35 @@ public class MultiTemplateTabPane extends JComponent {
});
}
/**
* 模板可以关闭的条件
*/
class CloseCondition {
private CloseOption closeOption;
public CloseCondition(CloseOption closeOption) {
this.closeOption = closeOption;
}
/**
* 判断模板是否可以关闭两个条件1是否满足CloseOption里面的条件在左侧在右侧等2是否和当前正在编辑模板属于同一种模板tab操作类型
* @param closeJTemplate
* @param tplIndex
* @param i
* @return
*/
public boolean shouldClose(JTemplate closeJTemplate, int tplIndex, int i) {
boolean matchOption = this.closeOption.shouldClose(tplIndex, i);
JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (!JTemplate.isValid(currentTemplate)) {
return matchOption;
}
return matchOption && ComparatorUtils.equals(closeJTemplate.getTemplateTabOperatorType(),
currentTemplate.getTemplateTabOperatorType());
}
}
enum CloseOption {
Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) {
@Override
@ -322,32 +352,34 @@ public class MultiTemplateTabPane extends JComponent {
@Override
public void actionPerformed(ActionEvent e) {
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false);
if (saveSomeTempaltePane.showSavePane()) {
//只有关闭所有模板才需要判断当前模板,关闭左侧、右侧、其他都不需要
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(option == CloseOption.All);
CloseCondition closeCondition = new CloseCondition(option);
if (saveSomeTemplatePane.showSavePane(closeCondition, false)) {
JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()];
for (int i = 0; i < openedTemplate.size(); i++) {
templates[i] = openedTemplate.get(i);
}
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
closeTemplate(templates, currentTemplate);
closeTemplate(closeCondition, templates, currentTemplate);
if (openedTemplate.size() == 0) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} else if (option == CloseOption.All){
DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(0));
//openedTemplate(0)是JVirtualTemplate时需重新打开
openedTemplate.get(0).activeOldJTemplate();
} else {
DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate);
currentTemplate.activeOldJTemplate();
}
MultiTemplateTabPane.getInstance().repaint();
}
}
private void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
String operator = currentTemplate.getTemplateTabOperatorType();
private void closeTemplate(CloseCondition closeCondition, JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
for (int i = 0; i < templates.length; i++) {
if (option.shouldClose(tplIndex, i) && ComparatorUtils.equals(operator, templates[i].getTemplateTabOperatorType())) {
if (closeCondition.shouldClose(templates[i], tplIndex, i)) {
JTemplate<?, ?> jTemplate = templates[i];
if (jTemplate == currentTemplate) {
currentTemplate = option == CloseOption.All ? null : templates[tplIndex];
@ -384,7 +416,8 @@ public class MultiTemplateTabPane extends JComponent {
* 关闭所有指定模板tab操作类型的模板
* @param operatorType
*/
public void closeAllByOperatorType(String operatorType){
public void closeOtherByOperatorType(String operatorType){
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false);
if (saveSomeTempaltePane.showSavePane()) {
List<JTemplate<?, ?>> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
@ -393,26 +426,24 @@ public class MultiTemplateTabPane extends JComponent {
for (int i = 0; i < openedTemplate.size(); i++) {
templates[i] = openedTemplate.get(i);
}
closeTemplate(templates, operatorType);
closeTemplate(templates, currentEditingTemplate, operatorType);
if (openedTemplate.size() == 0) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} else {
DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(0));
}
DesignerContext.getDesignerFrame().activateJTemplate(currentEditingTemplate);
MultiTemplateTabPane.getInstance().repaint();
}
}
/**
* 关闭指定模板
* 关闭指定的非当前编辑模板
* @param templates
* @param operatorType
*/
private static void closeTemplate(JTemplate<?, ?>[] templates, String operatorType) {
private static void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentEditingTemplate, String operatorType) {
for (int i = 0; i < templates.length; i++) {
JTemplate<?, ?> jTemplate = templates[i];
if (!ComparatorUtils.equals(operatorType, jTemplate.getTemplateTabOperatorType())){
boolean needClose = ComparatorUtils.equals(operatorType, jTemplate.getTemplateTabOperatorType())
&& jTemplate != currentEditingTemplate;
if (!needClose) {
continue;
}
MultiTemplateTabPane.getInstance().closeFormat(jTemplate);
@ -726,6 +757,58 @@ public class MultiTemplateTabPane extends JComponent {
minPaintIndex = 0;
maxPaintIndex = openedTemplate.size() - 1;
}
//需要根据每个tab的宽度重新check下实际的maxPaintIndex和minPaintIndex
checkActualPaintIndex();
}
/**
* 先计算出需要补充的tab个数
* @return
*/
private int calTabCountComplemented(){
int a = 0;
for (int i = minPaintIndex; i <= maxPaintIndex; i++) {
JTemplate template = openedTemplate.get(i);
if (!showJTemplateTab(template)) {
a++;
}
}
return a;
}
/**
* 由于可能存在宽度为0的tab所以这边需要重新check下先往后补再往前补
*/
private void checkActualPaintIndex(){
int tabCount = calTabCountComplemented();
if (tabCount == 0){
return;
}
if (maxPaintIndex < openedTemplate.size() - 1) {
for (int i = maxPaintIndex + 1; i < openedTemplate.size(); i++) {
JTemplate template = openedTemplate.get(i);
if (showJTemplateTab(template)) {
tabCount--;
}
maxPaintIndex++;
if (tabCount == 0){
return;
}
}
}
if (minPaintIndex > 0){
for (int i = minPaintIndex - 1; i >= 0; i--) {
JTemplate template = openedTemplate.get(i);
if (showJTemplateTab(template)) {
tabCount--;
}
minPaintIndex--;
if (tabCount == 0){
return;
}
}
}
}
@ -997,9 +1080,12 @@ public class MultiTemplateTabPane extends JComponent {
// selectIndex 没有变化,但是对应的模板已经变成了前一张模板
if (closeIconIndex == selectedIndex || isCloseCurrent) {
// 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界
// 关闭的模板是当前选中的模板时,需要重新计算下一个待展示的模板的index
if (selectedIndex >= maxPaintIndex) {
// selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true
selectedIndex = calNextShowJTemplateIndex(selectedIndex - 1);
} else {
selectedIndex = calNextShowJTemplateIndex(selectedIndex);
}
isCloseCurrent = false;
}
@ -1120,6 +1206,7 @@ public class MultiTemplateTabPane extends JComponent {
private class MultiTemplateTabMouseListener implements MouseListener {
private boolean oldLightWeightPopupEnabled;
/**
* 鼠标进入
@ -1128,7 +1215,8 @@ public class MultiTemplateTabPane extends JComponent {
*/
@Override
public void mouseEntered(MouseEvent e) {
// do nothing
this.oldLightWeightPopupEnabled = ToolTipManager.sharedInstance().isLightWeightPopupEnabled();
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
}
/**
@ -1138,6 +1226,9 @@ public class MultiTemplateTabPane extends JComponent {
*/
@Override
public void mouseExited(MouseEvent e) {
ToolTipManager.sharedInstance().setEnabled(false);
ToolTipManager.sharedInstance().setEnabled(true);
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(this.oldLightWeightPopupEnabled);
listDownMode = LIST_DOWN;
closeIconIndex = -1;
mouseOveredIndex = -1;

31
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

@ -17,6 +17,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@ -123,8 +124,10 @@ public class SaveSomeTemplatePane extends BasicPane {
if (index < 0) {
return;
}
boolean mustSaveBeforeSwitchEnv = judgeJTemplateMustSave
&& unSavedTemplate.get(index).needSaveBeforeSwitchEnv();
UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(index);
checkBox.setSelected(!checkBox.isSelected());
checkBox.setSelected(mustSaveBeforeSwitchEnv ||!checkBox.isSelected());
//根据templateCheckBoxes中的选择情况来更新全选框的状态
int selectedCount = calculateSelectedNum();
@ -162,8 +165,25 @@ public class SaveSomeTemplatePane extends BasicPane {
return showSavePane(false);
}
/**
* 显示保存模板提醒面板
*
* @param judgeJTemplateMustSave 模板是否必须保存
* @return
*/
public boolean showSavePane(boolean judgeJTemplateMustSave) {
populate(judgeJTemplateMustSave);
return showSavePane(null, judgeJTemplateMustSave);
}
/**
* 显示保存模板提醒面板
*
* @param option 具体关闭操作
* @param judgeJTemplateMustSave 模板是否必须保存
* @return
*/
public boolean showSavePane(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave) {
initAndPopulate(option, judgeJTemplateMustSave);
//如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目
if (!unSavedTemplate.isEmpty()) {
dialog.setVisible(true);
@ -177,11 +197,14 @@ public class SaveSomeTemplatePane extends BasicPane {
return HistoryTemplateListPane.getInstance().getHistoryList();
}
public void populate(boolean judgeJTemplateMustSave) {
private void initAndPopulate(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave) {
java.util.List<JTemplate<?, ?>> opendedTemplate = getOpenedTemplatesToProcess();
JTemplate<?, ?> currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
int currentIndex = opendedTemplate.indexOf(currentTemplate);
for (int i = 0; i < opendedTemplate.size(); i++) {
if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) {
//满足关闭条件的才继续判断文件是否发生了改动
boolean needClose = option == null || option.shouldClose(opendedTemplate.get(i), currentIndex, i);
if (needClose && isneedToAdd(opendedTemplate.get(i), currentTemplate)) {
unSavedTemplate.add(opendedTemplate.get(i));
}
}

2
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -391,7 +391,7 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
}
private void updateHelpDocuments(Object value, List<HelpDocument> helpDocuments) {
String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT) + value.toString();
try {
String result = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(result);

8
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java

@ -852,7 +852,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (jt == null || jt.getEditingFILE() == null) {
return;
}
if (currentTemplateDeactivateFail()) {
if (currentTemplateDeactivateFail(jt)) {
return;
}
jt.addJTemplateActionListener(this);
@ -877,7 +877,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (jt == null || jt.getEditingFILE() == null) {
return;
}
if (currentTemplateDeactivateFail()) {
if (currentTemplateDeactivateFail(jt)) {
return;
}
getCenterTemplateCardPane().showJTemplate(jt);
@ -939,9 +939,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @return 是否停用失败
*/
private boolean currentTemplateDeactivateFail() {
private boolean currentTemplateDeactivateFail(JTemplate jt) {
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate();
return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate(jt);
}

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

@ -1373,6 +1373,17 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
/**
* 将要激活打开其他模板使当前模板灭活
* 默认 do nothing 返回true
*
* @return true成功停用当前模板
*/
public boolean deactivateTemplate(JTemplate jTemplate) {
//兼容调用老的接口
return deactivateTemplate();
}
/**
* 返回当前支持的超链界面pane
*

4
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -416,7 +416,9 @@ public abstract class ToolBarMenuDock {
menuDef.addShortCut(new OpenRecentReportMenuDef());
addCloseCurrentTemplateAction(menuDef);
if (!DesignModeContext.isDuchampMode()) {
addCloseCurrentTemplateAction(menuDef);
}
scs = plus.shortcut4FileMenu();
if (!ArrayUtils.isEmpty(scs)) {

16
designer-base/src/main/java/com/fr/design/widget/btn/ButtonConstants.java

@ -44,4 +44,20 @@ public class ButtonConstants {
StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.TREE_NODE_TOGGLE_BUTTON, Widget.class)
};
public static final String[] TYPES_BUTTON_NO_FREE = {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Common"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Delete_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Type_Parameter_Submit"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_TreeNode")
};
public static final Class[] CLASSES_BUTTON_NO_FREE = {
Button.class,
StableFactory.getMarkedClass(BridgeMark.APPEND_ROW_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.DELETE_ROW_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.TREE_NODE_TOGGLE_BUTTON, Widget.class)
};
}

22
designer-base/src/main/java/com/fr/design/widget/btn/ButtonDetailPane.java

@ -1,11 +1,9 @@
package com.fr.design.widget.btn;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.dialog.BasicPane;
import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.event.ActionEvent;
@ -13,6 +11,7 @@ import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* Author : Richer
@ -22,7 +21,7 @@ import java.util.List;
*/
public abstract class ButtonDetailPane<T extends Button> extends BasicPane {
private List<ChangeListener> ls = new ArrayList<ChangeListener>();
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Button");
@ -49,7 +48,10 @@ public abstract class ButtonDetailPane<T extends Button> extends BasicPane {
public abstract Class classType();
protected DictionaryComboBox createButtonTypeComboBox() {
final DictionaryComboBox dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES4BUTTON, ButtonConstants.TYPES4BUTTON, false);
return createButtonTypeComboBox(false);
}
private DictionaryComboBox initDictionaryComboBox(DictionaryComboBox dictionaryComboBox) {
dictionaryComboBox.setSelectedItem(classType());
dictionaryComboBox.addActionListener(new ActionListener() {
@Override
@ -59,4 +61,14 @@ public abstract class ButtonDetailPane<T extends Button> extends BasicPane {
});
return dictionaryComboBox;
}
protected DictionaryComboBox createButtonTypeComboBox(Boolean containsExtraPane) {
final DictionaryComboBox dictionaryComboBox;
if (!containsExtraPane) {
dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES4BUTTON, ButtonConstants.TYPES4BUTTON, false);
} else {
dictionaryComboBox = new DictionaryComboBox(ButtonConstants.CLASSES_BUTTON_NO_FREE, ButtonConstants.TYPES_BUTTON_NO_FREE, false);
}
return initDictionaryComboBox(dictionaryComboBox);
}
}

12
designer-base/src/main/java/com/fr/design/widget/btn/ButtonWithHotkeysDetailPane.java

@ -6,6 +6,7 @@ import javax.swing.*;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
@ -42,8 +43,9 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
JPanel labelPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
iconPane = new AccessibleIconEditor();
labelPane.add(iconPane);
Component comp = createCenterPane();
Component[][] n_components = {
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createButtonTypeComboBox()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createCustomButtonTypeComboBox()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField = new UITextField()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Icon")), iconPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField = new UITextField()},
@ -52,7 +54,6 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
advancePane.add(panel, BorderLayout.NORTH);
Component comp = createCenterPane();
if(comp != null ) {
advancePane.add(comp,BorderLayout.CENTER);
}
@ -63,6 +64,13 @@ public abstract class ButtonWithHotkeysDetailPane<T extends Button> extends Butt
protected abstract Component createCenterPane();
/**
* 判断是按钮控件下拉框的种类1.有自定义按钮 2.无自定义按钮
*/
protected DictionaryComboBox createCustomButtonTypeComboBox() {
return createButtonTypeComboBox();
}
@Override
public void populate(T button) {
if (button == null) {

39
designer-base/src/main/java/com/fr/file/FILEChooserPane.java

@ -129,6 +129,10 @@ public class FILEChooserPane extends BasicPane {
public static final int JOPTIONPANE_CANCEL_OPTION = 3;
public static final String SEPARATOR_STRING = "/";
public static final char SEPARATOR_CHAR = '/';
/**
* alex:之所以在Pattern那里加个+,是因为有些路径会有两个甚至多个分隔符放在一起
@ -1466,10 +1470,17 @@ public class FILEChooserPane extends BasicPane {
for (int i = 0; i < this.buttonList.size(); i++) {
this.buttonList.get(i).setForeground(null);
if (((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir() != null
&& this.buttonList.get(i).getAction() instanceof SetDirectoryAction
&& (ComparatorUtils.equals(((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir().getPath(), dir.getPath()))) {
this.buttonList.get(i).setForeground(Color.BLUE);
&& this.buttonList.get(i).getAction() instanceof SetDirectoryAction) {
String actionPath = ((SetDirectoryAction) this.buttonList.get(i).getAction()).getDir().getPath();
String dirPath = dir.getPath();
//如果是报表环境,button的Action最后会跟上"/",这个是特意处理的,但是对应代码没有说明原因,不做修改
//FILE的getPath不会带"/",这边针对这种情况加个处理,不建议直接改FILE
if (actionPath.endsWith(SEPARATOR_STRING) && !dirPath.endsWith(SEPARATOR_STRING)) {
dirPath = dirPath + SEPARATOR_STRING;
}
if (ComparatorUtils.equals(actionPath, dirPath)) {
this.buttonList.get(i).setForeground(Color.BLUE);
}
}
}
}
@ -1479,7 +1490,7 @@ public class FILEChooserPane extends BasicPane {
}
public void populate(FILE dir) {
if (popDir != null && dir != null && popDir.toString().indexOf(dir.toString()) == 0) {
if (checkOnlyHighLight(dir)) {
highLightButton(dir);
return;
}
@ -1530,6 +1541,24 @@ public class FILEChooserPane extends BasicPane {
highLightButton(dir);
}
/**
* 检查是不是只需要设置高亮即可
*
* @param dir FILE
* @return 如果还要进行别的设置就返回false,如果只需要更新下高亮(通过点击上面的路径才会只需要更新高亮),返回true
*/
private boolean checkOnlyHighLight(FILE dir) {
if (popDir == null || dir == null) {
return false;
}
String popDirStr = popDir.toString();
String dirStr = dir.toString();
//前缀匹配是不够的,还要看下前缀匹配的下一位是不是'/'
//否则"test"和"test副本"明明不属于同个路径逻辑,也只更新高亮,应该是"test"和"test/副本"这样才可以通过
//如果通过了indexOf的检查,因为不会存在相同的路径,popDirStr只会比dirStr大,看一下前缀匹配的下一位是不是'/',如果不是就得更新路径文本,不能只设置高亮
return popDirStr.indexOf(dirStr) == 0 && popDirStr.length() > dirStr.length() && popDirStr.charAt(dirStr.length()) == SEPARATOR_CHAR;
}
// doLayout
@Override
public void doLayout() {

1
designer-base/src/main/resources/com/fr/design/config/default

@ -1 +1,2 @@
Fine-Designer_Login=i7hP48WAcuTrmxfN
Fine-Designer_Reu_Share_CERTIFICATE_PUBLIC_KEY=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8DtT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYXnMdTIrkz8tYkG3QoFQIDAQAB

29
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -97,25 +97,16 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
* @param ePane 面板
*/
public void populateChartPropertyPane(ChartCollection collection, TargetComponent<?> ePane) {
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
GEOJSONHelper.getInstance();
return null;
}
@Override
protected void done() {
String chartID = collection.getSelectedChartProvider(ChartProvider.class).getID();
updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID());
setSupportCellData(true);
container.setEPane(ePane);
if (ChartTypeManager.getInstance().chartExit(chartID)) {
chartEditPane.populate(collection);
} else {
GUICoreUtils.setEnabled(chartEditPane, false);
}
}
}.execute();
String chartID = collection.getSelectedChartProvider(ChartProvider.class).getID();
updateChartEditPane(collection.getSelectedChartProvider(ChartProvider.class).getID());
setSupportCellData(true);
this.container.setEPane(ePane);
if (ChartTypeManager.getInstance().chartExit(chartID)) {
chartEditPane.populate(collection);
} else {
GUICoreUtils.setEnabled(chartEditPane, false);
}
}
/**

41
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

@ -154,24 +154,23 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
}
HashMap paneMap = getHyperlinkMap();
//安装平台内打开插件时,添加相应按钮
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
java.util.List<UIMenuNameableCreator> list = refreshList(paneMap);
Map<String, NameObjectCreator> creators = new ListMap<>();
int size = list.size();
NameObjectCreator[] creators = new NameObjectCreator[size + providers.size()];
for (int i = 0; i < size; i++) {
UIMenuNameableCreator uiMenuNameableCreator = list.get(i);
creators[i] = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz());
NameObjectCreator creator = new NameObjectCreator(uiMenuNameableCreator.getName(), uiMenuNameableCreator.getObj().getClass(), uiMenuNameableCreator.getPaneClazz());
creators.put(uiMenuNameableCreator.getName(), creator);
}
//安装平台内打开插件时, 添加/替换 相应按钮
Set<HyperlinkProvider> providers = ExtraDesignClassManager.getInstance().getArray(HyperlinkProvider.XML_TAG);
for (HyperlinkProvider provider : providers) {
NameableCreator creator = provider.createHyperlinkCreator();
if (creator != null) {
creators[size] = new NameObjectCreator(creator.menuName(), creator.getHyperlink(), creator.getUpdatePane());
size++;
creators.put(creator.menuName(), new NameObjectCreator(creator.menuName(), creator.getHyperlink(), creator.getUpdatePane()));
}
}
refreshNameableCreator(creators);
refreshNameableCreator(creators.values().toArray(new NameObjectCreator[0]));
}
public void populate(Plot plot) {
@ -303,18 +302,30 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
this.creatorsFilter = nameableCreator -> {
Class<? extends JavaScript> clazz = nameableCreator.getHyperlink();
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (!JTemplate.isValid(template)) {
return false;
}
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
if (template.isJWorkBook()) {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
return !ComparatorUtils.equals(clazz, formHyperlink.getClass());
} else {
// 如果是决策报表
if (template.getEditingReportIndex() == BaseJForm.ELEMENTCASE_TAB) {
// 编辑的是决策报表中的报表块,那么没有 ChartHyperRelateFloatLink选项
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
}
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有 ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
}
}
}
}

110
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java

@ -10,6 +10,7 @@ import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.XButton;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ilable.UILabel;
@ -25,16 +26,27 @@ import com.fr.form.ui.container.WTabTextDirection;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Background;
import com.fr.general.act.BorderPacker;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.act.BorderPacker;
import com.fr.general.act.TitlePacker;
import com.fr.general.cardtag.TemplateStyle;
import com.fr.stable.unit.PT;
import javax.swing.*;
import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
import javax.swing.plaf.basic.BasicLabelUI;
import java.awt.*;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
@ -236,52 +248,43 @@ public class XCardSwitchButton extends XButton {
//SwitchButton对应的XWCardLayout和XWCardTagLayout暂未存到xml中,重新打开时根据父子层关系获取
private void initRelateLayout(){
this.tagLayout = (XWCardTagLayout)this.getBackupParent();
private void initRelateLayout() {
this.tagLayout = (XWCardTagLayout) this.getBackupParent();
XWCardTitleLayout titleLayout = (XWCardTitleLayout) this.tagLayout.getBackupParent();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout)titleLayout.getBackupParent();
XWCardMainBorderLayout borderLayout = (XWCardMainBorderLayout) titleLayout.getBackupParent();
this.cardLayout = borderLayout.getCardPart();
}
//是否进入点击关闭按钮区域
private boolean isSelectedClose(MouseEvent e, FormDesigner designer){
/**
* <p> 是否进入点击关闭按钮区域
* <p> 计算逻辑
* <p> 先得到鼠标的绝对坐标 -> tab布局的绝对坐标 -> 得到鼠标相对tab的坐标有参数面板时要减去参数面板的高度
* <p> 再计算删除区域位置的相对坐标通过对比判定鼠标是否在点击关闭按钮区域内鼠标的位置(ex,ey)
* <li> 当前点击tag删除区域的x坐标 < ex < 当前点击tag删除区域的x坐标 + 偏移量</li>
* <li> 当前点击tag删除区域的y坐标 < ey < 当前点击tag删除区域的y坐标 + 偏移量</li>
*
* @param e 鼠标事件
* @param designer 表单编辑对象
* @return true/false 在内/不在
*/
private boolean isSelectedClose(MouseEvent e, FormDesigner designer) {
int diff = designer.getHorizontalScaleValue();
// mouse position
// 这里是鼠标的绝对位置
int ex = e.getX() + diff;
int ey = e.getY();
//获取tab布局的位置,鼠标相对于tab按钮的位置
Container mainLayout = cardLayout.getBackupParent();
Point point = mainLayout.getLocation();
int y = 0;
int x = 0;
//遍历一下,不然是相对位置,嵌套后位置不对
while (mainLayout.getParent() != null){
if(mainLayout instanceof XWCardLayout){
y += mainLayout.getY();
}
mainLayout = mainLayout.getParent();
if(mainLayout instanceof XWCardMainBorderLayout){
x += mainLayout.getX();
y += mainLayout.getY();
}
}
double mainX = point.getX() + x;
double mainY = point.getY() + y;
// 获取tab布局的位置,鼠标相对于tab按钮的位置
double[] tabPositionInBody = getTabAbsolutePositionInBody();
// 参数界面对坐标的影响
JForm jform = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(jform.getFormDesign().getParaComponent() != null){
if (jform.getFormDesign().getParaComponent() != null) {
ey -= jform.getFormDesign().getParaHeight();
}
//减掉tab布局的相对位置
ex -= mainX;
ey -= mainY;
ex -= tabPositionInBody[0];
ey -= tabPositionInBody[1];
XLayoutContainer titleLayout = tagLayout.getBackupParent();
Point titlePoint = titleLayout.getLocation();
@ -291,10 +294,43 @@ public class XCardSwitchButton extends XButton {
int width = button.getWidth();
// 鼠标进入按钮右侧删除图标区域
double recX = position.getX() + titlePoint.getX() + (width - CLOSE_ICON_RIGHT_OFFSET);
double recX = position.getX() + titlePoint.getX() + (width - CLOSE_ICON_RIGHT_OFFSET);
double recY = position.getY() + titlePoint.getY() + CLOSE_ICON_TOP_OFFSET;
// 比较的是相对位置的偏移量是否在一定距离内
// 所以要得到鼠标相对于当前tab块的坐标
return (recX < ex && ex < recX + CLOSE_ICON_RIGHT_OFFSET && ey < recY && ey > position.getY());
}
/**
* 获取tab布局在body内的绝对位置
*
* @return
*/
private double[] getTabAbsolutePositionInBody() {
// 获取tab布局的位置,鼠标相对于tab按钮的位置
Container mainLayout = cardLayout.getBackupParent();
// 这个point是当前tab布局的相对坐标,是相对于父容器的坐标
// 比如父级是一个absolute块,放在左上角,现在得到的point就是(0,0)
Point point = mainLayout.getLocation();
int y = 0;
int x = 0;
// 遍历一下,不然是相对位置,嵌套后位置不对
// 这里是要得到tab布局的绝对位置,所以要加上父组件的位置
while (mainLayout.getParent() != null) {
if (mainLayout instanceof XWCardLayout) {
y += mainLayout.getY();
}
mainLayout = mainLayout.getParent();
return (recX < ex && ex < recX + CLOSE_ICON_RIGHT_OFFSET && ey < recY && ey > position.getY());
if ((mainLayout instanceof XWCardMainBorderLayout) || (mainLayout instanceof XWAbsoluteLayout)) {
x += mainLayout.getX();
y += mainLayout.getY();
}
}
double mainX = point.getX() + x;
double mainY = point.getY() + y;
return new double[]{mainX, mainY};
}
//将当前switchButton改为选中状态
@ -306,7 +342,7 @@ public class XCardSwitchButton extends XButton {
}
}
@Override
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;

37
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java

@ -24,21 +24,25 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.WTabDisplayPosition;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.act.BorderPacker;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.act.BorderPacker;
import com.fr.general.cardtag.DefaultTemplateStyle;
import com.fr.stable.StringUtils;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Rectangle;
import java.awt.event.ContainerEvent;
import java.awt.event.MouseEvent;
import java.util.HashMap;
@ -434,7 +438,7 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
}
private void fixTitleLayout(XLayoutContainer parent){
private void fixTitleLayout(XLayoutContainer parent) {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(formDesigner, parent);
if (layoutAdapter != null) {
@ -443,4 +447,31 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout {
}
}
/**
* <p> 对于tab组件WCardMainBorderLayout里面有两个子容器:
* <li> WCardTitleLayout里面包含两个部分一个是CardAddButton另一个是WCardTagLayout - tabpane0 </li>
* <li> WCardLayout里面放的是WTabFitLayout - tab00tab10</li>
* <p> 在右侧组件树选择删除WCardTagLayout时tabpane0按照现在的产品逻辑应该删除整个tab组件
*
* @param creator 组件
* @param designer 表单设计器
*/
@Override
public void deleteRelatedComponent(XCreator creator, FormDesigner designer) {
XWCardTagLayout tagLayout = (XWCardTagLayout) creator;
// 先删除所有tab按钮
tagLayout.removeAll();
//逐层回溯找出最外层的XWCardMainBorderLayout
XWCardTitleLayout cardTitleLayout = (XWCardTitleLayout) tagLayout.getBackupParent();
XWCardMainBorderLayout mainLayout = (XWCardMainBorderLayout) cardTitleLayout.getBackupParent();
// 删除tab布局
SelectionModel selectionModel = designer.getSelectionModel();
if (mainLayout != null) {
selectionModel.setSelectedCreator(mainLayout);
selectionModel.deleteSelection();
}
LayoutUtils.layoutRootContainer(designer.getRootComponent());
FormHierarchyTreePane.getInstance().refreshRoot();
selectionModel.setSelectedCreator(designer.getRootComponent());
}
}

6
designer-form/src/main/java/com/fr/design/mainframe/share/util/DownloadUtils.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe.share.util;
import com.fr.base.theme.FormTheme;
import com.fr.design.DesignerEnvManager;
import com.fr.design.extra.PluginConstants;
import com.fr.design.login.config.DefaultLoginKeys;
import com.fr.form.share.base.CancelCheck;
import com.fr.form.share.constants.ShareComponentConstants;
import com.fr.ftp.util.Base64;
@ -45,10 +46,7 @@ import java.util.Set;
* created by Harrison on 2020/05/27
**/
public class DownloadUtils {
private static final String CERTIFICATE_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtsz62CPSWXZE/IYZRiAuTSZkw\n" +
"1WOwer8+JFktK0uKLAUuQoBr+UjAMFtRA8W7JgKMDwZy/2liEAiXEOSPU/hrdV8D\n" +
"tT541LnGi1X/hXiRwuttPWYN3L2GYm/d5blU+FBNwghBIrdAxXTzYBc6P4KL/oYX\n" +
"nMdTIrkz8tYkG3QoFQIDAQAB";
private static final String CERTIFICATE_PUBLIC_KEY = DefaultLoginKeys.getInstance().getKey("Fine-Designer_Reu_Share_CERTIFICATE_PUBLIC_KEY");
private static String getReusesUrl() {
return StableUtils.pathJoin(OnlineShopUtils.getReuInfoPath(), "file/download");

126
designer-form/src/main/java/com/fr/design/widget/ui/btn/AbstractExtraButtonPane.java

@ -0,0 +1,126 @@
package com.fr.design.widget.ui.btn;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.form.ui.Button;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import org.jetbrains.annotations.Nullable;
import javax.swing.JPanel;
import java.awt.Component;
import java.util.Set;
/**
* 用来处理额外的按钮属性
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public abstract class AbstractExtraButtonPane<T extends Button> extends ButtonWithHotkeysDetailPane<T> {
protected JPanel extraPane;
protected boolean containsExtraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane(classType());
}
/**
* 根据按钮类别判断需要返回什么类型的属性界面
*/
protected void refreshExtraAdvancedPane(Class cls) {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (!provider.accept(cls)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
}
this.containsExtraPane = containsExtraPane;
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane(classType());
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
@Override
public void populate(T button) {
super.populate(button);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(button);
}
}
@Override
public T update() {
T button = super.update();
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(button);
}
return button;
}
@Override
protected DictionaryComboBox createCustomButtonTypeComboBox() {
return createButtonTypeComboBox(containsExtraPane);
}
/**
* 生成额外的属性界面
*/
protected Component createExtraPane(@Nullable BasicPane pane) {
initExtraPane();
Component[][] components = new Component[][]{
new Component[]{pane, null},
new Component[]{extraPane, null}
};
double[] rowSize = {P, P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7);
}
}

16
designer-form/src/main/java/com/fr/design/widget/ui/btn/FormSubmitButtonDetailPane.java

@ -1,22 +1,21 @@
package com.fr.design.widget.ui.btn;
import com.fr.form.parameter.FormSubmitButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午6:25
* 提交参数按钮
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public class FormSubmitButtonDetailPane extends ButtonWithHotkeysDetailPane<FormSubmitButton> {
public class FormSubmitButtonDetailPane extends AbstractExtraButtonPane<FormSubmitButton> {
@Override
protected Component createCenterPane() {
return null;
return createExtraPane(null);
}
@Override
@ -37,4 +36,5 @@ public class FormSubmitButtonDetailPane extends ButtonWithHotkeysDetailPane<Form
public Class classType() {
return FormSubmitButton.class;
}
}

3
designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java

@ -35,6 +35,7 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
protected UITextField labelNameTextField;
private final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
private JPanel extraPane;
protected boolean containsExtraPane;
public ButtonDefinePane(XCreator creator){
super(creator);
@ -63,7 +64,7 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
private void refreshAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (!provider.accept(creator)) {

19
designer-form/src/main/java/com/fr/design/widget/ui/designer/FreeButtonDefinePane.java

@ -41,10 +41,13 @@ public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
}
public void populateSubButtonPane(FreeButton e) {
if (containsExtraPane) {
return;
}
backgroundCompPane.populate(e);
frFontPane.setVisible(e.isCustomStyle());
fontLabel.setVisible(e.isCustomStyle());
if(e.isCustomStyle()){
if (e.isCustomStyle()) {
FRFont frFont = e.getFont();
if (frFont != null) {
frFontPane.populateBean(e.getFont());
@ -54,12 +57,14 @@ public class FreeButtonDefinePane extends ButtonDefinePane<FreeButton> {
public FreeButton updateSubButtonPane() {
FreeButton freeButton = (FreeButton) creator.toData();
backgroundCompPane.update(freeButton);
frFontPane.setVisible(freeButton.isCustomStyle());
fontLabel.setVisible(freeButton.isCustomStyle());
if(freeButton.isCustomStyle()){
FRFont frFont = freeButton.getFont() == null ? FRFont.getInstance() : freeButton.getFont();
freeButton.setFont(frFontPane.update(frFont));
if (!containsExtraPane) {
backgroundCompPane.update(freeButton);
frFontPane.setVisible(freeButton.isCustomStyle());
fontLabel.setVisible(freeButton.isCustomStyle());
if (freeButton.isCustomStyle()) {
FRFont frFont = freeButton.getFont() == null ? FRFont.getInstance() : freeButton.getFont();
freeButton.setFont(frFontPane.update(frFont));
}
}
return freeButton;
}

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/component/WidgetCardTagBoundPane.java

@ -29,7 +29,7 @@ public class WidgetCardTagBoundPane extends WidgetBoundPane {
@Override
public void initBoundPane() {
cardTagWidth = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
cardTagWidth = new UIBoundSpinner(0, Integer.MAX_VALUE, 1, 0);
cardTagWidth.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Coords_And_Size"));
this.add(WidgetBoundsPaneFactory.createCardTagBoundPane(cardTagWidth));
}

6
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardMainLayoutDefinePane.java

@ -7,16 +7,13 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.xpane.CardTagLayoutStylePane;
import com.fr.design.gui.xpane.LayoutStylePane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleCardTagWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.WCardLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -72,6 +69,9 @@ public class WCardMainLayoutDefinePane extends AbstractDataModify<WCardMainBorde
@Override
public void populateBean(WCardMainBorderLayout ob) {
WCardLayout cardLayout = ob.getCardPart();
if (cardLayout == null) {
return;
}
stylePane.populateBean((LayoutBorderStyle) cardLayout.getBorderStyle());
setCarousel.setSelected(cardLayout.isCarousel());
IntervalPane.setVisible(cardLayout.isCarousel());

6
designer-form/src/main/java/com/fr/design/widget/ui/designer/layout/WCardTagLayoutDefinePane.java

@ -24,7 +24,6 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.Background;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.cardtag.TemplateStyle;
import javax.swing.BorderFactory;
@ -107,8 +106,11 @@ public class WCardTagLayoutDefinePane extends AbstractDataModify<WCardTagLayout>
public void populateBean(WCardTagLayout ob) {
//标题背景和字体属性设置在WCardLayout上做兼容
XLayoutContainer topLayout = creator.getTopLayout();
if (topLayout.getComponentCount() == 0) {
// 没有子组件,不用做处理
return;
}
LayoutBorderStyle layoutBorderStyle = (LayoutBorderStyle) ((XWCardMainBorderLayout) topLayout).getCardPart().toData().getBorderStyle();
displayPositionGroup.setSelectedIndex(ob.getDisplayPosition().getType());
textDirectionGroup.setSelectedIndex(ob.getTextDirection().getType());
backgroundEditor.setValue(layoutBorderStyle.getTitle().getBackground());

22
designer-realize/src/main/java/com/fr/design/widget/ui/btn/AppendRowButtonDefinePane.java

@ -2,19 +2,23 @@ package com.fr.design.widget.ui.btn;
import com.fr.base.IconManager;
import com.fr.report.web.button.write.AppendRowButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午8:02
* 插入行按钮
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public class AppendRowButtonDefinePane<T extends AppendRowButton> extends ButtonWithHotkeysDetailPane<AppendRowButton> {
public class AppendRowButtonDefinePane<T extends AppendRowButton> extends AbstractExtraButtonPane<AppendRowButton> {
private DefineAppendColumnRowPane defineColumnRowPane;
// @Override
@ -26,7 +30,8 @@ public class AppendRowButtonDefinePane<T extends AppendRowButton> extends Button
@Override
protected Component createCenterPane() {
return defineColumnRowPane = new DefineAppendColumnRowPane();
defineColumnRowPane = new DefineAppendColumnRowPane();
return createExtraPane(defineColumnRowPane);
}
@Override
@ -55,4 +60,5 @@ public class AppendRowButtonDefinePane<T extends AppendRowButton> extends Button
public Class classType() {
return AppendRowButton.class;
}
}

16
designer-realize/src/main/java/com/fr/design/widget/ui/btn/DefaultButtonDetailPane.java

@ -1,20 +1,25 @@
package com.fr.design.widget.ui.btn;
import com.fr.form.ui.Button;
import com.fr.form.ui.FreeButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import java.awt.*;
/**
* Created by IntelliJ IDEA. Author : Richer Version: 6.5.6 Date : 11-11-15 Time
* : 下午6:24
* 普通按钮
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button> {
public class DefaultButtonDetailPane extends AbstractExtraButtonPane<Button> {
@Override
protected Component createCenterPane() {
return null;
return createExtraPane(null);
}
@Override
@ -27,4 +32,5 @@ public class DefaultButtonDetailPane extends ButtonWithHotkeysDetailPane<Button>
public Class classType() {
return Button.class;
}
}

17
designer-realize/src/main/java/com/fr/design/widget/ui/btn/DeleteRowButtonDefinePane.java

@ -3,23 +3,23 @@ package com.fr.design.widget.ui.btn;
import com.fr.base.IconManager;
import com.fr.report.web.button.write.DeleteRowButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午8:04
* 删除行按钮
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public class DeleteRowButtonDefinePane<T extends DeleteRowButton> extends ButtonWithHotkeysDetailPane<DeleteRowButton> {
public class DeleteRowButtonDefinePane<T extends DeleteRowButton> extends AbstractExtraButtonPane<DeleteRowButton> {
private DefineDeleteColumnRowPane ddcp;
@Override
protected Component createCenterPane() {
return ddcp = new DefineDeleteColumnRowPane();
ddcp = new DefineDeleteColumnRowPane();
return createExtraPane(ddcp);
}
@Override
@ -48,4 +48,5 @@ public class DeleteRowButtonDefinePane<T extends DeleteRowButton> extends Button
ddcp.update(btn);
return btn;
}
}

17
designer-realize/src/main/java/com/fr/design/widget/ui/btn/FreeButtonDetailPane.java

@ -1,19 +1,25 @@
package com.fr.design.widget.ui.btn;
import java.awt.Component;
import com.fr.form.ui.FreeButton;
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane;
import com.fr.form.ui.FreeButton;
public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton> {
/**
* 自定义按钮
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public class FreeButtonDetailPane extends AbstractExtraButtonPane<FreeButton> {
private ButtonSytleDefinedPane buttonSytleDefinedPane;
@Override
protected Component createCenterPane() {
buttonSytleDefinedPane = new ButtonSytleDefinedPane();
return buttonSytleDefinedPane;
return createExtraPane(buttonSytleDefinedPane);
}
@Override
public FreeButton createButton() {
return new FreeButton();
@ -35,4 +41,5 @@ public class FreeButtonDetailPane extends ButtonWithHotkeysDetailPane<FreeButton
public Class classType() {
return FreeButton.class;
}
}

21
designer-realize/src/main/java/com/fr/design/widget/ui/btn/TreeNodeToogleButtonDefinePane.java

@ -9,19 +9,18 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.Button;
import com.fr.report.web.button.form.TreeNodeToggleButton;
import com.fr.design.widget.btn.ButtonDetailPane;
import javax.swing.*;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 6.5.6
* Date : 11-11-15
* Time : 下午7:45
* 树节点按钮
*
* @author John.Ying
* @since 11.0
* Created on 2023/4/19
*/
public class TreeNodeToogleButtonDefinePane<T extends TreeNodeToggleButton> extends ButtonDetailPane<Button> {
public class TreeNodeToogleButtonDefinePane<T extends TreeNodeToggleButton> extends AbstractExtraButtonPane<Button> {
public TreeNodeToogleButtonDefinePane() {
initComponents();
@ -33,8 +32,9 @@ public class TreeNodeToogleButtonDefinePane<T extends TreeNodeToggleButton> exte
double p = TableLayout.PREFERRED;
double rowSize[] = {p};
double columnSize[] = {p, f};
initExtraPane();
Component[][] n_components = {
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createButtonTypeComboBox()},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Button_Type")), createCustomButtonTypeComboBox()},
};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, IntervalConstants.INTERVAL_L2, 8);
JPanel borderPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -45,6 +45,11 @@ public class TreeNodeToogleButtonDefinePane<T extends TreeNodeToggleButton> exte
}
@Override
protected Component createCenterPane() {
return null;
}
@Override
public TreeNodeToggleButton update() {
return createButton();

Loading…
Cancel
Save