Browse Source

兼容问题

master
richie 5 years ago
parent
commit
8ae5e092d9
  1. 2
      src/main/java/com/fanruan/api/cal/FormulaKit.java
  2. 2
      src/main/java/com/fanruan/api/conf/BaseConfiguration.java
  3. 4
      src/main/java/com/fanruan/api/data/ConnectionKit.java
  4. 15
      src/main/java/com/fanruan/api/design/macro/UIConstants.java
  5. 2
      src/main/java/com/fanruan/api/design/ui/container/BasicBeanPane.java
  6. 24
      src/main/java/com/fanruan/api/design/ui/container/BasicDialog.java
  7. 93
      src/main/java/com/fanruan/api/design/ui/container/BasicPane.java
  8. 25
      src/main/java/com/fanruan/api/design/util/GUICoreKit.java
  9. 13
      src/main/java/com/fanruan/api/err/UtilEvalError.java
  10. 23
      src/main/java/com/fanruan/api/xml/XmlKit.java

2
src/main/java/com/fanruan/api/cal/FormulaKit.java

@ -54,7 +54,7 @@ public class FormulaKit {
* @param content 公式的内容 * @param content 公式的内容
* @return 公式对象 * @return 公式对象
*/ */
public static @NotNull FormulaProvider newFormula(Object content) { public static @NotNull BaseFormula newFormula(Object content) {
return BaseFormula.createFormulaBuilder().build(content); return BaseFormula.createFormulaBuilder().build(content);
} }

2
src/main/java/com/fanruan/api/conf/BaseConfiguration.java

@ -30,7 +30,7 @@ public abstract class BaseConfiguration extends DefaultConfiguration {
* @param <T> 类型 * @param <T> 类型
* @return 配置对象 * @return 配置对象
*/ */
static <T extends BaseConfiguration> T getConfigInstance(final Class<T> clazz) { public static <T extends BaseConfiguration> T getConfigInstance(final Class<T> clazz) {
return ConfigContext.getConfigInstance(clazz); return ConfigContext.getConfigInstance(clazz);
} }
} }

4
src/main/java/com/fanruan/api/data/ConnectionKit.java

@ -17,7 +17,7 @@ public class ConnectionKit {
* @param name 名字 * @param name 名字
* @return 数据连接 * @return 数据连接
*/ */
public @Nullable Connection getConnection(@NotNull String name) { public static @Nullable Connection getConnection(@NotNull String name) {
return ConnectionConfig.getInstance().getConnection(name); return ConnectionConfig.getInstance().getConnection(name);
} }
@ -28,7 +28,7 @@ public class ConnectionKit {
* @param type 类型 * @param type 类型
* @return 数据连接 * @return 数据连接
*/ */
public <T extends Connection> @Nullable T getConnection(@NotNull String name, Class<? extends Connection> type) { public static <T extends Connection> @Nullable T getConnection(@NotNull String name, Class<? extends Connection> type) {
Connection connection = getConnection(name); Connection connection = getConnection(name);
if (TypeKit.objectInstanceOf(connection, type)) { if (TypeKit.objectInstanceOf(connection, type)) {
return (T) connection; return (T) connection;

15
src/main/java/com/fanruan/api/design/macro/UIConstants.java

@ -2,7 +2,18 @@ package com.fanruan.api.design.macro;
import java.awt.*; import java.awt.*;
public class UIConstants { /**
Color UIPOPUPMENU_LINE_COLOR = new Color(13158861); * 设计器界面使用的一些常量
*/
public interface UIConstants {
/**
* 边框线颜色
*/
Color LINE_COLOR = new Color(153, 153, 153);
/**
* 圆角弧度
*/
int ARC = 0; int ARC = 0;
} }

2
src/main/java/com/fanruan/api/design/ui/container/BasicBeanPane.java

@ -1,4 +1,4 @@
package com.fanruan.api.design.ui.container; package com.fanruan.api.design.ui.container;
public abstract class BasicBeanPane extends com.fr.design.beans.BasicBeanPane{ public abstract class BasicBeanPane<T> extends com.fr.design.beans.BasicBeanPane<T> {
} }

24
src/main/java/com/fanruan/api/design/ui/container/BasicDialog.java

@ -1,36 +1,40 @@
package com.fanruan.api.design.ui.container; package com.fanruan.api.design.ui.container;
import com.fanruan.api.design.ui.container.BasicPane;
import java.awt.*; import java.awt.*;
public class BasicDialog extends com.fr.design.dialog.BasicDialog{ public class BasicDialog extends com.fr.design.dialog.BasicDialog {
public BasicDialog(Dialog parent){
public BasicDialog(Dialog parent) {
super(parent); super(parent);
} }
public BasicDialog(Dialog parent, BasicPane pane){ public BasicDialog(Dialog parent, BasicPane pane) {
super(parent, pane); super(parent, pane);
} }
public BasicDialog(Dialog parent, BasicPane pane, boolean isNeedButton){ public BasicDialog(Dialog parent, BasicPane pane, boolean isNeedButton) {
super(parent, pane, isNeedButton); super(parent, pane, isNeedButton);
} }
public BasicDialog(Frame parent){ public BasicDialog(Frame parent) {
super(parent); super(parent);
} }
public BasicDialog(Frame parent, BasicPane pane){ public BasicDialog(Frame parent, BasicPane pane) {
super(parent, pane); super(parent, pane);
} }
public BasicDialog(Frame parent, BasicPane pane, boolean isNedButtonPane){ public BasicDialog(Frame parent, BasicPane pane, boolean isNedButtonPane) {
super(parent, pane, isNedButtonPane); super(parent, pane, isNedButtonPane);
} }
@Override @Override
public void checkValid(){ protected void setBasicDialogSize(Dimension dimension) {
super.setBasicDialogSize(dimension);
}
@Override
public void checkValid() throws Exception {
} }
} }

93
src/main/java/com/fanruan/api/design/ui/container/BasicPane.java

@ -1,5 +1,98 @@
package com.fanruan.api.design.ui.container; package com.fanruan.api.design.ui.container;
import com.fanruan.api.design.util.GUICoreKit;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog;
import java.awt.*;
public abstract class BasicPane extends com.fr.design.dialog.BasicPane { public abstract class BasicPane extends com.fr.design.dialog.BasicPane {
/**
* 显示窗口
*
* @param window 窗口
* @return 对话框
*/
public BasicDialog showWindow(Window window) {
return this.showWindow(window, null);
}
/**
* 显示窗口
*
* @param window 窗口
* @param l 对话框监听器
* @return 对话框
*/
public BasicDialog showWindow(Window window, DialogActionListener l) {
return showWindowWithCustomSize(window, l, BasicDialog.DEFAULT);
}
public BasicDialog showWindowWithCustomSize(Window window, DialogActionListener l, Dimension dimension) {
BasicDialog dg;
if (window instanceof Frame) {
dg = new DIALOG((Frame) window);
} else {
dg = new DIALOG((Dialog) window);
}
if (l != null) {
dg.addDialogActionListener(l);
}
dg.setBasicDialogSize(dimension);
GUICoreKit.centerWindow(dg);
dg.setResizable(false);
return dg;
}
private class DIALOG extends BasicDialog {
public DIALOG(Frame parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Dialog parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Frame parent, boolean isNeedButtonPane) {
super(parent, BasicPane.this, isNeedButtonPane);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public DIALOG(Dialog parent, boolean isNeedButtonPane) {
super(parent, BasicPane.this, isNeedButtonPane);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public void checkValid() throws Exception {
BasicPane.this.checkValid();
}
}
private class UnsizedDialog extends UIDialog {
public UnsizedDialog(Frame parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public UnsizedDialog(Dialog parent) {
super(parent, BasicPane.this);
this.setTitle(BasicPane.this.title4PopupWindow());
}
public void checkValid() throws Exception {
BasicPane.this.checkValid();
}
}
} }

25
src/main/java/com/fanruan/api/design/util/GUICoreKit.java

@ -1,7 +1,7 @@
package com.fanruan.api.design.util; package com.fanruan.api.design.util;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -100,20 +100,39 @@ public class GUICoreKit {
public static void showPopupMenu(JPopupMenu menu, Component component, int x, int y) { public static void showPopupMenu(JPopupMenu menu, Component component, int x, int y) {
GUICoreUtils.showPopupMenu(menu, component, x, y); GUICoreUtils.showPopupMenu(menu, component, x, y);
} }
/** /**
* 创建一个带有左空边框的面板 * 创建一个带有左空边框的面板
* *
* @return 返回一个JPanel对象 * @return 返回一个JPanel对象
*/ */
public static JPanel createNormalFlowInnerContainerPane(){ public static JPanel createNormalFlowInnerContainerPane() {
return FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); return FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
} }
/** /**
* 创建一个带有边框面板 * 创建一个带有边框面板
* *
* @return 返回一个JPanel对象 * @return 返回一个JPanel对象
*/ */
public static JPanel createBorderLayoutPane(){ public static JPanel createBorderLayoutPane() {
return FRGUIPaneFactory.createBorderLayout_S_Pane(); return FRGUIPaneFactory.createBorderLayout_S_Pane();
} }
/**
* 设置一个窗口居中
*/
public static void centerWindow(Window win) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension winSize = win.getSize();
if (winSize.height > screenSize.height) {
winSize.height = screenSize.height;
}
if (winSize.width > screenSize.width) {
winSize.width = screenSize.width;
}
win.setLocation((screenSize.width - winSize.width) / 2, (screenSize.height - winSize.height) / 2 - 20);
}
} }

13
src/main/java/com/fanruan/api/err/UtilEvalError.java

@ -1,4 +1,15 @@
package com.fanruan.api.err; package com.fanruan.api.err;
public class UtilEvalError extends com.fr.stable.UtilEvalError{ /**
* 公式计算异常
*/
public class UtilEvalError extends com.fr.stable.UtilEvalError {
public UtilEvalError() {
}
public UtilEvalError(String message) {
super(message);
}
} }

23
src/main/java/com/fanruan/api/xml/XmlKit.java

@ -1,9 +1,13 @@
package com.fanruan.api.xml; package com.fanruan.api.xml;
import com.fr.stable.xml.*;
import com.fr.data.core.DataCoreXmlUtils; import com.fr.data.core.DataCoreXmlUtils;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.general.xml.GeneralXMLTools; import com.fr.general.xml.GeneralXMLTools;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import java.io.InputStream; import java.io.InputStream;
@ -42,21 +46,34 @@ public class XmlKit {
public static void writeXMLable(XMLPrintWriter writer, XMLable xml, String tagName) { public static void writeXMLable(XMLPrintWriter writer, XMLable xml, String tagName) {
GeneralXMLTools.writeXMLable(writer, xml, tagName); GeneralXMLTools.writeXMLable(writer, xml, tagName);
} }
/** /**
* 读取connection对象 * 读取connection对象
*
* @param reader XMLableReader对象 * @param reader XMLableReader对象
* @return Connection对象 * @return Connection对象
*
*/ */
public static Connection readXMLConnectionMap(XMLableReader reader) { public static Connection readXMLConnectionMap(XMLableReader reader) {
return DataCoreXmlUtils.readXMLConnectionMap(reader); return DataCoreXmlUtils.readXMLConnectionMap(reader);
} }
/**
* 从xml中读取数据连接对象
* @param reader xml读取器
* @return 数据连接对象
*/
public static Connection readXMLConnection(XMLableReader reader) {
return DataCoreXmlUtils.readXMLConnection(reader);
}
/** /**
* 写connection对象 * 写connection对象
* @param writer XMLPrintWriter对象 *
* @param writer XMLPrintWriter对象
* @param connection Connection对象 * @param connection Connection对象
*/ */
public static void writeXMLConnection(XMLPrintWriter writer, Connection connection) { public static void writeXMLConnection(XMLPrintWriter writer, Connection connection) {
DataCoreXmlUtils.writeXMLConnection(writer, connection); DataCoreXmlUtils.writeXMLConnection(writer, connection);
} }
} }

Loading…
Cancel
Save