Browse Source

Merge pull request #843 in BA/design from ~NEIL/design:release to dev

* commit '487e1b17c31dec3809a4581d75b439a0043c1774': (60 commits)
  ct
  ct
  ct
  ct
  1
  ct
  REPORT-2526 tab交互改良后续--tab页签调整的视觉调整
  框选改错啦。
  无JIRA任务 master的boundsWidget到release
  控件的框选问题
  REPORT-2381 客户bug历史遗留问题,空指针引发控件属性面板生成失败最终导致报表切换失败
  国际化修改 日文 design部分 第1-200个key修改翻译 庄奇 syoki
  组件复用边界粘贴,之前考虑的片面了,修改下
  组件复用边界复制
  REPORT-2273 远程设计数据库连接成功,预览报错,datasourcexml保存失败问题修复
  REPORT-2368 修改控件设置界面对“基本属性”面板的初始化
  REPORT-2368 预定义控件设置了不可见,在参数面板上还是可见的
  REPORT-1344 命名规范
  无jira任务,代码被误杀了
  report-1945 frm本地组件复用
  ...
master
superman 8 years ago
parent
commit
7597e86eba
  1. 1
      .gitignore
  2. 16
      designer/src/com/fr/design/widget/CellWidgetCardPane.java
  3. 345
      designer_base/src/com/fr/design/actions/server/ConnectionListAction.java
  4. 266
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java
  5. 324
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java
  6. 155
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java
  7. 15
      designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java
  8. 13
      designer_base/src/com/fr/design/formula/VariableResolverAdapter.java
  9. BIN
      designer_base/src/com/fr/design/images/control/tab/end.png
  10. BIN
      designer_base/src/com/fr/design/images/control/tab/end_not.png
  11. BIN
      designer_base/src/com/fr/design/images/control/tab/first.png
  12. BIN
      designer_base/src/com/fr/design/images/control/tab/first_not.png
  13. BIN
      designer_base/src/com/fr/design/images/control/tab/next.png
  14. BIN
      designer_base/src/com/fr/design/images/control/tab/next_not.png
  15. BIN
      designer_base/src/com/fr/design/images/control/tab/prev.png
  16. BIN
      designer_base/src/com/fr/design/images/control/tab/prev_not.png
  17. 2
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java
  18. 31
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java
  19. 156
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  20. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java
  21. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java
  22. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java
  23. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java
  24. 10
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  25. 17
      designer_form/src/com/fr/design/mainframe/ComponentTree.java
  26. 1
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  27. 7
      designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java
  28. 7
      designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java

1
.gitignore vendored

@ -3,5 +3,6 @@ designer_base/bin
designer_chart/bin
designer_form/bin
*.iml
designer_base/src/com/fr/design/locale/.idea

16
designer/src/com/fr/design/widget/CellWidgetCardPane.java

@ -67,7 +67,12 @@ public class CellWidgetCardPane extends BasicPane {
treeTabPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
widgetPropertyPane = new BasicWidgetPropertySettingPane();
attriTabPane.add(widgetPropertyPane, BorderLayout.NORTH);
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8));
JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties"));
northPane.add(basic);
basic.add(widgetPropertyPane);
attriTabPane.add(northPane, BorderLayout.NORTH);
attriCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
attriTabPane.add(attriCardPane, BorderLayout.CENTER);
attriCardLayout = (CardLayout) attriCardPane.getLayout();
@ -88,15 +93,6 @@ public class CellWidgetCardPane extends BasicPane {
this.tabbedPane.setEnabled(true);
}
attriTabPane.remove(widgetPropertyPane);
widgetPropertyPane = new BasicWidgetPropertySettingPane();
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
northPane.setBorder(BorderFactory.createEmptyBorder(5, 8, 0, 8));
JPanel basic = FRGUIPaneFactory.createTitledBorderPane(Inter.getLocText("FR-Designer_Form_Basic_Properties"));
northPane.add(basic);
basic.add(widgetPropertyPane);
attriTabPane.add(northPane, BorderLayout.NORTH);
WidgetDefinePaneFactory.RN rn = WidgetDefinePaneFactory.createWidgetDefinePane(cellWidget, new Operator() {
@Override
public void did(DataCreatorUI ui, String cardName) {

345
designer_base/src/com/fr/design/actions/server/ConnectionListAction.java

@ -1,171 +1,176 @@
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable;
import com.fr.data.impl.Connection;
import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
/**
* DatasourceList Action
*/
public class ConnectionListAction extends UpdateAction {
private static final int BYTENUM = 1444;
public ConnectionListAction() {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
}
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'D';
}
@Override
public String getMenuName() {
return Inter.getLocText("Server-Define_Data_Connection");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
/**
* 执行动作
*
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
final DatasourceManager backupManager = datasourceManager.getBackUpManager();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
public void complete() {
populate(datasourceManager);
}
protected void renameConnection(String oldName, String newName) {
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName);
}
};
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// marks:保存数据
writeFile(datasourceManager);
}
public void doCancel() {
datasourceManager.synchronizedWithServer();
}
});
databaseListDialog.setVisible(true);
}
private void writeFile(DatasourceManagerProvider datasourceManager) {
Env currentEnv = FRContext.getCurrentEnv();
try {
boolean isSuccess = currentEnv.writeResource(datasourceManager);
if (!isSuccess) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
} catch (Exception e) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
/**
* 是否正常更新完datasourceManager
*
* @param datasourceManager
* @param databaseManagerPane
* @return
*/
private boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager backupManager,
ConnectionManagerPane databaseManagerPane, BasicDialog databaseListDialog) {
databaseManagerPane.update(datasourceManager);
HashMap<String, Connection> modifyDetails = datasourceManager.getConnectionModifyDetails();
modifyDetails.clear();
Env currentEnv = FRContext.getCurrentEnv();
ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID());
boolean isFailed = false;
if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) {
//如果是本地,并且有远程用户时则更新自己的修改表
datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER);
} else {
if (!currentEnv.isSupportLocalFileOperate()) {
//如果是远程,则去取服务器的最新的修改表,检查有没有冲突
ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION);
if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) {
//有冲突,进行提示
String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"});
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
//点击是,进行相应刷新去冲突
datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION);
//要是有重命名冲突的,则对详细的修改表先进行修改
datasourceManager.doWithConnectionConflict(localModifiedTable);
localModifiedTable.removeConfilct();
modifyDetails.clear();
//更新面板
databaseManagerPane.populate(datasourceManager);
} else {
//更新失败,继续停留页面
isFailed = true;
}
}
}
}
//存在请重命名则不能更新
int index = datasourceManager.isConnectionMapContainsRename();
if (index != -1) {
isFailed = true;
databaseManagerPane.setSelectedIndex(index);
}
databaseListDialog.setDoOKSucceed(!isFailed);
//如果修改成功,则去远程端增量修改修改表
if (!isFailed && !currentEnv.isSupportLocalFileOperate()) {
currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION);
localModifiedTable.clear();
modifyDetails.clear();
}
return !isFailed;
}
public void update() {
this.setEnabled(true);
}
package com.fr.design.actions.server;
import com.fr.base.BaseUtils;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.base.ModifiedTable;
import com.fr.data.impl.Connection;
import com.fr.dav.LocalEnv;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.connect.ConnectionManagerPane;
import com.fr.design.data.datapane.connect.ConnectionShowPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.menu.MenuKeySet;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.HashMap;
/**
* DatasourceList Action
*/
public class ConnectionListAction extends UpdateAction {
public ConnectionListAction() {
this.setMenuKeySet(DEFINE_DATA_CONNECTION);
this.setName(getMenuKeySet().getMenuKeySetName());
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_web/connection.png"));
}
public static final MenuKeySet DEFINE_DATA_CONNECTION = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'D';
}
@Override
public String getMenuName() {
return Inter.getLocText("Server-Define_Data_Connection");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
/**
* 执行动作
*
* @param evt 事件
*/
public void actionPerformed(ActionEvent evt) {
DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
final DatasourceManager backupManager = datasourceManager.getBackUpManager();
final ConnectionManagerPane databaseManagerPane = new ConnectionManagerPane() {
public void complete() {
populate(datasourceManager);
}
protected void renameConnection(String oldName, String newName) {
datasourceManager.getConnectionLocalModifyTable().rename(oldName, newName);
}
};
final BasicDialog databaseListDialog = databaseManagerPane.showLargeWindow(designerFrame, null);
databaseListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!databaseManagerPane.isNamePermitted()) {
databaseListDialog.setDoOKSucceed(false);
return;
}
if (!doWithDatasourceManager(datasourceManager, backupManager, databaseManagerPane, databaseListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// marks:保存数据
writeFile(datasourceManager);
}
public void doCancel() {
datasourceManager.synchronizedWithServer();
}
});
databaseListDialog.setVisible(true);
}
/**
* @param datasourceManager
*/
public static void writeFile(DatasourceManagerProvider datasourceManager) {
Env currentEnv = FRContext.getCurrentEnv();
try {
boolean isSuccess = currentEnv.writeResource(datasourceManager);
if (!isSuccess) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
} catch (Exception e) {
throw new RuntimeException(Inter.getLocText("FR-Designer_Already_exist"));
}
DesignerContext.getDesignerBean("databasename").refreshBeanElement();
}
/**
* 更新datasourceManager
*
* @param datasourceManager datasource管理对象
* @param backupManager datasource管理对象备份
* @param connectionShowPane datasource面板
* @param databaseListDialog datasource管理对话框
* @return boolean 是否更新成功
*/
public static boolean doWithDatasourceManager(DatasourceManagerProvider datasourceManager, DatasourceManager
backupManager, ConnectionShowPane connectionShowPane, BasicDialog databaseListDialog) {
connectionShowPane.update(datasourceManager);
HashMap<String, Connection> modifyDetails = datasourceManager.getConnectionModifyDetails();
modifyDetails.clear();
Env currentEnv = FRContext.getCurrentEnv();
ModifiedTable localModifiedTable = datasourceManager.checkConnectionModifyTable(backupManager, currentEnv.getUserID());
boolean isFailed = false;
if (currentEnv.isSupportLocalFileOperate() && !((LocalEnv) currentEnv).isNoRemoteUser()) {
//如果是本地,并且有远程用户时则更新自己的修改表
datasourceManager.updateSelfConnectionTotalModifiedTable(localModifiedTable, ModifiedTable.LOCAL_MODIFIER);
} else {
if (!currentEnv.isSupportLocalFileOperate()) {
//如果是远程,则去取服务器的最新的修改表,检查有没有冲突
ModifiedTable currentServerModifyTable = currentEnv.getDataSourceModifiedTables(DatasourceManager.CONNECTION);
if (localModifiedTable.checkModifiedTableConflictWithServer(currentServerModifyTable, currentEnv.getUserID())) {
//有冲突,进行提示
String title = Inter.getLocText(new String[]{"Select", "Single", "Setting"});
int returnVal = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), localModifiedTable.getWaringMessage(), title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (returnVal == JOptionPane.YES_OPTION) {
//点击是,进行相应刷新去冲突
datasourceManager.synchronizedWithServer(backupManager, DatasourceManager.CONNECTION);
//要是有重命名冲突的,则对详细的修改表先进行修改
datasourceManager.doWithConnectionConflict(localModifiedTable);
localModifiedTable.removeConfilct();
modifyDetails.clear();
//更新面板
connectionShowPane.populate(datasourceManager);
} else {
//更新失败,继续停留页面
isFailed = true;
}
}
}
}
//存在请重命名则不能更新
int index = datasourceManager.isConnectionMapContainsRename();
if (index != -1) {
isFailed = true;
connectionShowPane.setSelectedIndex(index);
}
databaseListDialog.setDoOKSucceed(!isFailed);
//如果修改成功,则去远程端增量修改修改表
if (!isFailed && !currentEnv.isSupportLocalFileOperate()) {
currentEnv.writeDataSourceModifiedTables(localModifiedTable, DatasourceManager.CONNECTION);
localModifiedTable.clear();
modifyDetails.clear();
}
return !isFailed;
}
public void update() {
this.setEnabled(true);
}
}

266
designer_base/src/com/fr/design/data/datapane/connect/ConnectionComboBoxPanel.java

@ -1,128 +1,140 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.Env;
import com.fr.base.FRContext;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* 选择数据连接的下拉框
*
* @editor zhou
* @since 2012-3-28下午3:02:30
*/
public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private Class<? extends Connection> cls; // 所取的Connection都是cls及其子类
private java.util.List<String> nameList = new ArrayList<String>();
public ConnectionComboBoxPanel(Class<? extends Connection> cls) {
super();
this.cls = cls;
// alex:添加item change监听,当改变时改变DesignerEnvManager中的最近选中的数据连接
this.itemComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String selected = ConnectionComboBoxPanel.this.getSelectedItem();
if (StringUtils.isNotBlank(selected)) {
DesignerEnvManager.getEnvManager().setRecentSelectedConnection(selected);
}
}
});
refreshItems();
}
/*
* 刷新ComboBox.items
*/
protected java.util.Iterator<String> items() {
nameList = new ArrayList<String>();
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance();
java.util.Iterator<String> nameIt = mgr.getConnectionNameIterator();
while (nameIt.hasNext()) {
String conName = nameIt.next();
Connection connection = mgr.getConnection(conName);
filterConnection(connection, conName, nameList);
}
return nameList.iterator();
}
protected void filterConnection(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
}
public int getConnectionSize() {
return nameList.size();
}
public String getConnection(int i) {
return nameList.get(i);
}
/*
* 弹出对话框编辑Items
*/
protected void editItems() {
final ConnectionListPane connectionListPane = new ConnectionListPane();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
connectionListPane.populate(datasourceManager);
BasicDialog connectionListDialog = connectionListPane.showLargeWindow(
SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), new DialogActionAdapter() {
public void doOk() {
connectionListPane.update(datasourceManager);
// marks:保存数据
Env currentEnv = FRContext.getCurrentEnv();
try {
currentEnv.writeResource(datasourceManager);
} catch (Exception ex) {
FRContext.getLogger().error(ex.getMessage(), ex);
}
}
});
connectionListDialog.setVisible(true);
refreshItems();
}
public void populate(com.fr.data.impl.Connection connection) {
editButton.setEnabled(FRContext.getCurrentEnv().isRoot());
if (connection instanceof NameDatabaseConnection) {
this.setSelectedItem(((NameDatabaseConnection) connection).getName());
} else {
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection();
if (StringUtils.isNotBlank(s)) {
for (int i = 0; i < this.getConnectionSize(); i++) {
String t = this.getConnection(i);
if (ComparatorUtils.equals(s, t)) {
this.setSelectedItem(s);
break;
}
}
}
// alex:如果这个ComboBox还是没有选中,那么选中第一个
if (StringUtils.isBlank(this.getSelectedItem()) && this.getConnectionSize() > 0) {
this.setSelectedItem(this.getConnection(0));
}
}
}
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.server.ConnectionListAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.file.DatasourceManager;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* 选择数据连接的下拉框
*
* @editor zhou
* @since 2012-3-28下午3:02:30
*/
public class ConnectionComboBoxPanel extends ItemEditableComboBoxPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private Class<? extends Connection> cls; // 所取的Connection都是cls及其子类
private List<String> nameList = new ArrayList<String>();
public ConnectionComboBoxPanel(Class<? extends Connection> cls) {
super();
this.cls = cls;
// alex:添加item change监听,当改变时改变DesignerEnvManager中的最近选中的数据连接
this.itemComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String selected = ConnectionComboBoxPanel.this.getSelectedItem();
if (StringUtils.isNotBlank(selected)) {
DesignerEnvManager.getEnvManager().setRecentSelectedConnection(selected);
}
}
});
refreshItems();
}
/*
* 刷新ComboBox.items
*/
protected Iterator<String> items() {
nameList = new ArrayList<String>();
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance();
Iterator<String> nameIt = mgr.getConnectionNameIterator();
while (nameIt.hasNext()) {
String conName = nameIt.next();
Connection connection = mgr.getConnection(conName);
filterConnection(connection, conName, nameList);
}
return nameList.iterator();
}
protected void filterConnection(Connection connection, String conName, List<String> nameList) {
connection.addConnection(nameList, conName, new Class[]{AbstractDatabaseConnection.class});
}
public int getConnectionSize() {
return nameList.size();
}
public String getConnection(int i) {
return nameList.get(i);
}
/*
* 弹出对话框编辑Items
*/
protected void editItems() {
final ConnectionListPane connectionListPane = new ConnectionListPane();
final DatasourceManagerProvider datasourceManager = DatasourceManager.getProviderInstance();
final DatasourceManager backupManager = datasourceManager.getBackUpManager();
connectionListPane.populate(datasourceManager);
final BasicDialog connectionListDialog = connectionListPane.showLargeWindow(
SwingUtilities.getWindowAncestor(ConnectionComboBoxPanel.this), null);
connectionListDialog.addDialogActionListener(new DialogActionAdapter() {
public void doOk() {
if (!connectionListPane.isNamePermitted()) {
connectionListDialog.setDoOKSucceed(false);
return;
}
if (!ConnectionListAction.doWithDatasourceManager(datasourceManager, backupManager, connectionListPane,
connectionListDialog)) {
//如果更新失败,则不关闭对话框,也不写xml文件,并且将对话框定位在请重命名的那个对象页面
return;
}
// marks:保存数据
ConnectionListAction.writeFile(datasourceManager);
}
public void doCancel() {
datasourceManager.synchronizedWithServer();
}
});
connectionListDialog.setVisible(true);
refreshItems();
}
/**
* @param connection 数据库链接
*/
public void populate(Connection connection) {
editButton.setEnabled(FRContext.getCurrentEnv().isRoot());
if (connection instanceof NameDatabaseConnection) {
this.setSelectedItem(((NameDatabaseConnection) connection).getName());
} else {
String s = DesignerEnvManager.getEnvManager().getRecentSelectedConnection();
if (StringUtils.isNotBlank(s)) {
for (int i = 0; i < this.getConnectionSize(); i++) {
String t = this.getConnection(i);
if (ComparatorUtils.equals(s, t)) {
this.setSelectedItem(s);
break;
}
}
}
// alex:如果这个ComboBox还是没有选中,那么选中第一个
if (StringUtils.isBlank(this.getSelectedItem()) && this.getConnectionSize() > 0) {
this.setSelectedItem(this.getConnection(0));
}
}
}
}

324
designer_base/src/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,163 +1,163 @@
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.*;
/**
* Connection List Pane.
*/
public class ConnectionListPane extends JListControlPane {
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection");
private boolean isNamePermitted = true;
private HashMap<String, String> renameMap = new HashMap<String, String>();
public ConnectionListPane() {
renameMap.clear();
this.addEditingListner(new PropertyChangeAdapter() {
public void propertyChange() {
isNamePermitted = true;
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) {
String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"};
String[] sign = new String[]{",", "!"};
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), Inter.getLocText(warning, sign));
setWarnigText(editingIndex);
isNamePermitted = false;
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
String message = Inter.getLocText(new String[]{"Utils-has_been_existed", "DashBoard-ConnectionList", "Please_Rename"}, new String[]{"", tempName + ",", "!"});
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setWarnigText(editingIndex);
}
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {
rename(selectedName, tempName);
}
}
});
}
protected void rename(String oldName, String newName) {
if (renameMap.containsKey(selectedName)) {
renameMap.remove(selectedName);
}
renameMap.put(selectedName, newName);
}
/**
* 名字是否允许
*
* @return /
*/
public boolean isNamePermitted() {
return isNamePermitted;
}
/**
* 检查按钮可用状态 Check button enabled.
*/
public void checkButtonEnabled() {
super.checkButtonEnabled();
isNamePermitted = !isContainsRename();
}
public HashMap<String, String> getRenameMap() {
return renameMap;
}
/**
* 创建菜单项
*
* @return 菜单项
*/
public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = new NameableCreator[]{new NameObjectCreator(
"JDBC",
"/com/fr/design/images/data/source/jdbcTableData.png",
JDBCDatabaseConnection.class,
DatabaseConnectionPane.JDBC.class
), new NameObjectCreator(
"JNDI",
"/com/fr/design/images/data/source/jdbcTableData.png",
JNDIDatabaseConnection.class,
DatabaseConnectionPane.JNDI.class
)};
Set<ConnectionProvider> pluginCreators = ExtraDesignClassManager.getInstance().getArray(ConnectionProvider.XML_TAG);
for (ConnectionProvider provider : pluginCreators) {
NameObjectCreator creator = new NameObjectCreator(
provider.nameForConnection(),
provider.iconPathForConnection(),
provider.classForConnection(),
provider.appearanceForConnection()
);
creators = ArrayUtils.add(creators, creator);
}
return creators;
}
@Override
protected String title4PopupWindow() {
return TITLE_NAME;
}
/**
* Populate.
*
* @param datasourceManager the new datasourceManager.
*/
public void populate(DatasourceManagerProvider datasourceManager) {
Iterator<String> nameIt = datasourceManager.getConnectionNameIterator();
List<NameObject> nameObjectList = new ArrayList<NameObject>();
while (nameIt.hasNext()) {
String name = nameIt.next();
nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name)));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
/**
* Update.
*/
public void update(DatasourceManagerProvider datasourceManager) {
// Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update();
NameObject[] res_array = new NameObject[res.length];
java.util.Arrays.asList(res).toArray(res_array);
datasourceManager.clearAllConnection();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject());
}
}
package com.fr.design.data.datapane.connect;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.ConnectionProvider;
import com.fr.design.gui.controlpane.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.NameObject;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.*;
/**
* Connection List Pane.
*/
public class ConnectionListPane extends JListControlPane implements ConnectionShowPane {
public static final String TITLE_NAME = Inter.getLocText("Server-Define_Data_Connection");
private boolean isNamePermitted = true;
private HashMap<String, String> renameMap = new HashMap<String, String>();
public ConnectionListPane() {
renameMap.clear();
this.addEditingListner(new PropertyChangeAdapter() {
public void propertyChange() {
isNamePermitted = true;
String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY;
String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) {
String[] warning = new String[]{"NOT_NULL_Des", "Please_Rename"};
String[] sign = new String[]{",", "!"};
nameableList.stopEditing();
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), Inter.getLocText(warning, sign));
setWarnigText(editingIndex);
isNamePermitted = false;
return;
}
if (!ComparatorUtils.equals(tempName, selectedName)
&& isNameRepeted(new List[]{Arrays.asList(allListNames)}, tempName)) {
isNamePermitted = false;
nameableList.stopEditing();
String message = Inter.getLocText(new String[]{"Utils-has_been_existed", "DashBoard-ConnectionList", "Please_Rename"}, new String[]{"", tempName + ",", "!"});
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ConnectionListPane.this), message);
setWarnigText(editingIndex);
}
if (isNamePermitted && !ComparatorUtils.equals(tempName, selectedName)) {
rename(selectedName, tempName);
}
}
});
}
protected void rename(String oldName, String newName) {
if (renameMap.containsKey(selectedName)) {
renameMap.remove(selectedName);
}
renameMap.put(selectedName, newName);
}
/**
* 名字是否允许
*
* @return /
*/
public boolean isNamePermitted() {
return isNamePermitted;
}
/**
* 检查按钮可用状态 Check button enabled.
*/
public void checkButtonEnabled() {
super.checkButtonEnabled();
isNamePermitted = !isContainsRename();
}
public HashMap<String, String> getRenameMap() {
return renameMap;
}
/**
* 创建菜单项
*
* @return 菜单项
*/
public NameableCreator[] createNameableCreators() {
NameableCreator[] creators = new NameableCreator[]{new NameObjectCreator(
"JDBC",
"/com/fr/design/images/data/source/jdbcTableData.png",
JDBCDatabaseConnection.class,
DatabaseConnectionPane.JDBC.class
), new NameObjectCreator(
"JNDI",
"/com/fr/design/images/data/source/jdbcTableData.png",
JNDIDatabaseConnection.class,
DatabaseConnectionPane.JNDI.class
)};
Set<ConnectionProvider> pluginCreators = ExtraDesignClassManager.getInstance().getArray(ConnectionProvider.XML_TAG);
for (ConnectionProvider provider : pluginCreators) {
NameObjectCreator creator = new NameObjectCreator(
provider.nameForConnection(),
provider.iconPathForConnection(),
provider.classForConnection(),
provider.appearanceForConnection()
);
creators = ArrayUtils.add(creators, creator);
}
return creators;
}
@Override
protected String title4PopupWindow() {
return TITLE_NAME;
}
/**
* Populate.
*
* @param datasourceManager the new datasourceManager.
*/
public void populate(DatasourceManagerProvider datasourceManager) {
Iterator<String> nameIt = datasourceManager.getConnectionNameIterator();
List<NameObject> nameObjectList = new ArrayList<NameObject>();
while (nameIt.hasNext()) {
String name = nameIt.next();
nameObjectList.add(new NameObject(name, datasourceManager.getConnection(name)));
}
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()]));
}
/**
* Update.
*/
public void update(DatasourceManagerProvider datasourceManager) {
// Nameable[]居然不能强转成NameObject[],一定要这么写...
Nameable[] res = this.update();
NameObject[] res_array = new NameObject[res.length];
java.util.Arrays.asList(res).toArray(res_array);
datasourceManager.clearAllConnection();
for (int i = 0; i < res_array.length; i++) {
NameObject nameObject = res_array[i];
datasourceManager.putConnection(nameObject.getName(), (Connection) nameObject.getObject());
}
}
}

155
designer_base/src/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -1,78 +1,79 @@
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.HashMap;
public class ConnectionManagerPane extends LoadingBasicPane {
private UITextField connectionTextField;
private ConnectionListPane connectionListPane;
protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel connectionPathPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
container.add(connectionPathPane, BorderLayout.NORTH);
connectionPathPane.setBorder(BorderFactory.createEmptyBorder(6, 2, 2, 2));
connectionPathPane.add(new UILabel(Inter.getLocText("FR-Designer_Save_Path") + ":"), BorderLayout.WEST);
this.connectionTextField = new UITextField();
connectionPathPane.add(connectionTextField, BorderLayout.CENTER);
this.connectionTextField.setEditable(false);
connectionListPane = new ConnectionListPane(){
protected void rename(String oldName,String newName) {
super.rename(oldName,newName);
renameConnection(oldName,newName);
}
};
container.add(connectionListPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Server-Define_Data_Connection");
}
public HashMap<String, String> getRenameMap() {
return connectionListPane.getRenameMap();
}
public void populate(DatasourceManagerProvider datasourceManager) {
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager);
}
public void update(DatasourceManagerProvider datasourceManager) {
this.connectionListPane.update(datasourceManager);
}
/**
* 设置选中项
*
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
this.connectionListPane.setSelectedIndex(index);
}
/**
* 名字是否允许
* @return 允许返回true
*/
public boolean isNamePermitted() {
return connectionListPane.isNamePermitted();
}
package com.fr.design.data.datapane.connect;
import com.fr.base.FRContext;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.file.DatasourceManagerProvider;
import com.fr.general.Inter;
import com.fr.stable.project.ProjectConstants;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.HashMap;
public class ConnectionManagerPane extends LoadingBasicPane implements ConnectionShowPane {
private UITextField connectionTextField;
private ConnectionListPane connectionListPane;
protected void initComponents(JPanel container) {
container.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel connectionPathPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
container.add(connectionPathPane, BorderLayout.NORTH);
connectionPathPane.setBorder(BorderFactory.createEmptyBorder(6, 2, 2, 2));
connectionPathPane.add(new UILabel(Inter.getLocText("FR-Designer_Save_Path") + ":"), BorderLayout.WEST);
this.connectionTextField = new UITextField();
connectionPathPane.add(connectionTextField, BorderLayout.CENTER);
this.connectionTextField.setEditable(false);
connectionListPane = new ConnectionListPane() {
protected void rename(String oldName, String newName) {
super.rename(oldName, newName);
renameConnection(oldName, newName);
}
};
container.add(connectionListPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Server-Define_Data_Connection");
}
public HashMap<String, String> getRenameMap() {
return connectionListPane.getRenameMap();
}
public void populate(DatasourceManagerProvider datasourceManager) {
this.connectionTextField.setText(FRContext.getCurrentEnv().getPath() + File.separator + ProjectConstants.RESOURCES_NAME
+ File.separator + datasourceManager.fileName());
this.connectionListPane.populate(datasourceManager);
}
public void update(DatasourceManagerProvider datasourceManager) {
this.connectionListPane.update(datasourceManager);
}
/**
* 设置选中项
*
* @param index 选中项的序列号
*/
public void setSelectedIndex(int index) {
this.connectionListPane.setSelectedIndex(index);
}
/**
* 名字是否允许
*
* @return 允许返回true
*/
public boolean isNamePermitted() {
return connectionListPane.isNamePermitted();
}
}

15
designer_base/src/com/fr/design/data/datapane/connect/ConnectionShowPane.java

@ -0,0 +1,15 @@
package com.fr.design.data.datapane.connect;
import com.fr.file.DatasourceManagerProvider;
/**
* Created by yaoh.wu on 2017/4/22.
* 数据链接显示面板
*/
public interface ConnectionShowPane {
void update(DatasourceManagerProvider datasourceManager);
void populate(DatasourceManagerProvider datasourceManager);
void setSelectedIndex(int index);
}

13
designer_base/src/com/fr/design/formula/VariableResolverAdapter.java

@ -4,12 +4,16 @@ import com.fr.base.ConfigManager;
import com.fr.base.Parameter;
import com.fr.design.DesignModelAdapter;
import com.fr.base.ConfigManagerProvider;
import com.fr.plugin.ExtraClassManager;
import com.fr.script.ScriptConstants;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Constants;
import com.fr.stable.fun.BuiltInParametersProvider;
import com.fr.stable.script.CalculatorProvider;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public abstract class VariableResolverAdapter implements VariableResolver {
private static final int TABLE_DATA_PARA = 0;
@ -21,7 +25,7 @@ public abstract class VariableResolverAdapter implements VariableResolver {
* @return 内置参数
*/
public String[] resolveCurReportVariables() {
return new String[] { ScriptConstants.SUMMARY_TAG + "page_number",
String [] variables = new String[] { ScriptConstants.SUMMARY_TAG + "page_number",
ScriptConstants.SUMMARY_TAG + "totalPage_number",
// 下面是权限相关的参数
ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_USERNAME, ScriptConstants.DETAIL_TAG + Constants.P.PRIVILEGE_AUTHORITY,
@ -32,6 +36,13 @@ public abstract class VariableResolverAdapter implements VariableResolver {
CalculatorProvider.REPORT_NAME, CalculatorProvider.FORMLET_NAME, CalculatorProvider.SERVLET_URL, CalculatorProvider.SERVER_SCHEMA, CalculatorProvider.SERVER_NAME,
CalculatorProvider.SERVER_PORT, CalculatorProvider.SERVER_URL, CalculatorProvider.CONTEXT_PATH, CalculatorProvider.SESSION_ID
};
Set<BuiltInParametersProvider> set = ExtraClassManager.getInstance().getArray(BuiltInParametersProvider.XML_TAG);
for (BuiltInParametersProvider provider : set) {
return (String[]) ArrayUtils.addAll(variables, new String []{
ScriptConstants.DETAIL_TAG + provider.getParametersName()
});
}
return variables;
}
private Parameter[] getCurrentModeParameters(int type) {

BIN
designer_base/src/com/fr/design/images/control/tab/end.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 B

BIN
designer_base/src/com/fr/design/images/control/tab/end_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

BIN
designer_base/src/com/fr/design/images/control/tab/first.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
designer_base/src/com/fr/design/images/control/tab/first_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
designer_base/src/com/fr/design/images/control/tab/next.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

BIN
designer_base/src/com/fr/design/images/control/tab/next_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

BIN
designer_base/src/com/fr/design/images/control/tab/prev.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

BIN
designer_base/src/com/fr/design/images/control/tab/prev_not.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

2
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/FormHyperlinkPane.java

@ -95,6 +95,8 @@ public class FormHyperlinkPane extends BasicBeanPane<FormHyperlinkProvider> {
parameterList.toArray(parameters);
formHyperlink.setParameters(parameters);
} else {
formHyperlink.setParameters(null);
}
}

31
designer_chart/src/com/fr/design/mainframe/chart/gui/data/TableDataPane.java

@ -25,6 +25,10 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
private ChartDataPane parent;
protected AbstractTableDataContentPane getDataContentPane() {
return dataContentPane;
}
public TableDataPane(ChartDataPane parent) {
this.parent = parent;
initDataPane();
@ -103,34 +107,41 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
* @param collection 图表属性的集合
*/
public void refreshContentPane(ChartCollection collection) {
refreshContentPane(getContentPane(collection.getSelectedChart().getPlot()));
}
protected void refreshContentPane(AbstractTableDataContentPane contentPane) {
if(dataContentPane != null) {
remove(dataContentPane);
}
dataContentPane = getContentPane(collection.getSelectedChart().getPlot());
dataContentPane = contentPane;
if(dataContentPane != null) {
add(dataContentPane, BorderLayout.CENTER);
}
}
/**
* 更新界面属性
* 更新界面属性
*/
public void populateBean(ChartCollection collection) {
if(collection == null) {
return;
}
TableDataDefinition data = (TableDataDefinition)collection.getSelectedChart().getFilterDefinition();
populateDSName(data);
if(dataContentPane != null) {
dataContentPane.populateBean(collection);
}
}
protected void populateDSName(TableDataDefinition dataDefinition){
TableData tableData = null;
if(data != null) {
tableData = data.getTableData();
if(dataDefinition != null) {
tableData = dataDefinition.getTableData();
}
onSelectTableData();
checkBoxUse();
tableDataPane.populateBean(tableData);
if(dataContentPane != null) {
dataContentPane.populateBean(collection);
}
}
/**
@ -141,6 +152,10 @@ public class TableDataPane extends FurtherBasicBeanPane<ChartCollection>{
dataContentPane.updateBean(collection);
}
TopDefinition dataDefinition = (TopDefinition)collection.getSelectedChart().getFilterDefinition();
updateDSName(dataDefinition);
}
protected void updateDSName(TopDefinition dataDefinition) {
if(dataDefinition instanceof TableDataDefinition) {
TableDataWrapper tableDataWrapper = tableDataPane.getTableDataWrapper();
if (dataDefinition != null && tableDataWrapper != null){

156
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -10,9 +10,11 @@ import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.fun.impl.AbstractFormElementCaseEditorProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarEditor;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PaddingMarginEditor;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer;
import com.fr.form.FormElementCaseContainerProvider;
import com.fr.form.FormElementCaseProvider;
import com.fr.form.FormProvider;
@ -34,8 +36,8 @@ import java.beans.PropertyDescriptor;
import java.util.Set;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable;
private CoverReportPane coverPanel;
private UILabel imageLable;
private CoverReportPane coverPanel;
private FormDesigner designer;
//缩略图
private BufferedImage thumbnailImage;
@ -64,18 +66,18 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
}
/**
* 是否支持设置标题
* @return 是返回true
*/
public boolean hasTitleStyle() {
* 是否支持设置标题
* @return 是返回true
*/
public boolean hasTitleStyle() {
return true;
}
/**
* 返回组件属性值
* @return 返回组件属性值
* @throws IntrospectionException 异常
*/
/**
* 返回组件属性值
* @return 返回组件属性值
* @throws IntrospectionException 异常
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{
@ -86,7 +88,8 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
@Override
public void propertyChange() {
makeVisible(toData().isVisible());}
makeVisible(toData().isVisible());
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setI18NName(
@ -97,12 +100,11 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
public void propertyChange() {
initStyle();
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setI18NName(Inter.getLocText("FR-Layout_Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("ToolBars", this.data.getClass()).setEditorClass(ElementCaseToolBarEditor.class)
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
@ -149,30 +151,30 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
return "text_field_16.png";
}
/**
* 返回组件默认名
* @return 组件类名(小写)
*/
public String createDefaultName() {
return "report";
}
/**
* 返回组件默认名
* @return 组件类名(小写)
*/
public String createDefaultName() {
return "report";
}
@Override
protected JComponent initEditor() {
if (editor == null) {
setBorder(DEFALUTBORDER);
editor = new JPanel();
editor.setBackground(null);
editor.setLayout(null);
imageLable = initImageBackground();
coverPanel = new CoverReportPane();
coverPanel.setPreferredSize(imageLable.getPreferredSize());
coverPanel.setBounds(imageLable.getBounds());
editor.add(coverPanel);
coverPanel.setVisible(false);
editor.add(imageLable);
editor = new JPanel();
editor.setBackground(null);
editor.setLayout(null);
imageLable = initImageBackground();
coverPanel = new CoverReportPane();
coverPanel.setPreferredSize(imageLable.getPreferredSize());
coverPanel.setBounds(imageLable.getBounds());
editor.add(coverPanel);
coverPanel.setVisible(false);
editor.add(imageLable);
}
return editor;
}
@ -185,7 +187,7 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
BufferedImage image = getThumbnailImage();
setLabelBackground(image, imageLable);
return imageLable;
return imageLable;
}
/**
@ -194,16 +196,16 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
private void setLabelBackground(Image image, UILabel imageLable){
ImageIcon icon = new ImageIcon(image);
imageLable.setIcon(icon);
imageLable.setOpaque(true);
imageLable.setLayout(null);
imageLable.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());
imageLable.setOpaque(true);
imageLable.setLayout(null);
imageLable.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight());
}
/**
* 是否展现覆盖的pane
* @param display 是否
*/
public void displayCoverPane(boolean display){
/**
* 是否展现覆盖的pane
* @param display 是否
*/
public void displayCoverPane(boolean display){
coverPanel.setVisible(display);
coverPanel.setBounds(1, 1, (int) editor.getBounds().getWidth(), (int) editor.getBounds().getHeight());
editor.repaint();
@ -216,41 +218,41 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
coverPanel.destroyHelpDialog();
}
public JComponent getCoverPane(){
return coverPanel;
}
public JComponent getCoverPane(){
return coverPanel;
}
/**
* 初始化大小
* @return 尺寸
*/
/**
* 初始化大小
* @return 尺寸
*/
public Dimension initEditorSize() {
return BORDER_PREFERRED_SIZE;
}
/**
* 是否是报表块
* @return
*/
/**
* 是否是报表块
* @return
*/
public boolean isReport() {
return true;
}
/**
* 该组件是否可以拖入参数面板
* @return 是则返回true
*/
public boolean canEnterIntoParaPane(){
return false;
}
/**
* 返回报表块对应的widget
* @return 返回ElementCaseEditor
*/
public ElementCaseEditor toData() {
return ((ElementCaseEditor) data);
}
/**
* 该组件是否可以拖入参数面板
* @return 是则返回true
*/
public boolean canEnterIntoParaPane(){
return false;
}
/**
* 返回报表块对应的widget
* @return 返回ElementCaseEditor
*/
public ElementCaseEditor toData() {
return ((ElementCaseEditor) data);
}
public FormElementCaseProvider getElementCase() {
return toData().getElementCase();
@ -301,14 +303,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
}
private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){
FormDesigner designer = editingMouseListener.getDesigner();
if (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR){
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e);
//切换设计器
designer.switchTab(component);
}
}
private void switchTab(MouseEvent e,EditingMouseListener editingMouseListener){
FormDesigner designer = editingMouseListener.getDesigner();
if (e.getClickCount() == 2 || designer.getCursor().getType() == Cursor.HAND_CURSOR){
FormElementCaseContainerProvider component = (FormElementCaseContainerProvider) designer.getComponentAt(e);
//切换设计器
designer.switchTab(component);
}
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {

2
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java

@ -14,7 +14,7 @@ public class TabMoveEndAction extends TabMoveAction {
public TabMoveEndAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_End"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/rightright.png"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/tab/end.png"));
}
//改变Tab的索引号

2
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java

@ -14,7 +14,7 @@ public class TabMoveFirstAction extends TabMoveAction {
public TabMoveFirstAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_First"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/leftleft.png"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/tab/first.png"));
}
@Override

2
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java

@ -14,7 +14,7 @@ public class TabMoveNextAction extends TabMoveAction {
public TabMoveNextAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_Next"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/right.png"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/tab/next.png"));
}
@Override

2
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java

@ -14,7 +14,7 @@ public class TabMovePrevAction extends TabMoveAction {
public TabMovePrevAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_Prev"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/left.png"));
this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/tab/prev.png"));
}
@Override

10
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -3,10 +3,6 @@
*/
package com.fr.design.designer.creator.cardlayout;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel;
@ -17,12 +13,18 @@ import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.EditingMouseListener;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.form.ui.container.WBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.IOUtils;
import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget;
import com.fr.general.Inter;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
/**
* card布局主体框架
*

17
designer_form/src/com/fr/design/mainframe/ComponentTree.java

@ -1,21 +1,14 @@
package com.fr.design.mainframe;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.DropMode;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.treeview.ComponentTreeCellRenderer;
import com.fr.design.designer.treeview.ComponentTreeModel;
@ -92,9 +85,9 @@ public class ComponentTree extends JTree {
}
}
public void setAndScrollSelectionPath(TreePath treepath) {
setSelectionPath(treepath);
scrollPathToVisible(treepath);
public void setAndScrollSelectionPath(TreePath[] treepath) {
setSelectionPaths(treepath);
scrollPathToVisible(treepath[0]);
}
@ -112,7 +105,6 @@ public class ComponentTree extends JTree {
public TreePath[] getSelectedTreePath() {
XCreator[] creators = designer.getSelectionModel().getSelection().getSelectedCreators();
TreePath[] paths = new TreePath[creators.length];
for (int i = 0; i < paths.length; i++) {
paths[i] = buildTreePath(creators[i]);
}
@ -141,7 +133,7 @@ public class ComponentTree extends JTree {
paths[i] = buildTreePath(searchList.get(i));
}
if(paths.length > 0) {
setAndScrollSelectionPath(paths[0]);
setAndScrollSelectionPath(paths);
} else {
setSelectionPath();
}
@ -217,4 +209,5 @@ public class ComponentTree extends JTree {
Object[] components = path.toArray();
return new TreePath(components);
}
}

1
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -1018,7 +1018,6 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
}
if (!BaseUtils.isAuthorityEditing()) {
selectionModel.setSelectedCreators(selected);
TreePath path = e.getNewLeadSelectionPath();

7
designer_form/src/com/fr/design/mainframe/WidgetPropertyPane.java

@ -259,8 +259,11 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
xCreator = designer.getRootComponent();
}
XLayoutContainer container = XCreatorUtils.getHotspotContainer(xCreator);
//TODO container可能为空,引发空指针异常
return xCreator.acceptType(XWParameterLayout.class) || container.acceptType(XWParameterLayout.class);
boolean xCreatorAccept = xCreator.acceptType(XWParameterLayout.class);
boolean containerAccept = container!=null && container.acceptType(XWParameterLayout.class);
return xCreatorAccept || containerAccept;
}
public void setEditingFormDesigner(BaseFormDesigner editor) {

7
designer_form/src/com/fr/design/mainframe/widget/UITreeComboBox.java

@ -65,7 +65,6 @@ public class UITreeComboBox extends JComboBox{
* @param o Object
*/
public void setSelectedItem(Object o){
tree.setSelectionPath((TreePath)o);
getModel().setSelectedItem(o);
}
@ -110,7 +109,7 @@ public class UITreeComboBox extends JComboBox{
int index, boolean isSelected, boolean cellHasFocus){
if(tree != null && tree.getSelectedTreePath().length > 0){
TreePath path = tree.getSelectedTreePath()[0];
tree.setAndScrollSelectionPath(path);
tree.setAndScrollSelectionPath(tree.getSelectedTreePath());
Object node = path.getLastPathComponent();
value = node;
TreeCellRenderer r = tree.getCellRenderer();
@ -132,7 +131,7 @@ public class UITreeComboBox extends JComboBox{
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_SELECTED) {
TreePath[] paths = tree.getSelectedTreePath();
if (tree != null && paths.length > 0) {
tree.setAndScrollSelectionPath(paths[0]);
tree.setAndScrollSelectionPath(paths);
setSelectedItem(paths[0]);
MenuSelectionManager.defaultManager().clearSelectedPath();
}
@ -141,7 +140,7 @@ public class UITreeComboBox extends JComboBox{
tree.refreshUI();
TreePath[] paths = tree.getSelectedTreePath();
if (tree != null && paths.length > 0) {
tree.setAndScrollSelectionPath(paths[0]);
tree.setAndScrollSelectionPath(paths);
setSelectedItem(paths[0]);
MenuSelectionManager.defaultManager().clearSelectedPath();
}

Loading…
Cancel
Save