daniel 8 years ago
parent
commit
297589fe16
  1. 6
      designer_base/src/com/fr/design/data/BasicTableDataTreePane.java
  2. 9
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 26
      designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  4. 14
      designer_base/src/com/fr/design/extra/PluginHelper.java
  5. 16
      designer_base/src/com/fr/design/formula/TinyFormulaPane.java
  6. 8
      designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java
  7. 5
      designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
  8. 60
      designer_base/src/com/fr/env/RemoteEnv.java
  9. 4
      designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java
  10. 7
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java
  11. 6
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java
  12. 9
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  13. 94
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

6
designer_base/src/com/fr/design/data/BasicTableDataTreePane.java

@ -428,11 +428,11 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
} }
/** /**
* 合并数据集 * 合并数据集并返回自动更改数据集名字的新老名字键值对
* @param srcName 数据集来源(比如报表块就是报表块的名称) * @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集 * @param tableDataSource 数据集
*/ */
public void addTableData(String srcName, TableDataSource tableDataSource) { public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
return new HashMap<>(0);
} }
} }

9
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -38,6 +38,7 @@ import java.awt.dnd.DnDConstants;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -275,13 +276,15 @@ public class TableDataTreePane extends BasicTableDataTreePane {
* @param srcName 数据集来源(比如报表块就是报表块的名称) * @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集 * @param tableDataSource 数据集
*/ */
public void addTableData(String srcName, TableDataSource tableDataSource) { public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
Map<String, String> tdNameMap = new HashMap<>();
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
TableDataSource tds = tc.getBook(); TableDataSource tds = tc.getBook();
Iterator tdIterator = tableDataSource.getTableDataNameIterator(); Iterator tdIterator = tableDataSource.getTableDataNameIterator();
while (tdIterator.hasNext()) { while (tdIterator.hasNext()) {
String tdName = (String) tdIterator.next(); String tdName = (String) tdIterator.next();
String oldName = tdName;
TableData td = tableDataSource.getTableData(tdName); TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称 if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称
tdName = srcName + tdName; tdName = srcName + tdName;
@ -292,8 +295,12 @@ public class TableDataTreePane extends BasicTableDataTreePane {
tdName += i; tdName += i;
} }
tds.putTableData(tdName, td); tds.putTableData(tdName, td);
if (!ComparatorUtils.equals(oldName, tdName)) {
tdNameMap.put(oldName, tdName);
}
} }
tc.parameterChanged(); tc.parameterChanged();
dataTree.refresh(); dataTree.refresh();
return Collections.unmodifiableMap(tdNameMap);
} }
} }

26
designer_base/src/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -28,6 +28,7 @@ import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -47,8 +48,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class DBTableDataPane extends AbstractTableDataPane<DBTableData> { public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
private static final String PREVIEW_BUTTON = Inter.getLocText("Preview"); private static final String PREVIEW_BUTTON = Inter.getLocText("FR-Designer_Preview");
private static final String REFRESH_BUTTON = Inter.getLocText("Refresh"); private static final String REFRESH_BUTTON = Inter.getLocText("FR-Designer_Refresh");
private ConnectionTableProcedurePane connectionTableProcedurePane; private ConnectionTableProcedurePane connectionTableProcedurePane;
private UITableEditorPane<ParameterProvider> editorPane; private UITableEditorPane<ParameterProvider> editorPane;
@ -77,7 +78,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
JPanel paraMeanPane = new JPanel(new BorderLayout()); JPanel paraMeanPane = new JPanel(new BorderLayout());
paraMeanPane.setPreferredSize(new Dimension(680, 90)); paraMeanPane.setPreferredSize(new Dimension(680, 90));
UILabel paraMean = new UILabel(Inter.getLocText("Datasource-Param_DES")); UILabel paraMean = new UILabel(Inter.getLocText("FR-Designer-Datasource-Param_DES"));
paraMeanPane.add(paraMean, BorderLayout.CENTER); paraMeanPane.add(paraMean, BorderLayout.CENTER);
ParameterTableModel model = new ParameterTableModel() { ParameterTableModel model = new ParameterTableModel() {
@ -125,9 +126,12 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
} }
} }
}); });
box.setMinimumSize(new Dimension(310, 400));
this.add(connectionTableProcedurePane, BorderLayout.WEST); // 使用SplitPane
this.add(sqlSplitPane, BorderLayout.CENTER); JSplitPane mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, connectionTableProcedurePane, sqlSplitPane);
mainSplitPane.setBorder(BorderFactory.createLineBorder(GUICoreUtils.getTitleLineBorderColor()));
mainSplitPane.setOneTouchExpandable(true);
this.add(mainSplitPane, BorderLayout.CENTER);
} }
private boolean isPreviewOrRefreshButton (FocusEvent e) { private boolean isPreviewOrRefreshButton (FocusEvent e) {
@ -140,7 +144,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("DS-Database_Query"); return Inter.getLocText("FR-Designer-DS-Database_Query");
} }
private void refresh() { private void refresh() {
@ -160,7 +164,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
toolBarDef.addShortCut(new PreviewAction()); toolBarDef.addShortCut(new PreviewAction());
toolBarDef.addShortCut(SeparatorDef.DEFAULT); toolBarDef.addShortCut(SeparatorDef.DEFAULT);
toolBarDef.addShortCut(new EditPageQueryAction()); toolBarDef.addShortCut(new EditPageQueryAction());
isShareCheckBox = new UICheckBox(Inter.getLocText("Is_Share_DBTableData")); isShareCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Is_Share_DBTableData"));
maxPanel = new MaxMemRowCountPanel(); maxPanel = new MaxMemRowCountPanel();
maxPanel.setBorder(null); maxPanel.setBorder(null);
UIToolbar editToolBar = ToolBarDef.createJToolBar(); UIToolbar editToolBar = ToolBarDef.createJToolBar();
@ -233,7 +237,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName(); String dbName = this.connectionTableProcedurePane.getSelectedDatabaseConnnectonName();
if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) { if (StringUtils.isBlank(dbName) || StringUtils.isBlank(this.sqlTextPane.getText())) {
try { try {
throw new Exception(Inter.getLocText("Connect_SQL_Cannot_Null") + "."); throw new Exception(Inter.getLocText("FR-Designer_Connect_SQL_Cannot_Null") + ".");
} catch (Exception e) { } catch (Exception e) {
// JOptionPane.showMessageDialog(DBTableDataPane.this, // JOptionPane.showMessageDialog(DBTableDataPane.this,
// Inter.getLocText("Connect_SQL_Cannot_Null") + "."); // Inter.getLocText("Connect_SQL_Cannot_Null") + ".");
@ -288,7 +292,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
private class EditPageQueryAction extends UpdateAction { private class EditPageQueryAction extends UpdateAction {
public EditPageQueryAction() { public EditPageQueryAction() {
this.setName(Inter.getLocText("LayerPageReport_PageQuery")); this.setName(Inter.getLocText("FR-Designer-LayerPageReport_PageQuery"));
this.setMnemonic('L'); this.setMnemonic('L');
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png"));
} }
@ -338,7 +342,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Inter.getLocText("LayerPageReport_Define_PageQuerySQL"); return Inter.getLocText("FR-Designer-LayerPageReport_Define_PageQuerySQL");
} }
} }
} }

14
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -15,6 +15,7 @@ import com.fr.plugin.dependence.PluginDependenceUnit;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
@ -47,6 +48,9 @@ public class PluginHelper {
* @param p 下载百分比处理 * @param p 下载百分比处理
*/ */
public static void downloadPluginFile(String id, String username, String password, Process<Double> p) throws Exception { public static void downloadPluginFile(String id, String username, String password, Process<Double> p) throws Exception {
if (!PluginHelper.invalidUser(id, username, password)) {
return;
}
HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password)); HttpClient httpClient = new HttpClient(getDownloadPath(id, username, password));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
int totalSize = httpClient.getContentLength(); int totalSize = httpClient.getContentLength();
@ -72,6 +76,16 @@ public class PluginHelper {
} }
} }
private static boolean invalidUser(String id, String username, String password) {
if (StringUtils.isEmpty(id)) {
return false;
} else if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){
return false;
} else {
return true;
}
}
private static String getDownloadPath(String id, String username, String password) throws Exception { private static String getDownloadPath(String id, String username, String password) throws Exception {
HashMap<String, String> map = new HashMap<String, String>(); HashMap<String, String> map = new HashMap<String, String>();
map.put("id", id); map.put("id", id);

16
designer_base/src/com/fr/design/formula/TinyFormulaPane.java

@ -42,7 +42,7 @@ public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver
// 添加一公式编辑器按钮 // 添加一公式编辑器按钮
formulaTextFieldButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); formulaTextFieldButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
formulaTextFieldButton.setToolTipText(Inter.getLocText("Formula") + "..."); formulaTextFieldButton.setToolTipText(Inter.getLocText("FR-Designer_Formula") + "...");
formulaTextFieldButton.setPreferredSize(new Dimension(24, 20)); formulaTextFieldButton.setPreferredSize(new Dimension(24, 20));
formulaTextFieldButton.setOpaque(false); formulaTextFieldButton.setOpaque(false);
formulaTextFieldButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); formulaTextFieldButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
@ -56,11 +56,7 @@ public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver
@Override @Override
public void doOk() { public void doOk() {
Formula fm = formulaPane.update(); Formula fm = formulaPane.update();
if (fm.getContent().length() <= 1) { populateTextField(fm);
formulaTextField.setText("$$$");
} else {
formulaTextField.setText(fm.getContent());
}
okEvent(); okEvent();
} }
}).setVisible(true); }).setVisible(true);
@ -69,6 +65,14 @@ public class TinyFormulaPane extends BasicBeanPane<String> implements UIObserver
initLayout(); initLayout();
} }
protected void populateTextField(Formula fm) {
if (fm.getContent().length() <= 1) {
formulaTextField.setText("$$$");
} else {
formulaTextField.setText(fm.getContent());
}
}
protected void initLayout() { protected void initLayout() {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;

8
designer_base/src/com/fr/design/gui/frpane/UICorrelationComboBoxPane.java

@ -46,6 +46,7 @@ import com.fr.stable.StringUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
public class UICorrelationComboBoxPane extends JPanel implements UIObserver { public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
private static final Dimension DIALOG_SIZE = new Dimension(500, 500);
private JPopupMenu popMenu; private JPopupMenu popMenu;
private UIMenuTable tablePane; private UIMenuTable tablePane;
private UIButton addButton; private UIButton addButton;
@ -79,6 +80,9 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
} }
} }
protected Dimension getDialogSize() {
return DIALOG_SIZE;
}
/** /**
* 刷新下拉列表和按钮 * 刷新下拉列表和按钮
@ -120,7 +124,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
fireTargetChanged(); fireTargetChanged();
} }
}); });
dialog.setSize(500, 500); dialog.setSize(getDialogSize());
GUICoreUtils.centerWindow(dialog); GUICoreUtils.centerWindow(dialog);
dialog.setVisible(true); dialog.setVisible(true);
} }
@ -202,7 +206,7 @@ public class UICorrelationComboBoxPane extends JPanel implements UIObserver {
fireTargetChanged(); fireTargetChanged();
} }
}); });
dialog.setSize(500, 500); dialog.setSize(getDialogSize());
dialog.setVisible(true); dialog.setVisible(true);
} else { } else {
popMenu.show(UICorrelationComboBoxPane.this, addButton.getX() + 1, addButton.getY() + addButton.getHeight()); popMenu.show(UICorrelationComboBoxPane.this, addButton.getX() + 1, addButton.getY() + addButton.getHeight());

5
designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -3,7 +3,6 @@ package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
@ -217,8 +216,8 @@ public class UIResizableContainer extends JPanel {
} }
} else if (direction == Constants.LEFT) { } else if (direction == Constants.LEFT) {
if(isDownPaneVisible){ if(isDownPaneVisible){
if (toolPaneY > getHeight() - toolPaneHeight) { if (toolPaneY > getHeight() - toolPaneHeight - getParameterPaneHeight()) {
toolPaneY = getHeight() - toolPaneHeight; toolPaneY = getHeight() - toolPaneHeight - getParameterPaneHeight();
} }
parameterPane.setBounds(20, 0, 230, getParameterPaneHeight()); parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());
upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY); upPane.setBounds(toolPaneHeight, getParameterPaneHeight(), containerWidth - toolPaneHeight, toolPaneY);

60
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -2116,6 +2116,7 @@ public class RemoteEnv implements Env {
StableUtils.mkdirs(target); StableUtils.mkdirs(target);
File cacheDir = null; File cacheDir = null;
File zip = null; File zip = null;
OutputStream out = null;
try { try {
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
@ -2124,16 +2125,15 @@ public class RemoteEnv implements Env {
para.put("currentUsername", this.getUser()); para.put("currentUsername", this.getUser());
HttpClient client = createHttpMethod(para); HttpClient client = createHttpMethod(para);
InputStream input = client.getResponseStream(); InputStream input = client.getResponseStream();//拿到服务端传过来的整个共享文件夹的压缩文件的文件流
zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip"); zip = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), "share.zip");
cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE); cacheDir = new File(StableUtils.pathJoin(CacheManager.getProviderInstance().getCacheDirectory().getAbsolutePath()), ShareConstants.DIR_SHARE_CACHE);
StableUtils.deleteFile(cacheDir); StableUtils.deleteFile(cacheDir);
StableUtils.mkdirs(cacheDir); StableUtils.mkdirs(cacheDir);
StableUtils.makesureFileExist(zip); StableUtils.makesureFileExist(zip);
FileOutputStream out = new FileOutputStream(zip); out = new FileOutputStream(zip);
IOUtils.copyBinaryTo(input, out); IOUtils.copyBinaryTo(input, out);//放到本地缓存目录下
out.flush();
out.close();
IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录 IOUtils.unzip(zip, cacheDir.getAbsolutePath(), EncodeConstants.ENCODING_GBK);//先解压到临时目录
if (cacheDir.exists() && cacheDir.isDirectory()) { if (cacheDir.exists() && cacheDir.isDirectory()) {
return cacheDir.listFiles(new FilenameFilter() { return cacheDir.listFiles(new FilenameFilter() {
@ -2146,6 +2146,10 @@ public class RemoteEnv implements Env {
} catch (Exception e) { } catch (Exception e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} finally { } finally {
if (out != null) {
out.flush();
out.close();
}
StableUtils.deleteFile(zip); StableUtils.deleteFile(zip);
} }
return new File[0]; return new File[0];
@ -2153,25 +2157,33 @@ public class RemoteEnv implements Env {
@Override @Override
public boolean installREUFile(File reuFile) { public boolean installREUFile(File reuFile) {
// if (reuFile == null) { if (reuFile == null) {
// return false; return false;
// } }
// try { File tempFile = new File(CacheManager.getProviderInstance().getCacheDirectory(), "temp_remote");
// HashMap<String, String> para = new HashMap<String, String>(); IOUtils.unzip(reuFile, tempFile.getAbsolutePath());
// para.put("op", "fr_remote_design"); String shareXMLName = StableUtils.pathJoin(tempFile.getAbsolutePath(), ShareConstants.NAME_XML_MODULE);
// para.put("cmd", "design_install_reufile"); String helpXMLName = StableUtils.pathJoin(tempFile.getAbsolutePath(), ShareConstants.NAME_XML_HELP);
// para.put("current_uid", this.createUserID()); try {
// para.put("currentUsername", this.getUser()); HashMap<String, String> para = new HashMap<String, String>();
// para.put("reuFileName", reuFile.getName()); para.put("op", "fr_remote_design");
// para.put("cmd", "design_install_reufile");
// HttpClient client = createHttpMethod(para); para.put("current_uid", this.createUserID());
// client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(reuFile))); para.put("currentUsername", this.getUser());
// InputStream input = execute4InputStream(client); para.put("reuFileName", reuFile.getName());
// return ComparatorUtils.equals(stream2String(input), "true");
// } catch (Exception e) { HttpClient client = createHttpMethod(para);
// return false; client.setContent(IOUtils.inputStream2Bytes(new FileInputStream(new File(shareXMLName))));
// } InputStream input = execute4InputStream(client);
return false; client.release();
para.put("isComplete", "true");
HttpClient client1 = createHttpMethod(para);
client1.setContent(IOUtils.inputStream2Bytes(new FileInputStream(new File(helpXMLName))));
InputStream input1 = execute4InputStream(client1);
return ComparatorUtils.equals(stream2String(input), "true") && ComparatorUtils.equals(stream2String(input1), "true");
} catch (Exception e) {
return false;
}
} }
@Override @Override

4
designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java

@ -168,7 +168,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4
} }
protected ChartDataPane createChartDataPane(String plotID) { protected ChartDataPane createChartDataPane(String plotID) {
return ChartTypeInterfaceManager.getInstance().getChartDataPane(plotID, listener); ChartDataPane chartDataPane = ChartTypeInterfaceManager.getInstance().getChartDataPane(plotID, listener);
chartDataPane.setSupportCellData(dataPane4SupportCell.isSupportCellData());
return chartDataPane;
} }
protected void addTypePane() { protected void addTypePane() {

7
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/AbstractReportDataContentPane.java

@ -3,8 +3,8 @@ package com.fr.design.mainframe.chart.gui.data.report;
import com.fr.base.Formula; import com.fr.base.Formula;
import com.fr.base.Utils; import com.fr.base.Utils;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.constants.UIConstants;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.frpane.UICorrelationPane; import com.fr.design.gui.frpane.UICorrelationPane;
@ -155,6 +155,11 @@ public abstract class AbstractReportDataContentPane extends BasicBeanPane<ChartC
seriesPane.stopCellEditing(); seriesPane.stopCellEditing();
seriesPane.fireTargetChanged(); seriesPane.fireTargetChanged();
} }
@Override
protected void populateTextField(Formula fm) {
formulaTextField.setText(fm.getContent());
}
}; };
editorComponent.setBackground(UIConstants.FLESH_BLUE); editorComponent.setBackground(UIConstants.FLESH_BLUE);

6
designer_chart/src/com/fr/design/mainframe/chart/gui/data/report/CategoryPlotReportDataContentPane.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe.chart.gui.data.report; package com.fr.design.mainframe.chart.gui.data.report;
import com.fr.base.Formula;
import com.fr.base.chart.chartdata.TopDefinitionProvider; import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.Bar2DPlot; import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
@ -56,6 +57,11 @@ public class CategoryPlotReportDataContentPane extends AbstractReportDataContent
this.add(formulaTextFieldButton, BorderLayout.EAST); this.add(formulaTextFieldButton, BorderLayout.EAST);
} }
@Override
protected void populateTextField(Formula fm) {
formulaTextField.setText(fm.getContent());
}
public void okEvent() { public void okEvent() {
checkBoxUse(); checkBoxUse();
} }

9
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -159,7 +159,10 @@ public class XWFitLayout extends XLayoutContainer {
creator.updateChildBound(getActualMinHeight()); creator.updateChildBound(getActualMinHeight());
} }
// 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器 // 布局内部组件放大缩小后,都是乘以百分比后取整,可能会产生空隙,此处调整容器
this.setSize(containerW + margin.getLeft() + margin.getRight(), containerH + margin.getTop() + margin.getBottom()); this.setSize(
containerW + (int)(margin.getLeft() * (1.0+percent) + margin.getRight() * (1.0+percent)),
containerH + (int)(margin.getTop() * (1.0+percent) + margin.getBottom() * (1.0+percent))
);
updateCreatorsBackupBound(); updateCreatorsBackupBound();
// 间隔也按显示大小比例调整 // 间隔也按显示大小比例调整
if (!hasCalGap) { if (!hasCalGap) {
@ -239,7 +242,7 @@ public class XWFitLayout extends XLayoutContainer {
posX.add(margin.getLeft()); posX.add(margin.getLeft());
int width = this.getWidth() - margin.getLeft() - margin.getRight(); int width = this.getWidth() - margin.getLeft() - margin.getRight();
int containW = (int) (width / perc); int containW = (int) (width / perc);
posX.add(containW); posX.add(containW + margin.getLeft());
for (int i=0, len=this.getComponentCount(); i < len; i++) { for (int i=0, len=this.getComponentCount(); i < len; i++) {
int x = this.getComponent(i).getX(); int x = this.getComponent(i).getX();
int finalX = (int) (x / perc); int finalX = (int) (x / perc);
@ -265,7 +268,7 @@ public class XWFitLayout extends XLayoutContainer {
posY.add(margin.getTop()); posY.add(margin.getTop());
int height = this.getHeight() - margin.getTop() - margin.getBottom(); int height = this.getHeight() - margin.getTop() - margin.getBottom();
int containH = (int) (height / perc); int containH = (int) (height / perc);
posY.add(containH); posY.add(containH + margin.getTop());
for (int i=0, len=this.getComponentCount(); i < len; i++) { for (int i=0, len=this.getComponentCount(); i < len; i++) {
int y = this.getComponent(i).getY(); int y = this.getComponent(i).getY();
int finalY = (int) (y / perc); int finalY = (int) (y / perc);

94
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -26,6 +26,7 @@ import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetEvent;
import java.util.Map;
/** /**
* 添加模式下鼠标事件处理器 * 添加模式下鼠标事件处理器
@ -55,15 +56,11 @@ public class FormCreatorDropTarget extends DropTarget {
private void adding(int x, int y) { private void adding(int x, int y) {
// 当前鼠标所在的组件 // 当前鼠标所在的组件
XCreator hoveredComponent = designer.getComponentAt(x, y); XCreator hoveredComponent = designer.getComponentAt(x, y);
// 获取该组件所在的焦点容器 // 获取该组件所在的焦点容器
XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent); XLayoutContainer container = XCreatorUtils.getHotspotContainer(hoveredComponent);
//cardTagLayout里用到 //cardTagLayout里用到
container.stopAddingState(designer); container.stopAddingState(designer);
boolean success = false; boolean success = false;
if (container != null) { if (container != null) {
// 如果是容器,则调用其acceptComponent接受组件 // 如果是容器,则调用其acceptComponent接受组件
AddingModel model = designer.getAddingModel(); AddingModel model = designer.getAddingModel();
@ -76,7 +73,6 @@ public class FormCreatorDropTarget extends DropTarget {
} }
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }
if (success) { if (success) {
// 如果添加成功,则触发相应事件 // 如果添加成功,则触发相应事件
XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent(); XCreator xCreator = container.acceptType(XWParameterLayout.class) ? designer.getParaComponent() : designer.getRootComponent();
@ -88,7 +84,9 @@ public class FormCreatorDropTarget extends DropTarget {
SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId); SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId);
ElCaseBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId); ElCaseBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (sharableEditor != null && bindInfo != null) { if (sharableEditor != null && bindInfo != null) {
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(),sharableEditor.getTableDataSource()); Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource());
//合并数据集之后,可能会有数据集名称变化,做一下联动
sharableEditor.batchRenameTdName(tdNameMap);
} }
} }
Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData(); Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();
@ -98,7 +96,6 @@ public class FormCreatorDropTarget extends DropTarget {
} else { } else {
Toolkit.getDefaultToolkit().beep(); Toolkit.getDefaultToolkit().beep();
} }
// 取消提示 // 取消提示
designer.setPainter(null); designer.setPainter(null);
// 切换添加状态到普通状态 // 切换添加状态到普通状态
@ -129,47 +126,9 @@ public class FormCreatorDropTarget extends DropTarget {
//提示组件是否可以拖入 //提示组件是否可以拖入
promptUser(x, y, container); promptUser(x, y, container);
if (container != null) { if (container != null) {
HoverPainter painter = null;
if (container != current || designer.getPainter() == null) { dealWithContainer(x, y, container);
// 如果焦点容器不是当前容器
if (current != null) {
// 取消前一个焦点容器的提示渲染器
designer.setPainter(null);
}
//获取painter的时候要考虑布局之间嵌套的问题
XLayoutContainer xLayoutContainer = container.getTopLayout();
if (xLayoutContainer != null && xLayoutContainer.getParent() != null
&& ((XLayoutContainer) xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)) {
if (!xLayoutContainer.isEditable()) {
xLayoutContainer = (XLayoutContainer) xLayoutContainer.getParent();
}
}
painter = AdapterBus.getContainerPainter(designer,
xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container);
// 为界面设计器设置提示渲染提示器
designer.setPainter(painter);
// 将当前容器更新为新的容器
current = container;
} else {
// 获取当前设计界面的提示渲染器
Painter p = designer.getPainter();
if (p instanceof HoverPainter) {
painter = (HoverPainter) p;
}
}
if (painter != null) {
// 为提示渲染器设置焦点位置、区域等渲染参数
Rectangle rect = ComponentUtils.getRelativeBounds(container);
rect.x -= designer.getArea().getHorizontalValue();
rect.y -= designer.getArea().getVerticalValue();
painter.setRenderingBounds(rect);
painter.setHotspot(new Point(x, y));
painter.setCreator(addingModel.getXCreator());
}
} else { } else {
// 如果鼠标不在任何组件上,则取消提示器 // 如果鼠标不在任何组件上,则取消提示器
designer.setPainter(null); designer.setPainter(null);
@ -178,6 +137,49 @@ public class FormCreatorDropTarget extends DropTarget {
designer.repaint(); designer.repaint();
} }
private void dealWithContainer(int x, int y, XLayoutContainer container) {
HoverPainter painter = null;
if (container != current || designer.getPainter() == null) {
// 如果焦点容器不是当前容器
if (current != null) {
// 取消前一个焦点容器的提示渲染器
designer.setPainter(null);
}
//获取painter的时候要考虑布局之间嵌套的问题
XLayoutContainer xLayoutContainer = container.getTopLayout();
if (xLayoutContainer != null && xLayoutContainer.getParent() != null
&& ((XLayoutContainer) xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)) {
if (!xLayoutContainer.isEditable()) {
xLayoutContainer = (XLayoutContainer) xLayoutContainer.getParent();
}
}
painter = AdapterBus.getContainerPainter(designer,
xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container);
// 为界面设计器设置提示渲染提示器
designer.setPainter(painter);
// 将当前容器更新为新的容器
current = container;
} else {
// 获取当前设计界面的提示渲染器
Painter p = designer.getPainter();
if (p instanceof HoverPainter) {
painter = (HoverPainter) p;
}
}
if (painter != null) {
// 为提示渲染器设置焦点位置、区域等渲染参数
Rectangle rect = ComponentUtils.getRelativeBounds(container);
rect.x -= designer.getArea().getHorizontalValue();
rect.y -= designer.getArea().getVerticalValue();
painter.setRenderingBounds(rect);
painter.setHotspot(new Point(x, y));
painter.setCreator(addingModel.getXCreator());
}
}
private void promptUser(int x, int y, XLayoutContainer container) { private void promptUser(int x, int y, XLayoutContainer container) {
if (!addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class)) { if (!addingModel.getXCreator().canEnterIntoParaPane() && container.acceptType(XWParameterLayout.class)) {
promptButton.setText(Inter.getLocText("FR-Designer_Forbid_Drag_into_Para_Pane")); promptButton.setText(Inter.getLocText("FR-Designer_Forbid_Drag_into_Para_Pane"));

Loading…
Cancel
Save