Browse Source
* commit '845ea0a352b3d4515dd723bfae5efb1ce66a691d': (35 commits) REPORT-148266 revert: 撤回TableDataComboBox数据集名称展示的改动 REPORT-149012 alphafine中搜索之前可以在设计器中搜到BI的模板,现在增加cid参数,只搜索fr相关模板 REPORT-148138 单测修复,由于资源同名导致覆盖,出现单测错误,通过修改资源解决。 REPORT-148096 整体代码已重构,删除无效单测 REPORT-148096 该方法的单测没用了,之前补充了新的没有删除旧的 && 改动,出现了未预期调用的方法 REPORT-148096 暂时过滤掉与UI相关的单测 REPORT-149091 修复动态参数切换异常 KERNEL-20956 修复jxbrowser因解压文件导致的启动失败问题 REPORT-148067【模板主题】开启控件显示增强后模板主题打开显示不全 REPORT-148266 feat:comboBox事件叠加导致部分操作卡顿问题优化 KERNEL-20792 报表工程中使用的仓库地址修改 feat: JSContentPane支持自定义提示功能 #REPORT-144004 fix: pr问题处理 #REPORT-147689 fix: 颜色选择面板数组越界 #REPORT-147689 REPORT-147166 linux下,条件属性-超链设置 打开之后,设置超链的窗口无法聚焦 REPORT-147166 修改代码质量 REPORT-147166 修改代码质量 REPORT-147166 统信uos下切换条件属性后,卡片不能及时更新。 REPORT-147166 统信uos下切换条件属性后,卡片不能及时更新。 REPORT-147166 统信uos下切换条件属性后,卡片不能及时更新。 ...release/11.0^2
63 changed files with 1198 additions and 201 deletions
@ -0,0 +1,16 @@
|
||||
# 设计器基础组件 |
||||
|
||||
主要用于提供以下内容 |
||||
- 读取设计器图片(icon) |
||||
- 不同的设计器模式 |
||||
- 基础设计模式 |
||||
- 版本管理模式 |
||||
- 权限设计模式 |
||||
- 设计器基础的UI界面 |
||||
- 设计器环境基础组件 |
||||
- 设计器退出功能相关组件 |
||||
- 设计器文件选择器 |
||||
- 控件主题 |
||||
- 设计器启动界面 |
||||
|
||||
属于设计器最底层的base框架,其他三个模块designer-chart、designer-form、designer-realize都依赖了该模块 |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.style.color; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
/** |
||||
* 颜色选择器中单元颜色具体配置 |
||||
*/ |
||||
public class ColorConfig { |
||||
private boolean supportTheme; |
||||
private DeriveAlgorithm algorithm; |
||||
|
||||
private ColorConfig(boolean supportTheme, DeriveAlgorithm algorithm) { |
||||
this.supportTheme = supportTheme; |
||||
this.algorithm = algorithm; |
||||
} |
||||
|
||||
public static ColorConfig createThemeColorConfig(DeriveAlgorithm deriveAlgorithm) { |
||||
return new ColorConfig(true, deriveAlgorithm); |
||||
} |
||||
|
||||
public static ColorConfig createThemeColorConfig(boolean supportTheme, DeriveAlgorithm deriveAlgorithm) { |
||||
return new ColorConfig(supportTheme, deriveAlgorithm); |
||||
} |
||||
|
||||
public boolean isSupportTheme() { |
||||
return supportTheme; |
||||
} |
||||
|
||||
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
||||
return algorithm.getDeriveColorArr(color, defaultDeriveCount); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.design.style.color; |
||||
|
||||
import com.fr.base.theme.FineColorDeriveState; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
public interface DeriveAlgorithm { |
||||
/** |
||||
* 通用的衍生规则 |
||||
*/ |
||||
DeriveAlgorithm PLAIN_ALGORITHM = new DeriveAlgorithm() { |
||||
@Override |
||||
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
||||
return FineColorDeriveState.getDeriveColorArr(color, false, defaultDeriveCount); |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 默认的衍生规则,主要针对字体和背景 |
||||
*/ |
||||
DeriveAlgorithm DEFAULT_DERIVE_ALGORITHM = new DeriveAlgorithm() { |
||||
public Color[] getDeriveColorArr(Color color, int defaultDeriveCount) { |
||||
return FineColorDeriveState.getDeriveColorArr(color, true, defaultDeriveCount); |
||||
} |
||||
}; |
||||
|
||||
Color[] getDeriveColorArr(Color color, int defaultDeriveCount); |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.style.color; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class FRColorSelectorStyle { |
||||
public static final List<ColorConfig> COLOR_CONFIG = new ArrayList<>(); |
||||
static { |
||||
// 8列主题色
|
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(DeriveAlgorithm.PLAIN_ALGORITHM)); |
||||
// 2列灰度色
|
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(false, DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM)); |
||||
COLOR_CONFIG.add(ColorConfig.createThemeColorConfig(false, DeriveAlgorithm.DEFAULT_DERIVE_ALGORITHM)); |
||||
} |
||||
} |
@ -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"] |
||||
} |
@ -0,0 +1,8 @@
|
||||
# 设计器表单UI模块 |
||||
|
||||
主要用于提供表单面板与各类菜单UI |
||||
- 菜单UI |
||||
- 表单绘制 |
||||
- 各类表单的自适应 |
||||
- 各类表单的布局 |
||||
- 参数面板与表格面板 |
@ -0,0 +1,260 @@
|
||||
package com.fr.design.mainframe.guide; |
||||
|
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.ui.util.UIUtil; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.Icon; |
||||
import javax.swing.JButton; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JTextPane; |
||||
import javax.swing.UIManager; |
||||
import javax.swing.border.LineBorder; |
||||
import javax.swing.event.AncestorEvent; |
||||
import javax.swing.event.AncestorListener; |
||||
import javax.swing.event.HyperlinkEvent; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Desktop; |
||||
import java.awt.Dimension; |
||||
import java.awt.Font; |
||||
import java.awt.FontMetrics; |
||||
import java.awt.Insets; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ComponentAdapter; |
||||
import java.awt.event.ComponentEvent; |
||||
|
||||
/** |
||||
* FRM引导提示使用FVS |
||||
* |
||||
* @author Zhanying |
||||
* @since 11.0 |
||||
* Created on 2024/12/20 |
||||
*/ |
||||
public class FvsGuidePane extends JPanel { |
||||
private static final String OMIT_TEXT = "..."; |
||||
private static final Color BACKGROUND_COLOR = new Color(255, 251, 230); |
||||
private static final Color BORDER_COLOR = new Color(255, 229, 143); |
||||
private static final Icon TIP_ICON = UIManager.getIcon("OptionPane.circularWarningIcon"); |
||||
private static final Icon CLOSE_ICON = IconUtils.readIcon("/com/fr/design/standard/close/close"); |
||||
// 引导URL
|
||||
private static final String GUIDE_URL = "https://help.fanruan.com/finereport/doc-view-4222.html?source=3"; |
||||
private static final int MAX_PANE_HEIGHT = 80; |
||||
private static final int MAX_CONTENT_HEIGHT = 60; |
||||
private static final int LINE_HEIGHT = 20; |
||||
// 计算文本框最多能容纳的行数 = 最大高度 / 行高,向下取整
|
||||
private static final int MAX_LINES = (int) Math.floor((double) MAX_CONTENT_HEIGHT / LINE_HEIGHT); |
||||
private static final String CONTENT_FORMAT = "<html>\n<body style=\"font-family: %s; font-size: %spt;\">\n %s\n</body>\n</html>"; |
||||
private final JComponent parent; |
||||
private JTextPane textPane; |
||||
|
||||
public FvsGuidePane(JComponent parent) { |
||||
super(); |
||||
this.parent = parent; |
||||
initUI(); |
||||
} |
||||
|
||||
private void initUI() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setLayout(new BorderLayout()); |
||||
this.setBorder(new LineBorder(BORDER_COLOR)); |
||||
this.setBackground(BACKGROUND_COLOR); |
||||
this.setMaximumSize(new Dimension(Integer.MAX_VALUE, MAX_PANE_HEIGHT)); |
||||
JPanel wrapPane = new JPanel(new BorderLayout(10, 0)); |
||||
wrapPane.setBorder(BorderFactory.createEmptyBorder(8, 13, 8, 13)); |
||||
wrapPane.setBackground(BACKGROUND_COLOR); |
||||
wrapPane.add(this.createIconPane(), BorderLayout.WEST); |
||||
wrapPane.add(this.createContentPane(), BorderLayout.CENTER); |
||||
wrapPane.add(this.createCloseBtnPane(), BorderLayout.EAST); |
||||
this.add(wrapPane, BorderLayout.CENTER); |
||||
addListener(); |
||||
} |
||||
|
||||
private void addListener() { |
||||
this.textPane.addComponentListener(new ComponentAdapter() { |
||||
@Override |
||||
public void componentResized(ComponentEvent e) { |
||||
refreshText(); |
||||
} |
||||
}); |
||||
this.textPane.addAncestorListener(new AncestorListener() { |
||||
@Override |
||||
public void ancestorAdded(AncestorEvent event) { |
||||
UIUtil.invokeLaterIfNeeded(FvsGuidePane.this::refreshText); |
||||
} |
||||
|
||||
@Override |
||||
public void ancestorRemoved(AncestorEvent event) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void ancestorMoved(AncestorEvent event) { |
||||
|
||||
} |
||||
}); |
||||
} |
||||
|
||||
private JPanel createIconPane() { |
||||
// 图标
|
||||
JPanel panel = new JPanel(new BorderLayout()); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(6, 0, 0, 0)); |
||||
panel.setBackground(BACKGROUND_COLOR); |
||||
UILabel iconLabel = new UILabel(TIP_ICON); |
||||
panel.add(iconLabel, BorderLayout.NORTH); |
||||
return panel; |
||||
} |
||||
|
||||
private JPanel createCloseBtnPane() { |
||||
JPanel panel = new JPanel(new BorderLayout()); |
||||
panel.setBackground(BACKGROUND_COLOR); |
||||
JButton closeButton = new JButton(this.closeBtnText(), CLOSE_ICON); |
||||
closeButton.setOpaque(false); |
||||
closeButton.setBorderPainted(false); |
||||
closeButton.setContentAreaFilled(false); |
||||
closeButton.addActionListener(this::close); |
||||
panel.add(closeButton, BorderLayout.NORTH); |
||||
return panel; |
||||
} |
||||
|
||||
private JPanel createContentPane() { |
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
contentPane.setBackground(BACKGROUND_COLOR); |
||||
textPane = new JTextPane(); |
||||
// 设置文本格式为 HTML
|
||||
textPane.setContentType("text/html"); |
||||
textPane.setEditable(false); |
||||
textPane.setBackground(BACKGROUND_COLOR); |
||||
|
||||
// 添加超链接监听器
|
||||
textPane.addHyperlinkListener(e -> { |
||||
if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { |
||||
// 用户点击了超链接,处理跳转
|
||||
try { |
||||
Desktop.getDesktop().browse(e.getURL().toURI()); |
||||
} catch (Exception ex) { |
||||
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); |
||||
} |
||||
} |
||||
}); |
||||
contentPane.add(textPane, BorderLayout.CENTER); |
||||
return contentPane; |
||||
} |
||||
|
||||
private void refreshText() { |
||||
int textPaneWidth = textPane.getWidth(); |
||||
if (textPaneWidth <= 0) { |
||||
return; |
||||
} |
||||
// 获取可用宽度:减去可能的左右边距
|
||||
Insets insets = textPane.getInsets(); |
||||
int availableWidth = textPaneWidth - insets.left - insets.right - 15;// 留点冗余
|
||||
// 组装html
|
||||
String buildHtml = buildHtml(textPane.getFont(), autoChangeLineAndOmit(availableWidth)); |
||||
textPane.setText(buildHtml); |
||||
} |
||||
|
||||
private String tipContent() { |
||||
return Toolkit.i18nText("Fine-Design_Form_Guide_Use_Fvs_Tips"); |
||||
} |
||||
|
||||
private String linkContent() { |
||||
return Toolkit.i18nText("Fine-Design_Form_Guide_Use_Fvs_Link_Tips"); |
||||
} |
||||
|
||||
private void close(ActionEvent e) { |
||||
parent.remove(this); |
||||
parent.revalidate(); |
||||
parent.repaint(); |
||||
} |
||||
|
||||
private String closeBtnText() { |
||||
return Toolkit.i18nText("Fine-Design_Form_Guide_Use_Fvs_Close_Tips"); |
||||
} |
||||
|
||||
private String buildHtml(Font font, String text) { |
||||
return String.format(CONTENT_FORMAT, font.getFamily(), font.getSize(), text); |
||||
} |
||||
|
||||
private String autoChangeLineAndOmit(double width) { |
||||
StringBuilder htmlBuilder = new StringBuilder(); |
||||
// 获取字体的大小
|
||||
FontMetrics fontMetrics = textPane.getFontMetrics(textPane.getFont()); |
||||
// 计算行间距
|
||||
int lineSpace = LINE_HEIGHT - fontMetrics.getHeight(); |
||||
String divStart = String.format("<div style=\"margin-bottom: %spt; margin-top: %spt;\">", lineSpace / 2, lineSpace / 2); |
||||
htmlBuilder.append(divStart); |
||||
|
||||
// 计算省略号的长度
|
||||
int omitLength = getStringWidth(OMIT_TEXT, fontMetrics); |
||||
|
||||
String linkContent = linkContent(); |
||||
// 计算超链的长度
|
||||
int linkLength = getStringWidth(linkContent, fontMetrics); |
||||
|
||||
String tipContent = tipContent(); |
||||
|
||||
// 宽度已经小于省略号+超链的宽度
|
||||
boolean widthTooSmall = width < omitLength + linkLength; |
||||
if (StringUtils.isNotEmpty(tipContent)) { |
||||
char[] chars = tipContent.toCharArray(); |
||||
|
||||
int row = 1; |
||||
int off = 0; |
||||
for (int i = 0; i < chars.length; i++) { |
||||
// 当前行占的宽度
|
||||
int currRowWidth = fontMetrics.charsWidth(chars, off, i - off); |
||||
// 到最后一行
|
||||
if (row == MAX_LINES) { |
||||
// 计算省略号的位置
|
||||
if (currRowWidth + omitLength + linkLength > width) { |
||||
//拼上省略号
|
||||
htmlBuilder.append(OMIT_TEXT); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (currRowWidth > width) { |
||||
// 换行
|
||||
htmlBuilder.append("</div>").append(divStart); |
||||
off = i; |
||||
row++; |
||||
} else if (widthTooSmall && simulateIfLastLineOverflows(fontMetrics, currRowWidth, row, (OMIT_TEXT + linkContent).toCharArray(), width)) { |
||||
//模拟到最后一行是否溢出;其实这么窄展示也没什么意义了
|
||||
//拼上省略号
|
||||
htmlBuilder.append(OMIT_TEXT); |
||||
break; |
||||
} |
||||
htmlBuilder.append(chars[i]); |
||||
} |
||||
} |
||||
htmlBuilder.append("<a href=\"").append(GUIDE_URL).append("\">").append(linkContent).append("</a></div>"); |
||||
return htmlBuilder.toString(); |
||||
} |
||||
|
||||
private boolean simulateIfLastLineOverflows(FontMetrics fontMetrics, int currRowWidth, int row, char[] omitAndLink, double width) { |
||||
int off = 0; |
||||
for (int i = 0; i < omitAndLink.length; i++) { |
||||
boolean lastRow = row == MAX_LINES; |
||||
if (currRowWidth + fontMetrics.charsWidth(omitAndLink, off, i - off) > (lastRow ? width - 30 : width)) { // 最后一行留点冗余
|
||||
if (lastRow) { |
||||
return true; |
||||
} |
||||
off = i; |
||||
currRowWidth = 0; |
||||
row++; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
private int getStringWidth(String str, FontMetrics fontMetrics) { |
||||
return fontMetrics.charsWidth(str.toCharArray(), 0, str.length()); |
||||
} |
||||
} |
@ -0,0 +1,7 @@
|
||||
# 设计器主要行为模块 |
||||
设计器各类编辑逻辑基本都汇总在该模块内 |
||||
- 设计器启动器 |
||||
- 各类编辑Editor |
||||
- 各级菜单下的具体行为Action(导出、插入...) |
||||
- 查找替换功能 |
||||
- 各类跟数据相关的面板(形态、参数等) |
@ -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(); |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
# 设计器模块 |
||||
设计器的所有实现代码汇总,具体的子模块参见: |
||||
|
||||
[设计器基础模块](designer-base/readme.md) |
||||
|
||||
[设计器图表模块](designer-chart/readme.md) |
||||
|
||||
[设计器表单UI模块](designer-form/readme.md) |
||||
|
||||
[设计器行为模块](designer-realize/readme.md) |
Loading…
Reference in new issue