@ -0,0 +1,47 @@ |
|||||||
|
package com.fr.design.data.datapane.connect; |
||||||
|
|
||||||
|
import com.fr.data.impl.JDBCDatabaseConnection; |
||||||
|
|
||||||
|
/** |
||||||
|
* JDBCDefPane和DBCPAttrPane沟通的桥梁 |
||||||
|
* |
||||||
|
*/ |
||||||
|
public class JDBCConnectionDef { |
||||||
|
|
||||||
|
private static volatile JDBCConnectionDef instance; |
||||||
|
|
||||||
|
private String databaseName; |
||||||
|
private JDBCDatabaseConnection connection; |
||||||
|
|
||||||
|
public static JDBCConnectionDef getInstance() { |
||||||
|
if (instance == null) { |
||||||
|
synchronized (JDBCConnectionDef.class) { |
||||||
|
if (instance == null) { |
||||||
|
instance = new JDBCConnectionDef(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return instance; |
||||||
|
} |
||||||
|
|
||||||
|
private JDBCConnectionDef() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public String getDatabaseName() { |
||||||
|
return databaseName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDatabaseName(String databaseName) { |
||||||
|
this.databaseName = databaseName; |
||||||
|
} |
||||||
|
|
||||||
|
public JDBCDatabaseConnection getConnection() { |
||||||
|
return connection; |
||||||
|
} |
||||||
|
|
||||||
|
public void setConnection(String databaseName, JDBCDatabaseConnection connection) { |
||||||
|
this.databaseName = databaseName; |
||||||
|
this.connection = connection; |
||||||
|
} |
||||||
|
} |
@ -1,5 +0,0 @@ |
|||||||
package com.fr.design.file; |
|
||||||
|
|
||||||
public interface Releasable { |
|
||||||
void releaseResources(); |
|
||||||
} |
|
@ -0,0 +1,30 @@ |
|||||||
|
package com.fr.design.gui.frpane; |
||||||
|
|
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Starryi |
||||||
|
* @version 10.0.18 |
||||||
|
* Created by Starryi on 2021/7/3 |
||||||
|
*/ |
||||||
|
public class UIPercentDragPane extends JPanel { |
||||||
|
|
||||||
|
private final UINumberDragPane dragPane = new UINumberDragPane(0, 100, 1); |
||||||
|
|
||||||
|
public UIPercentDragPane() { |
||||||
|
setLayout(new BorderLayout()); |
||||||
|
add(dragPane, BorderLayout.CENTER); |
||||||
|
add(new UILabel(" %"), BorderLayout.EAST); |
||||||
|
} |
||||||
|
|
||||||
|
public void populateBean(double value) { |
||||||
|
dragPane.populateBean(value * 100); |
||||||
|
} |
||||||
|
|
||||||
|
public double updateBean() { |
||||||
|
return dragPane.updateBean() * 100; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,84 @@ |
|||||||
|
package com.fr.design.mainframe; |
||||||
|
|
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import java.awt.event.WindowEvent; |
||||||
|
import java.awt.event.WindowListener; |
||||||
|
|
||||||
|
/** |
||||||
|
* 保证监听运行出错也不影响其他功能正常使用 |
||||||
|
* |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2021/6/30 |
||||||
|
*/ |
||||||
|
public class SafeWindowListener implements WindowListener { |
||||||
|
|
||||||
|
private final WindowListener windowListener; |
||||||
|
|
||||||
|
public SafeWindowListener(WindowListener windowListener) { |
||||||
|
this.windowListener = windowListener; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowOpened(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowOpened(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowClosing(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowClosing(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowClosed(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowClosed(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowIconified(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowIconified(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowDeiconified(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowDeiconified(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowActivated(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowActivated(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void windowDeactivated(WindowEvent e) { |
||||||
|
try { |
||||||
|
windowListener.windowDeactivated(e); |
||||||
|
} catch (Throwable throwable) { |
||||||
|
FineLoggerFactory.getLogger().debug(throwable.getMessage(), throwable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,148 @@ |
|||||||
|
package com.fr.env.utils; |
||||||
|
|
||||||
|
import com.fr.common.annotations.Compatible; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.stable.EncodeConstants; |
||||||
|
import com.fr.stable.ProductConstants; |
||||||
|
import com.fr.stable.StableUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.stable.xml.XMLPrintWriter; |
||||||
|
import com.fr.stable.xml.XMLReadable; |
||||||
|
import com.fr.stable.xml.XMLTools; |
||||||
|
import com.fr.stable.xml.XMLWriter; |
||||||
|
import com.fr.stable.xml.XMLableReader; |
||||||
|
import com.fr.third.javax.xml.stream.XMLStreamException; |
||||||
|
|
||||||
|
import java.io.BufferedWriter; |
||||||
|
import java.io.ByteArrayInputStream; |
||||||
|
import java.io.ByteArrayOutputStream; |
||||||
|
import java.io.File; |
||||||
|
import java.io.FileInputStream; |
||||||
|
import java.io.FileNotFoundException; |
||||||
|
import java.io.FileOutputStream; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.io.InputStreamReader; |
||||||
|
import java.io.OutputStreamWriter; |
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Starryi |
||||||
|
* @version 10.0.18 |
||||||
|
* Created by Starryi on 2021/7/7 |
||||||
|
* 设计器访问和获取关键历史交互信息的持久化工具,该关键历史交互信息, |
||||||
|
* 如用户是否点击过某按钮,是否查看过某弹窗信息,上次选择过的文件所在目录等 |
||||||
|
*/ |
||||||
|
@Compatible |
||||||
|
public class DesignerInteractionHistory implements XMLReadable, XMLWriter { |
||||||
|
|
||||||
|
private static final String FILE_NAME = "designer.ix.history.info"; |
||||||
|
private static final String ROOT_TAG = "History"; |
||||||
|
|
||||||
|
private static DesignerInteractionHistory history; |
||||||
|
public static DesignerInteractionHistory getInstance() { |
||||||
|
if (history == null) { |
||||||
|
history = new DesignerInteractionHistory(); |
||||||
|
|
||||||
|
readXMLFile(history, history.getHistoryFile()); |
||||||
|
} |
||||||
|
|
||||||
|
return history; |
||||||
|
} |
||||||
|
|
||||||
|
private File getHistoryFile() { |
||||||
|
return new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), FILE_NAME)); |
||||||
|
} |
||||||
|
|
||||||
|
private static void readXMLFile(XMLReadable xmlReadable, File xmlFile) { |
||||||
|
if (xmlFile == null || !xmlFile.exists()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
String charset = EncodeConstants.ENCODING_UTF_8; |
||||||
|
try { |
||||||
|
String decodeContent = getFileContent(xmlFile); |
||||||
|
InputStream xmlInputStream = new ByteArrayInputStream(decodeContent.getBytes(charset)); |
||||||
|
InputStreamReader inputStreamReader = new InputStreamReader(xmlInputStream, charset); |
||||||
|
|
||||||
|
XMLableReader xmlReader = XMLableReader.createXMLableReader(inputStreamReader); |
||||||
|
|
||||||
|
if (xmlReader != null) { |
||||||
|
xmlReader.readXMLObject(xmlReadable); |
||||||
|
} |
||||||
|
xmlInputStream.close(); |
||||||
|
} catch (IOException | XMLStreamException e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private static String getFileContent(File xmlFile) throws FileNotFoundException, UnsupportedEncodingException { |
||||||
|
InputStream encodeInputStream = new FileInputStream(xmlFile); |
||||||
|
return IOUtils.inputStream2String(encodeInputStream); |
||||||
|
} |
||||||
|
|
||||||
|
private static void writeContentToFile(String fileContent, File file) { |
||||||
|
try (FileOutputStream fos = new FileOutputStream(file); |
||||||
|
OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); |
||||||
|
BufferedWriter bw = new BufferedWriter(osw)) { |
||||||
|
bw.write(fileContent); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void saveXMLFile() { |
||||||
|
File xmlFile = this.getHistoryFile(); |
||||||
|
try { |
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
||||||
|
XMLTools.writeOutputStreamXML(this, out); |
||||||
|
out.flush(); |
||||||
|
out.close(); |
||||||
|
String fileContent = new String(out.toByteArray(), StandardCharsets.UTF_8); |
||||||
|
writeContentToFile(fileContent, xmlFile); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private static final String HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP = "hasShownShiftDragResizingTooltip"; |
||||||
|
private static final String LAST_SELECTED_BORDER_IMAGE_DIR = "lastSelectedBorderImageDir"; |
||||||
|
|
||||||
|
// 是否已展示过按下Shift键可锁定比例拖拽尺寸的Tooltip
|
||||||
|
private boolean hasShownShiftDragResizingTooltip = false; |
||||||
|
// 用户上次通过文件选择器选择的边框图片所在目录
|
||||||
|
private String lastSelectedBorderImageDir = StringUtils.EMPTY; |
||||||
|
|
||||||
|
public boolean isHasShownShiftDragResizingTooltip() { |
||||||
|
return hasShownShiftDragResizingTooltip; |
||||||
|
} |
||||||
|
|
||||||
|
public void setHasShownShiftDragResizingTooltip(boolean shown) { |
||||||
|
this.hasShownShiftDragResizingTooltip = shown; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLastSelectedBorderImageDir() { |
||||||
|
return lastSelectedBorderImageDir; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLastSelectedBorderImageDir(String dirPath) { |
||||||
|
this.lastSelectedBorderImageDir = dirPath; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void writeXML(XMLPrintWriter writer) { |
||||||
|
writer.startTAG(ROOT_TAG) |
||||||
|
.attr(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, isHasShownShiftDragResizingTooltip()) |
||||||
|
.attr(LAST_SELECTED_BORDER_IMAGE_DIR, getLastSelectedBorderImageDir()) |
||||||
|
.end(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void readXML(XMLableReader reader) { |
||||||
|
setHasShownShiftDragResizingTooltip(reader.getAttrAsBoolean(HAS_SHOWN_SHIFT_DRAG_RESIZING_TOOLTIP, false)); |
||||||
|
setLastSelectedBorderImageDir(reader.getAttrAsString(LAST_SELECTED_BORDER_IMAGE_DIR, StringUtils.EMPTY)); |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 468 B |
After Width: | Height: | Size: 280 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 145 B |
After Width: | Height: | Size: 141 B |
After Width: | Height: | Size: 155 B |
After Width: | Height: | Size: 141 B |
After Width: | Height: | Size: 140 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 225 B |
After Width: | Height: | Size: 229 B |
After Width: | Height: | Size: 226 B |
After Width: | Height: | Size: 229 B |
After Width: | Height: | Size: 255 B |
After Width: | Height: | Size: 220 B |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 281 B |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,21 @@ |
|||||||
|
package com.fr.van.chart.designer.style; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by eason on 2016/12/14. |
||||||
|
*/ |
||||||
|
public class VanLegendPaneWidthOutFixedCheck extends VanChartPlotLegendPane{ |
||||||
|
|
||||||
|
public VanLegendPaneWidthOutFixedCheck(){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public VanLegendPaneWidthOutFixedCheck(VanChartStylePane parent){ |
||||||
|
super(parent); |
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel createLegendPane(){ |
||||||
|
return this.createLegendPaneWithoutFixedCheck(); |
||||||
|
} |
||||||
|
} |
@ -1,21 +0,0 @@ |
|||||||
package com.fr.van.chart.designer.style; |
|
||||||
|
|
||||||
import javax.swing.JPanel; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by eason on 2016/12/14. |
|
||||||
*/ |
|
||||||
public class VanLegendPaneWidthOutHighlight extends VanChartPlotLegendPane{ |
|
||||||
|
|
||||||
public VanLegendPaneWidthOutHighlight(){ |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public VanLegendPaneWidthOutHighlight(VanChartStylePane parent){ |
|
||||||
super(parent); |
|
||||||
} |
|
||||||
|
|
||||||
protected JPanel createLegendPane(){ |
|
||||||
return this.createLegendPaneWithoutHighlight(); |
|
||||||
} |
|
||||||
} |
|