jeo
6 years ago
259 changed files with 2950 additions and 1626 deletions
File diff suppressed because one or more lines are too long
@ -0,0 +1,10 @@
|
||||
package com.fr.design.gui.core; |
||||
|
||||
/** |
||||
* 这个接口说明一个基本组件可以设置文本 |
||||
* Created by plough on 2019/1/11. |
||||
*/ |
||||
public interface UITextComponent { |
||||
String getText(); |
||||
void setText(String text); |
||||
} |
@ -1 +1,24 @@
|
||||
package com.fr.design.parameter;
import com.fr.base.Parameter;
public interface ParaDefinitePane {
public Parameter[] getNoRepeatParas(Parameter[] paras);
public void setParameterArray(Parameter[] ps);
public Parameter[] getParameterArray();
public void refreshParameter();
public boolean isWithQueryButton();
public void addingParameter2Editor(Parameter p);
public void addingParameter2EditorWithQueryButton(Parameter p);
public void addingAllParameter2Editor();
} |
||||
package com.fr.design.parameter; |
||||
|
||||
import com.fr.base.Parameter; |
||||
|
||||
|
||||
public interface ParaDefinitePane { |
||||
|
||||
Parameter[] getNoRepeatParas(Parameter[] paras); |
||||
|
||||
void setParameterArray(Parameter[] ps); |
||||
|
||||
Parameter[] getParameterArray(); |
||||
|
||||
void refreshParameter(); |
||||
|
||||
boolean isWithQueryButton(); |
||||
|
||||
void addingParameter2Editor(Parameter p); |
||||
|
||||
void addingParameter2EditorWithQueryButton(Parameter p); |
||||
|
||||
void addingAllParameter2Editor(); |
||||
|
||||
} |
@ -0,0 +1,91 @@
|
||||
package com.fr.design.utils.gui; |
||||
|
||||
import com.fr.design.gui.core.UITextComponent; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.GeneralContext; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.util.Locale; |
||||
|
||||
/** |
||||
* 包含 UI 组件相关的工具方法 |
||||
* Created by plough on 2019/1/11. |
||||
*/ |
||||
|
||||
// Noninstantiable utility class
|
||||
public class UIComponentUtils { |
||||
private static final String HTML_TAG_TPL = "<html><body style='width: %dpx'>"; |
||||
private static final String HTML_BODY_TAG = "<html><body>"; |
||||
private static final String HTML_TAG = "<html>"; |
||||
private static final int MIN_WIDTH = 10; |
||||
|
||||
// 覆盖缺省构造器,不可实例化
|
||||
private UIComponentUtils() { |
||||
throw new AssertionError(); |
||||
} |
||||
|
||||
/** |
||||
* 到达指定宽度后换行 |
||||
*/ |
||||
public static void setLineWrap(UITextComponent comp, int width) { |
||||
if (width < MIN_WIDTH) { |
||||
width = MIN_WIDTH; |
||||
} |
||||
insertPrefixToText(comp, String.format(HTML_TAG_TPL, width)); |
||||
} |
||||
|
||||
/** |
||||
* 自动换行 |
||||
*/ |
||||
public static void setLineWrap(UITextComponent comp) { |
||||
insertPrefixToText(comp, HTML_BODY_TAG); |
||||
} |
||||
|
||||
private static void insertPrefixToText(UITextComponent comp, String prefix) { |
||||
if (comp == null || ComparatorUtils.equals(Locale.CHINA, GeneralContext.getLocale())) { |
||||
// 最初是为了解决日文国际化显示不全,而增加的换行功能。中文不需要换行。
|
||||
// windows 下,字体为宋体时,对于 JLabel、JCheckBox、JButton 等控件,使用<html>换行后,文字会下移,可能导致文字下半部分被截断。
|
||||
// 因此中文直接返回,不加换行逻辑。
|
||||
return; |
||||
} |
||||
|
||||
String text = comp.getText(); |
||||
if (StringUtils.isEmpty(text) || text.startsWith(HTML_TAG)) { |
||||
return; |
||||
} |
||||
comp.setText(prefix + text); |
||||
} |
||||
|
||||
/** |
||||
* 将一个组件包装到 BorderLayout 布局的面板中 |
||||
* @param comp,待包装的组件 |
||||
* @param layoutConstraint,添加的方向,如 BorderLayout.NORTH |
||||
* @return 包装好的 JPanel |
||||
*/ |
||||
public static JPanel wrapWithBorderLayoutPane(Component comp, String layoutConstraint) { |
||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
panel.add(comp, layoutConstraint); |
||||
return panel; |
||||
} |
||||
|
||||
/** |
||||
* 将一个组件包装到 BorderLayout 布局的面板中 |
||||
* @param comp,待包装的组件 |
||||
* @return 包装好的 JPanel(布局方向为 BorderLayout.NORTH) |
||||
*/ |
||||
public static JPanel wrapWithBorderLayoutPane(Component comp) { |
||||
return wrapWithBorderLayoutPane(comp, BorderLayout.NORTH); |
||||
} |
||||
|
||||
public static void setPreferedWidth(JComponent comp, int width) { |
||||
Dimension dim = comp.getPreferredSize(); |
||||
dim.setSize(width, dim.getHeight()); |
||||
comp.setPreferredSize(dim); |
||||
} |
||||
} |
@ -0,0 +1,51 @@
|
||||
package com.fr.design.widget; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.utils.gui.UIComponentUtils; |
||||
|
||||
/** |
||||
* 创建 widget 的静态工厂 |
||||
* Created by plough on 2019/1/15. |
||||
*/ |
||||
public class FRWidgetFactory { |
||||
// 不可实例化
|
||||
private FRWidgetFactory() { |
||||
throw new AssertionError(); |
||||
} |
||||
|
||||
/** |
||||
* 创建一个可换行的 UILabel |
||||
* @param text 标签文字 |
||||
* @return com.fr.design.gui.ilable.UILabel |
||||
*/ |
||||
public static UILabel createLineWrapLabel(String text) { |
||||
UILabel label = new UILabel(text); |
||||
UIComponentUtils.setLineWrap(label); |
||||
return label; |
||||
} |
||||
|
||||
/** |
||||
* 创建一个可换行的 UILabel |
||||
* @param text 标签文字 |
||||
* @param lineWidth 最大行宽 |
||||
* @return com.fr.design.gui.ilable.UILabel |
||||
*/ |
||||
public static UILabel createLineWrapLabel(String text, int lineWidth) { |
||||
UILabel label = new UILabel(text); |
||||
UIComponentUtils.setLineWrap(label, lineWidth); |
||||
return label; |
||||
} |
||||
|
||||
/** |
||||
* 创建一个可换行可调整水平对齐的 UILabel |
||||
* @param text |
||||
* @param lineWidth |
||||
* @param horizontalAlignment |
||||
* @return com.fr.design.gui.ilable.UILabel |
||||
*/ |
||||
public static UILabel createLineWrapLabel(String text, int lineWidth, int horizontalAlignment) { |
||||
UILabel label = createLineWrapLabel(text, lineWidth); |
||||
label.setHorizontalAlignment(horizontalAlignment); |
||||
return label; |
||||
} |
||||
} |
@ -0,0 +1,93 @@
|
||||
package com.fr.file; |
||||
|
||||
import javax.swing.Icon; |
||||
import java.io.InputStream; |
||||
import java.io.OutputStream; |
||||
|
||||
public abstract class AbstractFILE implements FILE { |
||||
|
||||
@Override |
||||
public String prefix() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isDirectory() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public String getName() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public Icon getIcon() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public void setPath(String path) { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public FILE getParent() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public FILE[] listFiles() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean createFolder(String name) { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean mkfile() throws Exception { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean exists() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public void closeTemplate() throws Exception { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public InputStream asInputStream() throws Exception { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public OutputStream asOutputStream() throws Exception { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public String getEnvFullName() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isMemFile() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isEnvFile() { |
||||
throw new UnsupportedOperationException(); |
||||
} |
||||
} |
@ -0,0 +1,102 @@
|
||||
package com.fr.file; |
||||
|
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.third.org.apache.commons.io.FileUtils; |
||||
import com.fr.web.session.SessionLocalManager; |
||||
|
||||
import javax.swing.Icon; |
||||
import java.io.File; |
||||
import java.io.FileOutputStream; |
||||
import java.io.IOException; |
||||
import java.io.OutputStream; |
||||
|
||||
public class RenameExportFILE extends AbstractFILE { |
||||
|
||||
private static final String EXPORT_SUFFIX = ".FRExportTmp"; |
||||
|
||||
private FILE file; |
||||
|
||||
private RenameExportFILE(FILE file) { |
||||
this.file = new FileFILE(new File(file.getPath() + EXPORT_SUFFIX)); |
||||
} |
||||
|
||||
public static RenameExportFILE create(FILE file) { |
||||
return new RenameExportFILE(file); |
||||
} |
||||
|
||||
public static String recoverFileName(String fileName) { |
||||
if (StringUtils.isEmpty(fileName) || !fileName.endsWith(EXPORT_SUFFIX)) { |
||||
return fileName; |
||||
} |
||||
return fileName.substring(0, fileName.lastIndexOf(EXPORT_SUFFIX)); |
||||
} |
||||
|
||||
@Override |
||||
public String prefix() { |
||||
return file.prefix(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isDirectory() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public String getName() { |
||||
return file.getName(); |
||||
} |
||||
|
||||
@Override |
||||
public Icon getIcon() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return file.getPath(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public FILE getParent() { |
||||
return file.getParent(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public boolean mkfile() throws Exception { |
||||
return file.mkfile(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean exists() { |
||||
return file.exists(); |
||||
} |
||||
|
||||
@Override |
||||
public OutputStream asOutputStream() throws Exception { |
||||
|
||||
final File localeFile = new File(file.getPath()); |
||||
OutputStream out; |
||||
try { |
||||
StableUtils.makesureFileExist(localeFile); |
||||
out = new FileOutputStream(localeFile, false) { |
||||
@Override |
||||
public void close() throws IOException { |
||||
super.close(); |
||||
String path = file.getPath(); |
||||
if (localeFile.exists()) { |
||||
FileUtils.copyFile(localeFile, new File(recoverFileName(path))); |
||||
if (localeFile.getPath().endsWith(EXPORT_SUFFIX)) { |
||||
FileUtils.forceDelete(localeFile); |
||||
} |
||||
} |
||||
} |
||||
}; |
||||
} catch (Exception e) { |
||||
throw SessionLocalManager.createLogPackedException(e); |
||||
} |
||||
return out; |
||||
} |
||||
} |
@ -1 +1 @@
|
||||
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,contextPath是/WebReport |
||||
contextPath是指绝对路径的服务器别名,即虚拟目录.假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,contextPath是/webroot/decision/view |
@ -1 +1 @@
|
||||
表单名字假如访问:http://localhost:8080/WebReport/ReportServer?formlet=Form1.frm,formName就是Form1.frm |
||||
表单名字假如访问:http://localhost:8075/webroot/decision/view/form?viewlet=Form1.frm,formName就是Form1.frm |
@ -1 +1 @@
|
||||
报表名字假如访问:http://localhost:8080/WebReport/ReportServer?reportlet=WorkBook1.cpt,reportName就是WorkBook1.cpt |
||||
报表名字假如访问:http://localhost:8075/webroot/decision/view/report?viewlet=workbook1.cpt,reportName就是WorkBook1.cpt |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue