Crawford.Zhou
10 months ago
28 changed files with 340 additions and 198 deletions
@ -0,0 +1,64 @@
|
||||
package com.fr.design.lock; |
||||
|
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.file.TemplateTreePane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.utils.TemplateUtils; |
||||
import com.fr.file.FileNodeFILE; |
||||
import com.fr.file.filetree.FileNode; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.project.ProjectConstants; |
||||
|
||||
/** |
||||
* 被锁住的文件重新保存副本时的处理枚举类 |
||||
* |
||||
* @author Roger |
||||
* @since 11.0 |
||||
* Created on 2023/12/21 |
||||
*/ |
||||
public enum LockFileReSaveEnum { |
||||
|
||||
/** |
||||
* 保存目录树里面的模板副本 |
||||
*/ |
||||
TEMPLATE_TREE() { |
||||
@Override |
||||
public void action() { |
||||
FileNode node = TemplateTreePane.getInstance().getFileNode(); |
||||
if (node == null) { |
||||
return; |
||||
} |
||||
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getFilePath()); |
||||
TemplateUtils.createAndReOpenTemplate( |
||||
Toolkit.i18nText("Fine_Design_Template_Lock_Copy"), |
||||
new FileNodeFILE(new FileNode(selectedFilePath, false)), |
||||
false, |
||||
true); |
||||
} |
||||
}, |
||||
|
||||
/** |
||||
* 保存设计器里面已经打开的模板副本 |
||||
*/ |
||||
HISTORY_TEMPLATE_CACHE() { |
||||
@Override |
||||
public void action() { |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (JTemplate.isValid(template)) { |
||||
TemplateUtils.createAndOpenTemplate( |
||||
Toolkit.i18nText("Fine_Design_Template_Backup"), |
||||
new FileNodeFILE(new FileNode(template.getPath(), false)), |
||||
true, |
||||
true, |
||||
//另存之后需要关闭的模板
|
||||
template); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* 如何保存模板副本 |
||||
*/ |
||||
public abstract void action(); |
||||
} |
@ -1,70 +0,0 @@
|
||||
package com.fr.widgettheme.theme.panel; |
||||
|
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.frpane.FontSizeComboPane; |
||||
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Color; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.util.Vector; |
||||
|
||||
/** |
||||
* 控件文本样式配置面板 |
||||
* 包含文本字体大小和字体颜色 |
||||
* |
||||
* @author oBo |
||||
* @since 11.0 |
||||
* Created on 2023/12/13 |
||||
*/ |
||||
public class WidgetTextStylePane extends JPanel { |
||||
|
||||
private final FontSizeComboPane fontSizePane; |
||||
|
||||
private final UIColorButton fontColorButton; |
||||
|
||||
public WidgetTextStylePane(int preferredWidth) { |
||||
this(null, preferredWidth); |
||||
} |
||||
|
||||
public WidgetTextStylePane(Vector<Integer> fontSizes, int preferredWidth) { |
||||
this.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||
this.setBorder(BorderFactory.createEmptyBorder()); |
||||
fontSizePane = new FontSizeComboPane(fontSizes); |
||||
fontColorButton = new UIColorButton(); |
||||
fontSizePane.setPreferredSize(new Dimension(preferredWidth, fontSizePane.getPreferredSize().height)); |
||||
this.add(fontSizePane); |
||||
this.add(fontColorButton); |
||||
} |
||||
|
||||
public void setTextStyle(ThemeTextStyle themeTextStyle) { |
||||
this.fontSizePane.setValue(themeTextStyle.getFontSize()); |
||||
this.fontColorButton.setColor(themeTextStyle.getFontColor()); |
||||
} |
||||
|
||||
public ThemeTextStyle getTextStyle() { |
||||
ThemeTextStyle themeTextStyle = new ThemeTextStyle(); |
||||
themeTextStyle.setFontSize(this.fontSizePane.getValue()); |
||||
themeTextStyle.setFontColor(this.fontColorButton.getColor()); |
||||
return themeTextStyle; |
||||
} |
||||
|
||||
public void setFontSizeValue(int fontSize) { |
||||
this.fontSizePane.setValue(fontSize); |
||||
} |
||||
|
||||
public void setFontColorValue(Color fontColor) { |
||||
this.fontColorButton.setColor(fontColor); |
||||
} |
||||
|
||||
public int getFontSizeValue() { |
||||
return this.fontSizePane.getValue(); |
||||
} |
||||
|
||||
public Color getFontColorValue() { |
||||
return this.fontColorButton.getColor(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.widgettheme.util; |
||||
|
||||
import com.fr.design.gui.frpane.FontSizeComboPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
|
||||
import javax.swing.Box; |
||||
import javax.swing.JPanel; |
||||
import java.awt.Component; |
||||
|
||||
/** |
||||
* 创建主题文本样式的工具类 |
||||
* |
||||
* @author obo |
||||
* @since 11.0 |
||||
* Created on 2023/12/21 |
||||
*/ |
||||
public class ThemeTextStylePaneCreator { |
||||
private ThemeTextStylePaneCreator() {} |
||||
|
||||
/** |
||||
* 创建主题文本样式配置面板 |
||||
* 包含字体大小下拉框和字体颜色按钮 |
||||
* 可以自适应布局 |
||||
* |
||||
* @param fontSizePane 字体大小配置 |
||||
* @param fontColorButton 字体颜色配置 |
||||
* @return 文本样式面板 |
||||
*/ |
||||
public static JPanel create(FontSizeComboPane fontSizePane, UIColorButton fontColorButton) { |
||||
Component[][] components = {{fontSizePane, Box.createHorizontalStrut(5), fontColorButton}}; |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {f}; |
||||
double[] columnSize = {f, p, p}; |
||||
int[][] rowCount = {{1, 1, 1}}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, 0); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.fr.design.data.tabledata.tabledatapane; |
||||
|
||||
import com.fr.base.Parameter; |
||||
import com.fr.design.data.datapane.sqlpane.SQLEditPane; |
||||
import com.fr.invoke.Reflect; |
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
|
||||
/** |
||||
* @author Yuan.Wang |
||||
* @since 11.0 |
||||
* Created on 2023/12/22 |
||||
*/ |
||||
public class DBTableDataPaneTest extends TestCase { |
||||
|
||||
public void testGetParameters() { |
||||
DBTableDataPane pane = new DBTableDataPane(); |
||||
SQLEditPane editPane = new SQLEditPane(); |
||||
String sql = "select distinct 类别ID from S产品\n" + |
||||
"where 1=1\n" + |
||||
"order by 类别ID\n" + |
||||
"--${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}"; |
||||
|
||||
String sql1 = "select distinct 类别ID from S产品\n" + |
||||
"where 1=1\n" + |
||||
"order by 类别ID\n" + |
||||
"${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}"; |
||||
editPane.setText(sql); |
||||
Reflect.on(pane).set("sqlTextPane", editPane); |
||||
Reflect.on(pane).set("pageQuery", sql); |
||||
|
||||
Parameter[] parameters = Reflect.on(pane).call("getParameters").get(); |
||||
|
||||
Assert.assertEquals(0, parameters.length); |
||||
editPane.setText(sql1); |
||||
|
||||
parameters = Reflect.on(pane).call("getParameters").get(); |
||||
Assert.assertEquals(1, parameters.length); |
||||
Assert.assertEquals(parameters[0].getName(), "comboBox0"); |
||||
} |
||||
} |
Loading…
Reference in new issue