Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

research/11.0
Bryant 5 years ago
parent
commit
07c249e661
  1. 4
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 8
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  3. 66
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java
  4. 201
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java
  5. 48
      designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java
  6. 2
      designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java
  7. 16
      designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java
  8. 9
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  9. 1
      designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java
  10. 14
      designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java
  11. 3
      designer-base/src/main/java/com/fr/design/gui/UIDefaultTheme.java
  12. 3
      designer-base/src/main/java/com/fr/design/gui/autocomplete/LanguageAwareCompletionProvider.java
  13. 4
      designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java
  14. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UINumberSlidePane.java
  15. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java
  16. 100
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  17. 2
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBoxUI.java
  18. 1
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java
  19. 1
      designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java
  20. 12
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java
  21. 51
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  22. 27
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  23. 5
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  24. 6
      designer-base/src/main/java/com/fr/design/gui/ilable/MultilineLabel.java
  25. 4
      designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java
  26. 16
      designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java
  27. 12
      designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java
  28. 6
      designer-base/src/main/java/com/fr/design/layout/TableLayout.java
  29. 22
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java
  30. 69
      designer-base/src/main/java/com/fr/design/report/WatermarkPane.java
  31. 10
      designer-base/src/main/java/com/fr/design/web/CustomIconPane.java
  32. 116
      designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java
  33. 13
      designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java
  34. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java
  35. 1
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java
  36. 19
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  37. 92
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java
  38. 18
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java
  39. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java
  40. 12
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  41. 18
      designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java
  42. 20
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java

4
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -263,6 +263,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error("Map Save Error"); FineLoggerFactory.getLogger().error("Map Save Error");
Thread.currentThread().interrupt();
} }
} }
} }
@ -658,9 +659,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/ */
public void saveXMLFile() { public void saveXMLFile() {
File xmlFile = this.getDesignerEnvFile(); File xmlFile = this.getDesignerEnvFile();
if (xmlFile == null) {
return;
}
if (!xmlFile.getParentFile().exists()) {//建立目录. if (!xmlFile.getParentFile().exists()) {//建立目录.
StableUtils.mkdirs(xmlFile.getParentFile()); StableUtils.mkdirs(xmlFile.getParentFile());
} }

8
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -46,6 +46,7 @@ import java.awt.event.KeyEvent;
import java.util.EventObject; import java.util.EventObject;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* Coder: zack * Coder: zack
@ -70,6 +71,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
* *
* @return 返回位置 * @return 返回位置
*/ */
@Override
public Location preferredLocation() { public Location preferredLocation() {
return Location.WEST_ABOVE; return Location.WEST_ABOVE;
} }
@ -97,6 +99,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
/** /**
* 响应数据集改变 * 响应数据集改变
*/ */
@Override
public void fireDSChanged() { public void fireDSChanged() {
fireDSChanged(new HashMap<String, String>()); fireDSChanged(new HashMap<String, String>());
} }
@ -107,6 +110,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
* *
* @param map 数据集变化Map * @param map 数据集变化Map
*/ */
@Override
public void fireDSChanged(Map<String, String> map) { public void fireDSChanged(Map<String, String> map) {
DesignTableDataManager.fireDSChanged(map); DesignTableDataManager.fireDSChanged(map);
} }
@ -151,6 +155,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public abstract TableDataTree getDataTree(); public abstract TableDataTree getDataTree();
@Override
public abstract void refreshDockingView(); public abstract void refreshDockingView();
protected void checkButtonEnabled(UpdateAction editAction, UpdateAction previewTableDataAction, UpdateAction removeAction, TableDataSourceOP op, TableDataTree dataTree) { protected void checkButtonEnabled(UpdateAction editAction, UpdateAction previewTableDataAction, UpdateAction removeAction, TableDataSourceOP op, TableDataTree dataTree) {
@ -320,6 +325,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
this.setSmallIcon(this.getTDIcon()); this.setSmallIcon(this.getTDIcon());
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false); dgEdit(getTableDataInstance().creatTableDataPane(), createDsName(getNamePrefix()), false);
} }
@ -400,7 +406,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
data = selectedNO.getObject(); data = selectedNO.getObject();
} }
try { try {
if (((TableDataWrapper) data).getTableData() instanceof StoreProcedure) { if (((TableDataWrapper) Objects.requireNonNull(data)).getTableData() instanceof StoreProcedure) {
((StoreProcedure) (((TableDataWrapper) data).getTableData())).resetDataModelList(); ((StoreProcedure) (((TableDataWrapper) data).getTableData())).resetDataModelList();
if (data instanceof StoreProcedureDataWrapper) { if (data instanceof StoreProcedureDataWrapper) {
StoreProcedureDataWrapper oldSdw = ((StoreProcedureDataWrapper) data); StoreProcedureDataWrapper oldSdw = ((StoreProcedureDataWrapper) data);

66
designer-base/src/main/java/com/fr/design/data/datapane/TableDataSourceOP.java

@ -56,14 +56,18 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
return DesignTableDataManager.getEditingDataSet(tc.getBook()); return DesignTableDataManager.getEditingDataSet(tc.getBook());
} }
List<Map<String, TableDataWrapper>> empty = new ArrayList<Map<String, TableDataWrapper>>(); List<Map<String, TableDataWrapper>> empty = new ArrayList<Map<String, TableDataWrapper>>();
empty.add(Collections.<String, TableDataWrapper>emptyMap());//数据集 //数据集
empty.add(Collections.<String, TableDataWrapper>emptyMap());//服务器数据集 empty.add(Collections.<String, TableDataWrapper>emptyMap());
empty.add(Collections.<String, TableDataWrapper>emptyMap());//存储过程 //服务器数据集
empty.add(Collections.<String, TableDataWrapper>emptyMap());
//存储过程
empty.add(Collections.<String, TableDataWrapper>emptyMap());
return empty; return empty;
} }
/** /**
* ButtonEnabled intercept * ButtonEnabled intercept
*
* @return interceptbuttonEnabled * @return interceptbuttonEnabled
*/ */
@Override @Override
@ -73,8 +77,10 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
/** /**
* 移除名字是name的TableData * 移除名字是name的TableData
*
* @param name tabledata name * @param name tabledata name
*/ */
@Override
public void removeAction(String name) { public void removeAction(String name) {
if (tc != null) { if (tc != null) {
TableDataSource tds = tc.getBook(); TableDataSource tds = tc.getBook();
@ -85,7 +91,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
} }
protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, TableDataWrapper> map) { protected ExpandMutableTreeNode[] getNodeArrayFromMap(Map<String, TableDataWrapper> map) {
List<ExpandMutableTreeNode> dataList = new ArrayList<ExpandMutableTreeNode>(); List<ExpandMutableTreeNode> dataList = new ArrayList<>();
Iterator<Entry<String, TableDataWrapper>> entryIt = map.entrySet().iterator(); Iterator<Entry<String, TableDataWrapper>> entryIt = map.entrySet().iterator();
while (entryIt.hasNext()) { while (entryIt.hasNext()) {
Entry<String, TableDataWrapper> entry = entryIt.next(); Entry<String, TableDataWrapper> entry = entryIt.next();
@ -96,7 +102,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
dataList.add(newChildTreeNode); dataList.add(newChildTreeNode);
newChildTreeNode.add(new ExpandMutableTreeNode()); newChildTreeNode.add(new ExpandMutableTreeNode());
} }
return dataList.toArray(new ExpandMutableTreeNode[dataList.size()]); return dataList.toArray(new ExpandMutableTreeNode[0]);
} }
private ExpandMutableTreeNode initTemplateDataNode(Map<String, TableDataWrapper> templateDataMap) { private ExpandMutableTreeNode initTemplateDataNode(Map<String, TableDataWrapper> templateDataMap) {
@ -124,22 +130,20 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
*/ */
@Override @Override
public ExpandMutableTreeNode[] load() { public ExpandMutableTreeNode[] load() {
Map<String, TableDataWrapper> templateDataMap = null; Map<String, TableDataWrapper> templateDataMap;
Map<String, TableDataWrapper> serverDataMap = null; Map<String, TableDataWrapper> serverDataMap;
Map<String, TableDataWrapper> storeProcedureMap = null; Map<String, TableDataWrapper> storeProcedureMap;
if (this != null) { templateDataMap = this.init().get(0);
templateDataMap = this.init().get(0); serverDataMap = this.init().get(1);
serverDataMap = this.init().get(1); storeProcedureMap = this.init().get(2);
storeProcedureMap = this.init().get(2);
} else { //所有的数据集
templateDataMap = Collections.emptyMap(); List<ExpandMutableTreeNode> list = new ArrayList<>();
serverDataMap = Collections.emptyMap(); //模板数据集
storeProcedureMap = Collections.emptyMap(); List<ExpandMutableTreeNode> templist = new ArrayList<>();
} //服务器数据集
List<ExpandMutableTreeNode> list = new ArrayList<ExpandMutableTreeNode>(); //所有的数据集 List<ExpandMutableTreeNode> serverlist = new ArrayList<>();
List<ExpandMutableTreeNode> templist = new ArrayList<ExpandMutableTreeNode>(); //模板数据集
List<ExpandMutableTreeNode> serverlist = new ArrayList<ExpandMutableTreeNode>(); //服务器数据集
list.add(initTemplateDataNode(templateDataMap)); list.add(initTemplateDataNode(templateDataMap));
addNodeToList(templateDataMap, templist); addNodeToList(templateDataMap, templist);
@ -160,11 +164,11 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
} }
switch (dataMode) { switch (dataMode) {
case TEMPLATE_TABLE_DATA: case TEMPLATE_TABLE_DATA:
return templist.toArray(new ExpandMutableTreeNode[templist.size()]); return templist.toArray(new ExpandMutableTreeNode[0]);
case SERVER_TABLE_DATA: case SERVER_TABLE_DATA:
return serverlist.toArray(new ExpandMutableTreeNode[serverlist.size()]); return serverlist.toArray(new ExpandMutableTreeNode[0]);
default: default:
return list.toArray(new ExpandMutableTreeNode[list.size()]); return list.toArray(new ExpandMutableTreeNode[0]);
} }
} }
@ -182,7 +186,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
} }
protected void setStoreProcedureTree(TableData tableData, ExpandMutableTreeNode tmpNode) { protected void setStoreProcedureTree(TableData tableData, ExpandMutableTreeNode tmpNode) {
ArrayList<String> nodeName = new ArrayList<String>(); ArrayList<String> nodeName = new ArrayList<>();
StoreProcedure storeProcedure = (StoreProcedure) tableData; StoreProcedure storeProcedure = (StoreProcedure) tableData;
String name = ((NameObject) tmpNode.getUserObject()).getName(); String name = ((NameObject) tmpNode.getUserObject()).getName();
StoreProcedureParameter[] parameters = StoreProcedure.getSortPara(storeProcedure.getParameters()); StoreProcedureParameter[] parameters = StoreProcedure.getSortPara(storeProcedure.getParameters());
@ -208,13 +212,13 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
} }
if (!resultNames.isEmpty()) { if (!resultNames.isEmpty()) {
for (int i = 0; i < resultNames.size(); i++) { for (String resultName : resultNames) {
if (!nodeName.contains(resultNames.get(i))) { if (!nodeName.contains(resultName)) {
nodeName.add(resultNames.get(i)); nodeName.add(resultName);
hasChild = true; hasChild = true;
String parameterName = name + "_" + resultNames.get(i); String parameterName = name + "_" + resultName;
TableDataWrapper newTwd = new StoreProcedureDataWrapper(storeProcedure, name, parameterName, false); TableDataWrapper newTwd = new StoreProcedureDataWrapper(storeProcedure, name, parameterName, false);
ExpandMutableTreeNode newChildNode = new ExpandMutableTreeNode(new NameObject(resultNames.get(i), newTwd)); ExpandMutableTreeNode newChildNode = new ExpandMutableTreeNode(new NameObject(resultName, newTwd));
newChildNode.add(new ExpandMutableTreeNode()); newChildNode.add(new ExpandMutableTreeNode());
tmpNode.add(newChildNode); tmpNode.add(newChildNode);
} }
@ -230,7 +234,7 @@ public class TableDataSourceOP implements UserObjectOP<TableDataWrapper> {
public void setDataMode(int i) { public void setDataMode(int i) {
this.dataMode = i; dataMode = i;
} }
public int getDataMode() { public int getDataMode() {

201
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/FileTableDataPane.java

@ -76,6 +76,7 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
public class FileTableDataPane extends AbstractTableDataPane<FileTableData> { public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private static final int TEXT = 0; private static final int TEXT = 0;
@ -126,12 +127,12 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private static final int GAP = 23; private static final int GAP = 23;
public FileTableDataPane(){ public FileTableDataPane() {
this(SETPANELWIDTH,WIDTH,HEIGHT,GAP); this(SETPANELWIDTH, WIDTH, HEIGHT, GAP);
} }
public FileTableDataPane(int setPanelWidth,int width,int height,int gap) { public FileTableDataPane(int setPanelWidth, int width, int height, int gap) {
this.setLayout(new BorderLayout(gap,0)); this.setLayout(new BorderLayout(gap, 0));
JPanel northPanel = new JPanel(new BorderLayout()); JPanel northPanel = new JPanel(new BorderLayout());
JPanel type = new JPanel(); JPanel type = new JPanel();
type.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_File_Type") + ":")); type.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_File_Type") + ":"));
@ -163,16 +164,16 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
southPanel.add(setPanel, BorderLayout.CENTER); southPanel.add(setPanel, BorderLayout.CENTER);
setPanel.setPreferredSize(new Dimension(setPanelWidth, 460)); setPanel.setPreferredSize(new Dimension(setPanelWidth, 460));
setPanel.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"))); setPanel.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set")));
JPanel controlPane = textSetPanel(width,height); JPanel controlPane = textSetPanel(width, height);
setPanel.add(controlPane, BorderLayout.NORTH); setPanel.add(controlPane, BorderLayout.NORTH);
fileTypeComboBox.addActionListener(getFileTypeListener(setPanel,width,height)); fileTypeComboBox.addActionListener(getFileTypeListener(setPanel, width, height));
this.add(northPanel, BorderLayout.NORTH); this.add(northPanel, BorderLayout.NORTH);
this.add(centerPanel, BorderLayout.CENTER); this.add(centerPanel, BorderLayout.CENTER);
this.add(southPanel, BorderLayout.EAST); this.add(southPanel, BorderLayout.EAST);
} }
private void addToCenterPanel(JPanel centerPanel){ private void addToCenterPanel(JPanel centerPanel) {
localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Local_File") + ":", true); localFileRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Local_File") + ":", true);
urlFileRadioButton = new UIRadioButton("URL:", false); urlFileRadioButton = new UIRadioButton("URL:", false);
ButtonGroup bg = new ButtonGroup(); ButtonGroup bg = new ButtonGroup();
@ -217,8 +218,9 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
private ActionListener testConnectionListener = new ActionListener() { private ActionListener testConnectionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) { public void actionPerformed(ActionEvent arg0) {
String uri = ParameterHelper.analyze4Templatee( urlText.getText(), params); String uri = ParameterHelper.analyze4Templatee(urlText.getText(), params);
if (!checkURL(uri)) { if (!checkURL(uri)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning")); JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(FileTableDataPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Add_JS_warning"));
return; return;
@ -245,10 +247,11 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
}; };
private void previewPanel(JPanel jPanel){ private void previewPanel(JPanel jPanel) {
JPanel previewPanel = new JPanel(new BorderLayout()); JPanel previewPanel = new JPanel(new BorderLayout());
UIButton preview = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); UIButton preview = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"));
preview.addActionListener(new ActionListener() { preview.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
preview(); preview();
} }
@ -257,48 +260,47 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
jPanel.add(previewPanel, BorderLayout.SOUTH); jPanel.add(previewPanel, BorderLayout.SOUTH);
} }
private JPanel xmlSetPanel(int width,int height) { private JPanel xmlSetPanel(int width, int height) {
// xml设置pane // xml设置pane
JPanel controlPane = new JPanel(); JPanel controlPane = new JPanel();
JPanel northPane = new JPanel(new BorderLayout(8,8)); JPanel northPane = new JPanel(new BorderLayout(8, 8));
JPanel northTopPane = new JPanel(new BorderLayout(8,8)); JPanel northTopPane = new JPanel(new BorderLayout(8, 8));
JPanel southPane = new JPanel(new BorderLayout(8,8)); JPanel southPane = new JPanel(new BorderLayout(8, 8));
JPanel southTopPane = 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.setLayout(new BorderLayout(8,8));
controlPane.setPreferredSize(new Dimension(width, height)); controlPane.setPreferredSize(new Dimension(width, height));
JPanel comboboxPanel = new JPanel(new BorderLayout(8,8)); JPanel comboboxPanel = new JPanel(new BorderLayout(8, 8));
encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":"); encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":");
encodingComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); encodingComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
encodingComboBox.setSelectedIndex(4); encodingComboBox.setSelectedIndex(4);
encodingComboBox.setPreferredSize(new Dimension(90, 20)); encodingComboBox.setPreferredSize(new Dimension(90, 20));
JPanel treeContainerPane = new JPanel(); JPanel treeContainerPane = new JPanel();
treeContainerPane.setLayout(new BorderLayout(8,8)); treeContainerPane.setLayout(new BorderLayout(8, 8));
nodeTreePane = new XMLNodeTreePane(); nodeTreePane = new XMLNodeTreePane();
treeContainerPane.add(nodeTreePane,BorderLayout.CENTER); treeContainerPane.add(nodeTreePane, BorderLayout.CENTER);
comboboxPanel.add(encodeLabel, BorderLayout.WEST); comboboxPanel.add(encodeLabel, BorderLayout.WEST);
comboboxPanel.add(encodingComboBox, BorderLayout.CENTER); comboboxPanel.add(encodingComboBox, BorderLayout.CENTER);
northPane.add(comboboxPanel,BorderLayout.EAST); northPane.add(comboboxPanel, BorderLayout.EAST);
northTopPane.add(northPane,BorderLayout.WEST); northTopPane.add(northPane, BorderLayout.WEST);
southTopPane.add(southPane,BorderLayout.WEST); southTopPane.add(southPane, BorderLayout.WEST);
southTopPane.add(treeContainerPane,BorderLayout.CENTER); southTopPane.add(treeContainerPane, BorderLayout.CENTER);
controlPane.add(northTopPane, BorderLayout.NORTH); controlPane.add(northTopPane, BorderLayout.NORTH);
controlPane.add(southTopPane,BorderLayout.CENTER); controlPane.add(southTopPane, BorderLayout.CENTER);
previewPanel(controlPane); previewPanel(controlPane);
return controlPane; return controlPane;
} }
private JPanel excelSetPanel(int width,int height) { private JPanel excelSetPanel(int width, int height) {
// excel设置pane // excel设置pane
int checkBoxWidth = width - EIGHT; int checkBoxWidth = width - EIGHT;
JPanel controlPane = new JPanel(); JPanel controlPane = new JPanel();
JPanel northPane = new JPanel(new BorderLayout(8,8)); JPanel northPane = new JPanel(new BorderLayout(8, 8));
controlPane.setLayout(new BorderLayout()); controlPane.setLayout(new BorderLayout());
controlPane.setPreferredSize(new Dimension(width,height)); controlPane.setPreferredSize(new Dimension(width, height));
needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), false); needColumnNameCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FirstRow_IS_Column_Name"), false);
needColumnNameCheckBox.setPreferredSize(new Dimension(checkBoxWidth, 20)); needColumnNameCheckBox.setPreferredSize(new Dimension(checkBoxWidth, 20));
northPane.add(needColumnNameCheckBox, BorderLayout.EAST); northPane.add(needColumnNameCheckBox, BorderLayout.EAST);
@ -321,6 +323,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
* *
* @throws Exception * @throws Exception
*/ */
@Override
public void checkValid() throws Exception { public void checkValid() throws Exception {
if (urlFileRadioButton.isSelected()) { if (urlFileRadioButton.isSelected()) {
String url = urlText.getText().trim(); String url = urlText.getText().trim();
@ -331,33 +334,33 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
private boolean checkURL(String uri){ private boolean checkURL(String uri) {
try { try {
new URL(uri); new URL(uri);
return true; return true;
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
return false; return false;
} }
// return (uri.matches("https*://.+|\\$\\{.+\\}.*")); // return (uri.matches("https*://.+|\\$\\{.+\\}.*"));
} }
private JPanel textSetPanel(int width,int height) { private JPanel textSetPanel(int width, int height) {
// text设置pane // text设置pane
JPanel controlPane = new JPanel(); JPanel controlPane = new JPanel();
controlPane.setLayout(new BorderLayout()); controlPane.setLayout(new BorderLayout());
controlPane.setPreferredSize(new Dimension(width,height)); controlPane.setPreferredSize(new Dimension(width, height));
JPanel northPane = new JPanel(new BorderLayout(8,8)); JPanel northPane = new JPanel(new BorderLayout(8, 8));
addToNorthPane(northPane); addToNorthPane(northPane);
controlPane.add(northPane,BorderLayout.WEST); controlPane.add(northPane, BorderLayout.WEST);
previewPanel(controlPane); previewPanel(controlPane);
return controlPane; return controlPane;
} }
private void addToNorthPane(JPanel northPane){ private void addToNorthPane(JPanel northPane) {
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double columnSize[] = {f, p, p}; double[] columnSize = {f, p, p};
double rowSize[] = {B, B, B, B, B, B, B}; 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); 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") + ":"); 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); tableDismemberRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Table_Dismember"), false);
@ -390,18 +393,19 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":"); encodeLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Encoding_Type") + ":");
charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY); charsetComboBox = new UIComboBox(EncodeConstants.ALL_ENCODING_ARRAY);
Component[][] comps = { Component[][] comps = {
{encodeLabel,charsetComboBox,null}, {encodeLabel, charsetComboBox, null},
{needColumnNameCheckBox,null,null}, {needColumnNameCheckBox, null, null},
{dismenberLabel,tableDismemberRadioButton,null}, {dismenberLabel, tableDismemberRadioButton, null},
{null,spaceDismenberRadioButton,null}, {null, spaceDismenberRadioButton, null},
{null,commaDismenberRadioButton,null}, {null, commaDismenberRadioButton, null},
{null,otherDismenberRadioButton,otherDismenberTextField}, {null, otherDismenberRadioButton, otherDismenberTextField},
{ignoreOneMoreDelimiterCheckBox,null,null} {ignoreOneMoreDelimiterCheckBox, null, null}
}; };
northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize),BorderLayout.EAST); northPane.add(TableLayoutHelper.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.EAST);
} }
private ActionListener radioActionListener = new ActionListener() { private ActionListener radioActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (localFileRadioButton.isSelected()) { if (localFileRadioButton.isSelected()) {
localRadioSelectAction(); localRadioSelectAction();
@ -456,8 +460,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private String[] getFileSuffix() { private String[] getFileSuffix() {
List<String> suffixList = new ArrayList<String>(); List<String> suffixList = new ArrayList<String>();
String suffix = fileTypeComboBox.getSelectedItem().toString().toLowerCase(); String suffix = Objects.requireNonNull(fileTypeComboBox.getSelectedItem()).toString().toLowerCase();
if (suffix.equalsIgnoreCase("excel")) { if ("excel".equalsIgnoreCase(suffix)) {
suffixList.add("xls"); suffixList.add("xls");
suffixList.add("xlsx"); suffixList.add("xlsx");
} else { } else {
@ -467,8 +471,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
private String getFileSuffixToString() { private String getFileSuffixToString() {
String suffixToString = fileTypeComboBox.getSelectedItem().toString().toLowerCase(); String suffixToString = Objects.requireNonNull(fileTypeComboBox.getSelectedItem()).toString().toLowerCase();
if (suffixToString.equalsIgnoreCase("excel")) { if ("excel".equalsIgnoreCase(suffixToString)) {
suffixToString = "xls"; suffixToString = "xls";
} }
return suffixToString; return suffixToString;
@ -476,16 +480,17 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
private ActionListener getFileTypeListener(final JPanel setPanel, final int width, final int height) { private ActionListener getFileTypeListener(final JPanel setPanel, final int width, final int height) {
ActionListener fileTypeListener = new ActionListener() { ActionListener fileTypeListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
setPanel.removeAll(); setPanel.removeAll();
localText.setText(""); localText.setText("");
urlText.setText(""); urlText.setText("");
if (fileTypeComboBox.getSelectedIndex() == XML) { if (fileTypeComboBox.getSelectedIndex() == XML) {
setPanel.add(xmlSetPanel(width,height), BorderLayout.NORTH); setPanel.add(xmlSetPanel(width, height), BorderLayout.NORTH);
} else if (fileTypeComboBox.getSelectedIndex() == EXCEL) { } else if (fileTypeComboBox.getSelectedIndex() == EXCEL) {
setPanel.add(excelSetPanel(width,height), BorderLayout.NORTH); setPanel.add(excelSetPanel(width, height), BorderLayout.NORTH);
} else { } else {
setPanel.add(textSetPanel(width,height), BorderLayout.NORTH); setPanel.add(textSetPanel(width, height), BorderLayout.NORTH);
} }
String tipContent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffixToString() + "<br>" String tipContent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Type_Parameter") + "reportlets/excel/FineReport${abc}." + getFileSuffixToString() + "<br>"
+ "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp<br>" + "&nbsp</body> </html> "; + "http://192.168.100.120:8080/XXServer/Report/excel${abc}.jsp<br>" + "&nbsp</body> </html> ";
@ -503,6 +508,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
String[] paramTexts = new String[1]; String[] paramTexts = new String[1];
paramTexts[0] = getFilePathFromUrlOrLocal(); paramTexts[0] = getFilePathFromUrlOrLocal();
@ -545,25 +551,25 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
setTextField(xtd); setTextField(xtd);
editorPane.populate(xtd.getParams()); editorPane.populate(xtd.getParams());
encodingComboBox.setSelectedItem(xtd.getCharSet()); encodingComboBox.setSelectedItem(xtd.getCharSet());
if (!ComparatorUtils.equals(xtd,new XMLTableData())) { if (!ComparatorUtils.equals(xtd, new XMLTableData())) {
xmlNodeTree.initData(); xmlNodeTree.initData();
String[] path = xtd.getXPath(); String[] path = xtd.getXPath();
String[] paths; String[] paths;
if (path != null && path.length > 0) { if (path != null && path.length > 0) {
DefaultTreeModel treeModel = (DefaultTreeModel)xmlNodeTree.getModel(); DefaultTreeModel treeModel = (DefaultTreeModel) xmlNodeTree.getModel();
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
if (treeModel != null) { if (treeModel != null) {
if(!ComparatorUtils.equals(treeModel.getRoot().toString(),"")){ if (!ComparatorUtils.equals(treeModel.getRoot().toString(), "")) {
paths = new String[path.length - 1]; paths = new String[path.length - 1];
for(int i = 1;i< path.length;i++){ for (int i = 1; i < path.length; i++) {
paths[i -1] = path[i]; paths[i - 1] = path[i];
} }
}else{ } else {
paths = path; paths = path;
root.setUserObject(ROOTTAG); root.setUserObject(ROOTTAG);
} }
if (treeModel.getRoot() instanceof ExpandMutableTreeNode) { if (treeModel.getRoot() instanceof ExpandMutableTreeNode) {
selectNode((ExpandMutableTreeNode)treeModel.getRoot(), 0, paths); selectNode((ExpandMutableTreeNode) treeModel.getRoot(), 0, paths);
if (selectedNode != null) { if (selectedNode != null) {
TreePath treepath = new TreePath(treeModel.getPathToRoot(selectedNode)); TreePath treepath = new TreePath(treeModel.getPathToRoot(selectedNode));
xmlNodeTree.setSelectionPath(treepath); xmlNodeTree.setSelectionPath(treepath);
@ -571,8 +577,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
} }
//防止某种操作导致添加的tag作为root出现。 //防止某种操作导致添加的tag作为root出现。
if(ComparatorUtils.equals(root.toString(),ROOTTAG)){ if (ComparatorUtils.equals(root.toString(), ROOTTAG)) {
root.setUserObject(StringUtils.EMPTY); root.setUserObject(StringUtils.EMPTY);
} }
} }
} }
@ -638,7 +644,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
ttd.setDelimiter(this.showDelimiter()); ttd.setDelimiter(this.showDelimiter());
ttd.setIgnoreOneMoreDelimiter(ignoreOneMoreDelimiterCheckBox.isSelected()); ttd.setIgnoreOneMoreDelimiter(ignoreOneMoreDelimiterCheckBox.isSelected());
ttd.setNeedColumnName(needColumnNameCheckBox.isSelected()); ttd.setNeedColumnName(needColumnNameCheckBox.isSelected());
ttd.setCharset((String)charsetComboBox.getSelectedItem()); ttd.setCharset((String) charsetComboBox.getSelectedItem());
fileTableData = ttd; fileTableData = ttd;
return ttd; return ttd;
} }
@ -667,12 +673,12 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
xmlColumnsList.clear(); xmlColumnsList.clear();
ExpandMutableTreeNode treeNode; ExpandMutableTreeNode treeNode;
boolean flag = true; boolean flag = true;
for(int i = 0;i < selectedNode.getChildCount();i++){ for (int i = 0; i < selectedNode.getChildCount(); i++) {
treeNode = (ExpandMutableTreeNode) selectedNode.getChildAt(i); treeNode = (ExpandMutableTreeNode) selectedNode.getChildAt(i);
if(treeNode.isLeaf()){ if (treeNode.isLeaf()) {
xmlColumnsList.add(treeNode.toString()); xmlColumnsList.add(treeNode.toString());
}else{ } else {
if(flag){ if (flag) {
flag = false; flag = false;
finalSelectedNode = treeNode; finalSelectedNode = treeNode;
leafNode(treeNode); leafNode(treeNode);
@ -692,34 +698,34 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
//wikky:构建树时为了美观把添加的根节点值赋为空显示,现在还得该回去使得预览时能够顺利取到数据。 //wikky:构建树时为了美观把添加的根节点值赋为空显示,现在还得该回去使得预览时能够顺利取到数据。
private String[] getPaths(){ private String[] getPaths() {
TreePath treePath = GUICoreUtils.getTreePath(finalSelectedNode); TreePath treePath = GUICoreUtils.getTreePath(finalSelectedNode);
String path = StringUtils.EMPTY; String path = StringUtils.EMPTY;
if (treePath != null) { if (treePath != null) {
Object[] paths = treePath.getPath(); Object[] paths = treePath.getPath();
for (int i = 0; i < paths.length; i++) { for (int i = 0; i < paths.length; i++) {
path+="/" + paths[i]; path += "/" + paths[i];
} }
} }
if (path.startsWith("/")) { if (path.startsWith("/")) {
path = path.substring(1); path = path.substring(1);
} }
String[] paths = path.split("/"); String[] paths = path.split("/");
if(ComparatorUtils.equals(paths[0],StringUtils.EMPTY)){ if (ComparatorUtils.equals(paths[0], StringUtils.EMPTY)) {
paths[0] = ROOTTAG; paths[0] = ROOTTAG;
} }
return paths; return paths;
} }
private void leafNode(ExpandMutableTreeNode treeNode){ private void leafNode(ExpandMutableTreeNode treeNode) {
boolean flag = true; boolean flag = true;
ExpandMutableTreeNode firstNode; ExpandMutableTreeNode firstNode;
for(int i = 0;i < treeNode.getChildCount();i++){ for (int i = 0; i < treeNode.getChildCount(); i++) {
firstNode = (ExpandMutableTreeNode) treeNode.getChildAt(i); firstNode = (ExpandMutableTreeNode) treeNode.getChildAt(i);
if(firstNode.isLeaf()){ if (firstNode.isLeaf()) {
xmlColumnsList.add(firstNode.toString()); xmlColumnsList.add(firstNode.toString());
}else{ } else {
if(flag){ if (flag) {
flag = false; flag = false;
finalSelectedNode = treeNode; finalSelectedNode = treeNode;
leafNode(firstNode); leafNode(firstNode);
@ -729,16 +735,16 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
private void selectNode(ExpandMutableTreeNode node, int layer, String[] paths) { private void selectNode(ExpandMutableTreeNode node, int layer, String[] paths) {
if (selectedNode != null || node == null){ if (selectedNode != null || node == null) {
return; return;
} }
if (layer < paths.length && paths[layer] != null && ComparatorUtils.equals(paths[layer],node.getUserObject())) { if (layer < paths.length && paths[layer] != null && ComparatorUtils.equals(paths[layer], node.getUserObject())) {
if (layer == paths.length -1) { if (layer == paths.length - 1) {
selectedNode = node; selectedNode = node;
return; return;
} }
for (int i = 0; i < node.getChildCount(); i++) { for (int i = 0; i < node.getChildCount(); i++) {
selectNode((ExpandMutableTreeNode)node.getChildAt(i), layer + 1, paths); selectNode((ExpandMutableTreeNode) node.getChildAt(i), layer + 1, paths);
} }
} }
} }
@ -800,8 +806,8 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
toolbarDef.addShortCut(refreshAction); toolbarDef.addShortCut(refreshAction);
UIToolbar toolBar = ToolBarDef.createJToolBar(); UIToolbar toolBar = ToolBarDef.createJToolBar();
toolbarDef.updateToolBar(toolBar); toolbarDef.updateToolBar(toolBar);
toolbarPanel.add(keyPointLaber,BorderLayout.WEST); toolbarPanel.add(keyPointLaber, BorderLayout.WEST);
toolbarPanel.add(toolBar,BorderLayout.EAST); toolbarPanel.add(toolBar, BorderLayout.EAST);
this.add(toolbarPanel, BorderLayout.NORTH); this.add(toolbarPanel, BorderLayout.NORTH);
} }
@ -817,6 +823,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png"));
} }
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
xmlNodeTree.waitRefresh(); xmlNodeTree.waitRefresh();
xmlNodeTree.refreshData(); xmlNodeTree.refreshData();
@ -845,8 +852,9 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
} }
private MouseListener treeMouseListener = new MouseAdapter() { private MouseListener treeMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
if (XMLNodeTree.this.getModel() != treeModel){ if (XMLNodeTree.this.getModel() != treeModel) {
return; return;
} }
int selRow = XMLNodeTree.this.getRowForLocation(e.getX(), e.getY()); int selRow = XMLNodeTree.this.getRowForLocation(e.getX(), e.getY());
@ -858,12 +866,12 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
return;//没有选中某个树节点,就直接返回啦 return;//没有选中某个树节点,就直接返回啦
} }
Object selObject = selPath.getLastPathComponent(); Object selObject = selPath.getLastPathComponent();
if (selObject instanceof ExpandMutableTreeNode ) { if (selObject instanceof ExpandMutableTreeNode) {
ExpandMutableTreeNode expandMutableTreeNode = (ExpandMutableTreeNode) selObject; ExpandMutableTreeNode expandMutableTreeNode = (ExpandMutableTreeNode) selObject;
if (!expandMutableTreeNode.isLeaf()) { if (!expandMutableTreeNode.isLeaf()) {
selectedNode = expandMutableTreeNode; selectedNode = expandMutableTreeNode;
} else { } else {
selectedNode = (ExpandMutableTreeNode)expandMutableTreeNode.getParent(); selectedNode = (ExpandMutableTreeNode) expandMutableTreeNode.getParent();
} }
} }
} }
@ -906,7 +914,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
DataSource dataSource = null; DataSource dataSource = null;
if (localFileRadioButton.isSelected()) { if (localFileRadioButton.isSelected()) {
String localTextString = StringUtils.trimToNull(localText.getText()); String localTextString = StringUtils.trimToNull(localText.getText());
if(StringUtils.isEmpty(localTextString)){ if (StringUtils.isEmpty(localTextString)) {
FineLoggerFactory.getLogger().info("The file path is empty."); FineLoggerFactory.getLogger().info("The file path is empty.");
loadedTreeModel(); loadedTreeModel();
return; return;
@ -914,7 +922,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
dataSource = new FileDataSource(localTextString, params); dataSource = new FileDataSource(localTextString, params);
} else { } else {
String urlTextString = StringUtils.trimToNull(urlText.getText()); String urlTextString = StringUtils.trimToNull(urlText.getText());
if (StringUtils.isEmpty(urlTextString)){ if (StringUtils.isEmpty(urlTextString)) {
FineLoggerFactory.getLogger().info("The url path is empty."); FineLoggerFactory.getLogger().info("The url path is empty.");
loadedTreeModel(); loadedTreeModel();
return; return;
@ -922,7 +930,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
dataSource = new URLDataSource(urlTextString, params); dataSource = new URLDataSource(urlTextString, params);
} }
try { try {
InputStream in,input; InputStream in, input;
if ((in = dataSource.getSourceStream(params)) != null) { if ((in = dataSource.getSourceStream(params)) != null) {
String xmlString = Utils.inputStream2String(in, (String) encodingComboBox.getSelectedItem()); String xmlString = Utils.inputStream2String(in, (String) encodingComboBox.getSelectedItem());
String stringXml = addTag(xmlString); String stringXml = addTag(xmlString);
@ -941,16 +949,20 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
loadedTreeModel(); loadedTreeModel();
} }
if(treeModel.getChildCount(treeModel.getRoot()) == 1){ if (treeModel == null) {
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(),0)); FineLoggerFactory.getLogger().info("The file is wrong or bad, can not create the XMLReader.");
}else{ return;
}
if (treeModel.getChildCount(treeModel.getRoot()) == 1) {
treeModel = new DefaultTreeModel((ExpandMutableTreeNode) treeModel.getChild(treeModel.getRoot(), 0));
} else {
ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot(); ExpandMutableTreeNode root = (ExpandMutableTreeNode) treeModel.getRoot();
root.setUserObject(StringUtils.EMPTY); root.setUserObject(StringUtils.EMPTY);
} }
this.setModel(treeModel); this.setModel(treeModel);
} }
private void loadedTreeModel(){ private void loadedTreeModel() {
ExpandMutableTreeNode rootTreeNode = new ExpandMutableTreeNode(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loaded_Tree_Model")); ExpandMutableTreeNode rootTreeNode = new ExpandMutableTreeNode(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Loaded_Tree_Model"));
rootTreeNode.setExpanded(false); rootTreeNode.setExpanded(false);
rootTreeNode.setAllowsChildren(false); rootTreeNode.setAllowsChildren(false);
@ -958,14 +970,14 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
XMLNodeTree.this.setModel(loadedTreeModel); XMLNodeTree.this.setModel(loadedTreeModel);
} }
private String addTag(String string){ private String addTag(String string) {
String stringWithTag; String stringWithTag;
int beginIndex = 0; int beginIndex = 0;
int firstIndex = string.indexOf(">"); int firstIndex = string.indexOf(">");
int endIndex = string.length(); int endIndex = string.length();
String firstPart = string.substring(beginIndex,firstIndex + 1); String firstPart = string.substring(beginIndex, firstIndex + 1);
String secondPart = STARTTAG; String secondPart = STARTTAG;
String thirdPart = string.substring(firstIndex + 1,endIndex); String thirdPart = string.substring(firstIndex + 1, endIndex);
String lastPart = ENDTAG; String lastPart = ENDTAG;
stringWithTag = firstPart + secondPart + thirdPart + lastPart; stringWithTag = firstPart + secondPart + thirdPart + lastPart;
return stringWithTag; return stringWithTag;
@ -986,6 +998,7 @@ public class FileTableDataPane extends AbstractTableDataPane<FileTableData> {
this.layer = layer; this.layer = layer;
} }
@Override
public void readXML(XMLableReader reader) { public void readXML(XMLableReader reader) {
String nodeName; String nodeName;
if (this.layer < 0) { if (this.layer < 0) {

48
designer-base/src/main/java/com/fr/design/extra/LoginWebBridge.java

@ -1,6 +1,7 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.base.passport.FinePassportManager; import com.fr.base.passport.FinePassportManager;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.PluginLoginExecutor;
@ -8,47 +9,30 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javafx.concurrent.Task; import javafx.concurrent.Task;
import javafx.scene.web.WebEngine; import javafx.scene.web.WebEngine;
import netscape.javascript.JSObject; import netscape.javascript.JSObject;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.Color; import java.awt.Color;
import java.awt.Desktop; import java.awt.Desktop;
import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.net.URLEncoder; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* @author vito * @author vito
*/ */
public class LoginWebBridge { public class LoginWebBridge {
//默认查询消息时间, 30s
private static final long CHECK_MESSAGE_TIME = 30 * 1000L;
//数据查询正常的标志 ok
private static final String SUCCESS_MESSAGE_STATUS = "ok";
//数据通讯失败
private static final String FAILED_MESSAGE_STATUS = "error";
//最低消息的条数 //最低消息的条数
private static final int MIN_MESSAGE_COUNT = 0; private static final int MIN_MESSAGE_COUNT = 0;
//登录成功
private static final String LOGININ = "0";
//用户名不存在
private static final String USERNAME_NOT_EXSIT = "-1";
//密码错误
private static final String PASSWORD_ERROR = "-2";
//未知错误
private static final String UNKNOWN_ERROR = "-3";
//网络连接失败 //网络连接失败
private static final String NET_FAILED = "-4"; private static final String NET_FAILED = "-4";
//用户名,密码为空 //用户名,密码为空
private static final String LOGIN_INFO_EMPTY = "-5"; private static final String LOGIN_INFO_EMPTY = "-5";
private static final int TIME_OUT = 10000;
private static final String LOGIN_SUCCESS = "ok";
private static final String LOGIN_FAILED = "failed";
private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242); private static final Color LOGIN_BACKGROUND = new Color(184, 220, 242);
private static LoginWebBridge helper; private static LoginWebBridge helper;
//消息条数 //消息条数
@ -131,22 +115,6 @@ public class LoginWebBridge {
return client.isServerAlive(); return client.isServerAlive();
} }
private String encode(String str) {
try {
return URLEncoder.encode(str, EncodeConstants.ENCODING_UTF_8);
} catch (UnsupportedEncodingException e) {
return str;
}
}
private void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/** /**
* 注册页面 * 注册页面
*/ */
@ -178,7 +146,9 @@ public class LoginWebBridge {
*/ */
public void defaultLogin(String username, String password, final JSObject callback) { public void defaultLogin(String username, String password, final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password)); Task<Void> task = new PluginTask<>(webEngine, callback, new PluginLoginExecutor(username, password));
new Thread(task).start(); ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("bbsDefaultLogin"));
es.submit(task);
es.shutdown();
} }
/** /**
@ -250,10 +220,6 @@ public class LoginWebBridge {
} }
} }
public void openUrlAtLocalWebBrowser(WebEngine eng, String url) { public void openUrlAtLocalWebBrowser(WebEngine eng, String url) {
if (url.indexOf("qqLogin.html") > 0) {
return;
}
} }
} }

2
designer-base/src/main/java/com/fr/design/extra/PluginControlPane.java

@ -15,6 +15,7 @@ import com.fr.plugin.manage.control.PluginTaskCallback;
import com.fr.plugin.manage.control.PluginTaskResult; import com.fr.plugin.manage.control.PluginTaskResult;
import com.fr.plugin.view.PluginView; import com.fr.plugin.view.PluginView;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
@ -142,6 +143,7 @@ public class PluginControlPane extends BasicPane {
} }
} }
@Nullable
public PluginView getSelectedPlugin() { public PluginView getSelectedPlugin() {
return (PluginView) pluginList.getSelectedValue(); return (PluginView) pluginList.getSelectedValue();
} }

16
designer-base/src/main/java/com/fr/design/extra/PluginFromStorePane.java

@ -28,8 +28,6 @@ import java.util.List;
* @since 8.0 * @since 8.0
*/ */
public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> { public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<PluginView>, Void> {
private static final int LISTNUM1 = 1;
private static final int LISTNUM100 = 100;
private UILabel errorMsgLabel; private UILabel errorMsgLabel;
private UITabbedPane tabbedPane; private UITabbedPane tabbedPane;
private PluginControlPane controlPane; private PluginControlPane controlPane;
@ -45,6 +43,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @return 创建的页面对象 * @return 创建的页面对象
*/ */
@Override
public JPanel createSuccessPane() { public JPanel createSuccessPane() {
return new PluginStatusCheckCompletePane() { return new PluginStatusCheckCompletePane() {
@ -130,8 +129,8 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @return 插件 * @return 插件
*/ */
@Override
public List<PluginView> loadData() throws Exception { public List<PluginView> loadData() throws Exception {
//Thread.sleep(3000);
return PluginsReaderFromStore.readPlugins(); return PluginsReaderFromStore.readPlugins();
} }
@ -140,6 +139,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @param plugins 插件 * @param plugins 插件
*/ */
@Override
public void loadOnSuccess(List<PluginView> plugins) { public void loadOnSuccess(List<PluginView> plugins) {
controlPane.loadPlugins(plugins); controlPane.loadPlugins(plugins);
tabbedPane.setTitleAt(2, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_All_Plugins") + "(" + plugins.size() + ")"); tabbedPane.setTitleAt(2, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_All_Plugins") + "(" + plugins.size() + ")");
@ -150,10 +150,12 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @param e 异常消息 * @param e 异常消息
*/ */
@Override
public void loadOnFailed(Exception e) { public void loadOnFailed(Exception e) {
errorMsgLabel.setText(e.getCause().getMessage()); errorMsgLabel.setText(e.getCause().getMessage());
} }
@Override
protected void installFromDiskFile() { protected void installFromDiskFile() {
JFileChooser fileChooser = new JFileChooser(); JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
@ -196,10 +198,11 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
} }
if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) { if (StringUtils.isNotEmpty(MarketConfig.getInstance().getBbsUsername())) {
PluginView plugin = controlPane.getSelectedPlugin(); PluginView plugin = controlPane.getSelectedPlugin();
String id = null; if (plugin == null) {
if (plugin != null) { FineLoggerFactory.getLogger().error("selected plugin is null");
id = plugin.getID(); return;
} }
String id = plugin.getID();
try { try {
PluginMarker pluginMarker = PluginMarker.create(id, plugin.getVersion()); PluginMarker pluginMarker = PluginMarker.create(id, plugin.getVersion());
@ -219,6 +222,7 @@ public class PluginFromStorePane extends PluginAbstractLoadingViewPane<List<Plug
* *
* @return 标题字符串 * @return 标题字符串
*/ */
@Override
public String textForLoadingLabel() { public String textForLoadingLabel() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Load_Plugins_From_Server"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Load_Plugins_From_Server");
} }

9
designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java

@ -5,17 +5,15 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.CloudCenter;
import com.fr.general.CommonIOUtils; import com.fr.general.CommonIOUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException;
import com.fr.stable.CommonUtils; import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
@ -280,7 +278,10 @@ public class WebViewDlgHelper {
PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等 PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等
JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE);
} }
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }

1
designer-base/src/main/java/com/fr/design/formula/JavaEditorPane.java

@ -194,6 +194,7 @@ public class JavaEditorPane extends BasicPane {
JOptionPane.showMessageDialog(null, message); JOptionPane.showMessageDialog(null, message);
} catch (InterruptedException e1) { } catch (InterruptedException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
Thread.currentThread().interrupt();
} catch (ExecutionException e1) { } catch (ExecutionException e1) {
FineLoggerFactory.getLogger().error(e1.getMessage(), e1); FineLoggerFactory.getLogger().error(e1.getMessage(), e1);
} }

14
designer-base/src/main/java/com/fr/design/formula/VariableResolverAdapter.java

@ -23,6 +23,7 @@ public abstract class VariableResolverAdapter implements VariableResolver {
* *
* @return 内置参数 * @return 内置参数
*/ */
@Override
public String[] resolveCurReportVariables() { public String[] resolveCurReportVariables() {
String[] variables = new String[]{ String[] variables = new String[]{
ScriptConstants.SUMMARY_TAG + "page_number", ScriptConstants.SUMMARY_TAG + "page_number",
@ -38,10 +39,10 @@ public abstract class VariableResolverAdapter implements VariableResolver {
CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID
}; };
Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG); Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG);
for (BuiltInParametersProvider provider : set) { for (BuiltInParametersProvider provider : set) {
return (String[]) ArrayUtils.addAll(variables, new String[]{ ArrayUtils.addAll(variables, new String[]{
ScriptConstants.DETAIL_TAG + provider.getParametersName() ScriptConstants.DETAIL_TAG + provider.getParametersName()
}); });
} }
return variables; return variables;
} }
@ -65,6 +66,8 @@ public abstract class VariableResolverAdapter implements VariableResolver {
* *
* @return 所有参数 * @return 所有参数
*/ */
@Override
@SuppressWarnings("squid:S2259")
public String[] resolveTableDataParameterVariables() { public String[] resolveTableDataParameterVariables() {
Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA); Parameter[] parameters = getCurrentModeParameters(TABLE_DATA_PARA);
String[] parameterNames = new String[parameters.length]; String[] parameterNames = new String[parameters.length];
@ -79,6 +82,8 @@ public abstract class VariableResolverAdapter implements VariableResolver {
* *
* @return 所有参数 * @return 所有参数
*/ */
@Override
@SuppressWarnings("squid:S2259")
public String[] resolveReportParameterVariables() { public String[] resolveReportParameterVariables() {
Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA); Parameter[] parameters = getCurrentModeParameters(REPORT_DATA_PARA);
String[] parameterNames = new String[parameters.length]; String[] parameterNames = new String[parameters.length];
@ -93,6 +98,7 @@ public abstract class VariableResolverAdapter implements VariableResolver {
* *
* @return 所有参数 * @return 所有参数
*/ */
@Override
public String[] resolveGlobalParameterVariables() { public String[] resolveGlobalParameterVariables() {
// 加上全局的参数 // 加上全局的参数
Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters(); Parameter[] globalParameters = ParameterConfig.getInstance().getGlobalParameters();

3
designer-base/src/main/java/com/fr/design/gui/UIDefaultTheme.java

@ -76,7 +76,6 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("Table.background", ThemeUtils.TEXT_BG_COLOR); table.put("Table.background", ThemeUtils.TEXT_BG_COLOR);
table.put("Table.selectionForeground", ThemeUtils.NORMAL_FOREGROUND); table.put("Table.selectionForeground", ThemeUtils.NORMAL_FOREGROUND);
table.put("Table.selectionBackground", new ColorUIResource(200, 221, 233)); table.put("Table.selectionBackground", new ColorUIResource(200, 221, 233));
table.put("Table.gridColor", new ColorUIResource(200, 221, 233));
table.put("TableHeader.background", new ColorUIResource(229, 229, 229)); table.put("TableHeader.background", new ColorUIResource(229, 229, 229));
table.put("ProgressBar.foreground", ThemeUtils.PROCESS_COLOR); table.put("ProgressBar.foreground", ThemeUtils.PROCESS_COLOR);
table.put("ProgressBar.background", ThemeUtils.TEXT_BG_COLOR); table.put("ProgressBar.background", ThemeUtils.TEXT_BG_COLOR);
@ -85,7 +84,6 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("ProgressBar.selectionForeground", ThemeUtils.NORMAL_FOREGROUND); table.put("ProgressBar.selectionForeground", ThemeUtils.NORMAL_FOREGROUND);
table.put("ProgressBar.selectionBackground", ThemeUtils.NORMAL_FOREGROUND); table.put("ProgressBar.selectionBackground", ThemeUtils.NORMAL_FOREGROUND);
table.put("PopupMenu.background", ThemeUtils.NORMAL_BG); table.put("PopupMenu.background", ThemeUtils.NORMAL_BG);
table.put("TabbedPane.background", ThemeUtils.TEXT_BG_COLOR);
table.put("TabbedPane.background", ThemeUtils.NORMAL_BG); table.put("TabbedPane.background", ThemeUtils.NORMAL_BG);
table.put("TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 0)); table.put("TabbedPane.tabAreaInsets", new InsetsUIResource(4, 2, 0, 0));
table.put("TabbedPane.tabInsets", new InsetsUIResource(1, 6, 4, 6)); table.put("TabbedPane.tabInsets", new InsetsUIResource(1, 6, 4, 6));
@ -108,7 +106,6 @@ public class UIDefaultTheme extends DefaultMetalTheme {
table.put("ComboBox.foreground", ThemeUtils.NORMAL_FOREGROUND); table.put("ComboBox.foreground", ThemeUtils.NORMAL_FOREGROUND);
table.put("ComboBox.background", ThemeUtils.TEXT_BG_COLOR); table.put("ComboBox.background", ThemeUtils.TEXT_BG_COLOR);
table.put("ComboBox.disabledBackground", ThemeUtils.TEXT_DISABLED_BG_COLOR); table.put("ComboBox.disabledBackground", ThemeUtils.TEXT_DISABLED_BG_COLOR);
table.put("EditorPane.background", ThemeUtils.TEXT_BG_COLOR);
table.put("EditorPane.foreground", ThemeUtils.NORMAL_FOREGROUND); table.put("EditorPane.foreground", ThemeUtils.NORMAL_FOREGROUND);
table.put("PasswordField.background", ThemeUtils.TEXT_BG_COLOR); table.put("PasswordField.background", ThemeUtils.TEXT_BG_COLOR);
table.put("PasswordField.foreground", ThemeUtils.NORMAL_FOREGROUND); table.put("PasswordField.foreground", ThemeUtils.NORMAL_FOREGROUND);

3
designer-base/src/main/java/com/fr/design/gui/autocomplete/LanguageAwareCompletionProvider.java

@ -195,6 +195,9 @@ public class LanguageAwareCompletionProvider extends CompletionProviderBase
// provider. We do not do function/method completions while editing // provider. We do not do function/method completions while editing
// strings or comments. // strings or comments.
CompletionProvider provider = getProviderFor(tc); CompletionProvider provider = getProviderFor(tc);
if (provider == null) {
return null;
}
return provider==defaultProvider ? return provider==defaultProvider ?
provider.getParameterizedCompletions(tc) : null; provider.getParameterizedCompletions(tc) : null;
} }

4
designer-base/src/main/java/com/fr/design/gui/autocomplete/ParameterizedCompletionContext.java

@ -517,6 +517,10 @@ class ParameterizedCompletionContext {
} }
} }
if (currentNext == null) {
return;
}
// No params after caret - go to first one // No params after caret - go to first one
if (currentNext.getStartOffset() + 1 <= dot) { if (currentNext.getStartOffset() + 1 <= dot) {
int nextIndex = getFirstHighlight(highlights); int nextIndex = getFirstHighlight(highlights);

3
designer-base/src/main/java/com/fr/design/gui/frpane/UINumberSlidePane.java

@ -14,6 +14,7 @@ import javax.swing.event.ChangeListener;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.gui.style.NumberDragBar; import com.fr.design.gui.style.NumberDragBar;
import com.fr.stable.AssistUtils;
/** /**
* 拖拽的滑条和对应滑条值的数字 * 拖拽的滑条和对应滑条值的数字
@ -65,7 +66,7 @@ public class UINumberSlidePane extends BasicBeanPane<Double> {
public void checkValue(double value) { public void checkValue(double value) {
value = Math.max(value, minValue); value = Math.max(value, minValue);
value = Math.min(value, maxValue); value = Math.min(value, maxValue);
if (this.value == value) { if (AssistUtils.equals(this.value, value)) {
return; return;
} }
double diff = Math.abs(value - this.value); double diff = Math.abs(value - this.value);

3
designer-base/src/main/java/com/fr/design/gui/frpane/UnitInputPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
@ -81,7 +82,7 @@ public abstract class UnitInputPane extends BasicPane {
floatValue = de.floatValue(); floatValue = de.floatValue();
} }
//选中多列, 并且列宽不完全一致的话, 就不显示值了. //选中多列, 并且列宽不完全一致的话, 就不显示值了.
temp.setText(floatValue == 0 ? StringUtils.EMPTY : Utils.convertNumberStringToString(new Float(floatValue))); temp.setText(AssistUtils.equals(floatValue, 0) ? StringUtils.EMPTY : Utils.convertNumberStringToString(new Float(floatValue)));
// denny:默认应该为选中,方便用户修改 // denny:默认应该为选中,方便用户修改
temp.selectAll(); temp.selectAll();

100
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -125,60 +125,58 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
private class UICheckBoxUI extends MetalCheckBoxUI { private class UICheckBoxUI extends MetalCheckBoxUI {
@Override @Override
public void paint(Graphics g, JComponent c) { public synchronized void paint(Graphics g, JComponent c) {
synchronized (this) { AbstractButton b = (AbstractButton) c;
AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel();
ButtonModel model = b.getModel(); Dimension size = c.getSize();
Dimension size = c.getSize(); Font f = c.getFont();
Font f = c.getFont(); g.setFont(f);
g.setFont(f); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
Rectangle viewRect = new Rectangle(size);
Rectangle viewRect = new Rectangle(size); Rectangle iconRect = new Rectangle();
Rectangle iconRect = new Rectangle(); Rectangle textRect = new Rectangle();
Rectangle textRect = new Rectangle();
Insets i = c.getInsets();
Insets i = c.getInsets(); viewRect.x += i.left;
viewRect.x += i.left; viewRect.y += i.top;
viewRect.y += i.top; viewRect.width -= (i.right + viewRect.x);
viewRect.width -= (i.right + viewRect.x); viewRect.height -= (i.bottom + viewRect.y);
viewRect.height -= (i.bottom + viewRect.y);
Icon altIcon = b.getIcon();
Icon altIcon = b.getIcon();
String text = SwingUtilities.layoutCompoundLabel(
String text = SwingUtilities.layoutCompoundLabel( c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(),
c, fm, b.getText(), altIcon != null ? altIcon : getDefaultIcon(), b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect, iconRect, textRect, b.getIconTextGap());
viewRect, iconRect, textRect, b.getIconTextGap());
// fill background
// fill background if (c.isOpaque()) {
if (c.isOpaque()) { g.setColor(b.getBackground());
g.setColor(b.getBackground()); g.fillRect(0, 0, size.width, size.height);
g.fillRect(0, 0, size.width, size.height); }
}
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (model.isSelected()) {
GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height, false, Constants.NULL,
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0);
} else if (model.isRollover() && !model.isSelected()) {
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
} else {
g.setColor(UIConstants.LINE_COLOR);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
}
if (model.isSelected()) { Graphics2D g2d = (Graphics2D) g;
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
} if (model.isSelected()) {
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height, false, Constants.NULL,
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0);
} else if (model.isRollover() && !model.isSelected()) {
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
} else {
g.setColor(UIConstants.LINE_COLOR);
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC);
}
// Draw the Text if (model.isSelected()) {
drawLine(text, g, b, c, textRect, fm); UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2);
} }
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
// Draw the Text
drawLine(text, g, b, c, textRect, fm);
} }
private void drawLine(String text, Graphics g, AbstractButton b, JComponent c, Rectangle textRect, FontMetrics fm) { private void drawLine(String text, Graphics g, AbstractButton b, JComponent c, Rectangle textRect, FontMetrics fm) {

2
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBoxUI.java

@ -64,7 +64,7 @@ public class UICheckBoxUI extends MetalCheckBoxUI {
} }
} }
static BasicStroke focusStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[]{1.0f / 1.0f}, 1.0f); static BasicStroke focusStroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 1.0f, new float[]{1.0f}, 1.0f);
protected void paintFocus(Graphics g, Rectangle t, Dimension arg2) { protected void paintFocus(Graphics g, Rectangle t, Dimension arg2) {
if (!ThemeUtils.BUTTON_FOCUS) { if (!ThemeUtils.BUTTON_FOCUS) {

1
designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBox.java

@ -84,6 +84,7 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
LazyComboBox.this.loadList(get()); LazyComboBox.this.loadList(get());
} catch (InterruptedException | ExecutionException exception) { } catch (InterruptedException | ExecutionException exception) {
FineLoggerFactory.getLogger().debug(exception.getMessage()); FineLoggerFactory.getLogger().debug(exception.getMessage());
Thread.currentThread().interrupt();
} }
LazyComboBox.this.showPopup(); LazyComboBox.this.showPopup();
} }

1
designer-base/src/main/java/com/fr/design/gui/icombobox/LazyComboBoxTest.java

@ -40,6 +40,7 @@ public class LazyComboBoxTest {
Thread.sleep(3000); Thread.sleep(3000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
} }
return m; return m;
} }

12
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBoxButton.java

@ -127,10 +127,6 @@ public class UIComboBoxButton extends JButton {
boolean savedOpaque = false; boolean savedOpaque = false;
paintRender(g, c, mustResetOpaque, savedOpaque, leftToRight, width, insets, iconWidth, left, top, height); paintRender(g, c, mustResetOpaque, savedOpaque, leftToRight, width, insets, iconWidth, left, top, height);
if (mustResetOpaque) {
JComponent jc = (JComponent) c;
jc.setOpaque(savedOpaque);
}
} }
private void paintRender(Graphics g, Component c, boolean mustResetOpaque, boolean savedOpaque, boolean leftToRight, private void paintRender(Graphics g, Component c, boolean mustResetOpaque, boolean savedOpaque, boolean leftToRight,
@ -152,14 +148,6 @@ public class UIComboBoxButton extends JButton {
} else { } else {
rendererPane.paintComponent(g, c, this, left + iconWidth, top, cWidth, height, shouldValidate); rendererPane.paintComponent(g, c, this, left + iconWidth, top, cWidth, height, shouldValidate);
} }
if (paintFocus && ThemeUtils.COMBO_FOCUS) {
g.setColor(Color.black);
Graphics2D g2d = (Graphics2D) g;
Rectangle r = new Rectangle(left, top, 2, 2);
TexturePaint tp = new TexturePaint(focusImg, r);
g2d.setPaint(tp);
g2d.draw(new Rectangle(left, top, cWidth, height));
}
} }
} }

51
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -7,12 +7,25 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*; import javax.swing.JCheckBox;
import java.awt.event.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
public class UICheckListPopup extends UIPopupMenu { public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
@ -66,10 +79,10 @@ public class UICheckListPopup extends UIPopupMenu {
} }
addSelectListener(); addSelectListener();
jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); jScrollPane.setPreferredSize(new Dimension(130, checkBoxList.size() * CHECKBOX_HEIGHT + 10));
//超过1页的数量时显示滚动条 //超过1页的数量时显示滚动条
if (checkBoxList.size() > maxDisplayNumber) { if (checkBoxList.size() > maxDisplayNumber) {
jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT)); jScrollPane.setPreferredSize(new Dimension(130, maxDisplayNumber * CHECKBOX_HEIGHT));
} }
checkboxPane.repaint(); checkboxPane.repaint();
jScrollPane.repaint(); jScrollPane.repaint();
@ -77,11 +90,11 @@ public class UICheckListPopup extends UIPopupMenu {
private void addOneCheckValue(Object checkValue) { private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT)); checkPane.setPreferredSize(new Dimension(120, CHECKBOX_HEIGHT));
final JCheckBox temp = createCheckbox(); final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString()); final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setPreferredSize(new Dimension(156, 20)); label.setPreferredSize(new Dimension(80, 20));
checkPane.setBackground(Color.WHITE); checkPane.setBackground(Color.WHITE);
checkPane.add(temp); checkPane.add(temp);
checkPane.add(label); checkPane.add(label);
@ -95,8 +108,8 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = new JCheckBox(); JCheckBox checkBox = new JCheckBox();
checkBox.setPreferredSize(new Dimension(20, 20)); checkBox.setPreferredSize(new Dimension(20, 20));
checkBox.setBackground(Color.WHITE); checkBox.setBackground(Color.WHITE);
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); checkBox.setIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); checkBox.setSelectedIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
return checkBox; return checkBox;
} }
@ -109,10 +122,12 @@ public class UICheckListPopup extends UIPopupMenu {
*/ */
private void addMouseListener(final JCheckBox checkBox, final UILabel label) { private void addMouseListener(final JCheckBox checkBox, final UILabel label) {
label.addMouseListener(new MouseAdapter() { label.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
} }
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
label.setOpaque(true); label.setOpaque(true);
label.setBackground(mouseEnteredColor); label.setBackground(mouseEnteredColor);
@ -133,6 +148,7 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = checkBoxList.get(i); JCheckBox checkBox = checkBoxList.get(i);
if (i == 0) { if (i == 0) {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//全选checkbox事件 //全选checkbox事件
doSelectAll(checkBoxList.get(0).isSelected()); doSelectAll(checkBoxList.get(0).isSelected());
@ -140,6 +156,7 @@ public class UICheckListPopup extends UIPopupMenu {
}); });
} else { } else {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//do半选判断放在commit事件里 //do半选判断放在commit事件里
commit(); commit();
@ -157,8 +174,17 @@ public class UICheckListPopup extends UIPopupMenu {
private void doSelectAll(boolean isSelected) { private void doSelectAll(boolean isSelected) {
for (int i = 1; i < checkBoxList.size(); i++) { for (int i = 1; i < checkBoxList.size(); i++) {
//全选和反全选都不考虑全选按钮本身 //全选和反全选都不考虑全选按钮本身
if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) {
checkBoxList.get(i).setSelected(isSelected); checkBoxList.get(i).setSelected(isSelected);
}
}
}
public void setSelectedValue(Map<Object, Boolean> selectedValues) {
List<Object> allValue = Arrays.asList(values);
for (Object value : selectedValues.keySet()) {
int index = allValue.indexOf(value);
checkBoxList.get(index + 1).setSelected(selectedValues.get(value));
} }
} }
@ -214,8 +240,9 @@ public class UICheckListPopup extends UIPopupMenu {
} }
public void addActionListener(ActionListener listener) { public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) if (!listeners.contains(listener)) {
listeners.add(listener); listeners.add(listener);
}
} }
public void removeActionListener(ActionListener listener) { public void removeActionListener(ActionListener listener) {

27
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -11,14 +11,23 @@ import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 设计器下拉复选框组件 * 设计器下拉复选框组件
@ -125,7 +134,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private UITextField createEditor() { private UITextField createEditor() {
UITextField editor = new UITextField(); UITextField editor = new UITextField();
editor.setEditable(false); editor.setEditable(false);
editor.setPreferredSize(new Dimension(180, 20)); editor.setPreferredSize(new Dimension(110, 20));
addPopupListener(editor); addPopupListener(editor);
return editor; return editor;
@ -138,6 +147,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
*/ */
private void addPopupListener(Component component) { private void addPopupListener(Component component) {
component.addMouseListener(new MouseAdapter() { component.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
togglePopup(); togglePopup();
} }
@ -166,6 +176,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private class PopupAction implements ActionListener { private class PopupAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) { if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) {
selectedValues = popup.getSelectedValues(); selectedValues = popup.getSelectedValues();
@ -292,13 +303,15 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
public void addActionListener(ActionListener listener) { public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) if (!listeners.contains(listener)) {
listeners.add(listener); listeners.add(listener);
}
} }
public void removeActionListener(ActionListener listener) { public void removeActionListener(ActionListener listener) {
if (listeners.contains(listener)) if (listeners.contains(listener)) {
listeners.remove(listener); listeners.remove(listener);
}
} }
protected void fireActionPerformed(ActionEvent e) { protected void fireActionPerformed(ActionEvent e) {
@ -307,6 +320,10 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
} }
public void setSelectedValues(Map<Object, Boolean> map) {
popup.setSelectedValue(map);
}
/** /**
* 简单的测试demo * 简单的测试demo
* @param args * @param args

5
designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -438,11 +438,6 @@ public class UIResizableContainer extends JPanel {
containerWidth = containerWidth > MAX_WIDTH ? MAX_WIDTH : containerWidth; containerWidth = containerWidth > MAX_WIDTH ? MAX_WIDTH : containerWidth;
containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth; containerWidth = containerWidth < MIN_WIDTH ? MIN_WIDTH : containerWidth;
if (containerWidth < MIN_WIDTH) {
upPane.setVisible(false);
downPane.setVisible(false);
containerWidth = toolPaneHeight;
}
refreshContainer(); refreshContainer();
if (DesignerMode.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize(); DesignerContext.getDesignerFrame().doResize();

6
designer-base/src/main/java/com/fr/design/gui/ilable/MultilineLabel.java

@ -19,15 +19,15 @@ import com.fr.design.gui.itextarea.UITextArea;
*/ */
public class MultilineLabel extends UITextArea { public class MultilineLabel extends UITextArea {
public MultilineLabel() { public MultilineLabel() {
initComponents(); initCurrentComponents();
} }
public MultilineLabel(String s) { public MultilineLabel(String s) {
super(s); super(s);
initComponents(); initCurrentComponents();
} }
private void initComponents() { private void initCurrentComponents() {
adjustUI(); adjustUI();
} }

4
designer-base/src/main/java/com/fr/design/gui/imenu/UIBasicMenuItemUI.java

@ -7,6 +7,7 @@ package com.fr.design.gui.imenu;
import com.fr.design.utils.ColorRoutines; import com.fr.design.utils.ColorRoutines;
import com.fr.design.utils.ThemeUtils; import com.fr.design.utils.ThemeUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.ActionMap; import javax.swing.ActionMap;
@ -579,7 +580,8 @@ public class UIBasicMenuItemUI extends MenuItemUI {
*/ */
private boolean isInternalFrameSystemMenu() { private boolean isInternalFrameSystemMenu() {
String actionCommand = menuItem.getActionCommand(); String actionCommand = menuItem.getActionCommand();
return (actionCommand == "Close") || (actionCommand == "Minimize") || (actionCommand == "Restore") || (actionCommand == "Maximize"); return (StringUtils.equals(actionCommand,"Close") || StringUtils.equals(actionCommand,"Minimize")
|| StringUtils.equals(actionCommand,"Restore") || StringUtils.equals(actionCommand,"Maximize"));
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////

16
designer-base/src/main/java/com/fr/design/gui/iscrollbar/UIScrollBarUI.java

@ -1,5 +1,7 @@
package com.fr.design.gui.iscrollbar; package com.fr.design.gui.iscrollbar;
import com.fr.design.constants.UIConstants;
import com.fr.stable.StringUtils;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
@ -20,7 +22,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import javax.swing.BoundedRangeModel; import javax.swing.BoundedRangeModel;
import javax.swing.InputMap; import javax.swing.InputMap;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -38,8 +39,6 @@ import javax.swing.event.ChangeListener;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.ScrollBarUI; import javax.swing.plaf.ScrollBarUI;
import javax.swing.plaf.UIResource; import javax.swing.plaf.UIResource;
import com.fr.design.constants.UIConstants;
import sun.swing.DefaultLookup; import sun.swing.DefaultLookup;
/** /**
@ -148,6 +147,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* *
* @param c * @param c
*/ */
@Override
public void installUI(JComponent c) { public void installUI(JComponent c) {
scrollbar = (JScrollBar) c; scrollbar = (JScrollBar) c;
thumbRect = new Rectangle(0, 0, 0, 0); thumbRect = new Rectangle(0, 0, 0, 0);
@ -163,6 +163,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* *
* @param c * @param c
*/ */
@Override
public void uninstallUI(JComponent c) { public void uninstallUI(JComponent c) {
scrollbar = (JScrollBar) c; scrollbar = (JScrollBar) c;
uninstallListeners(); uninstallListeners();
@ -357,6 +358,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
/** /**
* 只画Thumb * 只画Thumb
*/ */
@Override
public void paint(Graphics g, JComponent c) { public void paint(Graphics g, JComponent c) {
Rectangle thumbBounds = getThumbBounds(); Rectangle thumbBounds = getThumbBounds();
if (thumbBounds.intersects(g.getClipBounds())) { if (thumbBounds.intersects(g.getClipBounds())) {
@ -380,6 +382,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* @see #getMaximumSize * @see #getMaximumSize
* @see #getMinimumSize * @see #getMinimumSize
*/ */
@Override
public Dimension getPreferredSize(JComponent c) { public Dimension getPreferredSize(JComponent c) {
return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth, 48) : new Dimension(48, scrollBarWidth); return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth, 48) : new Dimension(48, scrollBarWidth);
} }
@ -390,6 +393,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* @see #getMinimumSize * @see #getMinimumSize
* @see #getPreferredSize * @see #getPreferredSize
*/ */
@Override
public Dimension getMaximumSize(JComponent c) { public Dimension getMaximumSize(JComponent c) {
return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
} }
@ -937,6 +941,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
private transient int direction = +1; private transient int direction = +1;
@Override
public void mouseReleased(MouseEvent e) { public void mouseReleased(MouseEvent e) {
isPressing = false; isPressing = false;
if (isDragging) { if (isDragging) {
@ -968,6 +973,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
* one page. If there is no thumb then page up if the mouse is in the * one page. If there is no thumb then page up if the mouse is in the
* upper half of the track. * upper half of the track.
*/ */
@Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
boolean isMiddle = !isSupportsAbsolutePositioning() && SwingUtilities.isMiddleMouseButton(e); boolean isMiddle = !isSupportsAbsolutePositioning() && SwingUtilities.isMiddleMouseButton(e);
if (SwingUtilities.isRightMouseButton(e) || isMiddle) { if (SwingUtilities.isRightMouseButton(e) || isMiddle) {
@ -1313,7 +1319,7 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
public void propertyChange(PropertyChangeEvent e) { public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName(); String propertyName = e.getPropertyName();
if ("model" == propertyName) { if (StringUtils.equals("model", propertyName)) {
BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue(); BoundedRangeModel oldModel = (BoundedRangeModel) e.getOldValue();
BoundedRangeModel newModel = (BoundedRangeModel) e.getNewValue(); BoundedRangeModel newModel = (BoundedRangeModel) e.getNewValue();
oldModel.removeChangeListener(modelListener); oldModel.removeChangeListener(modelListener);
@ -1329,4 +1335,4 @@ public class UIScrollBarUI extends ScrollBarUI implements LayoutManager, SwingCo
} }
} }
} }
} }

12
designer-base/src/main/java/com/fr/design/layout/FRGUIPaneFactory.java

@ -217,6 +217,18 @@ public class FRGUIPaneFactory {
return jp; return jp;
} }
/**
* 创建一个靠左空边框面板间隔小firsthgap 为0
*
* @return JPanel对象
*/
public static JPanel createTinyHGapFlowInnerContainer_M_Pane_First0() {
JPanel jp = new JPanel();
jp.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jp.setLayout(new FRLeftFlowLayout(0, 5, 0));
return jp;
}
/** /**
* 创建一个靠左空边框面板间隔中等 * 创建一个靠左空边框面板间隔中等
* *

6
designer-base/src/main/java/com/fr/design/layout/TableLayout.java

@ -1218,7 +1218,7 @@ public class TableLayout implements LayoutManager2, Serializable {
* @param z indicates row or column * @param z indicates row or column
* @param availableSize amount of space available in the container * @param availableSize amount of space available in the container
*/ */
@SuppressWarnings("squid:S3518")
protected void assignFillSize(int z, int availableSize) { protected void assignFillSize(int z, int availableSize) {
// Skip if there is no more space to allocate // Skip if there is no more space to allocate
if (availableSize <= 0) if (availableSize <= 0)
@ -1290,7 +1290,7 @@ public class TableLayout implements LayoutManager2, Serializable {
* @return the amount of space available after absolute crs have been assigned * @return the amount of space available after absolute crs have been assigned
* sizes * sizes
*/ */
@SuppressWarnings("squid:S3518")
protected int assignPrefMinSize protected int assignPrefMinSize
(int z, int availableSize, double typeOfSize) { (int z, int availableSize, double typeOfSize) {
// Get variables referring to columns or rows (crs) // Get variables referring to columns or rows (crs)
@ -1727,7 +1727,7 @@ public class TableLayout implements LayoutManager2, Serializable {
* *
* @return a dimension indicating the container's preferred or minimum size * @return a dimension indicating the container's preferred or minimum size
*/ */
@SuppressWarnings("squid:S3518")
protected int calculateLayoutSize protected int calculateLayoutSize
(Container container, int z, double typeOfSize, Entry entryList[], (Container container, int z, double typeOfSize, Entry entryList[],
Dimension prefMinSize[]) { Dimension prefMinSize[]) {

22
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/TabIconConfigPane.java

@ -11,6 +11,8 @@ import com.fr.design.web.CustomIconPane;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -33,6 +35,7 @@ import java.util.ArrayList;
public class TabIconConfigPane extends JPanel { public class TabIconConfigPane extends JPanel {
private UIButton editIconButton; private UIButton editIconButton;
private UIButton deleteIconButton;
private String curIconName; private String curIconName;
private IconButton selectIconButton; private IconButton selectIconButton;
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>(); private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>();
@ -43,7 +46,7 @@ public class TabIconConfigPane extends JPanel {
public void initComp(int count) { public void initComp(int count) {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); JPanel panel = FRGUIPaneFactory.createTinyHGapFlowInnerContainer_M_Pane_First0();
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit")); editIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Edit"));
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
@ -63,12 +66,28 @@ public class TabIconConfigPane extends JPanel {
curIconName = cip.update(); curIconName = cip.update();
setShowIconImage(); setShowIconImage();
TabIconConfigPane.this.repaint(); TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(true);
} }
}); });
editDialog.setVisible(true); editDialog.setVisible(true);
} }
}); });
editIconButton.setEnabled(false); editIconButton.setEnabled(false);
deleteIconButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Delete"));
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A")));
deleteIconButton.setPreferredSize(new Dimension(62, 20));
panel.add(deleteIconButton);
deleteIconButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
curIconName = "";
setShowIconImage();
TabIconConfigPane.this.repaint();
deleteIconButton.setEnabled(false);
}
});
deleteIconButton.setEnabled(false);
this.add(panel, BorderLayout.CENTER); this.add(panel, BorderLayout.CENTER);
JPanel northPane = new JPanel(); JPanel northPane = new JPanel();
@ -163,6 +182,7 @@ public class TabIconConfigPane extends JPanel {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
selectIconButton = this; selectIconButton = this;
editIconButton.setEnabled(true); editIconButton.setEnabled(true);
deleteIconButton.setEnabled(StringUtils.isNotEmpty(this.getIconName()));
TabIconConfigPane.this.repaint();// repaint TabIconConfigPane.this.repaint();// repaint
} }

69
designer-base/src/main/java/com/fr/design/report/WatermarkPane.java

@ -6,6 +6,7 @@ import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.style.FRFontPane; import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -14,14 +15,18 @@ import com.fr.design.style.color.NewColorSelectPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.SwingConstants;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import java.awt.Dimension;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
@ -37,9 +42,15 @@ public class WatermarkPane extends BasicPane {
private TinyFormulaPane formulaPane; private TinyFormulaPane formulaPane;
// 字号 // 字号
private UIComboBox fontSizeComboBox; private UIComboBox fontSizeComboBox;
//横向间距
private UISpinner horizontalGapSpinner;
//横向间距
private UISpinner verticalGapSpinner;
// 文字颜色 // 文字颜色
private NewColorSelectPane colorPane; private NewColorSelectPane colorPane;
private static final Dimension SPINNER_DIMENSION = new Dimension(75, 20);
public WatermarkPane() { public WatermarkPane() {
initComponents(); initComponents();
} }
@ -73,6 +84,7 @@ public class WatermarkPane extends BasicPane {
} }
populateFourmula(watermark.getText()); populateFourmula(watermark.getText());
populateFontSize(watermark.getFontSize()); populateFontSize(watermark.getFontSize());
populateWatermarkGap(watermark);
populateColor(watermark.getColor()); populateColor(watermark.getColor());
paintPreviewPane(); paintPreviewPane();
} }
@ -81,6 +93,8 @@ public class WatermarkPane extends BasicPane {
WatermarkAttr watermark = new WatermarkAttr(); WatermarkAttr watermark = new WatermarkAttr();
watermark.setText(formulaPane.getUITextField().getText()); watermark.setText(formulaPane.getUITextField().getText());
watermark.setFontSize((int)fontSizeComboBox.getSelectedItem()); watermark.setFontSize((int)fontSizeComboBox.getSelectedItem());
watermark.setHorizontalGap((int) horizontalGapSpinner.getValue());
watermark.setVerticalGap((int) verticalGapSpinner.getValue());
watermark.setColor(colorPane.getColor()); watermark.setColor(colorPane.getColor());
colorPane.updateUsedColor(); colorPane.updateUsedColor();
return watermark; return watermark;
@ -98,20 +112,39 @@ public class WatermarkPane extends BasicPane {
formulaPane = new TinyFormulaPane(); formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox.setEditable(true); fontSizeComboBox.setEditable(true);
horizontalGapSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 200);
verticalGapSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 100);
horizontalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
verticalGapSpinner.setPreferredSize(SPINNER_DIMENSION);
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0)); JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER); fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER);
//水印间距面板
JPanel watermarkGapPane = new JPanel(new BorderLayout(10, 0));
JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0);
jp.add(horizontalGapSpinner);
jp.add(verticalGapSpinner);
watermarkGapPane.add(jp, BorderLayout.CENTER);
JPanel watermarkGapTipsPane = new JPanel(new BorderLayout());
JPanel tipsJp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 10, 0);
tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal"), SwingConstants.CENTER));
tipsJp.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Vertical"), SwingConstants.CENTER));
watermarkGapTipsPane.add(tipsJp, BorderLayout.CENTER);
colorPane = new NewColorSelectPane(); colorPane = new NewColorSelectPane();
JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel colorLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH); colorLabelPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Text_Color")), BorderLayout.NORTH);
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p,p,p}; double[] rowSize = {p, p, p, p, p};
double[] columnSize = { p, MAX_WIDTH}; double[] columnSize = {p, MAX_WIDTH};
JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][]{ JPanel rightContentPane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Watermark_Text")), formulaPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Font_Size")), fontSizeTypePane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Watermark_Gap")),watermarkGapPane },
{null,watermarkGapTipsPane },
{colorLabelPane, colorPane}, {colorLabelPane, colorPane},
}, rowSize, columnSize, 10); }, rowSize, columnSize, 10);
rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12)); rightContentPane.setBorder(BorderFactory.createEmptyBorder(15, 12, 10, 12));
@ -131,6 +164,36 @@ public class WatermarkPane extends BasicPane {
}); });
} }
protected void populateWatermarkGap(WatermarkAttr watermark){
this.horizontalGapSpinner.setValue(watermark.getHorizontalGap());
this.horizontalGapSpinner.addUISpinnerFocusListenner(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
paintPreviewPane();
}
@Override
public void focusLost(FocusEvent e) {
paintPreviewPane();
}
});
this.verticalGapSpinner.setValue(watermark.getVerticalGap());
this.verticalGapSpinner.addUISpinnerFocusListenner(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
paintPreviewPane();
}
@Override
public void focusLost(FocusEvent e) {
paintPreviewPane();
}
});
}
protected void paintPreviewPane(){ protected void paintPreviewPane(){
watermarkPreviewPane.repaint(update()); watermarkPreviewPane.repaint(update());
} }

10
designer-base/src/main/java/com/fr/design/web/CustomIconPane.java

@ -433,7 +433,7 @@ public class CustomIconPane extends BasicPane {
JPanel imagePane = new JPanel(); JPanel imagePane = new JPanel();
imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0)); imagePane.setLayout(new FlowLayout(FlowLayout.LEFT, 30, 0));
showImageLabel = new UILabel(); showImageLabel = new UILabel();
showImageLabel.setPreferredSize(new Dimension(20, 20)); showImageLabel.setPreferredSize(new Dimension(50, 50));
imagePane.add(showImageLabel); imagePane.add(showImageLabel);
imagePane.add(browseButton); imagePane.add(browseButton);
Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}}; Component[][] components = {{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name") + ":"), nameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon") + ":"), imagePane}};
@ -450,12 +450,12 @@ public class CustomIconPane extends BasicPane {
if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) { if (JFileChooser.APPROVE_OPTION == jf.showOpenDialog(DesignerContext.getDesignerFrame())) {
String path = jf.getSelectedFile().getAbsolutePath(); String path = jf.getSelectedFile().getAbsolutePath();
// 将图片转化到16 × 16大小 // 图片存储有最大值48*48限制,没有超过最大值时,按原图大小存储,超过最大值后,压缩至最大值存储
Image image = BaseUtils.readImage(path); Image image = BaseUtils.readImage(path);
BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(IconManager.DEFAULT_ICONWIDTH, BufferedImage bufferedImage = CoreGraphHelper.createBufferedImage(Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH),
IconManager.DEFAULT_ICONHEIGHT, BufferedImage.TYPE_INT_ARGB); Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = bufferedImage.createGraphics(); Graphics2D g2d = bufferedImage.createGraphics();
g2d.drawImage(image, 0, 0, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); g2d.drawImage(image, 0, 0, Math.min(image.getWidth(null), IconManager.MAXSTORAGE_ICONWIDTH), Math.min(image.getHeight(null), IconManager.MAXSTORAGE_ICONHEIGHT), null);
bufferedImage.flush(); bufferedImage.flush();
g2d.dispose(); g2d.dispose();
iconImage = bufferedImage; iconImage = bufferedImage;

116
designer-chart/src/main/java/com/fr/design/chart/ChartIcon.java

@ -0,0 +1,116 @@
package com.fr.design.chart;
import com.fr.base.GraphHelper;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import javax.swing.Icon;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.image.BufferedImage;
/**
* 图表的缩略图Icon, 在选择图表类型界面 用到.
*/
public class ChartIcon implements Icon, XMLable {
private static final int WIDTH = 400;
private static final int HEIGHT = 225;
/**
* 缩略图中的图片路径
*/
private String imagePath;
private String chartName;
/**
* 构造Chart的缩略图Icon
*/
public ChartIcon(String imagePath, String chartName) {
this.imagePath = imagePath;
this.chartName = chartName;
}
/**
* 画出缩略图Icon
*
* @param g 图形的上下文
* @param c 所在的Component
* @param x 缩略图的起始坐标x
* @param y 缩略图的起始坐标y
*/
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2d = (Graphics2D) g;
Paint oldPaint = g2d.getPaint();
g.translate(x, y);
g2d.setPaint(Color.white);
g2d.fillRect(0, 0, getIconWidth(), getIconHeight());
BufferedImage demoImage = IOUtils.readImageWithCache(imagePath);
GraphHelper.paintImage(g, getIconWidth(), getIconHeight(), demoImage, Constants.IMAGE_ADJUST, Constants.NULL, Constants.NULL, -1, -1);
g.translate(-x, -y);
g2d.setPaint(oldPaint);
}
/**
* 返回缩略图的宽度
*
* @return int 缩略图宽度
*/
public int getIconWidth() {
return WIDTH;
}
/**
* 返回缩略图的高度
*
* @return int 缩略图高度
*/
public int getIconHeight() {
return HEIGHT;
}
/**
* 返回缩略图中的图片路径
*
* @return 缩略图中的图片路径
*/
public String getImagePath() {
return imagePath;
}
public String getChartName() {
return chartName;
}
public void readXML(XMLableReader reader) {
}
public void writeXML(XMLPrintWriter writer) {
}
/**
* @return 克隆后的对象
* @throws CloneNotSupportedException 如果克隆失败则抛出此异常
*/
public Object clone() throws CloneNotSupportedException {
ChartIcon cloned = (ChartIcon) super.clone();
cloned.imagePath = this.imagePath;
cloned.chartName = this.chartName;
return cloned;
}
}

13
designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java

@ -1,12 +1,10 @@
package com.fr.design.chart; package com.fr.design.chart;
/** /**
* the Pane of the Chart * the Pane of the Chart
*
*/ */
import com.fr.chart.base.ChartInternationalNameContentBean; import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.ChartIcon;
import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -120,15 +118,16 @@ public class ChartTypePane extends ChartCommonWizardPane {
ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index]; ChartProvider[] sub_charts = ChartTypePane.this.charts4Icon[main_index];
ChartTypePane.this.iconListModel.clear(); ChartTypePane.this.iconListModel.clear();
for (int i = 0; i < sub_charts.length; i++) { for (int i = 0; i < sub_charts.length; i++) {
ChartTypePane.this.iconListModel.addElement(new ChartIcon(sub_charts[i])); String ImagePath = sub_charts[i].demoImagePath();
String chartName = sub_charts[i].getChartName();
ChartTypePane.this.iconListModel.addElement(new ChartIcon(ImagePath, chartName));
} }
iconViewList.setSelectedIndex(0); iconViewList.setSelectedIndex(0);
} }
}; };
public String getChartName(ChartIcon chartIcon) { public String getChartName(ChartIcon chartIcon) {
ChartProvider chart = chartIcon.getChart(); return chartIcon.getChartName();
return ChartTypeManager.getInstanceWithCheck().getChartName(chart.getID());
} }
public void populate(ChartProvider chart) { public void populate(ChartProvider chart) {
@ -146,10 +145,10 @@ public class ChartTypePane extends ChartCommonWizardPane {
if (chart4Update == null) { if (chart4Update == null) {
String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID(); String plotID = typeName[mainTypeList.getSelectedIndex()].getChartID();
ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()]; ChartProvider chart = ChartTypeManager.getInstance().getChartTypes(plotID)[iconViewList.getSelectedIndex()];
try{ try {
chart4Update = (ChartProvider) chart.clone(); chart4Update = (ChartProvider) chart.clone();
cc.addChart(chart4Update); cc.addChart(chart4Update);
}catch (CloneNotSupportedException ex){ } catch (CloneNotSupportedException ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex); FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
} }

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java

@ -11,7 +11,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentFrozenPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.RichStyleWidgetProvider; import com.fr.form.ui.RichStyleWidgetProvider;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
@ -30,8 +31,11 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private UICheckBox appRelayoutCheck; private UICheckBox appRelayoutCheck;
private MobileWidgetListPane mobileWidgetListPane; private MobileWidgetListPane mobileWidgetListPane;
private MobileComponentAdvancePane advancePane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
private MobileComponentFrozenPane frozenPane;
private UIExpandablePane advancePane;
private UIExpandablePane layoutPane;
public BodyMobileDefinePane(XCreator xCreator) { public BodyMobileDefinePane(XCreator xCreator) {
this.bodyCreator = xCreator; this.bodyCreator = xCreator;
@ -89,16 +93,23 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(getMobilePropertyPane(), BorderLayout.NORTH); holder.add(getMobilePropertyPane(), BorderLayout.NORTH);
marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG);
advancePane = new MobileComponentAdvancePane(FormBodyPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG);
frozenPane = new MobileComponentFrozenPane();
JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapLayoutPane.add(intervalPane, BorderLayout.NORTH);
wrapLayoutPane.add(frozenPane, BorderLayout.CENTER);
advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, wrapLayoutPane);
//高级 //高级
holder.add(advancePane, BorderLayout.CENTER); holder.add(advancePane, BorderLayout.CENTER);
//布局 //布局
holder.add(intervalPane, BorderLayout.SOUTH); holder.add(layoutPane, BorderLayout.SOUTH);
advancePane.setVisible(!shouldHidePadding(designer)); boolean flag = !shouldHidePadding(designer);
intervalPane.setVisible(!shouldHidePadding(designer)); advancePane.setVisible(flag);
layoutPane.setVisible(flag);
frozenPane.setVisible(appRelayoutCheck.isSelected());
return holder; return holder;
} }
@ -137,13 +148,12 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {
this.designer = designer; this.designer = designer;
appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer)); appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer));
// 数据 populate 完成后,再设置监听 // 数据 populate 完成后,再设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
marginPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
advancePane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
frozenPane.populate(designer.getSelectionModel().getSelection().getSelectedCreator());
} }
@Override @Override
@ -152,15 +162,19 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
setAppRelayout(appRelayoutCheck.isSelected()); setAppRelayout(appRelayoutCheck.isSelected());
boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer); boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer);
advancePane.setVisible(appPaddingVisible); advancePane.setVisible(appPaddingVisible);
intervalPane.setVisible(appPaddingVisible); layoutPane.setVisible(appPaddingVisible);
frozenPane.setVisible(appRelayout);
mobileWidgetListPane.updateToDesigner(); mobileWidgetListPane.updateToDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
if (advancePane.isVisible()) { if (advancePane.isVisible()) {
advancePane.update((RichStyleWidgetProvider) getBodyCreator().toData()); marginPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (intervalPane.isVisible()) { if (layoutPane.isVisible()) {
intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (appRelayout) {
frozenPane.update(designer.getSelectionModel().getSelection().getSelectedCreator());
}
} }
} }

1
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -168,6 +168,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
break; break;
case "allowFullCheckBox": case "allowFullCheckBox":
((ElementCaseEditor) xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected()); ((ElementCaseEditor) xCreator.toData()).setAllowFullScreen(allowFullCheckBox.isSelected());
break;
case "functionalWhenUnactivatedCheckBox": case "functionalWhenUnactivatedCheckBox":
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected()); ((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(functionalWhenUnactivatedCheckBox.isSelected());
} }

19
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

@ -4,6 +4,7 @@ import com.fr.base.iofile.attr.FormTabPaddingAttrMark;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -13,7 +14,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
@ -27,7 +28,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private FormDesigner designer; // 当前设计器 private FormDesigner designer; // 当前设计器
private AccessibleTemplateStyleEditor templateStyleEditor; private AccessibleTemplateStyleEditor templateStyleEditor;
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private MobileComponentAdvancePane advancePane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
public TabMobileWidgetDefinePane(XCreator xCreator) { public TabMobileWidgetDefinePane(XCreator xCreator) {
@ -61,12 +62,14 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(jPanel, BorderLayout.NORTH); holder.add(jPanel, BorderLayout.NORTH);
if (!shouldHidePadding(designer)) { if (!shouldHidePadding(designer)) {
advancePane = new MobileComponentAdvancePane(FormTabPaddingAttrMark.XML_TAG); marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane);
//高级 //高级
holder.add(advancePane, BorderLayout.CENTER); holder.add(advancePane, BorderLayout.CENTER);
//布局 //布局
holder.add(intervalPane, BorderLayout.SOUTH); holder.add(layoutPane, BorderLayout.SOUTH);
} }
this.add(holder, BorderLayout.NORTH); this.add(holder, BorderLayout.NORTH);
@ -78,8 +81,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
// 数据 populate 完成后,再设置监听 // 数据 populate 完成后,再设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
if (advancePane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点 if (marginPane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点
advancePane.populate((WCardTagLayout) xCreator.toData()); marginPane.populate((WCardTagLayout) xCreator.toData());
} }
if (intervalPane != null) { if (intervalPane != null) {
intervalPane.populate((WCardTagLayout) xCreator.toData()); intervalPane.populate((WCardTagLayout) xCreator.toData());
@ -90,8 +93,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
public void update() { public void update() {
((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); ((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
if (advancePane != null) { if (marginPane != null) {
advancePane.update((WCardTagLayout) xCreator.toData()); marginPane.update((WCardTagLayout) xCreator.toData());
} }
if (intervalPane != null) { if (intervalPane != null) {
intervalPane.update((WCardTagLayout) xCreator.toData()); intervalPane.update((WCardTagLayout) xCreator.toData());

92
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java

@ -0,0 +1,92 @@
package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WSortLayout;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author Hades
* @date 2019/8/14
*/
public class MobileComponentFrozenPane extends BasicPane {
private UIComboCheckBox uiComboCheckBox;
public MobileComponentFrozenPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel frozenLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Frozen"));
uiComboCheckBox = new UIComboCheckBox(initData());
JPanel wrapJPanel = UIComponentUtils.wrapWithBorderLayoutPane(uiComboCheckBox);
Component[][] components = new Component[][]{
new Component[]{frozenLabel, wrapJPanel}
};
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0));
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(centerPane, BorderLayout.NORTH);
this.add(holder, BorderLayout.NORTH);
}
private String[] initData() {
FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
Widget selectedModel = selectedCreator != null ? selectedCreator.toData() : null;
if (selectedModel == null || !selectedModel.acceptType(WSortLayout.class)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> widgetList = ((WSortLayout) selectedModel).getNonContainerWidgetList();
return widgetList.toArray(new String[0]);
}
public void update(XCreator xCreator) {
List<String> selected = new ArrayList<>();
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
Object[] values = uiComboCheckBox.getSelectedValues();
for (Object widgetName : values) {
selected.add((String) widgetName);
}
wSortLayout.updateFrozenWidgets(selected);
}
public void populate(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
List<String> all = wSortLayout.getNonContainerWidgetList();
List<String> selected = wSortLayout.getFrozenWidgets();
Map<Object, Boolean> map = new LinkedHashMap<>();
for (String value : selected) {
map.put(value, true);
}
all.removeAll(selected);
for (String value : all) {
map.put(value, false);
}
uiComboCheckBox.setSelectedValues(map);
}
@Override
protected String title4PopupWindow() {
return "ComponentFrozenPane";
}
}

18
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java

@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.AttrMarkFactory;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -29,24 +28,17 @@ public class MobileComponentLayoutIntervalPane extends XmlRelationedBasicPane {
super(xmlTag); super(xmlTag);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")); UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE); componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE);
JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); JPanel componentIntervalPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{intervalLabel, componentIntervelPane} new Component[]{intervalLabel, componentIntervalPane}
}; };
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0)); centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0));
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(centerPane, BorderLayout.NORTH); holder.add(centerPane, BorderLayout.NORTH);
UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, holder); this.add(holder, BorderLayout.NORTH);
this.add(layoutExpandablePane, BorderLayout.NORTH);
} }
@Override @Override

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentAdvancePane.java → designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java

@ -2,7 +2,6 @@ package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.AttrMarkFactory;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.ui.designer.XmlRelationedBasicPane; import com.fr.design.widget.ui.designer.XmlRelationedBasicPane;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
@ -13,20 +12,19 @@ import java.awt.BorderLayout;
/** /**
* 只有内边距设置的高级设置 * 只有内边距设置的高级设置
*/ */
public class MobileComponentAdvancePane extends XmlRelationedBasicPane { public class MobileComponentMarginPane extends XmlRelationedBasicPane {
private PaddingBoundPane paddingBound; private PaddingBoundPane paddingBound;
public MobileComponentAdvancePane(String xmlTag) { public MobileComponentMarginPane(String xmlTag) {
super(xmlTag); super(xmlTag);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE); paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, paddingBound); this.add(paddingBound, BorderLayout.NORTH);
this.add(advanceExpandablePane, BorderLayout.NORTH);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "ComponentAdvancePane"; return "ComponentMarginPane";
} }
public void update(RichStyleWidgetProvider marginWidget) { public void update(RichStyleWidgetProvider marginWidget) {

12
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -95,10 +95,6 @@ import com.fr.stable.module.Module;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.web.controller.ViewRequestConstants; import com.fr.web.controller.ViewRequestConstants;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -106,6 +102,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
/** /**
* JWorkBook used to edit WorkBook. * JWorkBook used to edit WorkBook.
@ -1103,9 +1102,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
// 弹出输入参数 // 弹出输入参数
java.util.Map<String, Object> parameterMap = inputParameters(tpl); java.util.Map<String, Object> parameterMap = inputParameters(tpl);
try { String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath());
String fullPath = StableUtils.pathJoin(WorkContext.getCurrent().getPath(), newFile.getPath()); try (FileOutputStream fileOutputStream = new FileOutputStream(fullPath)) {
FileOutputStream fileOutputStream = new FileOutputStream(fullPath);
EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter(); EmbeddedTableDataExporter exporter = new EmbeddedTableDataExporter();
exporter.export(fileOutputStream, tpl, parameterMap); exporter.export(fileOutputStream, tpl, parameterMap);
} catch (Exception e1) { } catch (Exception e1) {

18
designer-realize/src/main/java/com/fr/design/mainframe/errorinfo/ErrorInfo.java

@ -2,14 +2,17 @@ package com.fr.design.mainframe.errorinfo;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.core.UUID; import com.fr.stable.core.UUID;
import java.io.ByteArrayInputStream;
import java.io.*; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Date; import java.util.Date;
@ -124,13 +127,14 @@ public class ErrorInfo {
String content = jo.toString(); String content = jo.toString();
String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX; String fileName = UUID.randomUUID() + ErrorInfoUploader.SUFFIX;
File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName)); File file = new File(StableUtils.pathJoin(ProductConstants.getEnvHome(), ErrorInfoUploader.FOLDER_NAME, fileName));
try { FileOutputStream out = null;
try (InputStream in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
StableUtils.makesureFileExist(file); StableUtils.makesureFileExist(file);
FileOutputStream out = new FileOutputStream(file); out = new FileOutputStream(file);
InputStream in = new ByteArrayInputStream(content.getBytes(EncodeConstants.ENCODING_UTF_8));
IOUtils.copyBinaryTo(in, out); IOUtils.copyBinaryTo(in, out);
out.close();
} catch (IOException ignore) { } catch (IOException ignore) {
} finally {
IOUtils.close(out);
} }
} }
} }

20
designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java

@ -19,7 +19,9 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.UUID; import java.util.UUID;
import java.util.zip.ZipOutputStream;
/** /**
* @author alex sung * @author alex sung
@ -52,13 +54,15 @@ public class FileEntityBuilder {
return null; return null;
} }
File zipFile = null; File zipFile = null;
ZipOutputStream zipOut = null;
try { try {
zipFile = new File(pathName + ".zip"); zipFile = new File(pathName + ".zip");
java.util.zip.ZipOutputStream zipOut = new java.util.zip.ZipOutputStream(new FileOutputStream(zipFile)); zipOut = new ZipOutputStream(new FileOutputStream(zipFile));
IOUtils.zip(zipOut, new File(pathName)); IOUtils.zip(zipOut, new File(pathName));
zipOut.close();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
IOUtils.close(zipOut);
} }
return zipFile; return zipFile;
} }
@ -67,18 +71,18 @@ public class FileEntityBuilder {
if (jsonArray.size() == 0) { if (jsonArray.size() == 0) {
return; return;
} }
try { FileOutputStream out = null;
String content = jsonArray.toString(); String content = jsonArray.toString();
try (InputStream in = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8))) {
String fileName = String.valueOf(UUID.randomUUID()); String fileName = String.valueOf(UUID.randomUUID());
File file = new File(folderName + File.separator + fileName + ".json"); File file = new File(folderName + File.separator + fileName + ".json");
StableUtils.makesureFileExist(file); StableUtils.makesureFileExist(file);
FileOutputStream out = new FileOutputStream(file); out = new FileOutputStream(file);
InputStream in = new ByteArrayInputStream(content.getBytes(EncodeConstants.ENCODING_UTF_8));
IOUtils.copyBinaryTo(in, out); IOUtils.copyBinaryTo(in, out);
in.close();
out.close();
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} finally {
IOUtils.close(out);
} }
} }

Loading…
Cancel
Save