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. 10
      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. 21
      src/main/java/com/fanruan/api/design/util/GUICoreKit.java
  9. 11
      src/main/java/com/fanruan/api/err/UtilEvalError.java
  10. 21
      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 公式的内容
* @return 公式对象
*/
public static @NotNull FormulaProvider newFormula(Object content) {
public static @NotNull BaseFormula newFormula(Object 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> 类型
* @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);
}
}

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

@ -17,7 +17,7 @@ public class ConnectionKit {
* @param name 名字
* @return 数据连接
*/
public @Nullable Connection getConnection(@NotNull String name) {
public static @Nullable Connection getConnection(@NotNull String name) {
return ConnectionConfig.getInstance().getConnection(name);
}
@ -28,7 +28,7 @@ public class ConnectionKit {
* @param type 类型
* @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);
if (TypeKit.objectInstanceOf(connection, type)) {
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.*;
public class UIConstants {
Color UIPOPUPMENU_LINE_COLOR = new Color(13158861);
/**
* 设计器界面使用的一些常量
*/
public interface UIConstants {
/**
* 边框线颜色
*/
Color LINE_COLOR = new Color(153, 153, 153);
/**
* 圆角弧度
*/
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;
public abstract class BasicBeanPane extends com.fr.design.beans.BasicBeanPane{
public abstract class BasicBeanPane<T> extends com.fr.design.beans.BasicBeanPane<T> {
}

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

@ -1,10 +1,9 @@
package com.fanruan.api.design.ui.container;
import com.fanruan.api.design.ui.container.BasicPane;
import java.awt.*;
public class BasicDialog extends com.fr.design.dialog.BasicDialog {
public BasicDialog(Dialog parent) {
super(parent);
}
@ -30,7 +29,12 @@ public class BasicDialog extends com.fr.design.dialog.BasicDialog{
}
@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;
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 {
/**
* 显示窗口
*
* @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();
}
}
}

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

@ -1,7 +1,7 @@
package com.fanruan.api.design.util;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
@ -100,6 +100,7 @@ public class GUICoreKit {
public static void showPopupMenu(JPopupMenu menu, Component component, int x, int y) {
GUICoreUtils.showPopupMenu(menu, component, x, y);
}
/**
* 创建一个带有左空边框的面板
*
@ -108,6 +109,7 @@ public class GUICoreKit {
public static JPanel createNormalFlowInnerContainerPane() {
return FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
}
/**
* 创建一个带有边框面板
*
@ -116,4 +118,21 @@ public class GUICoreKit {
public static JPanel createBorderLayoutPane() {
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);
}
}

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

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

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

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

Loading…
Cancel
Save