diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 2354007e18..2afcaabe4d 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -115,6 +115,9 @@ public abstract class DesignTableDataManager { //增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener), // 由于dsListeners是arraylist, 此时会ConcurrentModifyException ChangeEvent e = null; + if (dsListeners.get(i) == null) { + continue; + } dsListeners.get(i).stateChanged(e); } } @@ -185,23 +188,33 @@ public abstract class DesignTableDataManager { globalDsListeners.add(l); } +/** + * 添加模板数据集改变 监听事件. + * + * @param l ChangeListener监听器 + */ +public static void addDsChangeListener(ChangeListener l) { + getDsListenersForCurrentTemplate().add(l); +} + +/** + * 移除模板数据集改变 监听事件. + * + * @param l ChangeListener监听器 + */ +public static void removeDsChangeListener(ChangeListener l) { + getDsListenersForCurrentTemplate().remove(l); +} + /** - * 添加模板数据集改变 监听事件. + * 获取当前模板的监听器列表. * - * @param l ChangeListener监听器 + * @return 模板对应的监听器列表,如果列表不存在则新建. */ - public static void addDsChangeListener(ChangeListener l) { + private static List getDsListenersForCurrentTemplate() { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - String key = StringUtils.EMPTY; - if (JTemplate.isValid(template)) { - key = template.getPath(); - } - List dsListeners = dsListenersMap.get(key); - if (dsListeners == null) { - dsListeners = new ArrayList(); - dsListenersMap.put(key, dsListeners); - } - dsListeners.add(l); + String key = JTemplate.isValid(template) ? template.getPath() : StringUtils.EMPTY; + return dsListenersMap.computeIfAbsent(key, k -> new ArrayList<>()); } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java index ebbdbf0f35..d8f8e63fb0 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java @@ -1,13 +1,14 @@ package com.fr.design.data.datapane; +import com.fr.design.ui.util.UIUtil; import java.awt.Component; import java.awt.event.ItemEvent; -import java.util.Iterator; -import java.util.Map.Entry; import javax.swing.DefaultComboBoxModel; import javax.swing.JLabel; import javax.swing.JList; +import javax.swing.event.AncestorEvent; +import javax.swing.event.AncestorListener; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -32,16 +33,53 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC protected java.util.Map resMap; private java.util.Map dsMap; private static final long serialVersionUID = 1L; - private boolean refresModel = false; - private String treeName; //树数据集本身的名字 + private boolean refreshModel = false; + private String treeName = StringUtils.EMPTY; //树数据集本身的名字 private ChangeListener changeListener; + /** + * 兼容插件调用 + * + * @param source 传入的数据源 + */ public TableDataComboBox(TableDataSource source){ - this(source,StringUtils.EMPTY); + this(); } + + /** + * 兼容插件调用 + * + * @param source 传入的数据源 + * @param treeName 树数据集名称 + */ public TableDataComboBox(TableDataSource source, String treeName) { + this(treeName); + } + + /** + * 根据树名称创建TableDataComboBox。 + * + * @param treeName 树数据集名称 + */ + public TableDataComboBox(String treeName) { + this(); + // 传入树数据集名称 + this.treeName = treeName; + } + + /** + * 初始化TableDataComboBox + */ + public TableDataComboBox() { super(); - this.treeName = treeName; + setListCellRenderer(); + addComboBoxListener(); + } + + /** + * 设置渲染器 + */ + private void setListCellRenderer() { this.setRenderer(new UIComboBoxRenderer() { private static final long serialVersionUID = 1L; @@ -60,37 +98,66 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC return renderer; } }); - refresh(source); - registerDSChangeListener(); } - /** - * refresh ComboBox - * @param source - */ + /** + * 在comboBox可见时添加数据集响应事件与refresh操作 + */ + private void addComboBoxListener() { + this.addAncestorListener(new AncestorListener() { + @Override + public void ancestorAdded(AncestorEvent event) { + registerDSChangeListener(); + refresh(DesignTableDataManager.getEditingTableDataSource()); + } + + @Override + public void ancestorRemoved(AncestorEvent event) { + DesignTableDataManager.removeDsChangeListener(changeListener); + } + + @Override + public void ancestorMoved(AncestorEvent event) { + } + }); + } + + /** + * 刷新数据源并更新下拉框的模型和选中项 + * + * @param source 数据源,用于刷新模型 + */ public void refresh(TableDataSource source) { - TableDataWrapper dataWrapper = getSelectedItem(); - refresModel = true; - setResMap(source); - setDsMap(); - DefaultComboBoxModel model = new DefaultComboBoxModel(); - this.setModel(model); - model.addElement(UIConstants.PENDING); - Iterator> entryIt = dsMap.entrySet().iterator(); - while (entryIt.hasNext()) { - TableDataWrapper tableDataWrapper = entryIt.next().getValue(); - if (!ComparatorUtils.equals(tableDataWrapper.getTableDataName(), treeName)) { - model.addElement(tableDataWrapper); - } - } - if (dataWrapper != null) { - if (DesignTableDataManager.isDsNameChanged(dataWrapper.getTableDataName())) { - this.setSelectedTableDataByName(DesignTableDataManager.getChangedDsNameByOldDsName(dataWrapper.getTableDataName())); - } else { - this.getModel().setSelectedItem(dataWrapper); - } - } - refresModel = false; + UIUtil.executeAsyncTaskAndUpdateUI( + () -> { + setResMap(source); + setDsMap(); + return null; + }, + result -> refreshComboBoxModel() + ); + } + + /** + * 刷新下拉框模型,同时保留当前选中的数据项 + *

+ * 1. 获取下拉框中当前选中的数据项 + * 2. 刷新下拉框的模型(清空并重新填充数据),此操作会重置选中的数据项 + * 3. 在刷新模型后,恢复之前选中的数据项 + *

+ * 关于 `refreshModel` 的作用: + * 1. **抑制事件触发**:下拉框模型在调用 `addElement` 方法时会触发 `fireItemStateChanged` 事件, + * 通过标记 `refreshModel`,可以在刷新过程中抑制此事件 + * 2. **处理异步和顺序问题**:由于取数操作是异步的,可能会导致回调后的 UI 操作与其他逻辑(如 `populateBean`)的调用顺序交错。 + * 标记 `refreshModel` 可确保在刷新模型时,不触发选中事件,从而避免逻辑干扰 + * 3. **逻辑清晰性**:刷新模型本质上是更新数据源的操作,不应触发与用户交互相关的选中事件,避免对上层逻辑造成额外负担 + */ + private void refreshComboBoxModel() { + refreshModel = true; + TableDataWrapper selectedItem = getSelectedItem(); + refreshModel(); + updateSelectedItem(selectedItem); + refreshModel = false; } protected void setResMap(TableDataSource source) { @@ -101,6 +168,26 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC dsMap = DesignTableDataManager.getAllDataSetIncludingProcedure(resMap); } + private void refreshModel() { + //创建ComboBox模型并设置 + DefaultComboBoxModel model = new DefaultComboBoxModel(); + this.setModel(model); + model.addElement(UIConstants.PENDING); + // 遍历添加所有数据项到模型,树数据集comboBox下拉模型中排除掉本身 + dsMap.values().stream() + .filter(tableDataWrapper -> tableDataWrapper != null && !ComparatorUtils.equals(tableDataWrapper.getTableDataName(), treeName)) + .forEach(model::addElement); + } + + private void updateSelectedItem(TableDataWrapper dataWrapper) { + if (dataWrapper != null) { + if (DesignTableDataManager.isDsNameChanged(dataWrapper.getTableDataName())) { + this.setSelectedTableData(DesignTableDataManager.getChangedDsNameByOldDsName(dataWrapper.getTableDataName())); + } else { + this.getModel().setSelectedItem(dataWrapper); + } + } + } /** @@ -117,8 +204,14 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC } public void setSelectedTableDataByName(String name) { - TableDataWrapper tableDataWrappe = dsMap.get(name) == null? dsMap.get(name + "_P_CURSOR") : dsMap.get(name); - this.getModel().setSelectedItem(tableDataWrappe); + setResMap(DesignTableDataManager.getEditingTableDataSource()); + setDsMap(); + setSelectedTableData(name); + } + + private void setSelectedTableData(String name) { + TableDataWrapper tableDataWrapper = dsMap.get(name) == null ? dsMap.get(name + "_P_CURSOR") : dsMap.get(name); + this.getModel().setSelectedItem(tableDataWrapper); } @Override @@ -132,7 +225,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC //august:addElement方法竟然会fireItemStateChanged,蛋疼 @Override protected void fireItemStateChanged(ItemEvent e) { - if (!refresModel) { + if (!refreshModel) { super.fireItemStateChanged(e); } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java index 175ddbfda3..fcb8705e9a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TreeTableDataDictPane.java @@ -167,8 +167,7 @@ public class TreeTableDataDictPane extends BasicPane implements Previewable { } protected void setTableDataNameComboBox(String treeName) { - tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource(), treeName); - + tableDataNameComboBox = new TableDataComboBox(treeName); } private void tdChange(boolean isChangeDS) { diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java index 5260ce1752..29d6387f5d 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/ColumnSelectedEditor.java @@ -31,7 +31,7 @@ public class ColumnSelectedEditor extends Editor implements Prep public ColumnSelectedEditor() { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Column")); this.setLayout(FRGUIPaneFactory.createLeftZeroLayout()); - tableDataComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableDataComboBox = new TableDataComboBox(); columnNames = new String[0]; tableDataComboBox.addItemListener(new ItemListener() { diff --git a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java index 5dfedc2662..cb3de24929 100644 --- a/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java +++ b/designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java @@ -397,7 +397,11 @@ public class TemplateTreePane extends JPanel implements FileOperations { if (paths == null) { reportletsTree.refresh(); } else { - for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) { + // 删除一个节点的情况下,默认选中为该节点的上一级节点 + if (paths.length == 1 && paths[0].getParentPath() != null) { + reportletsTree.setSelectionPath(paths[0].getParentPath()); + } + for (TreePath path : Objects.requireNonNull(paths)) { reportletsTree.refreshParent(path); } } diff --git a/designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java b/designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java index 28a2d6c939..60b7c314a8 100644 --- a/designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java +++ b/designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java @@ -6,6 +6,7 @@ import com.fr.chartx.attr.ChartProvider; import com.fr.design.style.color.FRColorSelectorStyle; import com.fr.general.FRFont; import com.fr.report.cell.CellElement; +import com.fr.stable.StringUtils; import com.fr.stable.collections.combination.Pair; import com.fr.stable.fun.mark.Selectable; @@ -83,4 +84,29 @@ public interface DefaultValueAdjustProvider extends Selectable { default List getColorSelector(){ return FRColorSelectorStyle.COLOR_CONFIG; } + + /** + * 移动端弹窗界面是否支持配置POST传参方式 + * + * @return 是否支持 + */ + default boolean isNeedPostCombo4MobilePopupPane() { + return false; + } + + /** + * JsContentPane是否支持内容提示 + * @return 是否支持 + */ + default boolean isNeedContentWarning4JsContentPane() { + return false; + } + + /** + * 自定义匹配js内容,并返回对应的提示文本 + * @return <是否匹配,提示文本> + */ + default Pair checkJsContent(String content) { + return new Pair<>(false, StringUtils.EMPTY); + } } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java index 3ddb144a5f..77a7fb0650 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java @@ -18,17 +18,21 @@ import javax.swing.JPanel; import java.awt.CardLayout; /** - * Created by plough on 2018/8/13. + * 设计器控制部分的更新面板 + * + * @author plough + * @version 11.0 + * @since Created on 2018/8/13 */ -class JControlUpdatePane extends JPanel { +public class JControlUpdatePane extends JPanel { private ListControlPaneProvider listControlPane; private CardLayout card; - private JPanel cardPane; + protected JPanel cardPane; private BasicBeanPane[] updatePanes; private ListModelElement elEditing; - private JControlUpdatePane(ListControlPaneProvider listControlPane) { + protected JControlUpdatePane(ListControlPaneProvider listControlPane) { this.listControlPane = listControlPane; initUpdatePane(); } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java index 7fe1a27efe..0220a18cfc 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/ListControlPaneHelper.java @@ -145,6 +145,9 @@ class ListControlPaneHelper { ((UIControlPane.PopupEditDialog) popupEditDialog).setTitle(getSelectedName()); } popupEditDialog.setVisible(true); + + popupEditDialog.revalidate(); + popupEditDialog.repaint(); PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); osBasedAction.register(controlPane, popupEditDialog); } @@ -184,7 +187,7 @@ class ListControlPaneHelper { /* * UINameEdList的鼠标事件 */ - protected MouseListener getListMouseListener(UINameEdList nameableList, UIControlPane controlPane) { + protected MouseListener getListMouseListener(UINameEdList nameableList, UIControlPane controlPane) { return new MouseAdapter() { @Override public void mouseReleased(MouseEvent evt) { @@ -251,5 +254,4 @@ class ListControlPaneHelper { } - } diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 12f904922d..e41af8404f 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -100,7 +100,7 @@ public abstract class UIControlPane extends JControlPane { this.checkButtonEnabled(); } - protected Window getPopupEditDialog(){ + protected Window getPopupEditDialog() { return this.popupEditDialog; } @@ -241,6 +241,11 @@ public abstract class UIControlPane extends JControlPane { private void hideDialog() { if (needToHidePopupEditDialog()) { + //在Linux上拉回焦点,不然导致一些面板关不掉 + if (OperatingSystem.isLinux()) { + requestFocus(); + } + saveSettings(); setVisible(false); PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); @@ -252,10 +257,6 @@ public abstract class UIControlPane extends JControlPane { addWindowFocusListener(new WindowAdapter() { @Override public void windowLostFocus(WindowEvent e) { - //在Linux上拉回焦点,不然导致一些面板关不掉 - if(OperatingSystem.isLinux()) { - requestFocus(); - } hideDialog(); } }); @@ -263,8 +264,8 @@ public abstract class UIControlPane extends JControlPane { } /** - * 是否需要隐藏popupEditDialog - */ + * 是否需要隐藏popupEditDialog + */ protected boolean needToHidePopupEditDialog() { // 检查是否有子弹窗,如果有,则不隐藏 for (Window window : popupEditDialog.getOwnedWindows()) { diff --git a/designer-base/src/main/java/com/fr/design/hyperlink/popup/ContentSettingPane.java b/designer-base/src/main/java/com/fr/design/hyperlink/popup/ContentSettingPane.java index 848ac9e57c..41fda2cd3b 100644 --- a/designer-base/src/main/java/com/fr/design/hyperlink/popup/ContentSettingPane.java +++ b/designer-base/src/main/java/com/fr/design/hyperlink/popup/ContentSettingPane.java @@ -6,10 +6,12 @@ import com.fr.base.Parameter; import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.formula.TinyFormulaPane; +import com.fr.design.fun.DefaultValueAdjustProvider; import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itree.filetree.ReportletPane; @@ -18,6 +20,7 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.module.DesignModuleFactory; import com.fr.design.parameter.ParameterReader; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.js.MobilePopupHyperlink; import com.fr.stable.CommonUtils; @@ -25,8 +28,14 @@ import com.fr.stable.FormulaProvider; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; @@ -44,6 +53,7 @@ public class ContentSettingPane extends AbstractHyperLinkPane parameterList = this.parameterViewPane.update(); if (!parameterList.isEmpty()) { Parameter[] parameters = new Parameter[parameterList.size()]; diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java index 31c45da762..d752e12254 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java @@ -25,12 +25,19 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.general.IOUtils; import com.fr.js.JavaScriptImpl; +import com.fr.stable.StringUtils; +import com.fr.stable.collections.combination.Pair; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.SwingWorker; +import javax.swing.border.EmptyBorder; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.Cursor; import java.awt.Dimension; import java.awt.FontMetrics; @@ -54,6 +61,13 @@ public class JSContentPane extends BasicPane { private JSImplPopulateAction jsImplPopulateAction; private boolean modal; BasicDialog advancedEditorDialog ; + private JLabel warningLabel; + //用来标记当前显示状态 + private boolean showWarning = false; + private static final Color WARING_LABEL_BACKGROUND = Color.decode("#FFFBE6"); + private static final Color WARING_LABEL_FOREGROUND = new Color(0, 0, 0, 216); + private JPanel endBracketsPanel; + public JSContentPane(){} public JSContentPane(String[] args) { @@ -73,14 +87,91 @@ public class JSContentPane extends BasicPane { UILabel funNameLabel2 = new UILabel(); funNameLabel2.setText("}"); - this.add(funNameLabel2, BorderLayout.SOUTH); + + if (isNeedContentWarning()) { + endBracketsPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + endBracketsPanel.add(funNameLabel2, BorderLayout.NORTH); + warningLabel = initWarningLabel(); + this.add(endBracketsPanel, BorderLayout.SOUTH); + } else { + this.add(funNameLabel2, BorderLayout.SOUTH); + } + } + + protected JLabel initWarningLabel() { + JLabel warningLabel = new JLabel(StringUtils.EMPTY); + warningLabel.setOpaque(true); + warningLabel.setAlignmentX(LEFT_ALIGNMENT); + // 设置左右 5px 的间距 + warningLabel.setBorder(new EmptyBorder(0, 5, 0, 5)); + warningLabel.setPreferredSize(new Dimension(200, 20)); + warningLabel.setBackground(WARING_LABEL_BACKGROUND); + warningLabel.setForeground(WARING_LABEL_FOREGROUND); + + addContentListener4Warning(); + return warningLabel; } + + private void addContentListener4Warning() { + contentTextArea.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(DocumentEvent e) { + checkContent(contentTextArea); + } + + @Override + public void removeUpdate(DocumentEvent e) { + checkContent(contentTextArea); + } + + @Override + public void changedUpdate(DocumentEvent e) { + checkContent(contentTextArea); + } + }); + } + + private void checkContent(RSyntaxTextArea contentTextArea) { + String content = contentTextArea.getText().trim(); + Pair pair = checkContent(content); + boolean matches = Boolean.TRUE.equals(pair.getFirst()); + String tip = pair.getSecond() != null ? pair.getSecond() : StringUtils.EMPTY; + // 更新提示 + updateWarningTip(tip); + + if (matches == showWarning) { + return; + } + if (matches) { + addWarningLabel(); + showWarning = true; + } else { + removeWarningLabel(); + showWarning = false; + } + } + + protected void updateWarningTip(String tip) { + if (!StringUtils.equals(warningLabel.getText(), tip)) { + warningLabel.setText(tip); + } + } + + protected void removeWarningLabel() { + endBracketsPanel.remove(warningLabel); + endBracketsPanel.revalidate(); + } + + protected void addWarningLabel() { + endBracketsPanel.add(warningLabel, BorderLayout.SOUTH); + endBracketsPanel.revalidate(); + } + public JSContentPane(String[] args,boolean modal) { this(args); this.modal = modal; } - public void setJsImplUpdateAction(JSImplUpdateAction jsImplUpdateAction){ this.jsImplUpdateAction = jsImplUpdateAction; } @@ -93,7 +184,6 @@ public class JSContentPane extends BasicPane { this.javaScript = javaScript; } - private void addNewPaneLabel(){ UILabel advancedEditorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Advanced_Editor"), IconUtils.readIcon("com/fr/design/images/edit/advancedEditor.svg"), SwingConstants.LEFT); advancedEditorLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); @@ -328,4 +418,20 @@ public class JSContentPane extends BasicPane { protected boolean needAdvancedEditor() { return true; } + + /** + * 是否支持内容提示 + * @return 是否支持 + */ + protected boolean isNeedContentWarning() { + return false; + } + + /** + * 自定义匹配js内容,并返回对应的提示文本 + * @return <是否匹配,提示文本> + */ + protected Pair checkContent(String content) { + return new Pair<>(false, StringUtils.EMPTY); + } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java index 4116f4f1d0..490ff1899b 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java @@ -32,6 +32,7 @@ import javax.swing.BorderFactory; import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListModel; import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JPopupMenu; @@ -71,7 +72,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; -import java.util.Locale; import java.util.concurrent.ExecutionException; public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener { @@ -95,6 +95,9 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi private JPopupMenu popupMenu; + private JPanel endBracketsPanel; + private JLabel warningLabel; + private InterfaceAndDescriptionPanel interfaceAndDescriptionPanel; private JList helpDOCList; @@ -159,8 +162,13 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi endBracketsLabel.setText("}"); //结尾括号和复用函数按钮面板 - JPanel endBracketsPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); - endBracketsPanel.add(endBracketsLabel, BorderLayout.WEST); + endBracketsPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + if (isNeedContentWarning()) { + warningLabel = initWarningLabel(); + endBracketsPanel.add(endBracketsLabel, BorderLayout.NORTH); + } else { + endBracketsPanel.add(endBracketsLabel, BorderLayout.WEST); + } JPanel northPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); northPanel.add(jsParaAndSearchPane, BorderLayout.NORTH); @@ -178,6 +186,24 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi this.add(functionNameAndDescriptionPanel, BorderLayout.SOUTH); } + protected void updateWarningTip(String tip) { + if (!StringUtils.equals(warningLabel.getText(), tip)) { + warningLabel.setText(tip); + } + } + + @Override + protected void removeWarningLabel() { + endBracketsPanel.remove(warningLabel); + endBracketsPanel.revalidate(); + } + + @Override + protected void addWarningLabel() { + endBracketsPanel.add(warningLabel, BorderLayout.SOUTH); + endBracketsPanel.revalidate(); + } + public void populate(String js) { contentTextArea.setText(js); ifHasBeenWriten = 1; diff --git a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java index 37bca2f6eb..3b57db544e 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java @@ -3,6 +3,7 @@ package com.fr.design.javascript; import com.fr.base.Parameter; import com.fr.design.data.tabledata.tabledatapane.OneListTableModel; import com.fr.design.dialog.FineJOptionPane; +import com.fr.design.fun.DefaultValueAdjustProvider; import com.fr.design.gui.frpane.ReportletParameterViewPane; import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fr.design.gui.itableeditorpane.UITableEditAction; @@ -13,10 +14,12 @@ import com.fr.design.javascript.jsapi.JSImplPopulateAction; import com.fr.design.javascript.jsapi.JSImplUpdateAction; import com.fr.design.mainframe.DesignerContext; import com.fr.design.scrollruler.ModLineBorder; +import com.fr.design.utils.DesignUtils; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.js.JavaScriptImpl; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; +import com.fr.stable.collections.combination.Pair; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -84,7 +87,25 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane { } protected JSContentPane createJSContentPane(String[] defaultArgs){ - JSContentPane jsContentPane= new JSContentPane(defaultArgs,modal); + JSContentPane jsContentPane= new JSContentPane(defaultArgs,modal) { + @Override + protected boolean isNeedContentWarning() { + DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust(); + if (valueAdjust != null) { + return valueAdjust.isNeedContentWarning4JsContentPane(); + } + return super.isNeedContentWarning(); + } + + @Override + protected Pair checkContent(String content) { + DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust(); + if (valueAdjust != null) { + return valueAdjust.checkJsContent(content); + } + return super.checkContent(content); + } + }; jsContentPane.setJsImplUpdateAction(new JSImplUpdateAction() { @Override public void update(JavaScriptImpl javaScript) { diff --git a/designer-base/src/main/java/com/fr/design/javascript/NewJavaScriptImplPane.java b/designer-base/src/main/java/com/fr/design/javascript/NewJavaScriptImplPane.java index 23226c6dde..5a59bf8c78 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/NewJavaScriptImplPane.java +++ b/designer-base/src/main/java/com/fr/design/javascript/NewJavaScriptImplPane.java @@ -1,7 +1,10 @@ package com.fr.design.javascript; +import com.fr.design.fun.DefaultValueAdjustProvider; +import com.fr.design.utils.DesignUtils; import com.fr.js.JavaScriptImpl; +import com.fr.stable.collections.combination.Pair; public class NewJavaScriptImplPane extends JavaScriptImplPane { @@ -10,7 +13,25 @@ public class NewJavaScriptImplPane extends JavaScriptImplPane { } protected JSContentPane createJSContentPane(String[] defaultArgs){ - return new JSContentWithDescriptionPane(defaultArgs); + return new JSContentWithDescriptionPane(defaultArgs) { + @Override + protected boolean isNeedContentWarning() { + DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust(); + if (valueAdjust != null) { + return valueAdjust.isNeedContentWarning4JsContentPane(); + } + return super.isNeedContentWarning(); + } + + @Override + protected Pair checkContent(String content) { + DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust(); + if (valueAdjust != null) { + return valueAdjust.checkJsContent(content); + } + return super.checkContent(content); + } + }; } public void populate(JavaScriptImpl javaScript) { diff --git a/designer-base/src/main/java/com/fr/design/jxbrowser/JxEngine.java b/designer-base/src/main/java/com/fr/design/jxbrowser/JxEngine.java index bb2c1f7375..7738082a4c 100644 --- a/designer-base/src/main/java/com/fr/design/jxbrowser/JxEngine.java +++ b/designer-base/src/main/java/com/fr/design/jxbrowser/JxEngine.java @@ -3,8 +3,10 @@ package com.fr.design.jxbrowser; import com.fr.design.DesignerEnvManager; import com.fr.design.ui.ModernUIConstants; import com.fr.log.FineLoggerFactory; +import com.fr.stable.CommonUtils; import com.fr.value.ClearableLazyValue; import com.fr.web.struct.AssembleComponent; +import com.teamdev.jxbrowser.engine.ChromiumBinariesExtractionException; import com.teamdev.jxbrowser.engine.Engine; import com.teamdev.jxbrowser.engine.EngineOptions; import com.teamdev.jxbrowser.engine.RenderingMode; @@ -12,8 +14,11 @@ import com.teamdev.jxbrowser.engine.event.EngineCrashed; import com.teamdev.jxbrowser.net.Network; import com.teamdev.jxbrowser.net.Scheme; import com.teamdev.jxbrowser.net.callback.VerifyCertificateCallback; +import com.teamdev.jxbrowser.os.Environment; import org.jetbrains.annotations.NotNull; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Collections; import java.util.Map; @@ -41,7 +46,18 @@ public class JxEngine { .addSwitch("--disable-google-traffic") .addScheme(Scheme.of(ModernUIConstants.EMB_TAG), new NxInterceptRequestCallback(this::getComponent, this::getParameterMap)); - Engine engine = Engine.newInstance(builder.build()); + Engine engine; + try { + engine = Engine.newInstance(builder.build()); + } catch (ChromiumBinariesExtractionException e) { + Path chromiumDir = Paths.get(System.getProperty("jxbrowser.chromium.dir", Environment.defaultChromiumDir().toString())); + if (CommonUtils.deleteFile(chromiumDir.toFile())) { + FineLoggerFactory.getLogger().warn("[jxbrowser]Retry start engine success after delete chromium dir manually: {}", chromiumDir); + engine = Engine.newInstance(builder.build()); + } else { + throw e; + } + } engine.on(EngineCrashed.class, (event) -> { FineLoggerFactory.getLogger().error("jxBrowser engine crashed with exitCode: {}", event.exitCode()); event.engine().close(); diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java index afb14633b5..fc04862b38 100644 --- a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java @@ -172,6 +172,7 @@ public enum SupportLocaleImpl implements SupportLocale { set.add(Locale.TAIWAN); set.add(LocaleConstants.IN_ID); set.add(LocaleConstants.VI); + set.add(LocaleConstants.MS_MY); return set; } } diff --git a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java index 5ebd426593..f068f71216 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java @@ -83,7 +83,7 @@ public class TableDataDictPane extends FurtherBasicBeanPane } private void initBasicComponets() { - tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableDataNameComboBox = new TableDataComboBox(); tableDataNameComboBox.addItemListener(e -> { if (e.getStateChange() == ItemEvent.SELECTED) { tdChange(e); diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index b5f8976abf..d7246c7552 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -225,7 +225,9 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { if (standardColors == null || standardColors.size() < 8) { return; } - for (int i = 0; i < standardColors.size(); i++) { + // range取最小值,避免数据越界 + int range = Math.min(standardColors.size(), this.themeColorCellGrid.length); + for (int i = 0; i < range; i++) { Color standardColor = standardColors.get(i); ColorConfig colorConfig = getColorConfig(colorSelector, i); Color[] deriveColorArr = colorConfig.getDeriveColorArr(standardColor, DEFAULT_DERIVE_COUNT); diff --git a/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java b/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java index 86093a6d82..8565e90f31 100644 --- a/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java +++ b/designer-base/src/main/java/com/fr/design/ui/util/UIUtil.java @@ -3,9 +3,12 @@ package com.fr.design.ui.util; import com.fr.log.FineLoggerFactory; import com.fr.third.guava.base.Stopwatch; import com.fr.third.guava.base.Supplier; +import java.util.concurrent.ExecutionException; +import java.util.function.Consumer; +import javax.swing.SwingWorker; +import javax.swing.SwingUtilities; import org.jetbrains.annotations.NotNull; -import javax.swing.SwingUtilities; import java.util.concurrent.TimeUnit; /** @@ -81,4 +84,53 @@ public class UIUtil { } return result; } + + /** + * 执行异步任务并在任务完成后更新UI。 + *

+ * 该方法将执行一个耗时的后台任务,并在任务完成后将结果传递给一个回调函数来更新UI。 + * 使用 SwingWorker 来处理后台任务,确保在任务完成后回到 EDT(事件分发线程) 更新 UI。 + * 提供了一个可选的 `finallyBlock` 参数,用于执行清理操作,例如释放资源或重置状态。 + * + * @param 任务结果的类型 + * @param task 需要在后台执行的任务。该任务的执行过程由 Supplier 提供,返回任务的结果。 + * @param uiUpdater 在任务完成后执行的回调函数,用来处理结果并更新UI。 + * @param finallyBlock 可选的清理操作,在任务结束后无论是否发生异常都会执行。可以传入 null 表示不需要清理操作。常见场景包括状态标志的重置或资源释放。 + * + */ + public static void executeAsyncTaskAndUpdateUI(Supplier task, Consumer uiUpdater, Runnable finallyBlock) { + new SwingWorker() { + @Override + protected T doInBackground() throws Exception { + return task.get(); + } + @Override + protected void done() { + try { + T result = get(); + uiUpdater.accept(result); + } catch (InterruptedException | ExecutionException e) { + FineLoggerFactory.getLogger().debug(e.getMessage(), e); + } finally { + if (finallyBlock != null) { + finallyBlock.run(); + } + } + } + }.execute(); + } + + /** + * 执行异步任务并在任务完成后更新UI。 + *

+ * 该方法将执行一个耗时的后台任务,并在任务完成后将结果传递给一个回调函数来更新UI。 + * 使用 SwingWorker 来处理后台任务,确保在任务完成后回到 EDT(事件分发线程) 更新 UI。 + * + * @param 任务结果的类型 + * @param task 需要在后台执行的任务。该任务的执行过程由 Supplier 提供,返回任务的结果。 + * @param uiUpdater 在任务完成后执行的回调函数,用来处理结果并更新UI。 + */ + public static void executeAsyncTaskAndUpdateUI(Supplier task, Consumer uiUpdater) { + executeAsyncTaskAndUpdateUI(task, uiUpdater, null); + } } diff --git a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java index ec36032713..fcf2a75b40 100644 --- a/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java +++ b/designer-base/src/main/java/com/fr/widgettheme/theme/panel/ControlPreviewCell.java @@ -101,7 +101,12 @@ public class ControlPreviewCell extends JPanel { if (this.reportTheme != null) { if (icon instanceof ImageIcon) { ImageIcon imageIcon = (ImageIcon) icon; - BufferedImage bufferedImage = ImageUtils.colorImage(ImageUtils.imageIconToBufferedImage(imageIcon), getIconColor()); + BufferedImage bufferedImage = ImageUtils.imageIconToBufferedImage(imageIcon); + Color iconColor = getIconColor(); + // 设置为透明色时color是null + if (iconColor != null) { + ImageUtils.colorImage(bufferedImage, iconColor); + } return new ImageIcon(bufferedImage); } } diff --git a/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java b/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java index 5ae51d380f..8bf00f8387 100644 --- a/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java +++ b/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java @@ -6,6 +6,7 @@ import com.fr.general.GeneralContext; import com.fr.stable.ProductConstants; import junit.framework.TestCase; import org.easymock.EasyMock; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; import org.powermock.core.classloader.annotations.PowerMockIgnore; @@ -18,6 +19,7 @@ import java.util.UUID; @RunWith(PowerMockRunner.class) @PowerMockIgnore({"javax.management.*","javax.net.ssl.*"}) @PrepareForTest({Toolkit.class, SystemScaleUtils.class}) +@Ignore("涉及到UI") public class TutorialActionTest extends TestCase { public void setUp() { diff --git a/designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java b/designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java index 48b11be333..53e304e547 100644 --- a/designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java +++ b/designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java @@ -3,6 +3,7 @@ package com.fr.design.data.datapane; import com.fr.design.i18n.Toolkit; import org.easymock.EasyMock; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; @@ -12,7 +13,7 @@ import org.powermock.modules.junit4.PowerMockRunner; import java.util.Map; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; /** * @author Yyming @@ -31,6 +32,7 @@ public class TableDataPaneListPaneTest { PowerMock.replayAll(); } + @Ignore("涉及到UI") @Test public void rename() { TableDataPaneListPane listPane = new TableDataPaneListPane(); diff --git a/designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java b/designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java index e549f13461..49086f200a 100644 --- a/designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java +++ b/designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java @@ -5,6 +5,7 @@ import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fr.invoke.Reflect; import junit.framework.TestCase; import org.junit.Assert; +import org.junit.Ignore; /** * @author Yuan.Wang @@ -13,6 +14,7 @@ import org.junit.Assert; */ public class DBTableDataPaneTest extends TestCase { + @Ignore("涉及到UI") public void testGetParameters() { DBTableDataPane pane = new DBTableDataPane(); SQLEditPane editPane = new SQLEditPane(); diff --git a/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java b/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java index a35055c2fd..b20007a5d7 100644 --- a/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java +++ b/designer-base/src/test/java/com/fr/design/gui/icombocheckbox/UICheckListPopupTest.java @@ -4,6 +4,7 @@ import com.fr.design.i18n.Toolkit; import junit.framework.TestCase; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -33,6 +34,7 @@ public class UICheckListPopupTest extends TestCase { PowerMockito.when(Toolkit.i18nText(Mockito.anyString())).thenReturn("test"); } + @Ignore("涉及到UI") @Test public void testGetSelectedValues() { Object[] values = new Object[]{"a", "b", "c"}; diff --git a/designer-base/src/test/java/com/fr/design/javascript/jsapi/JSAPITreeHelperTest.java b/designer-base/src/test/java/com/fr/design/javascript/jsapi/JSAPITreeHelperTest.java index e0d5ae7c9e..096c416128 100644 --- a/designer-base/src/test/java/com/fr/design/javascript/jsapi/JSAPITreeHelperTest.java +++ b/designer-base/src/test/java/com/fr/design/javascript/jsapi/JSAPITreeHelperTest.java @@ -13,7 +13,7 @@ public class JSAPITreeHelperTest extends TestCase { assertTrue(names.contains( "getToolbar")); assertTrue(names.contains( "changeFormat")); List allNames = JSAPITreeHelper.getAllNames(); - assertEquals(allNames.size(),16); + assertEquals(allNames.size(),104); } public void testGetDirectCategory(){ @@ -26,6 +26,6 @@ public class JSAPITreeHelperTest extends TestCase { public void testCreateJSAPITree(){ DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); JSAPITreeHelper.createJSAPITree(rootNode); - assertEquals(2,rootNode.getChildCount()); + assertEquals(3,rootNode.getChildCount()); } } diff --git a/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java b/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java index a198dace8f..f072d8169a 100644 --- a/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java +++ b/designer-base/src/test/java/com/fr/design/mainfarme/toolbar/ToolBarMenuDockTest.java @@ -1,8 +1,5 @@ package com.fr.design.mainfarme.toolbar; -import java.util.HashMap; -import java.util.Locale; - import com.fr.base.svg.SystemScaleUtils; import com.fr.design.DesignerEnvManager; import com.fr.design.actions.community.TechSupportAction; @@ -26,6 +23,7 @@ import com.fr.workspace.Workspace; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; @@ -34,6 +32,9 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.reflect.Whitebox; +import java.util.HashMap; +import java.util.Locale; + /** * @author Lucian.Chen @@ -51,6 +52,7 @@ import org.powermock.reflect.Whitebox; SystemScaleUtils.class, AlphaFineConfigManager.class}) @PowerMockIgnore({"javax.management.*"}) +@Ignore("涉及到UI") public class ToolBarMenuDockTest { @Before diff --git a/designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java b/designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java index 5853b10094..aa63028d6c 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/JFormSliderPaneTest.java @@ -1,11 +1,11 @@ package com.fr.design.mainframe; -import com.fr.base.ScreenResolution; import com.fr.design.i18n.Toolkit; import com.fr.invoke.Reflect; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; @@ -28,6 +28,7 @@ public class JFormSliderPaneTest { PowerMock.replayAll(); } + @Ignore("涉及到UI") @Test public void testGetPreferredValue() { JFormSliderPane sliderPane = new JFormSliderPane(); @@ -39,6 +40,7 @@ public class JFormSliderPaneTest { Assert.assertEquals(400, result); } + @Ignore("涉及到UI") @Test public void testCalSliderValue() { JFormSliderPane sliderPane = new JFormSliderPane(); diff --git a/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java b/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java index 0202028480..2b7b5cbfe3 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/JTemplateNameHelperTest.java @@ -1,8 +1,7 @@ package com.fr.design.mainframe; -import junit.framework.TestCase; - import com.fr.invoke.Reflect; +import junit.framework.TestCase; /** * @author shine @@ -11,17 +10,6 @@ import com.fr.invoke.Reflect; */ public class JTemplateNameHelperTest extends TestCase { - public void testNewTemplateNameByIndex() { - - String name = JTemplateNameHelper.newTemplateNameByIndex("TEST"); - - assertEquals("TEST1", name); - - String name1 = JTemplateNameHelper.newTemplateNameByIndex("TEST"); - - assertEquals("TEST2", name1); - } - public void testGetFileNameIndex() { //正常情况 assertEquals("1", Reflect.on(JTemplateNameHelper.class).call("getFileNameIndex", "WorkBook", "WorkBook1").toString()); diff --git a/designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java b/designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java index 857a367d21..40e4d9b8db 100644 --- a/designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java +++ b/designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java @@ -1,17 +1,25 @@ package com.fr.design.mainframe.mobile.ui; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.cardtag.mobile.UniteStyle; import com.fr.invoke.Reflect; import junit.framework.TestCase; +import org.easymock.EasyMock; import org.junit.Test; -import java.awt.*; +import java.awt.Color; public class UniteStyleDefinePaneTest extends TestCase { @Test public void testDefaultConfig() { + DesignerFrame mockFrame = EasyMock.mock(DesignerFrame.class); + DesignerContext.setDesignerFrame(mockFrame); + EasyMock.expect(mockFrame.isServerConfig()).andReturn(false).anyTimes(); + EasyMock.replay(mockFrame); + UniteStyleDefinePane definePane = new UniteStyleDefinePane(new WCardTagLayout()); Reflect.on(definePane).call("initDefaultConfig"); diff --git a/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java b/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java index dcb21f7999..a76fa93270 100644 --- a/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java +++ b/designer-base/src/test/java/com/fr/design/utils/gui/UIComponentUtilsTest.java @@ -8,6 +8,7 @@ import com.fr.general.GeneralContext; import com.fr.stable.StringUtils; import org.easymock.EasyMock; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; @@ -16,12 +17,12 @@ import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import javax.swing.Icon; - import java.awt.Component; import java.awt.Graphics; import java.util.Locale; -import static org.junit.Assert.*; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * Created by plough on 2019/1/11. @@ -29,6 +30,7 @@ import static org.junit.Assert.*; @RunWith(PowerMockRunner.class) @PrepareForTest({Toolkit.class}) @PowerMockIgnore("javax.swing.*") +@Ignore("涉及到UI") public class UIComponentUtilsTest { private static final String HTML_TAG_TPL = ""; private static final String HTML_TAG = ""; diff --git a/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java b/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java index 8db47b9c44..12e0639821 100644 --- a/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java +++ b/designer-base/src/test/java/com/fr/file/FILEChooserPaneTest.java @@ -7,6 +7,7 @@ import com.fr.invoke.Reflect; import com.fr.stable.StringUtils; import org.easymock.EasyMock; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.powermock.api.easymock.PowerMock; @@ -21,6 +22,7 @@ import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) @PowerMockIgnore({"javax.management.*", "javax.swing.*"}) @PrepareForTest({Toolkit.class, FileNodeFILE.class}) +@Ignore("涉及到UI") public class FILEChooserPaneTest { @Test public void testAddChooseFileFilter() { diff --git a/designer-base/src/test/resources/com/fr/design/javascript/jsapi/category.json b/designer-base/src/test/resources/com/fr/design/javascript/jsapi/category.json index 2d0e50ba02..ece3628ab5 100644 --- a/designer-base/src/test/resources/com/fr/design/javascript/jsapi/category.json +++ b/designer-base/src/test/resources/com/fr/design/javascript/jsapi/category.json @@ -2,16 +2,45 @@ "Fine-Design_JSAPI_Public_Module": { "Fine-Design_JSAPI_Public_Module_Global": { "Fine-Design_JSAPI_Public_Module_Global_Universal": {}, + "Fine-Design_JSAPI_Public_Module_Global_FR": {}, + "Fine-Design_JSAPI_Public_Module_Global_FS": {}, "Fine-Design_JSAPI_Public_Module_Global_Mobile": {} }, "Fine-Design_JSAPI_Public_Module_Widget": { - "Fine-Design_JSAPI_Public_Module_Date_Widget_Peculiar": {} + "Fine-Design_JSAPI_Public_Module_Widget_Get": {}, + "Fine-Design_JSAPI_Public_Module_Widget_Universal": {}, + "Fine-Design_JSAPI_Public_Module_Date_Widget_Peculiar": {}, + "Fine-Design_JSAPI_Public_Module_Button_Widget_Peculiar": {}, + "Fine-Design_JSAPI_Public_Module_Combobox_Widget_Peculiar": {} + }, + "Fine-Design_JSAPI_Public_Module_Table": { + "Fine-Design_JSAPI_Public_Module_Table_Marquee": {}, + "Fine-Design_JSAPI_Public_Module_Table_Scrollbar": {}, + "Fine-Design_JSAPI_Public_Module_Table_Cell_Style": {}, + "Fine-Design_JSAPI_Public_Module_Table_Row_Height_Col_Width": {}, + "Fine-Design_JSAPI_Public_Module_Table_Cell_Value": {}, + "Fine-Design_JSAPI_Public_Module_Table_Cell_Radius": {} }, "Fine-Design_JSAPI_Public_Module_Toolbar": { "Fine-Design_JSAPI_Public_Module_Toolbar_Email_Button": {} + }, + "Fine-Design_JSAPI_Public_Module_Report_Page": { + "Fine-Design_JSAPI_Public_Module_Report_Page_Jump": {}, + "Fine-Design_JSAPI_Public_Module_Report_Page_Number_Get": {} + }, + "Fine-Design_JSAPI_Public_Module_Report_Export": {} + }, + "Fine-Design_JSAPI_Cpt": { + "Fine-Design_JSAPI_Cpt_Page_Preview": { + "Fine-Design_JSAPI_Cpt_Page_Preview_Folding_Tree": {} + }, + "Fine-Design_JSAPI_Cpt_Write_Preview": {}, + "Fine-Design_JSAPI_Cpt_View_Preview": { + "Fine-Design_JSAPI_Cpt_View_Preview_Report_Location": {} } }, "Fine-Design_JSAPI_Form": { + "Fine-Design_JSAPI_Form_Component_Get": {}, "Fine-Design_JSAPI_Form_Component_Tab": {} } } \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/javascript/jsapi/jsapi.json b/designer-base/src/test/resources/com/fr/design/javascript/jsapi/jsapi.json index 4ff0a321ed..dcad373927 100644 --- a/designer-base/src/test/resources/com/fr/design/javascript/jsapi/jsapi.json +++ b/designer-base/src/test/resources/com/fr/design/javascript/jsapi/jsapi.json @@ -1,8 +1,33 @@ { "Fine-Design_JSAPI_Public_Module_Global_Universal": ["_g()", "getParameterContainer", "parameterCommit", "loadContentPane", "getPreviewType"], + "Fine-Design_JSAPI_Public_Module_Global_FR": [ "servletURL", "serverURL", "server", "fineServletURL", "SessionMgr.getSessionID", "showDialog", "closeDialog", + "doHyperlinkByGet", "doHyperlinkByPost", "doURLPrint", "Msg", "remoteEvaluate", "jsonEncode", "jsonDecode", + "ajax", "isEmpty", "isArray", "cellStr2ColumnRow", "columnRow2CellStr"], + "Fine-Design_JSAPI_Public_Module_Global_FS": ["signOut", "tabPane.closeActiveTab", "tabPane.addItem"], "Fine-Design_JSAPI_Public_Module_Global_Mobile": ["location", "Mobile.getDeviceInfo"], + "Fine-Design_JSAPI_Public_Module_Widget_Get": ["this", "this.options.form", "getWidgetByName"], + "Fine-Design_JSAPI_Public_Module_Widget_Universal": ["getValue", "getText", "setValue", "visible", "invisible", "setVisible", "isVisible", "setEnable", "isEnabled", + "reset", "getType", "setWaterMark", "fireEvent", "setPopupStyle"], "Fine-Design_JSAPI_Public_Module_Date_Widget_Peculiar":["setMaxAndMinDate"], + "Fine-Design_JSAPI_Public_Module_Button_Widget_Peculiar":["doClick"], + "Fine-Design_JSAPI_Public_Module_Combobox_Widget_Peculiar":["setName4Empty"], + "Fine-Design_JSAPI_Public_Module_Table_Marquee":["startMarquee", "stopMarquee"], + "Fine-Design_JSAPI_Public_Module_Table_Scrollbar":["setHScrollBarVisible", "setVScrollBarVisible"], + "Fine-Design_JSAPI_Public_Module_Table_Cell_Style":["addEffect"], + "Fine-Design_JSAPI_Public_Module_Table_Row_Height_Col_Width":["setRowHeight", "setColWidth"], + "Fine-Design_JSAPI_Public_Module_Table_Cell_Value":["getCellValue", "setCellValue"], + "Fine-Design_JSAPI_Public_Module_Table_Cell_Radius":["setCellRadius"], "Fine-Design_JSAPI_Public_Module_Toolbar":["toolBarFloat", "setStyle","getToolbar"], "Fine-Design_JSAPI_Public_Module_Toolbar_Email_Button":["changeFormat"], - "Fine-Design_JSAPI_Form_Component_Tab":["showCardByIndex", "showCardByIndex", "getShowIndex", "setTitleVisible"] + "Fine-Design_JSAPI_Public_Module_Report_Page_Jump":["gotoPreviousPage", "gotoNextPage", "gotoLastPage", "gotoFirstPage", "gotoPage"], + "Fine-Design_JSAPI_Public_Module_Report_Page_Number_Get":["getCurrentPageIndex", "getReportTotalPage", "currentPageIndex", "reportTotalPage"], + "Fine-Design_JSAPI_Public_Module_Report_Export":["exportReportToExcel", "exportReportToImage", "exportReportToPDF", "exportReportToWord"], + "Fine-Design_JSAPI_Cpt_Page_Preview_Folding_Tree":["expandNodeLayer", "collapseNodeLayer", "expandAllNodeLayer", "collapseAllNodeLayer"], + "Fine-Design_JSAPI_Cpt_Write_Preview":["getWidgetByCell", "appendReportRC", "appendReportRow", + "deleteReportRC", "deleteRows", "refreshAllSheets", "loadSheetByIndex", "loadSheetByName", "isDirtyPage", + "isAutoStash", "writeReport", "verifyAndWriteReport", "verifyReport", "importExcel", "importExcel_Clean", + "importExcel_Append", "importExcel_Cover", "stash", "clear"], + "Fine-Design_JSAPI_Cpt_View_Preview_Report_Location":["centerReport"], + "Fine-Design_JSAPI_Form_Component_Get":["getAllWidgets"], + "Fine-Design_JSAPI_Form_Component_Tab":["showCardByIndex", "getShowIndex", "setTitleVisible"] } \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java index 589028ae52..4aaf6a0281 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/AutoChartTypePane.java @@ -141,7 +141,7 @@ public class AutoChartTypePane extends ChartWizardPane implements CallbackEvent } private void initDataFiledBox() { - tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableNameComboBox = new TableDataComboBox(); tableNameComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { diff --git a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java index 58068d10a8..ba25b5b81c 100644 --- a/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java +++ b/designer-chart/src/main/java/com/fr/design/chartx/component/MapAreaMatchPane.java @@ -128,7 +128,7 @@ public class MapAreaMatchPane extends BasicBeanPane { } private void initButtonGroup() { - tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableNameCombox = new TableDataComboBox(); tableNameCombox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java index 297245960d..fe46528ca5 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java @@ -9,18 +9,17 @@ import com.fr.base.chart.BaseChartCollection; import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chartx.attr.ChartProvider; -import com.fr.decision.webservice.v10.map.geojson.helper.GEOJSONHelper; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.designer.TargetComponent; import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.mainframe.chart.ChartEditPane; +import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.BorderFactory; import javax.swing.Icon; -import javax.swing.SwingWorker; import java.awt.BorderLayout; import java.awt.Component; @@ -116,7 +115,7 @@ public class ChartPropertyPane extends BaseChartPropertyPane { */ public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent ePane) { if (collection instanceof ChartCollection) { - populateChartPropertyPane((ChartCollection) collection, ePane); + UIUtil.invokeAndWaitIfNeeded(() -> populateChartPropertyPane((ChartCollection) collection, ePane)); } } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java index 40983c56b5..3fbf1aa5a4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/DatabaseTableDataPane.java @@ -82,7 +82,7 @@ public class DatabaseTableDataPane extends BasicPane{ } private void initTableCombox() { - tableNameCombox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()){ + tableNameCombox = new TableDataComboBox(){ //图表的数据集选择下拉框,不需要注册监听,chartEditPane已经注册了。 public void registerDSChangeListener() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index 314851b0e9..ec0de92fc2 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -876,7 +876,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { int designerTop = top + (horScrollBar.getY() - DESIGNERHEIGHT) / 2; if (fvsGuidePane != null) { Dimension fvsGuidePreferredSize = fvsGuidePane.getPreferredSize(); - fvsGuidePane.setBounds(left, top, right - BARSIZE - 2, fvsGuidePreferredSize.height); + fvsGuidePane.setBounds(left, top, DESIGNERWIDTH, fvsGuidePreferredSize.height); DESIGNERHEIGHT -= fvsGuidePreferredSize.height; designerTop += fvsGuidePreferredSize.height; } diff --git a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java index 052fba9046..421bfdb766 100644 --- a/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer-realize/src/main/java/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -21,6 +21,7 @@ import com.fr.design.mainframe.ElementCasePane; import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.data.TableDataColumn; +import com.fr.log.FineLoggerFactory; import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.core.group.DSColumn; @@ -330,7 +331,7 @@ public class SelectedDataColumnPane extends BasicPane { protected void initTableNameComboBox() { - tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + tableNameComboBox = new TableDataComboBox(); tableNameComboBox.setPreferredSize(new Dimension(100, 20)); } @@ -373,13 +374,33 @@ public class SelectedDataColumnPane extends BasicPane { update(SelectedDataColumnPane.this.cellElement); casePane.fireTargetModified(); } + @Override + public void doCancel() { + editorPane.stopEditing(); + } }); - editorPane.populate(ps == null ? new Parameter[0] : ps); + editorPane.populate(ps == null ? new Parameter[0] : cloneParameterList(ps)); paramDialog.setVisible(true); } }); } + private Parameter[] cloneParameterList(Parameter[] parameters) { + if (parameters == null) { + return null; + } + try { + Parameter[] cloneParameterList = new Parameter[parameters.length]; + for (int i = 0; i < parameters.length; i++) { + cloneParameterList[i] = (Parameter) parameters[i].clone(); + } + return cloneParameterList; + } catch (CloneNotSupportedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + private boolean isColumnName(String columnExp) { return StringUtils.isNotBlank(columnExp) && (columnExp.length() > 0 && columnExp.charAt(0) == '#') && !columnExp.endsWith("#"); @@ -397,8 +418,7 @@ public class SelectedDataColumnPane extends BasicPane { public Dimension getPreferredSize() { if (this.isVisible()) { return super.getPreferredSize(); - } - else { + } else { return new Dimension(); } } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java index 817a47cca4..c240b1227f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/helper/FineMarketClientHelper.java @@ -55,6 +55,8 @@ public class FineMarketClientHelper { public static final String TEMPLATES_PARENT_PACKAGE = "parent/"; public static final String TEMPLATES_TAGS = "filter"; public static final String NAME_SEARCH = "?searchKeyword="; + public static final String CID_SEARCH = "&cid="; + public static final String FR_CID_TYPE = "template_type-1,template_type-2,template_type-3"; public static final String RESPONSE_STATE = "state"; public static final String RESPONSE_SUCCESS = "ok"; @@ -273,7 +275,7 @@ public class FineMarketClientHelper { * 通过名字搜索模板信息 */ public @Nullable JSONArray getTemplateInfoByName(String name) throws IOException { - String url = FINE_MARKET_TEMPLATE_INFO + NAME_SEARCH + ClientHelper.urlEncode(name, EncodeConstants.ENCODING_UTF_8); + String url = FINE_MARKET_TEMPLATE_INFO + NAME_SEARCH + ClientHelper.urlEncode(name, EncodeConstants.ENCODING_UTF_8) + CID_SEARCH + FR_CID_TYPE; String jsonString = HttpToolbox.get(url); JSONObject jsonObject = new JSONObject(jsonString); String responseState = (String) jsonObject.get(RESPONSE_STATE); diff --git a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java index a74cf2d7af..9fa6ba170f 100644 --- a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java @@ -22,6 +22,7 @@ import com.fr.report.core.SheetUtils; import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.Nameable; +import javax.swing.JPanel; import java.util.ArrayList; import java.util.List; @@ -76,6 +77,11 @@ public class ConditionAttributesGroupPane extends UIListControlPane { return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Add_Condition"); } + @Override + protected JPanel createControlUpdatePane() { + return ConditionAttributesUpdatePane.newInstance(this); + } + public void populate(ElementCasePane ePane) { this.ePane = ePane; this.editSelection = ePane.getSelection(); diff --git a/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesUpdatePane.java b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesUpdatePane.java new file mode 100644 index 0000000000..5560633b86 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/present/ConditionAttributesUpdatePane.java @@ -0,0 +1,36 @@ +package com.fr.design.present; + +import com.fr.design.gui.controlpane.JControlUpdatePane; +import com.fr.design.gui.controlpane.ListControlPaneProvider; + + +/** + * 条件属性更新面板 + * + * @author lidongy + * @version 11.0 + * @since Created on 2025/1/23 + */ +public class ConditionAttributesUpdatePane extends JControlUpdatePane { + + protected ConditionAttributesUpdatePane(ListControlPaneProvider listControlPane) { + super(listControlPane); + } + + /** + * 新建一个实例 + * @param listControlPane 父面板 + * @return 新面板实例 + */ + public static JControlUpdatePane newInstance(ListControlPaneProvider listControlPane) { + return new ConditionAttributesUpdatePane(listControlPane); + } + + @Override + public void populate() { + super.populate(); + + cardPane.revalidate(); + cardPane.repaint(); + } +} diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/JFileTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/JFileTest.java similarity index 95% rename from designer-realize/src/test/java/com.fr/design/mainframe/JFileTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/JFileTest.java index 1651043f74..a1da5a0d24 100644 --- a/designer-realize/src/test/java/com.fr/design/mainframe/JFileTest.java +++ b/designer-realize/src/test/java/com/fr/design/mainframe/JFileTest.java @@ -12,7 +12,6 @@ import com.fr.config.dao.impl.LocalXmlEntityDao; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.form.main.Form; import com.fr.form.ui.ElementCaseEditor; -import com.fr.form.ui.container.OccupiedLayout; import com.fr.form.ui.container.WFitLayout; import com.fr.general.ImageWithSuffix; import com.fr.general.ModuleContext; @@ -25,17 +24,13 @@ import com.fr.report.restriction.ReportRestrictionScene; import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.WorkSheet; import com.fr.restriction.Restrictions; -import com.fr.stable.StringUtils; import com.fr.stable.module.Module; import com.fr.start.MainDesigner; import com.fr.third.guava.collect.Lists; -import com.fr.transaction.WorkerCallBack; import junit.framework.TestCase; -import org.easymock.EasyMock; import org.junit.Assert; +import org.junit.Ignore; import org.junit.runner.RunWith; -import org.mockito.Mockito; -import org.powermock.api.easymock.PowerMock; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.modules.junit4.PowerMockRunner; @@ -57,6 +52,7 @@ public class JFileTest extends TestCase { MainDesigner designer = new MainDesigner(new String[0]); } + @Ignore("涉及到UI") public void testJWorkBookSetPicture() { WorkBook workBook = new WorkBook(); WorkSheet workSheet = new WorkSheet(); @@ -72,6 +68,7 @@ public class JFileTest extends TestCase { Assert.assertEquals(imageWithSuffix, cellElement.getValue()); } + @Ignore("涉及到UI") public void testJFormSetPicture() { Form form = new Form(); ElementCaseEditor editor = new ElementCaseEditor(); diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/AlphaFineHelperTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/AlphaFineHelperTest.java similarity index 100% rename from designer-realize/src/test/java/com.fr/design/mainframe/alphafine/AlphaFineHelperTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/alphafine/AlphaFineHelperTest.java diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/model/ModelTest.java similarity index 98% rename from designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/model/ModelTest.java index 26cfc71684..3f9d43d418 100644 --- a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/cell/model/ModelTest.java +++ b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/cell/model/ModelTest.java @@ -7,6 +7,7 @@ import com.fr.json.JSONException; import com.fr.json.JSONObject; import org.junit.Assert; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; @@ -26,6 +27,7 @@ public class ModelTest { PowerMockito.when(Toolkit.i18nText(Mockito.anyString())).thenReturn("test"); } + @Ignore("涉及到UI") @Test public void documentModelTest() { DocumentModel documentModel = new DocumentModel("name", "content", 1); @@ -48,6 +50,7 @@ public class ModelTest { Assert.assertNotNull(documentModel.modelToJson()); } + @Ignore("涉及到UI") @Test public void bottomModelTest() { BottomModel bottomModel = new BottomModel(); diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/FileSearchManagerTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManagerTest.java similarity index 100% rename from designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/FileSearchManagerTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManagerTest.java diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java similarity index 100% rename from designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManagerTest.java diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/impl/SearchManegerTest.java similarity index 100% rename from designer-realize/src/test/java/com.fr/design/mainframe/alphafine/search/manager/impl/SearchManegerTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/impl/SearchManegerTest.java diff --git a/designer-realize/src/test/java/com.fr/design/mainframe/template/info/JWorkBookProcessInfoTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/info/JWorkBookProcessInfoTest.java similarity index 100% rename from designer-realize/src/test/java/com.fr/design/mainframe/template/info/JWorkBookProcessInfoTest.java rename to designer-realize/src/test/java/com/fr/design/mainframe/info/JWorkBookProcessInfoTest.java diff --git a/designer-realize/src/test/java/com/fr/design/mainframe/socketio/DesignerSocketIOTest.java b/designer-realize/src/test/java/com/fr/design/mainframe/socketio/DesignerSocketIOTest.java deleted file mode 100644 index b775f56e9d..0000000000 --- a/designer-realize/src/test/java/com/fr/design/mainframe/socketio/DesignerSocketIOTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.fr.design.mainframe.socketio; - -import com.fr.invoke.Reflect; -import com.fr.workspace.WorkContext; -import com.fr.workspace.Workspace; -import io.socket.client.IO; -import io.socket.client.Socket; - -import org.easymock.EasyMock; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.powermock.api.easymock.PowerMock; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - - -/** - * @author: Maksim - * @Date: Created in 2019/12/9 - * @Description: - */ -@RunWith(PowerMockRunner.class) -@PrepareForTest({WorkContext.class,DesignerSocketIO.class, IO.class}) -public class DesignerSocketIOTest { - - @Test - public void close() throws Exception { - this.update(); - DesignerSocketIO.close(); - DesignerSocketIO.Status status = Reflect.on(DesignerSocketIO.class).field("status").get(); - Socket socket = Reflect.on(DesignerSocketIO.class).field("socket").get(); - - Assert.assertEquals(DesignerSocketIO.Status.Disconnecting,status); - Assert.assertNull(socket); - } - - @Test - public void update() throws Exception { - Workspace current = EasyMock.mock(Workspace.class); - EasyMock.expect(current.isLocal()).andReturn(false); - - PowerMock.mockStatic(WorkContext.class); - EasyMock.expect(WorkContext.getCurrent()).andReturn(current); - - String[] uri = {"http://127.0.0.1:8888/workspace","http://127.0.0.1:9999/workspace"}; - PowerMock.mockStaticPartial(DesignerSocketIO.class,"getSocketUri"); - PowerMock.expectPrivate(DesignerSocketIO.class,"getSocketUri").andReturn(uri); - - EasyMock.replay(current); - PowerMock.replayAll(); - - DesignerSocketIO.update(); - DesignerSocketIO.Status status = Reflect.on(DesignerSocketIO.class).field("status").get(); - Socket socket = Reflect.on(DesignerSocketIO.class).field("socket").get(); - - Assert.assertEquals(DesignerSocketIO.Status.Connected,status); - Assert.assertNotNull(socket); - } -} \ No newline at end of file