|
|
|
@ -76,6 +76,7 @@ import java.net.MalformedURLException;
|
|
|
|
|
import java.net.URL; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
public class FileTableDataPane extends AbstractTableDataPane<FileTableData> { |
|
|
|
|
private static final int TEXT = 0; |
|
|
|
@ -217,6 +218,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ActionListener testConnectionListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent arg0) { |
|
|
|
|
String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params); |
|
|
|
|
if (!checkURL(uri)) { |
|
|
|
@ -249,6 +251,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
JPanel previewPanel = new JPanel(new BorderLayout()); |
|
|
|
|
UIButton preview = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); |
|
|
|
|
preview.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
preview(); |
|
|
|
|
} |
|
|
|
@ -264,7 +267,6 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
JPanel northTopPane = new JPanel(new BorderLayout(8, 8)); |
|
|
|
|
JPanel southPane = new JPanel(new BorderLayout(8, 8)); |
|
|
|
|
JPanel southTopPane = new JPanel(new BorderLayout(8, 8)); |
|
|
|
|
JPanel westPane = new JPanel(new BorderLayout()); |
|
|
|
|
controlPane.setLayout(new BorderLayout(8, 8)); |
|
|
|
|
controlPane.setPreferredSize(new Dimension(width, height)); |
|
|
|
|
JPanel comboboxPanel = new JPanel(new BorderLayout(8, 8)); |
|
|
|
@ -321,6 +323,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
* |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void checkValid() throws Exception { |
|
|
|
|
if (urlFileRadioButton.isSelected()) { |
|
|
|
|
String url = urlText.getText().trim(); |
|
|
|
@ -356,8 +359,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
private void addToNorthPane(JPanel northPane) { |
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double columnSize[] = {f, p, p}; |
|
|
|
|
double rowSize[] = {B, B, B, B, B, B, B}; |
|
|
|
|
double[] columnSize = {f, p, p}; |
|
|
|
|
double[] rowSize = {B, B, B, B, B, B, B}; |
|
|
|
|
needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), true); |
|
|
|
|
dismenberLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Dismenber") + ":"); |
|
|
|
|
tableDismemberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Table_Dismember"), false); |
|
|
|
@ -402,6 +405,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private ActionListener radioActionListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
if (localFileRadioButton.isSelected()) { |
|
|
|
|
localRadioSelectAction(); |
|
|
|
@ -456,8 +460,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
|
|
|
|
|
private String[] getFileSuffix() { |
|
|
|
|
List<String> suffixList = new ArrayList<String>(); |
|
|
|
|
String suffix = fileTypeComboBox.getSelectedItem().toString().toLowerCase(); |
|
|
|
|
if (suffix.equalsIgnoreCase("excel")) { |
|
|
|
|
String suffix = Objects.requireNonNull(fileTypeComboBox.getSelectedItem()).toString().toLowerCase(); |
|
|
|
|
if ("excel".equalsIgnoreCase(suffix)) { |
|
|
|
|
suffixList.add("xls"); |
|
|
|
|
suffixList.add("xlsx"); |
|
|
|
|
} else { |
|
|
|
@ -467,8 +471,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getFileSuffixToString() { |
|
|
|
|
String suffixToString = fileTypeComboBox.getSelectedItem().toString().toLowerCase(); |
|
|
|
|
if (suffixToString.equalsIgnoreCase("excel")) { |
|
|
|
|
String suffixToString = Objects.requireNonNull(fileTypeComboBox.getSelectedItem()).toString().toLowerCase(); |
|
|
|
|
if ("excel".equalsIgnoreCase(suffixToString)) { |
|
|
|
|
suffixToString = "xls"; |
|
|
|
|
} |
|
|
|
|
return suffixToString; |
|
|
|
@ -476,6 +480,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
|
|
|
|
|
private ActionListener getFileTypeListener(final JPanel setPanel, final int width, final int height) { |
|
|
|
|
ActionListener fileTypeListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
setPanel.removeAll(); |
|
|
|
|
localText.setText(""); |
|
|
|
@ -503,6 +508,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
String[] paramTexts = new String[1]; |
|
|
|
|
paramTexts[0] = getFilePathFromUrlOrLocal(); |
|
|
|
@ -817,6 +823,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
xmlNodeTree.waitRefresh(); |
|
|
|
|
xmlNodeTree.refreshData(); |
|
|
|
@ -845,6 +852,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private MouseListener treeMouseListener = new MouseAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void mousePressed(MouseEvent e) { |
|
|
|
|
if (XMLNodeTree.this.getModel() != treeModel) { |
|
|
|
|
return; |
|
|
|
@ -941,6 +949,10 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
loadedTreeModel(); |
|
|
|
|
} |
|
|
|
|
if (treeModel == null) { |
|
|
|
|
FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader."); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (treeModel.getChildCount(treeModel.getRoot()) == 1) { |
|
|
|
|
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(), 0)); |
|
|
|
|
} else { |
|
|
|
@ -986,6 +998,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
|
|
|
|
|
this.layer = layer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void readXML(XMLableReader reader) { |
|
|
|
|
String nodeName; |
|
|
|
|
if (this.layer < 0) { |
|
|
|
|