From c1523ffdbfee7ace739e9e3b350fd8c4ee75f0a2 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Wed, 22 Nov 2017 11:52:01 +0800 Subject: [PATCH 01/67] =?UTF-8?q?QuickEditor=20=E5=86=85=E5=AD=98=E9=87=8A?= =?UTF-8?q?=E6=94=BE=E9=97=AE=E9=A2=98=E5=92=8C=E5=86=85=E5=AD=98=E6=BF=80?= =?UTF-8?q?=E5=A2=9E=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/dscolumn/DSColumnBasicPane.java | 55 ++++++------- .../SelectedConfirmedDataColumnPane.java | 4 +- .../dscolumn/SelectedDataColumnPane.java | 39 ++++++--- .../fr/design/mainframe/ElementCasePane.java | 80 ++++++++++++++++--- .../mainframe/ReportComponentComposite.java | 5 +- .../cell/AbstractDSCellEditorPane.java | 5 ++ .../com/fr/design/module/DesignerModule.java | 34 ++++---- .../com/fr/grid/selection/CellSelection.java | 58 +++++++++----- .../com/fr/grid/selection/FloatSelection.java | 29 ++++--- .../com/fr/quickeditor/FloatQuickEditor.java | 28 ++++--- .../cellquick/CellDSColumnEditor.java | 32 +++++--- .../cellquick/CellRichTextEditor.java | 5 ++ .../cellquick/CellStringQuickEditor.java | 2 - .../cellquick/CellSubReportEditor.java | 6 ++ .../floatquick/FloatImageQuickEditor.java | 8 +- .../floatquick/FloatStringQuickEditor.java | 66 ++++++++------- .../fr/design/actions/core/ActionFactory.java | 14 ++++ .../fr/design/file/MutilTempalteTabPane.java | 51 ++++++++---- .../fr/design/mainframe/DesignerFrame.java | 23 +++++- .../fr/design/mainframe/JFormSliderPane.java | 80 +++++++++++-------- .../com/fr/design/mainframe/JSliderPane.java | 79 +++++++++++------- .../com/fr/design/selection/QuickEditor.java | 9 ++- .../design/mainframe/WidgetToolBarPane.java | 2 +- 23 files changed, 468 insertions(+), 246 deletions(-) diff --git a/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java b/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java index 603356a882..45434fa82c 100644 --- a/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java +++ b/designer/src/com/fr/design/dscolumn/DSColumnBasicPane.java @@ -14,8 +14,9 @@ import com.fr.report.cell.CellElement; import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.cellattr.CellExpandAttr; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -27,6 +28,29 @@ public class DSColumnBasicPane extends BasicPane { private ExpandDirectionPane expandDirectionPane; private CellElement cellElement; + private ActionListener summaryDirectionActionlistener = new ActionListener() { + + public void actionPerformed(ActionEvent evt) { + if (expandDirectionPane != null) { + expandDirectionPane.setNoneRadioButtonSelected(true); + } + } + }; + private ActionListener othergroupDirectionActionlistener = new ActionListener() { + + public void actionPerformed(ActionEvent evt) { + if (expandDirectionPane != null) { + expandDirectionPane.setNoneRadioButtonSelected(false); + } + } + }; + private ActionListener sdcupdateActionlistener = new ActionListener() { + + public void actionPerformed(ActionEvent evt) { + selectDataColumnPane.update(cellElement); + } + }; + public DSColumnBasicPane() { this(DSColumnPane.SETTING_ALL); } @@ -78,7 +102,7 @@ public class DSColumnBasicPane extends BasicPane { this.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize), BorderLayout.CENTER); - this.resultSetGroupPane.addListeners(summary_direction_ActionListener, otherGroup_direction_ActionListener, sdcUpdate_ActionListener); + this.resultSetGroupPane.addListeners(summaryDirectionActionlistener, othergroupDirectionActionlistener, sdcupdateActionlistener); } @Override @@ -93,7 +117,7 @@ public class DSColumnBasicPane extends BasicPane { this.cellElement = cellElement; - selectDataColumnPane.populate(source, cellElement); + selectDataColumnPane.populate(source, cellElement, null); CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr(); if (conditionParentPane != null) { @@ -134,29 +158,6 @@ public class DSColumnBasicPane extends BasicPane { resultSetGroupPane.update(); } - ActionListener summary_direction_ActionListener = new ActionListener() { - - public void actionPerformed(ActionEvent evt) { - if (expandDirectionPane != null) { - expandDirectionPane.setNoneRadioButtonSelected(true); - } - } - }; - ActionListener otherGroup_direction_ActionListener = new ActionListener() { - - public void actionPerformed(ActionEvent evt) { - if (expandDirectionPane != null) { - expandDirectionPane.setNoneRadioButtonSelected(false); - } - } - }; - ActionListener sdcUpdate_ActionListener = new ActionListener() { - - public void actionPerformed(ActionEvent evt) { - selectDataColumnPane.update(cellElement); - } - }; - public void putElementcase(ElementCasePane t) { if (conditionParentPane != null) { conditionParentPane.putElementcase(t); diff --git a/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java index e71f539ebb..9552f6ba95 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedConfirmedDataColumnPane.java @@ -6,7 +6,7 @@ import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; import com.fr.main.impl.WorkBook; import com.fr.report.cell.TemplateCellElement; -import java.awt.*; +import java.awt.Dimension; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Iterator; @@ -32,7 +32,7 @@ public class SelectedConfirmedDataColumnPane extends SelectedDataColumnPane { tableNameComboBox.refresh(source); tableNameComboBox.setEditable(false); tableNameComboBox.setEnabled(false); - super.populate(source, cell); + super.populate(source, cell, null); try { Iterator it = source.getTableDataNameIterator(); String name = (String) it.next(); diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index 362c281667..bb52b766c3 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -26,8 +26,11 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.*; -import java.awt.*; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -41,7 +44,7 @@ import java.util.regex.Pattern; * * @author yaoh.wu * @version 2017年8月3日 - * 复用对话框代码,保留对话框原始布局 + * 复用对话框代码,保留对话框原始布局 * @since 8.0 */ public class SelectedDataColumnPane extends BasicPane { @@ -53,19 +56,20 @@ public class SelectedDataColumnPane extends BasicPane { private ItemListener itemListener; private UIButton paramButton; + private ElementCasePane casePane; public SelectedDataColumnPane() { - this(true, false, null, null); + this(true, false, null); } public SelectedDataColumnPane(boolean showParameterButton) { - this(showParameterButton, false, null, null); + this(showParameterButton, false, null); } - public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, ElementCasePane casePane, TemplateCellElement cellElement) { + public SelectedDataColumnPane(boolean showParameterButton, boolean verticalLayout, TemplateCellElement cellElement) { if (verticalLayout) { - initComponentVerticalLayout(casePane, cellElement); + initComponentVerticalLayout(cellElement); } else { initComponent(showParameterButton); } @@ -119,9 +123,9 @@ public class SelectedDataColumnPane extends BasicPane { /** * 初始化竖直布局的组件 */ - public void initComponentVerticalLayout(ElementCasePane casePane, TemplateCellElement cellElement) { + private void initComponentVerticalLayout(TemplateCellElement cellElement) { initTableNameComboBox(); - initWithParameterButton(casePane, cellElement); + initWithParameterButton(cellElement); columnNameComboBox = new LazyComboBox() { @Override public Object[] load() { @@ -149,7 +153,9 @@ public class SelectedDataColumnPane extends BasicPane { } - public void populate(TableDataSource source, TemplateCellElement cellElement) { + public void populate(TableDataSource source, TemplateCellElement cellElement, ElementCasePane casePane) { + tableNameComboBox.refresh(source); + this.casePane = casePane; if (cellElement == null) { return; } @@ -191,6 +197,14 @@ public class SelectedDataColumnPane extends BasicPane { dsColumn.setParameters((ps != null && ps.length > 0) ? ps : null); } + /** + * 释放模板对象 + */ + public void release() { + this.casePane = null; + this.tableNameComboBox.setModel(new DefaultComboBoxModel()); + } + /** * 更新面板 * @@ -279,8 +293,7 @@ public class SelectedDataColumnPane extends BasicPane { }); } - private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) { - final SelectedDataColumnPane that = this; + private void initWithParameterButton(final TemplateCellElement cellElement) { editorPane = new UITableEditorPane(new ParameterTableModel()); paramButton = new UIButton(Inter.getLocText("FR-Designer-Basic_Dynamic_Parameter_Injection")); paramButton.addActionListener(new ActionListener() { @@ -290,7 +303,7 @@ public class SelectedDataColumnPane extends BasicPane { public void doOk() { List parameterList = editorPane.update(); ps = parameterList.toArray(new Parameter[parameterList.size()]); - that.update(cellElement); + update(cellElement); casePane.fireTargetModified(); } }); diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index 656d2ec93a..f65e660ac7 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -3,7 +3,13 @@ */ package com.fr.design.mainframe; -import com.fr.base.*; +import com.fr.base.BaseFormula; +import com.fr.base.BaseUtils; +import com.fr.base.DynamicUnitList; +import com.fr.base.FRContext; +import com.fr.base.Formula; +import com.fr.base.ScreenResolution; +import com.fr.base.Style; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; @@ -12,8 +18,30 @@ import com.fr.design.actions.ExitAuthorityEditAction; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.cell.BorderAction; import com.fr.design.actions.cell.CleanAuthorityAction; -import com.fr.design.actions.cell.style.*; -import com.fr.design.actions.columnrow.*; +import com.fr.design.actions.cell.style.AlignmentAction; +import com.fr.design.actions.cell.style.ReportFontBoldAction; +import com.fr.design.actions.cell.style.ReportFontForegroundAction; +import com.fr.design.actions.cell.style.ReportFontItalicAction; +import com.fr.design.actions.cell.style.ReportFontNameAction; +import com.fr.design.actions.cell.style.ReportFontSizeAction; +import com.fr.design.actions.cell.style.ReportFontUnderlineAction; +import com.fr.design.actions.cell.style.StyleBackgroundAction; +import com.fr.design.actions.columnrow.CancelColumnAction; +import com.fr.design.actions.columnrow.CancelRowAction; +import com.fr.design.actions.columnrow.ColumnHideAction; +import com.fr.design.actions.columnrow.ColumnWidthAction; +import com.fr.design.actions.columnrow.DeleteColumnAction; +import com.fr.design.actions.columnrow.DeleteRowAction; +import com.fr.design.actions.columnrow.FootColumnAction; +import com.fr.design.actions.columnrow.FootRowAction; +import com.fr.design.actions.columnrow.HeadColumnAction; +import com.fr.design.actions.columnrow.HeadRowAction; +import com.fr.design.actions.columnrow.InsertColumnAction; +import com.fr.design.actions.columnrow.InsertRowAction; +import com.fr.design.actions.columnrow.ResetColumnHideAction; +import com.fr.design.actions.columnrow.ResetRowHideAction; +import com.fr.design.actions.columnrow.RowHeightAction; +import com.fr.design.actions.columnrow.RowHideAction; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.edit.CopyAction; import com.fr.design.actions.edit.CutAction; @@ -24,8 +52,17 @@ import com.fr.design.cell.bar.DynamicScrollBar; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; -import com.fr.design.cell.editor.*; +import com.fr.design.cell.editor.BiasTextPainterCellEditor; import com.fr.design.cell.editor.CellEditor; +import com.fr.design.cell.editor.ChartCellEditor; +import com.fr.design.cell.editor.ChartFloatEditor; +import com.fr.design.cell.editor.DSColumnCellEditor; +import com.fr.design.cell.editor.FormulaCellEditor; +import com.fr.design.cell.editor.FormulaFloatEditor; +import com.fr.design.cell.editor.ImageCellEditor; +import com.fr.design.cell.editor.ImageFloatEditor; +import com.fr.design.cell.editor.RichTextCellEditor; +import com.fr.design.cell.editor.SubReportCellEditor; import com.fr.design.constants.UIConstants; import com.fr.design.designer.EditingState; import com.fr.design.designer.TargetComponent; @@ -35,7 +72,11 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.menu.*; +import com.fr.design.menu.KeySetUtils; +import com.fr.design.menu.MenuDef; +import com.fr.design.menu.NameSeparator; +import com.fr.design.menu.ShortCut; +import com.fr.design.menu.ToolBarDef; import com.fr.design.selection.QuickEditor; import com.fr.design.selection.Selectedable; import com.fr.design.selection.SelectionEvent; @@ -43,7 +84,11 @@ import com.fr.design.selection.SelectionListener; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.grid.*; +import com.fr.grid.Grid; +import com.fr.grid.GridColumn; +import com.fr.grid.GridCorner; +import com.fr.grid.GridRow; +import com.fr.grid.GridUtils; import com.fr.grid.dnd.ElementCasePaneDropTarget; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.Selection; @@ -65,12 +110,27 @@ import com.fr.stable.ArrayUtils; import com.fr.stable.ColumnRow; import com.fr.stable.unit.FU; -import javax.swing.*; -import java.awt.*; +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JScrollBar; +import javax.swing.KeyStroke; +import java.awt.AWTEvent; +import java.awt.Adjustable; +import java.awt.Dimension; +import java.awt.Image; +import java.awt.Rectangle; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; -import java.awt.event.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.lang.reflect.Constructor; import java.util.Set; @@ -462,6 +522,8 @@ public abstract class ElementCasePane extends Tar * 因为这边判断selection是一个selection,所以不会触发fireSelectionChanged */ public void setSelection(Selection selection) { + //旧选中内容编辑器释放模板对象 + this.getCurrentEditor().release(); if (!ComparatorUtils.equals(this.selection, selection) || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { this.selection = selection; diff --git a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java index 6d6a9b9fcc..70b75e1576 100644 --- a/designer/src/com/fr/design/mainframe/ReportComponentComposite.java +++ b/designer/src/com/fr/design/mainframe/ReportComponentComposite.java @@ -127,9 +127,8 @@ public class ReportComponentComposite extends JComponent { templateStateList.add(null); } centerCardPane.editingComponet.setSelection(centerCardPane.editingComponet.getDefaultSelectElement()); - if (jSliderContainer != null){ - jSliderContainer.reset(); - } + jSliderContainer=JSliderPane.getInstance(); + jSliderContainer.reset(); } if (centerCardPane.editingComponet.elementCasePane == null) { diff --git a/designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java b/designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java index a56d251a7a..8a3b2ded4d 100644 --- a/designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java +++ b/designer/src/com/fr/design/mainframe/cell/AbstractDSCellEditorPane.java @@ -120,4 +120,9 @@ public abstract class AbstractDSCellEditorPane extends JPanel { scrollBar.setBlockIncrement(SCROLLBAR_WIDTH + CONTENT_PANE_WIDTH_GAP); scrollBar.setBorder(BorderFactory.createMatteBorder(0, CONTENT_PANE_WIDTH_GAP, 0, 0, this.getBackground())); } + + /** + * 释放tc + */ + protected abstract void release(); } diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index 1ec15dabb8..c87ef19875 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/designer/src/com/fr/design/module/DesignerModule.java @@ -140,23 +140,21 @@ public class DesignerModule extends DesignModule { * kunsnat:注册单元格选中Editor */ private void registerCellEditor() { - - ActionFactory.registerCellEditorClass(String.class, CellStringQuickEditor.class); - ActionFactory.registerCellEditorClass(Number.class, CellStringQuickEditor.class); - ActionFactory.registerCellEditorClass(BaseFormula.class, CellFormulaQuickEditor.class); - ActionFactory.registerCellEditorClass(SubReport.class, CellSubReportEditor.class); - ActionFactory.registerCellEditorClass(RichText.class, CellRichTextEditor.class); - ActionFactory.registerCellEditorClass(DSColumn.class, CellDSColumnEditor.class); - ActionFactory.registerCellEditorClass(Image.class, CellImageQuickEditor.class); - ActionFactory.registerCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class); - ActionFactory.registerCellEditorClass(BufferedImage.class, CellImageQuickEditor.class); - + ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor()); + ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor()); + ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor()); + ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor()); + ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor()); + ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor()); + ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor()); + ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor()); + ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor()); + //todo 图表编辑器populate没能实现刷新面板显示 ActionFactory.registerChartCellEditorInEditor(BasicChartQuickEditor.class); - Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); for (ElementUIProvider provider : providers) { try { - ActionFactory.registerCellEditorClass(provider.targetObjectClass(), provider.quickEditor()); + ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance()); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage(), e); } @@ -174,11 +172,11 @@ public class DesignerModule extends DesignModule { */ private void registerFloatEditor() { - ActionFactory.registerFloatEditorClass(String.class, FloatStringQuickEditor.class); - ActionFactory.registerFloatEditorClass(Formula.class, FloatStringQuickEditor.class); - ActionFactory.registerFloatEditorClass(Image.class, FloatImageQuickEditor.class); - ActionFactory.registerFloatEditorClass(BufferedImage.class, FloatImageQuickEditor.class); - + ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor()); + ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor()); + ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor()); + ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor()); + //todo 图表编辑器populate没能实现刷新面板显示 ActionFactory.registerChartFloatEditorInEditor(FloatChartQuickEditor.class); } diff --git a/designer/src/com/fr/grid/selection/CellSelection.java b/designer/src/com/fr/grid/selection/CellSelection.java index c501efd265..3201c44344 100644 --- a/designer/src/com/fr/grid/selection/CellSelection.java +++ b/designer/src/com/fr/grid/selection/CellSelection.java @@ -49,8 +49,9 @@ import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.unit.FU; -import javax.swing.*; -import java.awt.*; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; +import java.awt.Rectangle; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -114,6 +115,7 @@ public class CellSelection extends Selection { /** * 增加选中的区域 + * * @param cellRectangle 区域 */ public void addCellRectangle(Rectangle cellRectangle) { @@ -164,6 +166,7 @@ public class CellSelection extends Selection { /** * 清除区域块 + * * @param i 区域块 */ public void clearCellRectangles(int i) { @@ -172,8 +175,9 @@ public class CellSelection extends Selection { /** * 包含单元格 - * @param column 列 - * @param row 行 + * + * @param column 列 + * @param row 行 * @return 若不包含返回-1 */ public int containsCell(int column, int row) { @@ -205,6 +209,7 @@ public class CellSelection extends Selection { /** * 转换成矩形 + * * @return 矩形 */ public Rectangle toRectangle() { @@ -213,6 +218,7 @@ public class CellSelection extends Selection { /** * 是否选择一个单元格 + * * @param ePane 区域 * @return 是则返回rue */ @@ -239,8 +245,9 @@ public class CellSelection extends Selection { /** * 作为可传输的 + * * @param transferable 传输介质 - * @param ePane 区域 + * @param ePane 区域 */ public void asTransferable(ElementsTransferable transferable, ElementCasePane ePane) { java.util.List list = new java.util.ArrayList(); @@ -251,12 +258,12 @@ public class CellSelection extends Selection { TemplateCellElement cellElement = (TemplateCellElement) cells.next(); list.add((TemplateCellElement) cellElement.deriveCellElement(cellElement.getColumn() - column, cellElement.getRow() - row)); } - FU [] columnWidth = new FU[columnSpan]; - FU [] rowHeight = new FU[rowSpan]; - for (int i = 0; i < columnSpan; i++){ + FU[] columnWidth = new FU[columnSpan]; + FU[] rowHeight = new FU[rowSpan]; + for (int i = 0; i < columnSpan; i++) { columnWidth[i] = ec.getColumnWidth(this.column + i); } - for (int j = 0; j < rowSpan; j++){ + for (int j = 0; j < rowSpan; j++) { rowHeight[j] = ec.getRowHeight(this.row + j); } transferable.addObject(new CellElementsClip(this.columnSpan, this.rowSpan, columnWidth, rowHeight, list.toArray(new TemplateCellElement[list.size()]))); @@ -264,9 +271,10 @@ public class CellSelection extends Selection { /** * 黏贴单元格 + * * @param ceClip 单元格 - * @param ePane 区域 - * @return 成功返回true + * @param ePane 区域 + * @return 成功返回true */ @Override public boolean pasteCellElementsClip(CellElementsClip ceClip, ElementCasePane ePane) { @@ -281,8 +289,9 @@ public class CellSelection extends Selection { /** * 黏贴字符串 - * @param str 字符串 - * @param ePane 区域 + * + * @param str 字符串 + * @param ePane 区域 * @return 成功返回true */ @Override @@ -329,7 +338,8 @@ public class CellSelection extends Selection { /** * 黏贴其他 - * @param ob 要黏贴的东西 + * + * @param ob 要黏贴的东西 * @param ePane 区域 * @return 成功返回true */ @@ -352,6 +362,7 @@ public class CellSelection extends Selection { /** * 是否能合并单元格 + * * @param ePane 区域 * @return 是则返回true */ @@ -363,6 +374,7 @@ public class CellSelection extends Selection { /** * 合并单元格 + * * @param ePane 区域 * @return 成功返回true */ @@ -386,6 +398,7 @@ public class CellSelection extends Selection { /** * 是否撤销合并单元格 + * * @param ePane 区域 * @return 是则返回true */ @@ -407,6 +420,7 @@ public class CellSelection extends Selection { /** * 撤销合并单元格 + * * @param ePane 区域 * @return 成功返回true */ @@ -443,6 +457,7 @@ public class CellSelection extends Selection { /** * 创建弹出菜单 + * * @param ePane 区域 * @return 菜单 */ @@ -477,7 +492,7 @@ public class CellSelection extends Selection { popup.add(DeprecatedActionManager.getPresentMenu(ePane).createJMenu()); popup.add(new CellAttributeAction().createMenuItem()); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (jTemplate.isJWorkBook()){ //表单中报表块编辑屏蔽掉 控件设置 + if (jTemplate.isJWorkBook()) { //表单中报表块编辑屏蔽掉 控件设置 popup.add(new CellWidgetAttrAction().createMenuItem()); } popup.add(new ConditionAttributesAction().createMenuItem()); @@ -497,8 +512,9 @@ public class CellSelection extends Selection { /** * 清除 - * @param type 要清除的类型 - * @param ePane 区域 + * + * @param type 要清除的类型 + * @param ePane 区域 * @return 成功返回true */ @Override @@ -581,6 +597,7 @@ public class CellSelection extends Selection { /** * 向左移动 + * * @param ePane 区域 */ public void moveLeft(ElementCasePane ePane) { @@ -592,6 +609,7 @@ public class CellSelection extends Selection { /** * 向右移动 + * * @param ePane 区域 */ public void moveRight(ElementCasePane ePane) { @@ -600,6 +618,7 @@ public class CellSelection extends Selection { /** * 向上移动 + * * @param ePane 区域 */ public void moveUp(ElementCasePane ePane) { @@ -611,6 +630,7 @@ public class CellSelection extends Selection { /** * 向下移动 + * * @param ePane 区域 */ public void moveDown(ElementCasePane ePane) { @@ -626,6 +646,7 @@ public class CellSelection extends Selection { /** * 触发删除动作 + * * @param ePane 区域 * @return 成功返回true */ @@ -657,6 +678,7 @@ public class CellSelection extends Selection { /** * 包含行列 + * * @param cr 行列 * @return 包含返回true */ @@ -716,7 +738,7 @@ public class CellSelection extends Selection { CellElementPropertyPane.getInstance().reInit(ePane); } - public void populateWidgetPropertyPane(ElementCasePane ePane){ + public void populateWidgetPropertyPane(ElementCasePane ePane) { CellWidgetPropertyPane.getInstance().reInit(ePane); } diff --git a/designer/src/com/fr/grid/selection/FloatSelection.java b/designer/src/com/fr/grid/selection/FloatSelection.java index de44152f77..534312a0a3 100644 --- a/designer/src/com/fr/grid/selection/FloatSelection.java +++ b/designer/src/com/fr/grid/selection/FloatSelection.java @@ -1,34 +1,40 @@ package com.fr.grid.selection; -import java.awt.Toolkit; - -import javax.swing.JPopupMenu; - import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.core.ActionFactory; -import com.fr.design.actions.edit.*; +import com.fr.design.actions.edit.CopyAction; +import com.fr.design.actions.edit.CutAction; +import com.fr.design.actions.edit.DeleteAction; +import com.fr.design.actions.edit.EditFloatElementNameAction; +import com.fr.design.actions.edit.HyperlinkAction; +import com.fr.design.actions.edit.PasteAction; import com.fr.design.actions.utils.DeprecatedActionManager; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.designer.TargetComponent; import com.fr.design.mainframe.CellElementPropertyPane; -import com.fr.general.ComparatorUtils; -import com.fr.general.Inter; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane.Clear; +import com.fr.design.selection.QuickEditor; +import com.fr.design.utils.DesignUtils; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; -import com.fr.design.selection.QuickEditor; import com.fr.stable.ColumnRow; import com.fr.stable.unit.FU; import com.fr.stable.unit.OLDPIX; -import com.fr.design.utils.DesignUtils; + +import javax.swing.JPopupMenu; +import java.awt.Toolkit; + /** * the float selection + * * @editor zhou * 2012-3-22下午2:09:20 */ @@ -209,6 +215,7 @@ public class FloatSelection extends Selection { public boolean isSelectedOneCell(ElementCasePane ePane) { return false; } + //TODO:august 这儿不比较FloatElement会不会有问题啊 @Override public boolean equals(Object obj) { @@ -232,8 +239,8 @@ public class FloatSelection extends Selection { CellElementPropertyPane.getInstance().removeAll(); } - public void populateWidgetPropertyPane(ElementCasePane ePane){ - return; + public void populateWidgetPropertyPane(ElementCasePane ePane) { + } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/FloatQuickEditor.java b/designer/src/com/fr/quickeditor/FloatQuickEditor.java index 6a9fa1475f..db24065a39 100644 --- a/designer/src/com/fr/quickeditor/FloatQuickEditor.java +++ b/designer/src/com/fr/quickeditor/FloatQuickEditor.java @@ -1,24 +1,32 @@ package com.fr.quickeditor; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.selection.QuickEditor; import com.fr.grid.selection.FloatSelection; import com.fr.report.cell.FloatElement; -import com.fr.design.selection.QuickEditor; /** - * * @author zhou * @since 2012-7-23下午5:17:23 */ public abstract class FloatQuickEditor extends QuickEditor { - protected FloatElement floatElement; + protected FloatElement floatElement; + + @Override + protected void refresh() { + FloatSelection fs = (FloatSelection) tc.getSelection(); + floatElement = tc.getEditingElementCase().getFloatElement(fs.getSelectedFloatName()); + refreshDetails(); + } - @Override - protected void refresh() { - FloatSelection fs = (FloatSelection)tc.getSelection(); - floatElement = tc.getEditingElementCase().getFloatElement(fs.getSelectedFloatName()); - refreshDetails(); - } + /** + * 刷新详细信息 + */ + protected abstract void refreshDetails(); - protected abstract void refreshDetails(); + @Override + public void release() { + super.release(); + floatElement = null; + } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index 1ae401bc5e..ea872d01cf 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -141,17 +141,6 @@ public class CellDSColumnEditor extends CellQuickEditor { } - /** - * 关闭时候释放 - */ - @Override - public void release() { - super.release(); - dsColumnRegion = null; - centerPane = null; - } - - /** * 初始化基本和高级设置切换tab */ @@ -187,6 +176,12 @@ public class CellDSColumnEditor extends CellQuickEditor { paneList.add(cellDSColumnAdvancedPane); } + @Override + public void release() { + super.release(); + cellDSColumnBasicPane.release(); + cellDSColumnAdvancedPane.release(); + } /** * 单元格元素 数据列 高级设置内容面板 @@ -252,7 +247,7 @@ public class CellDSColumnEditor extends CellQuickEditor { }; DSColumnBasicEditorPane() { - dataPane = new SelectedDataColumnPane(true, true, tc, cellElement); + dataPane = new SelectedDataColumnPane(true, true, cellElement); groupPane = new ResultSetGroupDockingPane(); dataPane.addListener(dataListener); groupPane.setListener(groupListener); @@ -297,13 +292,19 @@ public class CellDSColumnEditor extends CellQuickEditor { @Override public void populate() { - dataPane.populate(null, cellElement); + dataPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement, tc); groupPane.populate(cellElement); if (tc != null) { condition.setEditingComponent(tc); } } + @Override + protected void release() { + condition.setEditingComponent(null); + dataPane.release(); + } + /** * 创建有内容的面板显示信息 @@ -434,6 +435,11 @@ public class CellDSColumnEditor extends CellQuickEditor { } } + @Override + protected void release() { + + } + /** * 更新单元格扩展属性 */ diff --git a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java index 461dee3eee..29503d051f 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -58,4 +58,9 @@ public class CellRichTextEditor extends CellQuickEditor { return true; } + @Override + public void release() { + super.release(); + richTextButton.setAction(null); + } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java index e8f79166ad..e90e277153 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java @@ -3,7 +3,6 @@ package com.fr.quickeditor.cellquick; import com.fr.base.BaseFormula; import com.fr.base.Style; import com.fr.base.TextFormat; -import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.UITextArea; import com.fr.grid.GridKeyListener; import com.fr.grid.selection.CellSelection; @@ -18,7 +17,6 @@ import javax.swing.JPanel; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import java.awt.BorderLayout; -import java.awt.Dimension; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; diff --git a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java index cfa362cb38..b33deff88b 100644 --- a/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -56,4 +56,10 @@ public class CellSubReportEditor extends CellQuickEditor { public boolean isScrollAll() { return true; } + + @Override + public void release() { + super.release(); + subReportButton.setAction(null); + } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java b/designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java index 81507186ba..5d8a72e002 100644 --- a/designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java +++ b/designer/src/com/fr/quickeditor/floatquick/FloatImageQuickEditor.java @@ -12,8 +12,10 @@ import com.fr.general.Inter; import com.fr.quickeditor.FloatQuickEditor; import com.fr.report.cell.cellattr.CellImage; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -70,8 +72,6 @@ public class FloatImageQuickEditor extends FloatQuickEditor { @Override protected void refreshDetails() { - // TODO Auto-generated method stub - } } \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java b/designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java index 1f5718a9e9..eae3e81dc0 100644 --- a/designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java +++ b/designer/src/com/fr/quickeditor/floatquick/FloatStringQuickEditor.java @@ -12,10 +12,16 @@ import com.fr.quickeditor.FloatQuickEditor; import com.fr.report.ReportHelper; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JTextArea; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -27,6 +33,25 @@ public class FloatStringQuickEditor extends FloatQuickEditor { private boolean reserveInResult = false; private boolean reserveOnWriteOrAnaly = true; + private DocumentListener documentListener = new DocumentListener() { + + @Override + public void insertUpdate(DocumentEvent e) { + changeReportPaneCell(stringTextField.getText().trim()); + } + + @Override + public void removeUpdate(DocumentEvent e) { + changeReportPaneCell(stringTextField.getText().trim()); + } + + @Override + public void changedUpdate(DocumentEvent e) { + changeReportPaneCell(stringTextField.getText().trim()); + } + + }; + public FloatStringQuickEditor() { super(); stringTextField = new JTextArea(); @@ -34,11 +59,17 @@ public class FloatStringQuickEditor extends FloatQuickEditor { formulaButton = new UIButton(); formulaButton.setPreferredSize(new Dimension(25, 23)); formulaButton.setIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); + ActionListener getFormulaActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + ((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing(); + } + }; formulaButton.addActionListener(getFormulaActionListener); JPanel pane = new JPanel(new BorderLayout(5, 0)); pane.add(stringTextField, BorderLayout.CENTER); pane.add(formulaButton, BorderLayout.EAST); - pane.setBorder(BorderFactory.createEmptyBorder(0,0,0,5)); + pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); formulaButton.setVisible(false); this.setLayout(new BorderLayout()); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); @@ -55,16 +86,10 @@ public class FloatStringQuickEditor extends FloatQuickEditor { stringTextField.setBackground(Color.WHITE); } - ActionListener getFormulaActionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - ((ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane()).getGrid().startEditing(); - } - }; @Override protected void refreshDetails() { - String str = null; + String str; Object value = floatElement.getValue(); if (value == null) { str = StringUtils.EMPTY; @@ -89,26 +114,8 @@ public class FloatStringQuickEditor extends FloatQuickEditor { stringTextField.getDocument().addDocumentListener(documentListener); } - DocumentListener documentListener = new DocumentListener() { - - @Override - public void insertUpdate(DocumentEvent e) { - changeReportPaneCell(stringTextField.getText().trim()); - } - - @Override - public void removeUpdate(DocumentEvent e) { - changeReportPaneCell(stringTextField.getText().trim()); - } - - @Override - public void changedUpdate(DocumentEvent e) { - changeReportPaneCell(stringTextField.getText().trim()); - } - - }; - protected void changeReportPaneCell(String tmpText) { + private void changeReportPaneCell(String tmpText) { if (tmpText != null && (tmpText.length() > 0 && tmpText.charAt(0) == '=')) { BaseFormula textFormula = BaseFormula.createFormulaBuilder().build(tmpText); textFormula.setReserveInResult(reserveInResult); @@ -125,5 +132,4 @@ public class FloatStringQuickEditor extends FloatQuickEditor { fireTargetModified(); stringTextField.requestFocus(); } - } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/actions/core/ActionFactory.java b/designer_base/src/com/fr/design/actions/core/ActionFactory.java index 7bc73acbb6..e48caa0ac0 100644 --- a/designer_base/src/com/fr/design/actions/core/ActionFactory.java +++ b/designer_base/src/com/fr/design/actions/core/ActionFactory.java @@ -55,6 +55,20 @@ public class ActionFactory { private ActionFactory() { } + + /** + * 元素编辑器释放模板对象 + */ + public static void editorRelease() { + for (Map.Entry entry : cellEditor.entrySet()) { + entry.getValue().release(); + } + for (Map.Entry entry : floatEditor.entrySet()) { + entry.getValue().release(); + } + } + + /** * 注册无需每次实例化的单元格元素编辑器 * diff --git a/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java b/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java index a08fabc1cf..796071ce23 100644 --- a/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java @@ -3,6 +3,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; +import com.fr.design.actions.core.ActionFactory; import com.fr.design.constants.UIConstants; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; @@ -19,11 +20,38 @@ import com.fr.stable.Constants; import com.fr.stable.ProductConstants; import com.fr.stable.project.ProjectConstants; -import javax.swing.*; +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.ButtonModel; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JMenu; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSeparator; import javax.swing.plaf.basic.BasicMenuItemUI; -import java.awt.*; -import java.awt.event.*; -import java.awt.geom.*; +import java.awt.AWTEvent; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Toolkit; +import java.awt.event.AWTEventListener; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.geom.Arc2D; +import java.awt.geom.GeneralPath; +import java.awt.geom.Line2D; +import java.awt.geom.Path2D; +import java.awt.geom.RoundRectangle2D; import java.io.File; import java.util.logging.Level; @@ -711,21 +739,10 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { specifiedTemplate.saveTemplate(); FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); - HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); - activeTemplate(filename); - } else if (returnVal == JOptionPane.NO_OPTION) { - //不保存 - HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); - activeTemplate(filename); } - //若是点击取消关闭,则什么都不做 - } else { - //若是已经保存过了,则关闭即可 - HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); - activeTemplate(filename); } - - + HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); + activeTemplate(filename); } /** diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index b8dc09bab7..92489c598a 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -10,6 +10,7 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.DesignState; import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; +import com.fr.design.actions.core.ActionFactory; import com.fr.design.constants.UIConstants; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; @@ -53,9 +54,23 @@ import com.fr.stable.StableUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; -import javax.swing.*; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLayeredPane; +import javax.swing.JMenuBar; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.WindowConstants; import javax.swing.border.MatteBorder; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; @@ -749,6 +764,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 添加的模板. */ public void addAndActivateJTemplate(JTemplate jt) { + //释放模板对象 + ActionFactory.editorRelease(); if (jt == null || jt.getEditingFILE() == null) { return; } @@ -765,6 +782,8 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta * @param jt 模板 */ public void activateJTemplate(JTemplate jt) { + //释放模板对象 + ActionFactory.editorRelease(); if (jt == null || jt.getEditingFILE() == null) { return; } diff --git a/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java b/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java index 81a916637b..8a0ad05a42 100644 --- a/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JFormSliderPane.java @@ -14,13 +14,33 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JFormattedTextField; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Point; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; import java.math.BigDecimal; /** @@ -51,7 +71,6 @@ public class JFormSliderPane extends JPanel { private static final Color BACK_COLOR = new Color(245, 245, 247); public int showValue = 100; public double resolutionTimes = 1.0; - private static JFormSliderPane THIS; private UITextField showVal; private JSpinner showValSpinner; private UISlider slider; @@ -62,7 +81,7 @@ public class JFormSliderPane extends JPanel { private UISliderButton showValButton; private UIRadioButton twoHundredButton; private UIRadioButton oneHundredButton; - private UIRadioButton SevenFiveButton; + private UIRadioButton sevenFiveButton; private UIRadioButton fiveTenButton; private UIRadioButton twoFiveButton; private UIRadioButton selfAdaptButton; @@ -83,7 +102,7 @@ public class JFormSliderPane extends JPanel { showValSpinner.setEditor(editor); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); textField.setEditable(true); - DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); + DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); formatter.setAllowsInvalid(false); @@ -91,7 +110,7 @@ public class JFormSliderPane extends JPanel { initShowValButton(); initUIRadioButton(); initPane(); - JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); panel.add(downButton); panel.add(slider); panel.add(upButton); @@ -100,17 +119,13 @@ public class JFormSliderPane extends JPanel { this.add(panel, BorderLayout.NORTH); } - public static final JFormSliderPane getInstance() { -// if (THIS == null) { -// THIS = new JSliderPane(); -// } - THIS = new JFormSliderPane(); - return THIS; + public static JFormSliderPane getInstance() { + return new JFormSliderPane(); } private void initSlider() { - slider = new UISlider(0, HUNDRED, HALF_HUNDRED){ - public Point getToolTipLocation(MouseEvent event){ + slider = new UISlider(0, HUNDRED, HALF_HUNDRED) { + public Point getToolTipLocation(MouseEvent event) { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; @@ -123,8 +138,8 @@ public class JFormSliderPane extends JPanel { } private void initShowValSpinner() { - showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)){ - public Point getToolTipLocation(MouseEvent event){ + showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, 0, FOUR_HUNDRED, 1)) { + public Point getToolTipLocation(MouseEvent event) { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; @@ -134,16 +149,16 @@ public class JFormSliderPane extends JPanel { } private void initDownUpButton() { - downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")){ - public Point getToolTipLocation(MouseEvent event){ + downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverDown20.png")) { + public Point getToolTipLocation(MouseEvent event) { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; downButton.setOpaque(false); downButton.setBorderPainted(false); downButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Down")); - upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")){ - public Point getToolTipLocation(MouseEvent event){ + upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/normalUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png"), BaseUtils.readIcon("com/fr/design/images/data/source/hoverUp20.png")) { + public Point getToolTipLocation(MouseEvent event) { return new Point(event.getX(), event.getY() - TOOLTIP_Y); } }; @@ -164,10 +179,11 @@ public class JFormSliderPane extends JPanel { showValButton.addActionListener(showValButtonActionListener); showValButton.setToolTipText(Inter.getLocText("FR-Designer_Scale_Grade")); } + private void initUIRadioButton() { twoHundredButton = new UIRadioButton("200%"); oneHundredButton = new UIRadioButton("100%"); - SevenFiveButton = new UIRadioButton("75%"); + sevenFiveButton = new UIRadioButton("75%"); fiveTenButton = new UIRadioButton("50%"); twoFiveButton = new UIRadioButton("25%"); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); @@ -176,7 +192,7 @@ public class JFormSliderPane extends JPanel { customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); twoHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener); - SevenFiveButton.addItemListener(radioButtonItemListener); + sevenFiveButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener); customButton.addItemListener(new ItemListener() { @@ -194,7 +210,7 @@ public class JFormSliderPane extends JPanel { ButtonGroup bg = new ButtonGroup();// 初始化按钮组 bg.add(twoHundredButton);// 加入按钮组 bg.add(oneHundredButton); - bg.add(SevenFiveButton); + bg.add(sevenFiveButton); bg.add(fiveTenButton); bg.add(twoFiveButton); bg.add(selfAdaptButton); @@ -217,7 +233,7 @@ public class JFormSliderPane extends JPanel { septPane.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR); - SevenFiveButton.setBackground(BACK_COLOR); + sevenFiveButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR); // selfAdaptButton.setBackground(BACK_COLOR); @@ -227,7 +243,7 @@ public class JFormSliderPane extends JPanel { new Component[]{septPane, null}, new Component[]{twoHundredButton, null}, new Component[]{oneHundredButton, null}, - new Component[]{SevenFiveButton, null}, + new Component[]{sevenFiveButton, null}, new Component[]{fiveTenButton, null}, new Component[]{twoFiveButton, null}, new Component[]{customButton, createSpinnerPanel()} @@ -247,14 +263,14 @@ public class JFormSliderPane extends JPanel { return spinnerPanel; } - ActionListener showValButtonActionListener = new ActionListener() { + private ActionListener showValButtonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { popupDialog(); } }; - ChangeListener showValSpinnerChangeListener = new ChangeListener() { + private ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); @@ -277,7 +293,7 @@ public class JFormSliderPane extends JPanel { //定义一个监听器,用于监听所有滑动条 - ChangeListener listener = new ChangeListener() { + private ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent event) { //取出滑动条的值,并在文本中显示出来 if (!isButtonOrIsTxt) { @@ -296,7 +312,7 @@ public class JFormSliderPane extends JPanel { } }; - ItemListener radioButtonItemListener = new ItemListener() { + private ItemListener radioButtonItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JRadioButton temp = (JRadioButton) e.getSource(); @@ -312,7 +328,7 @@ public class JFormSliderPane extends JPanel { slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); } else if (showValue < HUNDRED) { slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); - } else if (showValue == HUNDRED) { + } else { slider.setValue(HALF_HUNDRED); } } @@ -336,7 +352,7 @@ public class JFormSliderPane extends JPanel { return b1.divide(b2, scale).doubleValue(); } - ActionListener buttonActionListener = new ActionListener() { + private ActionListener buttonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showValue = (int) showValSpinner.getValue(); diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index d056551399..2562755e57 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -15,15 +15,38 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFormattedTextField; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.basic.BasicSliderUI; -import javax.swing.text.BadLocationException; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; import java.math.BigDecimal; /** @@ -55,7 +78,6 @@ public class JSliderPane extends JPanel { private static final Color BACK_COLOR = new Color(245, 245, 247); public int showValue = 100; public double resolutionTimes = 1.0; - private static JSliderPane THIS; private UITextField showVal; private JSpinner showValSpinner; private UISlider slider; @@ -66,12 +88,14 @@ public class JSliderPane extends JPanel { private UISliderButton showValButton; private UIRadioButton twoHundredButton; private UIRadioButton oneHundredButton; - private UIRadioButton SevenFiveButton; + private UIRadioButton sevenFiveButton; private UIRadioButton fiveTenButton; private UIRadioButton twoFiveButton; private UIRadioButton selfAdaptButton; private UIRadioButton customButton; - //拖动条处理和button、直接输入不一样 + /** + * 拖动条处理和button、直接输入不一样 + */ private boolean isButtonOrIsTxt = true; private PopupPane dialog; private int upButtonX; @@ -87,7 +111,7 @@ public class JSliderPane extends JPanel { showValSpinner.setEditor(editor); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); textField.setEditable(true); - DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); + DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); formatter.setAllowsInvalid(false); @@ -95,7 +119,7 @@ public class JSliderPane extends JPanel { initShowValButton(); initUIRadioButton(); initPane(); - JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); panel.add(downButton); panel.add(slider); panel.add(upButton); @@ -105,12 +129,8 @@ public class JSliderPane extends JPanel { } - public static final JSliderPane getInstance() { -// if (THIS == null) { -// THIS = new JSliderPane(); -// } - THIS = new JSliderPane(); - return THIS; + public static JSliderPane getInstance() { + return new JSliderPane(); } private void initSlider() { @@ -174,7 +194,7 @@ public class JSliderPane extends JPanel { private void initUIRadioButton() { twoHundredButton = new UIRadioButton("200%"); oneHundredButton = new UIRadioButton("100%"); - SevenFiveButton = new UIRadioButton("75%"); + sevenFiveButton = new UIRadioButton("75%"); fiveTenButton = new UIRadioButton("50%"); twoFiveButton = new UIRadioButton("25%"); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); @@ -183,7 +203,7 @@ public class JSliderPane extends JPanel { customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); twoHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener); - SevenFiveButton.addItemListener(radioButtonItemListener); + sevenFiveButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener); customButton.addItemListener(new ItemListener() { @@ -201,7 +221,7 @@ public class JSliderPane extends JPanel { ButtonGroup bg = new ButtonGroup();// 初始化按钮组 bg.add(twoHundredButton);// 加入按钮组 bg.add(oneHundredButton); - bg.add(SevenFiveButton); + bg.add(sevenFiveButton); bg.add(fiveTenButton); bg.add(twoFiveButton); bg.add(selfAdaptButton); @@ -224,7 +244,7 @@ public class JSliderPane extends JPanel { septPane.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR); - SevenFiveButton.setBackground(BACK_COLOR); + sevenFiveButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR); selfAdaptButton.setBackground(BACK_COLOR); @@ -234,7 +254,7 @@ public class JSliderPane extends JPanel { new Component[]{septPane, null}, new Component[]{twoHundredButton, null}, new Component[]{oneHundredButton, null}, - new Component[]{SevenFiveButton, null}, + new Component[]{sevenFiveButton, null}, new Component[]{fiveTenButton, null}, new Component[]{twoFiveButton, null}, new Component[]{selfAdaptButton, null}, @@ -255,14 +275,14 @@ public class JSliderPane extends JPanel { return spinnerPanel; } - ActionListener showValButtonActionListener = new ActionListener() { + private ActionListener showValButtonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { popupDialog(); } }; - ChangeListener showValSpinnerChangeListener = new ChangeListener() { + private ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); @@ -285,7 +305,7 @@ public class JSliderPane extends JPanel { //定义一个监听器,用于监听所有滑动条 - ChangeListener listener = new ChangeListener() { + private ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent event) { //取出滑动条的值,并在文本中显示出来 if (!isButtonOrIsTxt) { @@ -305,7 +325,7 @@ public class JSliderPane extends JPanel { } }; - ItemListener radioButtonItemListener = new ItemListener() { + private ItemListener radioButtonItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JRadioButton temp = (JRadioButton) e.getSource(); @@ -321,7 +341,7 @@ public class JSliderPane extends JPanel { slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); } else if (showValue < HUNDRED) { slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); - } else if (showValue == HUNDRED) { + } else { slider.setValue(HALF_HUNDRED); } } @@ -339,7 +359,7 @@ public class JSliderPane extends JPanel { return this.showValue; } - public void reset(){ + public void reset() { this.showValSpinner.setValue(HUNDRED); } @@ -349,7 +369,7 @@ public class JSliderPane extends JPanel { return b1.divide(b2, scale).doubleValue(); } - ActionListener buttonActionListener = new ActionListener() { + private ActionListener buttonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showValue = (int) showValSpinner.getValue(); @@ -386,7 +406,7 @@ public class JSliderPane extends JPanel { } else if (value < HALF_HUNDRED) { times = (int) Math.round(ONEPOINTEIGHT * value + TEN); } else { - times = (int) (SIX * value - TWO_HUNDRED); + times = SIX * value - TWO_HUNDRED; } } @@ -444,11 +464,9 @@ class JSliderPaneUI extends BasicSliderUI { super(b); } - /** */ /** * 绘制指示物 */ - public void paintThumb(Graphics g) { Rectangle knobBounds = thumbRect; int w = knobBounds.width; @@ -460,7 +478,6 @@ class JSliderPaneUI extends BasicSliderUI { g2d.fillRoundRect(0, SIX, FOUR, 9, 2, 2); } - /** */ /** * 绘制刻度轨迹 */ diff --git a/designer_base/src/com/fr/design/selection/QuickEditor.java b/designer_base/src/com/fr/design/selection/QuickEditor.java index d2e74da5cd..c3a0c043af 100644 --- a/designer_base/src/com/fr/design/selection/QuickEditor.java +++ b/designer_base/src/com/fr/design/selection/QuickEditor.java @@ -2,7 +2,7 @@ package com.fr.design.selection; import com.fr.design.designer.TargetComponent; -import javax.swing.*; +import javax.swing.JComponent; /** * 快速编辑区域 @@ -39,11 +39,15 @@ public abstract class QuickEditor extends JComponent tc.fireTargetModified(); } + /** + * 刷新面板 + */ protected abstract void refresh(); /** - * for 关闭时候释放 + * 关闭模板时释放模板对象 + * 所有持有tc的对象也必须置空或者丢弃对于tc的引用 */ public void release() { tc = null; @@ -53,7 +57,6 @@ public abstract class QuickEditor extends JComponent @Override protected void refresh() { - } }; diff --git a/designer_form/src/com/fr/design/mainframe/WidgetToolBarPane.java b/designer_form/src/com/fr/design/mainframe/WidgetToolBarPane.java index cac2354e98..e627de1397 100644 --- a/designer_form/src/com/fr/design/mainframe/WidgetToolBarPane.java +++ b/designer_form/src/com/fr/design/mainframe/WidgetToolBarPane.java @@ -47,7 +47,7 @@ public class WidgetToolBarPane extends BasicPane implements DesignToolbarProvide } public void refreshToolbar() { - reset(); + singleton.reset(); } public static void refresh() { From 382656018e40c5c4c19742c25722a8f04305bb14 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 23 Nov 2017 14:50:21 +0800 Subject: [PATCH 02/67] =?UTF-8?q?REPORT-5313=209.0[8.0]=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=AE=BE=E7=BD=AE=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E9=A2=84=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=86=8D=E5=88=87=E6=8D=A2=E5=9B=9E=E6=9D=A5=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E7=95=8C=E9=9D=A2=E9=94=99=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../style/background/gradient/GradientBar.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java b/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java index 36aab678b4..01894aa065 100644 --- a/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java @@ -182,6 +182,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl for (int i = 0; i < list.size(); i++) { dist[i] = (float) ((list.get(i).getX() - 4) / (max - 4)); } + dist = correctDist(dist); LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, c); g2.setPaint(paint); @@ -193,6 +194,17 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } } + /** + * 确保dist在0-1之间 + */ + public float[] correctDist(float[] dist){ + if (dist.length == 2) { + dist[0] = dist[0] < 0 ? 0 : dist[0]; + dist[1] = dist[1] > 1 ? 1 : dist[1]; + } + return dist; + } + /** * 状态改变 */ From fbfd2dd25946c0a4023a68308f63bc3b2c0b3b4d Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 23 Nov 2017 15:47:47 +0800 Subject: [PATCH 03/67] =?UTF-8?q?REPORT-5313=209.0[8.0]=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E8=AE=BE=E7=BD=AE=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E9=A2=84=E5=AE=9A=E4=B9=89=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=86=8D=E5=88=87=E6=8D=A2=E5=9B=9E=E6=9D=A5=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E7=95=8C=E9=9D=A2=E9=94=99=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../background/gradient/GradientBar.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java b/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java index 01894aa065..e9e6d092a9 100644 --- a/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java @@ -180,9 +180,13 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } float[] dist = new float[list.size()]; for (int i = 0; i < list.size(); i++) { - dist[i] = (float) ((list.get(i).getX() - 4) / (max - 4)); + float value = (float) ((list.get(i).getX() - 4) / (max - 4)); + if (0 <= value && value <= 1) { + dist[i] = value; + } else { + dist[i] = value < 0 ? 0 : 1; + } } - dist = correctDist(dist); LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, c); g2.setPaint(paint); @@ -194,17 +198,6 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl } } - /** - * 确保dist在0-1之间 - */ - public float[] correctDist(float[] dist){ - if (dist.length == 2) { - dist[0] = dist[0] < 0 ? 0 : dist[0]; - dist[1] = dist[1] > 1 ? 1 : dist[1]; - } - return dist; - } - /** * 状态改变 */ From 3c7c15566f175bad330e56d11333c5fc8cf2cc22 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 23 Nov 2017 16:14:59 +0800 Subject: [PATCH 04/67] =?UTF-8?q?PMD=E3=80=82=E3=80=82=E3=80=82=E3=80=82?= =?UTF-8?q?=E3=80=82=E3=80=82=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/style/background/gradient/GradientBar.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java b/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java index e9e6d092a9..cf27b6acd2 100644 --- a/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java +++ b/designer_base/src/com/fr/design/style/background/gradient/GradientBar.java @@ -181,11 +181,7 @@ public class GradientBar extends JComponent implements UIObserver,ColorSelectabl float[] dist = new float[list.size()]; for (int i = 0; i < list.size(); i++) { float value = (float) ((list.get(i).getX() - 4) / (max - 4)); - if (0 <= value && value <= 1) { - dist[i] = value; - } else { - dist[i] = value < 0 ? 0 : 1; - } + dist[i] = Math.min(Math.max(0, value), 1); } LinearGradientPaint paint = new LinearGradientPaint(start, end, dist, c); From 81730387ce060f1c1864e2ff450e0ec807f4bc0f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Fri, 24 Nov 2017 15:53:33 +0800 Subject: [PATCH 05/67] =?UTF-8?q?=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8A=A5=E8=A1=A8=E5=9D=97=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/ElementCasePane.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index f65e660ac7..46c363c380 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -522,8 +522,13 @@ public abstract class ElementCasePane extends Tar * 因为这边判断selection是一个selection,所以不会触发fireSelectionChanged */ public void setSelection(Selection selection) { - //旧选中内容编辑器释放模板对象 - this.getCurrentEditor().release(); + try { + //旧选中内容编辑器释放模板对象 + this.getCurrentEditor().release(); + } catch (UnsupportedOperationException e) { + FRLogger.getLogger().info("Nothing to release"); + } + if (!ComparatorUtils.equals(this.selection, selection) || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { this.selection = selection; From 842ece0e82725ecbf2fc78041ee25d38302d3edc Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 28 Nov 2017 13:47:03 +0800 Subject: [PATCH 06/67] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/widget/component/BackgroundCompPane.java | 1 - .../widget/component/NumberEditorValidatePane.java | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java b/designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java index e534521706..fa0f4a6f9b 100644 --- a/designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java +++ b/designer_base/src/com/fr/design/widget/component/BackgroundCompPane.java @@ -10,7 +10,6 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.mainframe.widget.accessibles.AccessibleImgBackgroundEditor; import com.fr.form.ui.Widget; import com.fr.general.Inter; -import com.vividsolutions.jts.index.bintree.Interval; import javax.swing.*; import java.awt.*; diff --git a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java index feaaf67dc1..4aedc2c57c 100644 --- a/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer_base/src/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -3,7 +3,6 @@ package com.fr.design.widget.component; import com.fr.design.designer.IntervalConstants; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; @@ -13,11 +12,13 @@ import com.fr.form.ui.NumberEditor; import com.fr.general.Inter; import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import javax.swing.text.DefaultFormatter; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; From 988689ad4e60a06feccbf26294a8084232549c2e Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 28 Nov 2017 13:57:13 +0800 Subject: [PATCH 07/67] =?UTF-8?q?REPORT-5840=20=E6=8E=A7=E4=BB=B6=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=92=8C=E4=BD=BF=E7=94=A8=E5=A1=AB=E6=8A=A5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/present/ConditionAttributesGroupPane.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java index 6eac1c5710..5aafd01edb 100644 --- a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java @@ -16,6 +16,7 @@ import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.general.Inter; import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.Selection; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.TemplateCellElement; @@ -29,6 +30,7 @@ import com.fr.stable.Nameable; public class ConditionAttributesGroupPane extends UIListControlPane { private static ConditionAttributesGroupPane singleton; private TemplateCellElement editCellElement; // 当前单元格对象 + private Selection editSelection; // 当前编辑对象 private ElementCasePane ePane; private ConditionAttributesGroupPane() { @@ -52,10 +54,8 @@ public class ConditionAttributesGroupPane extends UIListControlPane { if (isPopulating) { return; } - final CellSelection finalCS = (CellSelection) ePane.getSelection(); final TemplateElementCase tplEC = ePane.getEditingElementCase(); - - ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() { + ReportActionUtils.actionIterateWithCellSelection((CellSelection) editSelection, tplEC, new ReportActionUtils.IterAction() { public void dealWith(CellElement editCellElement) { ((TemplateCellElement)editCellElement).setHighlightGroup(updateHighlightGroup()); } @@ -75,6 +75,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane { public void populate(ElementCasePane ePane) { this.ePane = ePane; + this.editSelection = ePane.getSelection(); CellSelection cs = (CellSelection) ePane.getSelection(); final TemplateElementCase tplEC = ePane.getEditingElementCase(); editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); From 04e2b236c43a7a641e6b64a3f9a160776e37b17f Mon Sep 17 00:00:00 2001 From: ju Date: Wed, 29 Nov 2017 11:35:16 +0800 Subject: [PATCH 08/67] =?UTF-8?q?REPORT-5894=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=89=93=E5=BC=80=E5=A4=A7=E9=87=8F=E5=B8=A6=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=90=8E,=20=E5=85=B3=E9=97=AD,=20G?= =?UTF-8?q?C=E5=90=8E=E5=86=85=E5=AD=98=E6=B2=A1=E6=9C=89=E6=94=BE?= =?UTF-8?q?=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/toolbar/ToolBarMenuDock.java | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index f43419d47f..fba7d9945e 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -58,7 +58,6 @@ import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; -import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import javax.swing.*; @@ -132,6 +131,9 @@ public abstract class ToolBarMenuDock { }; private static final String FINEREPORT = "FineReport"; private static final int MENUBAR_HEIGHT = 22; + + private static final List PLUGIN_LISTENERS = new ArrayList<>(); + private MenuDef[] menus; private ToolBarDef toolBarDef; private List shortCutsList; @@ -177,7 +179,6 @@ public abstract class ToolBarMenuDock { return dim; } }; - this.menus = menus(plus); for (int i = 0; i < menus.length; i++) { UIMenu subMenu = menus[i].createJMenu(); @@ -201,6 +202,8 @@ public abstract class ToolBarMenuDock { } public MenuDef[] menus(final ToolBarMenuDockPlus plus) { + //删除之前创建的插件菜单监听 + clearPluginListeners(); java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -230,7 +233,14 @@ public abstract class ToolBarMenuDock { return menuList.toArray(new MenuDef[menuList.size()]); } - + + private static synchronized void clearPluginListeners() { + + for (PluginEventListener listener : PLUGIN_LISTENERS) { + GeneralContext.stopListenPlugin(listener); + } + } + /** * 获取所有actionmodel * @@ -602,9 +612,9 @@ public abstract class ToolBarMenuDock { addExtraMenus(menuDef, anchor, action, set); } - - private void listenPluginMenuChange(final MenuDef menuDef, final String anchor, final ShortCutMethodAction action) { - + + private static synchronized void listenPluginMenuChange(final MenuDef menuDef, final String anchor, final ShortCutMethodAction action) { + PluginFilter filter = new PluginFilter() { @Override @@ -613,29 +623,35 @@ public abstract class ToolBarMenuDock { return context.contain(MenuHandler.MARK_STRING); } }; - - GeneralContext.listenPlugin(PluginEventType.BeforeStop, new PluginEventListener() { - + + PluginEventListener beforeStop = new PluginEventListener() { + @Override public void on(PluginEvent event) { PluginRuntime runtime = event.getContext().getRuntime(); Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); removeExtraMenus(menuDef, anchor, action, menuHandlers); } - }, filter); - GeneralContext.listenPlugin(PluginEventType.AfterRun, new PluginEventListener() { - + }; + + PluginEventListener afterRun = new PluginEventListener() { + @Override public void on(PluginEvent event) { - + PluginRuntime runtime = event.getContext().getRuntime(); Set menuHandlers = runtime.get(MenuHandler.MARK_STRING); addExtraMenus(menuDef, anchor, action, menuHandlers); } - }, filter); + }; + + GeneralContext.listenPlugin(PluginEventType.BeforeStop, beforeStop, filter); + GeneralContext.listenPlugin(PluginEventType.AfterRun, afterRun, filter); + PLUGIN_LISTENERS.add(afterRun); + PLUGIN_LISTENERS.add(beforeStop); } - - private void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { + + private static void removeExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { List target = new ArrayList<>(); @@ -657,8 +673,8 @@ public abstract class ToolBarMenuDock { menuDef.removeShortCut(shortCut); } } - - private void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { + + private static void addExtraMenus(MenuDef menuDef, String anchor, ShortCutMethodAction action, Set set) { List target = new ArrayList<>(); for (MenuHandler handler : set) { From f26cf271f0428d39270949866290e4a5bfcec7a2 Mon Sep 17 00:00:00 2001 From: ju Date: Wed, 29 Nov 2017 11:41:45 +0800 Subject: [PATCH 09/67] =?UTF-8?q?REPORT-5894=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=89=93=E5=BC=80=E5=A4=A7=E9=87=8F=E5=B8=A6=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=90=8E,=20=E5=85=B3=E9=97=AD,=20G?= =?UTF-8?q?C=E5=90=8E=E5=86=85=E5=AD=98=E6=B2=A1=E6=9C=89=E6=94=BE?= =?UTF-8?q?=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index fba7d9945e..c8a4d25766 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -239,6 +239,7 @@ public abstract class ToolBarMenuDock { for (PluginEventListener listener : PLUGIN_LISTENERS) { GeneralContext.stopListenPlugin(listener); } + PLUGIN_LISTENERS.clear(); } /** From 82eac484a999c342698b55fc6818b6420afb5d3e Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 29 Nov 2017 15:30:52 +0800 Subject: [PATCH 10/67] =?UTF-8?q?REPORT-5832=20=E8=A1=A8=E5=8D=95=E8=87=AA?= =?UTF-8?q?=E9=80=82=E5=BA=94=E5=88=87=E5=88=B0=E7=BB=9D=E5=AF=B9=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E5=90=8E,=20=E9=9C=80=E8=A6=81=E6=B8=85=E7=90=86?= =?UTF-8?q?=E6=8E=89=E4=B8=80=E4=BA=9B=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E9=87=8C=E6=B2=A1=E6=9C=89=E7=9A=84=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/widget/ui/designer/layout/FRFitLayoutDefinePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java index b429ff84b4..be330d2f92 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRFitLayoutDefinePane.java @@ -161,6 +161,7 @@ public class FRFitLayoutDefinePane extends AbstractDataModify { wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); Component[] components = xWFitLayout.getComponents(); xWFitLayout.removeAll(); + layout.resetStyle(); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); xWFitLayout.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { From ce67e756d988cf69c83ac71bc262a065f332a236 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 29 Nov 2017 16:56:08 +0800 Subject: [PATCH 11/67] =?UTF-8?q?REPORT-5832=20=E5=8E=BB=E6=8E=89=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java | 5 ----- .../designer/properties/FRFitLayoutPropertiesGroupModel.java | 1 - 2 files changed, 6 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java index 20702ec8f4..c7fbdb7592 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java @@ -98,11 +98,6 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr if (row == 0) { if (state == WBodyLayoutType.FIT.getTypeValue()) { return switch2FitBodyLayout(); - } else { - XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); - if (xfl.toData().removeMargin()) { - DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); - } } } if (row == 1) { diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java index d6d7c06c59..9ffad45338 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java @@ -152,7 +152,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel { wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); Component[] components = xfl.getComponents(); xfl.removeAll(); - xfl.toData().removeMargin(); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0)); xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); for (Component component : components) { From fbcd70a73c04f595db4e9f662eef4ed39e92ac95 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Mon, 4 Dec 2017 00:59:07 +0800 Subject: [PATCH 12/67] =?UTF-8?q?REPORT-5793=20=E3=80=909.0=E3=80=91?= =?UTF-8?q?=E4=BB=8Ealphafine=E8=BF=9B=E5=85=A5=E6=A8=A1=E6=9D=BF=E7=9A=84?= =?UTF-8?q?web=E5=B1=9E=E6=80=A7=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=83=BD=E6=98=AF=E4=B8=8A=E4=B8=80=E5=BC=A0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/manager/RecentSearchManager.java | 9 +++++++-- .../mainframe/toolbar/UpdateActionManager.java | 14 ++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java index c191c0c11e..48cb40d88b 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/RecentSearchManager.java @@ -2,6 +2,7 @@ package com.fr.design.mainframe.alphafine.search.manager; import com.fr.base.FRContext; import com.fr.base.Utils; +import com.fr.design.actions.UpdateAction; import com.fr.design.mainframe.alphafine.AlphaFineConstants; import com.fr.design.mainframe.alphafine.AlphaFineHelper; import com.fr.design.mainframe.alphafine.CellType; @@ -233,8 +234,12 @@ public class RecentSearchManager extends XMLFileManager implements AlphaFineSear SearchResult searchResult = new SearchResult(); while (modelIterator.hasNext()) { AlphaCellModel model = modelIterator.next(); - if (model.getType() == CellType.ACTION && !UpdateActionManager.getUpdateActionManager().isEnable(((ActionModel) model).getAction())) { - continue; + if (model.getType() == CellType.ACTION) { + UpdateAction action = UpdateActionManager.getUpdateActionManager().getActionByName(model.getName()); + if (action != null) { + ((ActionModel) model).setAction(action); + searchResult.add(model); + } } else { searchResult.add(model); } diff --git a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java index 845eb3660e..853ff15923 100644 --- a/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java +++ b/designer_base/src/com/fr/design/mainframe/toolbar/UpdateActionManager.java @@ -27,12 +27,18 @@ public class UpdateActionManager { this.updateActions = updateActions; } - public boolean isEnable(UpdateAction updateAction) { + /** + * 根据action name获取action对象 + * + * @param name + * @return + */ + public UpdateAction getActionByName(String name) { for (UpdateActionModel action : updateActions) { - if (ComparatorUtils.equals(updateAction.getName(), action.getActionName()) && action.getAction().isEnabled()) { - return true; + if (ComparatorUtils.equals(name, action.getActionName()) && action.getAction().isEnabled()) { + return action.getAction(); } } - return false; + return null; } } From e9bcc8188379852ab030b0c397a83fe8710a3b5d Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Dec 2017 17:09:40 +0800 Subject: [PATCH 13/67] =?UTF-8?q?REPORT-5954=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=8E=A7=E4=BB=B6=E6=96=87=E5=AD=97=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/foldablepane/HeaderPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index 31cc290324..96980bd9bc 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -3,6 +3,7 @@ package com.fr.design.foldablepane; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; +import com.fr.stable.OperatingSystem; import javax.swing.*; import java.awt.*; @@ -55,8 +56,11 @@ public class HeaderPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); + //mac下抗锯齿处理 + if(OperatingSystem.isMacOS()){ + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } BufferedImage panelImage = createPanelImage(); g2d.drawImage(panelImage, null, 0, 0); GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); From 989ef0936dc50927cede9e7b7f427c813aad088e Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Dec 2017 17:12:21 +0800 Subject: [PATCH 14/67] =?UTF-8?q?=E4=BF=AE=E6=94=B9import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/foldablepane/HeaderPane.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index 96980bd9bc..f6e182e2b3 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -5,8 +5,16 @@ import com.fr.design.constants.UIConstants; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; import com.fr.stable.OperatingSystem; -import javax.swing.*; -import java.awt.*; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.util.Map; From 129739d9e1fd80bab29daa720c1bc25be159d1fc Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 4 Dec 2017 18:54:05 +0800 Subject: [PATCH 15/67] =?UTF-8?q?REPORT-5954=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=8A=98=E5=8F=A0=E6=8E=A7=E4=BB=B6=E6=96=87=E5=AD=97=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/foldablepane/HeaderPane.java | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java index f6e182e2b3..506f64ef56 100644 --- a/designer_base/src/com/fr/design/foldablepane/HeaderPane.java +++ b/designer_base/src/com/fr/design/foldablepane/HeaderPane.java @@ -2,9 +2,6 @@ package com.fr.design.foldablepane; import com.fr.base.GraphHelper; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxUtilities; -import com.fr.stable.OperatingSystem; - import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -14,9 +11,7 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; -import java.awt.RenderingHints; import java.awt.image.BufferedImage; -import java.util.Map; /** * Created by MoMeak on 2017/7/5. @@ -64,29 +59,20 @@ public class HeaderPane extends JPanel { @Override protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g.create(); - //mac下抗锯齿处理 - if(OperatingSystem.isMacOS()){ - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } BufferedImage panelImage = createPanelImage(); g2d.drawImage(panelImage, null, 0, 0); + GraphHelper.applyRenderingHints(g2d); GraphHelper.drawString(g2d, this.title, TITLE_X, headHeight - fontSize / 2 - 1); } private BufferedImage createPanelImage() { BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = panelImage.createGraphics(); - g2d.setColor(isPressed ? UIConstants.POPUP_TITLE_BACKGROUND : UIConstants.COMPONENT_BACKGROUND_COLOR); headWidth = this.getWidth(); g2d.fillRect(0, 0, headWidth, headHeight); g2d.setFont(new Font("SimSun", 0, fontSize)); g2d.setPaint(bgColor); - Map desktopHints = RSyntaxUtilities.getDesktopAntiAliasHints(); - if (desktopHints != null) { - g2d.setRenderingHints(desktopHints); - } int leftWdith = headWidth - LEFT_X; if (this.isShow) { image = UIConstants.DRAG_DOWN_SELECTED_SMALL; From 261feb1394cb5fea5527f49a7c4f2f0286871422 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 5 Dec 2017 11:55:28 +0800 Subject: [PATCH 16/67] =?UTF-8?q?REPORT-5955=20[Report]=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E5=90=8E=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8=E5=8D=A1=E6=AD=BB=20=E4=B9=8B=E5=89=8Dwu?= =?UTF-8?q?=E5=81=9A=E4=BA=86=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98=EF=BC=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E4=BC=9A?= =?UTF-8?q?=E6=8A=A5nep=EF=BC=9B=E5=88=A0=E9=99=A4=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E9=80=BB=E8=BE=91=E6=94=B9=E4=B8=BA=E5=85=88?= =?UTF-8?q?setSelection=20=E5=86=8D=20remove?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/grid/selection/FloatSelection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/grid/selection/FloatSelection.java b/designer/src/com/fr/grid/selection/FloatSelection.java index 534312a0a3..60fe54b7cb 100644 --- a/designer/src/com/fr/grid/selection/FloatSelection.java +++ b/designer/src/com/fr/grid/selection/FloatSelection.java @@ -148,8 +148,8 @@ public class FloatSelection extends Selection { TemplateElementCase ec = ePane.getEditingElementCase(); FloatElement fe = ec.getFloatElement(selectedFloatName); if (fe != null) { - ec.removeFloatElement(fe); ePane.setSelection(new CellSelection(0, 0, 1, 1)); + ec.removeFloatElement(fe); return true; } From 33b935e3d8839ef117ed269c3ac28fde0774132e Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 7 Dec 2017 15:19:26 +0800 Subject: [PATCH 17/67] =?UTF-8?q?REPORT-5004=20=E2=80=9C=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E2=80=9D=E7=BB=9F=E4=B8=80=E6=94=B9=E4=B8=BA=E2=80=9C=E5=86=B3?= =?UTF-8?q?=E7=AD=96=E6=8A=A5=E8=A1=A8=E2=80=9D2/3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/locale/designer.properties | 26 ++++++------- .../design/locale/designer_en_US.properties | 36 +++++++++--------- .../design/locale/designer_zh_CN.properties | 38 +++++++++---------- .../design/locale/designer_zh_TW.properties | 34 ++++++++--------- 4 files changed, 67 insertions(+), 67 deletions(-) diff --git a/designer_base/src/com/fr/design/locale/designer.properties b/designer_base/src/com/fr/design/locale/designer.properties index bbed62b646..017ae2ba55 100644 --- a/designer_base/src/com/fr/design/locale/designer.properties +++ b/designer_base/src/com/fr/design/locale/designer.properties @@ -107,10 +107,10 @@ FR-Designer_Font-Size= FR-Designer_Forbid_Drag_into_Adapt_Pane=Forbid Drag into Para Pane FR-Designer_Forbid_Drag_into_Para_Pane=Forbid Drag into Para Pane FR-Designer_Foreground= -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Form authority editing can not be supported +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Dashboard authority editing can not be supported FR-Designer_Form-Report= FR-Designer_Form_EmbeddedTD= -FR-Designer_Form_Module=Form Module +FR-Designer_Form_Module=Dashboard Module FR-Designer_Format_explan= FR-Designer_Formula= FR-Designer_Forum= @@ -562,7 +562,7 @@ FR-Designer_DS_TableData=Data Set FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order -FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP. +FR-Designer_Mobile_Form_Analysis_Annotation=annotation: You can use this attribute to control the analysis of the dashboard in the APP. FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. FR-Designer_Background_Null= FR-Designer_Background_Color= @@ -620,7 +620,7 @@ Tree-Width=Tree Width alert_word= PageSetup-Paper_Size=Paper Size M-Page_Setup=Page Setup -DashBoard-FormBook=Form +DashBoard-FormBook=Dashboard X-Coordinate=X Coordinate Style-Line_Spacing=Line Spacing FR-Designer_Plugin_Should_Update_Title=Warning @@ -696,7 +696,7 @@ WF-Name=Name RWA-Click_Cell_To_Edit_Value=Click Cell to Edit Value Utils-Row_Height=Row Height ReportD-Excel_Export=ReportD Excel Export -Form-Please_Select_A_Kind_Of_Form_Container=Select Form Container +Form-Please_Select_A_Kind_Of_Form_Container=Select Dashboard Container Column_Does_Not_Exsit=Column Does Not Exsit M_Insert-Hyperlink=Hyperlink can_not_include_underline=can not contain "_" @@ -831,7 +831,7 @@ Values=Values Not_use_a_cell_attribute_table_editing=You may not use a cell attribute table editing Root=Root cycle=cycle -open-new-form-tip=open new form tip +open-new-form-tip=open new dashboard tip Support-Current_Auto_Complete_Shortcut=Current Shortcut GROUPING_MODE=Grouping DBCP_MAX_IDLE=MaxIdle @@ -1088,7 +1088,7 @@ Form-View_Tree=Tree View M_Insert-Chart=Insert Chart HF-Even_Page=Even Page ReportServerP-Report_server_parameter=Report Server Parameter -JavaScript-Form_Submit=Form Submit +JavaScript-Form_Submit=Dashboard Submit Horizontal-Split_Layout=Horizontal Split Layout BorderLayout-Center=Center INFO-Reset_Webapp=Reset Webapp @@ -1439,7 +1439,7 @@ ReportColumns-Columns_after=Columns after FR-Designer_Undo= DBCP_MIN_IDLE=MinIdle M-Data_Analysis_Settings=Data Analysis Settings -M-Form_Preview=Form Preview +M-Form_Preview=Dashboard Preview Form-Basic_Properties=Basic Properties quote= Thu=Thu @@ -1594,7 +1594,7 @@ FS_Report_Type=Report Type HF-New_Line=New Line Privilege=Privilege Export-Offline-Html=Export Offline HTML -FR-Designer_open-new-form-tip=open new form tip +FR-Designer_open-new-form-tip=open new dashboard tip FR-Designer-Widget-Style_Frame_Style= Present-No_Present=No Present FR-Designer_Form-Password=Password @@ -1618,7 +1618,7 @@ Above=Above Utils-The-Chart= FRFont-plain=plain Calculating=Calculating -Form-Object=Form Object +Form-Object=Dashboard Object May=May FR-Designer_Plugin_Normal_Update=Update FR-Hyperlink_Reportlet= @@ -1753,7 +1753,7 @@ ReportServerP-Last=Last FR-Base_Columns= SpecifiedG-Leave_in_their_own_groups=Leave in their own groups LOG-Please_Wait=Please Waiting -Form-ToolBar=Form ToolBar +Form-ToolBar=Dashboard ToolBar FR-Base_sure_remove_item= Component_Scale=Component Scale Hyperlink-Use_CJK_to_encode_parameter=Use CJK to encode parameter @@ -1798,7 +1798,7 @@ Only_selected_cell_can_paste_only=Only selected cell can paste only M_Report-Report_Columns=Report Columns Unit_Hundred=Hundred FR-Designer_DataTable-Build= -Widget-Form_Widget_Config=Form Widget +Widget-Form_Widget_Config=Dashboard Widget Server-version-tip-moreInfo=Your own team of our FineReport Designer version number of the product as well as the deployment server version number is consistent, in order to avoid the problems caused by inconsistent versions of risk.If you open a template produced higher Designer version, may open the error may be missing the original template properties. If you create the template used Designer Version higher than your final deployment with the server version, the server may not be able to properly load the template you create. Actions=Actions FR-Designer-Dependence_Connect_Server_Error=connect error @@ -1951,7 +1951,7 @@ ReportServerP-Import_JavaScript=Import JavaScript Form-TableTree=Table Tree Opened=Opened M_Edit-Delete=Delete -Widget-Form_Widget_Container=Form Container +Widget-Form_Widget_Container=Dashboard Container BindColumn-Summary=Summary Sche-Second=Second Server-Open_Service_Manager=Open Service Manager diff --git a/designer_base/src/com/fr/design/locale/designer_en_US.properties b/designer_base/src/com/fr/design/locale/designer_en_US.properties index e5608bf896..19ecfce77e 100644 --- a/designer_base/src/com/fr/design/locale/designer_en_US.properties +++ b/designer_base/src/com/fr/design/locale/designer_en_US.properties @@ -103,13 +103,13 @@ FR-Designer_Fit-App=App self-adaption FR-Designer_Fit=self-adaption FR-Designer_Font-Family=Font name FR-Designer_Font-Size=Font size -FR-Designer_Forbid_Drag_into_Adapt_Pane=Form body cannot be dragged into the object +FR-Designer_Forbid_Drag_into_Adapt_Pane=Dashboard body cannot be dragged into the object FR-Designer_Forbid_Drag_into_Para_Pane=The object cannot be dragged into the parameter panel FR-Designer_Foreground=Foreground -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Form permissions edition is not supported +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=Dashboard permissions edition is not supported FR-Designer_Form-Report=Report block -FR-Designer_Form_EmbeddedTD=Form(built-in data) -FR-Designer_Form_Module=Form Module +FR-Designer_Form_EmbeddedTD=Dashboard(built-in data) +FR-Designer_Form_Module=Dashboard Module FR-Designer_Format_explan=Format explain FR-Designer_Allow-Blank=Allow Blank FR-Designer_Formula=Formula @@ -500,7 +500,7 @@ FR-Designer_Properties_Mobile=MobileProperties FR-Designer_Button_OK=OK FR-Designer_Button_Cancel=Cancel FR-Designer_JavaScript=JavaScript -FR-Designer_JavaScript_Form_Submit=Form Submit +FR-Designer_JavaScript_Form_Submit=Dashboard Submit FR-Designer_JavaScript_Commit_to_Database=Commit to DB FR-Designer_JavaScript_Custom=Custom FR-Designer_RWA_Submit=Submit @@ -563,7 +563,7 @@ FR-Designer_DS_TableData=Data Set FR-Designer_Parameter-Formula=Formula FR-Designer_Plugin_Should_Update_Please_Contact_Developer=Plugin version is too low, and is not compatible with current API. Please contact the developer to update. FR-Designer_WidgetOrder=Widget Order -FR-Designer_Mobile_Form_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the form in the APP. +FR-Designer_Mobile_Form_Analysis_Annotation=annotation: You can use this attribute to control the analysis of the dashboard in the APP. FR-Designer_Mobile_Report_Analysis_Annotation=annotation\: You can use this attribute to control the analysis of the report in the APP, only to support the paging preview, fill in the preview of the property is invalid. FR-Designer_Background_Null=No Background FR-Designer_Background_Color=Color @@ -622,7 +622,7 @@ Tree-Width=Tree Width alert_word=Export without fixed height, cell hight will change according to the content and pagination position will different from the preview result. PageSetup-Paper_Size=Paper Size M-Page_Setup=Page Setup -DashBoard-FormBook=Form +DashBoard-FormBook=Dashboard X-Coordinate=Horizontal axis Style-Line_Spacing=Line Spacing FR-Designer_Plugin_Should_Update_Title=Warning @@ -698,7 +698,7 @@ WF-Name=Name RWA-Click_Cell_To_Edit_Value=Click Cell to Edit Value Utils-Row_Height=Row Height ReportD-Excel_Export=Export Attributes -Form-Please_Select_A_Kind_Of_Form_Container=Select A Form Container +Form-Please_Select_A_Kind_Of_Form_Container=Select A Dashboard Container Column_Does_Not_Exsit=Column Does Not Exsit M_Insert-Hyperlink=Hyperlink can_not_include_underline=Can not contain "_" @@ -833,7 +833,7 @@ Values=Values Not_use_a_cell_attribute_table_editing=You may not use a cell attribute table editing Root=Root node cycle=Cycle -open-new-form-tip=open new form tip +open-new-form-tip=open new dashboard tip Support-Current_Auto_Complete_Shortcut=Current Shortcut key GROUPING_MODE=Ordinary Grouping DBCP_MAX_IDLE=Max Idle Connections @@ -1090,7 +1090,7 @@ Form-View_Tree=View Tree M_Insert-Chart=Insert Chart HF-Even_Page=Even Page ReportServerP-Report_server_parameter=Report Server Parameter -JavaScript-Form_Submit=Form Submit +JavaScript-Form_Submit=Dashboard Submit Horizontal-Split_Layout=Horizontal partitioning layout BorderLayout-Center=Center INFO-Reset_Webapp=Reset Application Server @@ -1440,7 +1440,7 @@ ReportColumns-Columns_after=Over FR-Designer_Undo=Undo DBCP_MIN_IDLE=Min Idle Connections M-Data_Analysis_Settings=Data Analysis Settings -M-Form_Preview=Form Preview +M-Form_Preview=Dashboard Preview Form-Basic_Properties=Basic Property quote=quote Thu=Thu @@ -1518,7 +1518,7 @@ FR-Template-Path_chooseRightPath=Please choose a right path FR-Remote_Re_Connect_to_Server=The server is down, whether to reconnect it Nation=Country DBCP_MAX_WAIT=Max wait time -FR-App-Template_Form=Form +FR-App-Template_Form=Dashboard Address=Address Sub_Report=Sub Report FR-Import-Export_Word=Word @@ -1561,7 +1561,7 @@ Sub_Report_Description=The sub-report should exist in the runtime environment of T_Insert-Float=Insert Float Element BackgroundTexture-FishFossil=Fish Fossil My_Computer=My Computer -FORMLET=Path parameter when accessing different forms +FORMLET=Path parameter when accessing different dashboards HF-Undefined=Undefined Widget-User_Defined_Widget_Config=Predefined control Report-Write_Attributes_Group_Warning=Number of cells in each field in all cell group must be the same @@ -1595,7 +1595,7 @@ FS_Report_Type=Report Type HF-New_Line=Line breaks Privilege=Permission Export-Offline-Html=Output offline HTML report -FR-Designer_open-new-form-tip=The form is created by the designer older than 711 vision, it cannot be opened. Please use the corresponding designer. +FR-Designer_open-new-form-tip=The dashboard is created by the designer older than 711 vision, it cannot be opened. Please use the corresponding designer. FR-Designer-Widget-Style_Frame_Style=Frame Style Present-No_Present=Cancel Present Settings FR-Designer_Form-Password=Password @@ -1619,7 +1619,7 @@ Above=Above Version Utils-The-Chart=Chart FRFont-plain=General Calculating=Calculating -Form-Object=Form Object\: +Form-Object=Dashboard Object: May=May FR-Designer_Plugin_Normal_Update=Update FR-Hyperlink_Reportlet=Webreport @@ -1754,7 +1754,7 @@ ReportServerP-Last=Last FR-Base_Columns=Columns SpecifiedG-Leave_in_their_own_groups=Leave in their own groups LOG-Please_Wait=Please Waiting -Form-ToolBar=Form ToolBar +Form-ToolBar=Dashboard ToolBar FR-Base_sure_remove_item=Are you sure to delete the selected item Component_Scale=Component Scale Hyperlink-Use_CJK_to_encode_parameter=Use CJK to process parameter @@ -1799,7 +1799,7 @@ Only_selected_cell_can_paste_only=Paste when cell is selected M_Report-Report_Columns=Multi-columns/lines Unit_Hundred=Hundred FR-Designer_DataTable-Build=Speed layered construction -Widget-Form_Widget_Config=Form control +Widget-Form_Widget_Config=Dashboard control Server-version-tip-moreInfo=Conform the version numbers of FineReport Designer and the deployment server are consistent, in order to avoid the problems caused by inconsistent versions. If you open the template produced by higher designer vision, error may occurs or the original template properties missed. If the Designer Version you used to create the template is higher than the final deployment server version, the server may not be able to properly load the template. Actions=Task FR-Designer-Dependence_Connect_Server_Error=connect error @@ -1952,7 +1952,7 @@ ReportServerP-Import_JavaScript=Reference JavaScript Form-TableTree=Table Tree Opened=Opened M_Edit-Delete=Delete -Widget-Form_Widget_Container=Form Container +Widget-Form_Widget_Container=Dashboard Container BindColumn-Summary=Summary Sche-Second=Second Server-Open_Service_Manager=Open Service Manager diff --git a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties index f7b8d3a3cd..ee55805e6f 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_CN.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_CN.properties @@ -104,13 +104,13 @@ FR-Designer_Fit-App=App\u81EA\u9002\u5E94 FR-Designer_Fit=\u81EA\u9002\u5E94 FR-Designer_Font-Family=\u5B57\u4F53\u540D\u79F0 FR-Designer_Font-Size=\u5B57\u4F53\u5927\u5C0F -FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u5141\u8BB8\u62D6\u5165\u8868\u5355\u4E3B\u4F53 +FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u5141\u8BB8\u62D6\u5165\u51B3\u7B56\u62A5\u8868\u4E3B\u4F53 FR-Designer_Forbid_Drag_into_Para_Pane=\u8BE5\u5BF9\u8C61\u4E0D\u80FD\u62D6\u5165\u53C2\u6570\u9762\u677F FR-Designer_Foreground=\u989C\u8272 -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u6682\u4E0D\u652F\u6301\u8868\u5355\u6743\u9650\u7F16\u8F91 +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u6682\u4E0D\u652F\u6301\u51B3\u7B56\u62A5\u8868\u6743\u9650\u7F16\u8F91 FR-Designer_Form-Report=\u62A5\u8868\u5757 -FR-Designer_Form_EmbeddedTD=\u8868\u5355(\u5185\u7F6E\u6570\u636E) -FR-Designer_Form_Module=\u8868\u5355\u6A21\u5757 +FR-Designer_Form_EmbeddedTD=\u51B3\u7B56\u62A5\u8868(\u5185\u7F6E\u6570\u636E) +FR-Designer_Form_Module=\u51B3\u7B56\u62A5\u8868\u6A21\u5757 FR-Designer_Format_explan=\u683C\u5F0F\u8BF4\u660E FR-Designer_Formula=\u516C\u5F0F FR-Designer_Forum=\u8BBA\u575B @@ -119,7 +119,7 @@ FR-Designer_Help=\u5E2E\u52A9 FR-Designer_Hide=\u9690\u85CF FR-Designer_Show=\u663E\u793A FR-Designer_Hyperlink=\u8D85\u7EA7\u94FE\u63A5 -FR-Designer_Hyperlink-Form_link=\u5F53\u524D\u8868\u5355\u5BF9\u8C61 +FR-Designer_Hyperlink-Form_link=\u5F53\u524D\u51B3\u7B56\u62A5\u8868\u5BF9\u8C61 FR-Designer_IDCard=\u8EAB\u4EFD\u8BC1 FR-Designer_Icon=\u56FE\u6807 FR-Designer_Index=\u5217\u8F74/\u6307\u6807 @@ -507,7 +507,7 @@ FR-Designer_Properties_Mobile=\u624B\u673A\u5C5E\u6027 FR-Designer_Button_OK=\u786E\u5B9A FR-Designer_Button_Cancel=\u53D6\u6D88 FR-Designer_JavaScript=JavaScript\u811A\u672C -FR-Designer_JavaScript_Form_Submit=\u8868\u5355\u63D0\u4EA4 +FR-Designer_JavaScript_Form_Submit=\u51B3\u7B56\u62A5\u8868\u63D0\u4EA4 FR-Designer_JavaScript_Commit_to_Database=\u63D0\u4EA4\u5165\u5E93 FR-Designer_JavaScript_Custom=\u81EA\u5B9A\u4E49 FR-Designer_RWA_Submit=\u63D0\u4EA4 @@ -574,7 +574,7 @@ FR-Designer_DS_TableData=\u6570\u636E\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u63D2\u4EF6\u7248\u672C\u8FC7\u4F4E, \u5B58\u5728API\u4E0D\u517C\u5BB9, \u8BF7\u8054\u7CFB\u5F00\u53D1\u8005\u5347\u7EA7\u63D2\u4EF6 FR-Designer_WidgetOrder=\u63A7\u4EF6\u987A\u5E8F -FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u8868\u5355\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 +FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CA\uFF1A\u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u51B3\u7B56\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CA: \u53EF\u4EE5\u901A\u8FC7\u8BE5\u5C5E\u6027\u63A7\u5236\u62A5\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9875\u9884\u89C8\uFF0C\u586B\u62A5\u9884\u89C8\u65F6\u5C5E\u6027\u65E0\u6548\u3002 FR-Designer_Background_Null=\u6CA1\u6709\u80CC\u666F FR-Designer_Background_Color=\u989C\u8272 @@ -624,7 +624,7 @@ Tree-Width=\u5BBD\u5EA6 alert_word=\u9009\u62E9\u4E0D\u56FA\u5B9A\u884C\u9AD8\u5BFC\u51FA\u65F6, \u7F16\u8F91\u5BFC\u51FA\u7684word, \u5355\u5143\u683C\u884C\u9AD8\u4F1A\u968F\u7740\u5185\u5BB9\u81EA\u52A8\u62C9\u4F38, \u6B64\u60C5\u51B5\u4E0B\u5BFC\u51FA\u7ED3\u679C\u5206\u9875\u4F4D\u7F6E\u4E0E\u9884\u89C8\u7ED3\u679C\u53EF\u80FD\u4F1A\u4E0D\u518D\u4E00\u81F4. PageSetup-Paper_Size=\u7EB8\u5F20\u5927\u5C0F M-Page_Setup=\u9875\u9762\u8BBE\u7F6E -DashBoard-FormBook=\u8868\u5355 +DashBoard-FormBook=\u51B3\u7B56\u62A5\u8868 X-Coordinate=\u6A2A\u5750\u6807 Style-Line_Spacing=\u884C\u95F4\u8DDD FR-Designer_Plugin_Should_Update_Title=\u63D2\u4EF6\u5347\u7EA7\u63D0\u9192 @@ -700,7 +700,7 @@ WF-Name=\u540D\u79F0 RWA-Click_Cell_To_Edit_Value=\u5355\u51FB\u6A21\u677F\u5355\u5143\u683C\u4FEE\u6539\u503C Utils-Row_Height=\u884C\u9AD8 ReportD-Excel_Export=\u6A21\u677F\u5BFC\u51FA\u5C5E\u6027 -Form-Please_Select_A_Kind_Of_Form_Container=\u8BF7\u9009\u62E9\u4E00\u79CD\u8868\u5355\u5BB9\u5668 +Form-Please_Select_A_Kind_Of_Form_Container=\u8BF7\u9009\u62E9\u4E00\u79CD\u51B3\u7B56\u62A5\u8868\u5BB9\u5668 Column_Does_Not_Exsit=\u5217\u4E0D\u5B58\u5728 M_Insert-Hyperlink=\u8D85\u7EA7\u94FE\u63A5 can_not_include_underline=\u4E0D\u80FD\u5305\u542B"_" @@ -835,7 +835,7 @@ Values=\u503C Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5355\u5143\u683C\u5C5E\u6027\u8868\u7F16\u8F91 Root=\u6839\u8282\u70B9 cycle=\u5468\u671F -open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u8868\u5355\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 +open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u51B3\u7B56\u62A5\u8868\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 Support-Current_Auto_Complete_Shortcut=\u5F53\u524D\u5FEB\u6377\u952E GROUPING_MODE=\u666E\u901A\u5206\u7EC4 DBCP_MAX_IDLE=\u6700\u5927\u7A7A\u95F2\u8FDE\u63A5\u6570 @@ -1092,7 +1092,7 @@ Form-View_Tree=\u89C6\u56FE\u6811 M_Insert-Chart=\u63D2\u5165\u56FE\u8868 HF-Even_Page=\u5076\u6570\u9875 ReportServerP-Report_server_parameter=\u62A5\u8868\u670D\u52A1\u5668\u53C2\u6570 -JavaScript-Form_Submit=\u8868\u5355\u63D0\u4EA4 +JavaScript-Form_Submit=\u51B3\u7B56\u62A5\u8868\u63D0\u4EA4 Horizontal-Split_Layout=\u6C34\u5E73\u5206\u5272\u5E03\u5C40 BorderLayout-Center=\u4E2D INFO-Reset_Webapp=\u91CD\u7F6E\u5E94\u7528\u670D\u52A1\u5668 @@ -1442,7 +1442,7 @@ ReportColumns-Columns_after=\u8D85\u8FC7 FR-Designer_Undo=\u64A4\u9500 DBCP_MIN_IDLE=\u6700\u5C0F\u7A7A\u95F2\u8FDE\u63A5\u6570 M-Data_Analysis_Settings=\u6570\u636E\u5206\u6790\u8BBE\u7F6E -M-Form_Preview=\u8868\u5355\u9884\u89C8 +M-Form_Preview=\u51B3\u7B56\u62A5\u8868\u9884\u89C8 Form-Basic_Properties=\u57FA\u672C\u5C5E\u6027 quote=\u5F15\u7528 Thu=\u56DB @@ -1519,7 +1519,7 @@ FR-Template-Path_chooseRightPath=\u8BF7\u9009\u62E9\u6B63\u786E\u8DEF\u5F84 FR-Remote_Re_Connect_to_Server=\u670D\u52A1\u5668\u5DF2\u5173\u95ED\uFF0C\u662F\u5426\u91CD\u65B0\u8FDE\u63A5\u670D\u52A1\u5668? Nation=\u56FD\u5BB6 DBCP_MAX_WAIT=\u6700\u5927\u7B49\u5F85\u65F6\u95F4 -FR-App-Template_Form=\u8868\u5355 +FR-App-Template_Form=\u51B3\u7B56\u62A5\u8868 Address=\u5730\u5740 Sub_Report=\u5B50\u62A5\u8868 FR-Import-Export_Word=Word\u683C\u5F0F @@ -1562,7 +1562,7 @@ Sub_Report_Description=\u5B50\u62A5\u8868\u9700\u8981\u5B58\u5728\u4E8E\u7236\u8 T_Insert-Float=\u63D2\u5165\u60AC\u6D6E\u5143\u7D20 BackgroundTexture-FishFossil=\u9C7C\u7C7B\u5316\u77F3 My_Computer=\u6211\u7684\u7535\u8111 -FORMLET=\u8BBF\u95EE\u4E0D\u540C\u8868\u5355\u7684\u8DEF\u5F84\u7684\u53C2\u6570 +FORMLET=\u8BBF\u95EE\u4E0D\u540C\u51B3\u7B56\u62A5\u8868\u7684\u8DEF\u5F84\u7684\u53C2\u6570 HF-Undefined=\u6CA1\u6709\u5B9A\u4E49 Widget-User_Defined_Widget_Config=\u9884\u5B9A\u4E49\u63A7\u4EF6 Report-Write_Attributes_Group_Warning=\u8BBE\u7F6E\u4E3A\u5355\u5143\u683C\u7EC4\u7684\u5404\u5B57\u6BB5\u4E2D\u7684\u5355\u5143\u683C\u4E2A\u6570\u5FC5\u987B\u76F8\u540C @@ -1596,7 +1596,7 @@ FS_Report_Type=\u7C7B\u578B HF-New_Line=\u6362\u884C\u7B26 Privilege=\u6743\u9650 Export-Offline-Html=\u8F93\u51FA\u79BB\u7EBFhtml\u62A5\u8868 -FR-Designer_open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u8868\u5355\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 +FR-Designer_open-new-form-tip=\u5F53\u524D\u6A21\u677F\u4E3A711\u4EE5\u4E0B\u7248\u672C\u5236\u4F5C\uFF0C\u65E0\u6CD5\u517C\u5BB9\uFF0C\u4E0D\u80FD\u6253\u5F00\u3002\u5047\u5982\u60F3\u6253\u5F00\u4FEE\u6539\u6B64\u51B3\u7B56\u62A5\u8868\uFF0C\u8BF7\u4F7F\u7528\u5BF9\u5E94\u7248\u672C\u8BBE\u8BA1\u5668\u6253\u5F00\u3002 FR-Designer-Widget-Style_Frame_Style=\u6846\u67B6\u6837\u5F0F Present-No_Present=\u53D6\u6D88\u5F62\u6001\u8BBE\u7F6E FR-Designer_Form-Password=\u5BC6\u7801 @@ -1620,7 +1620,7 @@ Above=\u4EE5\u4E0A\u7248\u672C Utils-The-Chart=\u56FE\u8868 FRFont-plain=\u5E38\u89C4 Calculating=\u5904\u7406\u4E2D -Form-Object=\u8868\u5355\u5BF9\u8C61\: +Form-Object=\u51B3\u7B56\u62A5\u8868\u5BF9\u8C61\: May=\u4E94\u6708 FR-Designer_Plugin_Normal_Update=\u66F4\u65B0 FR-Hyperlink_Reportlet=\u7F51\u7EDC\u62A5\u8868 @@ -1755,7 +1755,7 @@ ReportServerP-Last=\u672B\u9875 FR-Base_Columns=\u5217 SpecifiedG-Leave_in_their_own_groups=\u7559\u5728\u5404\u81EA\u7684\u7EC4\u5185 LOG-Please_Wait=\u8BF7\u7A0D\u5019 -Form-ToolBar=\u8868\u5355\u5DE5\u5177\u680F +Form-ToolBar=\u51B3\u7B56\u62A5\u8868\u5DE5\u5177\u680F FR-Base_sure_remove_item=\u4F60\u786E\u5B9E\u51B3\u5B9A\u5220\u9664\u9009\u4E2D\u7684\u9879 Component_Scale=\u7EC4\u4EF6\u7F29\u653E Hyperlink-Use_CJK_to_encode_parameter=\u4F7F\u7528CJK\u5904\u7406\u53C2\u6570 @@ -1800,7 +1800,7 @@ Only_selected_cell_can_paste_only=\u53EA\u6709\u9009\u4E2D\u5355\u5143\u683C\u65 M_Report-Report_Columns=\u62A5\u8868\u5206\u680F Unit_Hundred=\u767E FR-Designer_DataTable-Build=\u6781\u901F\u5206\u5C42\u6784\u5EFA -Widget-Form_Widget_Config=\u8868\u5355\u63A7\u4EF6 +Widget-Form_Widget_Config=\u51B3\u7B56\u62A5\u8868\u63A7\u4EF6 Server-version-tip-moreInfo=\u5EFA\u8BAE\u60A8\u6240\u5C5E\u56E2\u961F\u4F7F\u7528\u7684\u6211\u65B9FineReport\u4EA7\u54C1\u7684\u8BBE\u8BA1\u5668\u7248\u672C\u53F7\u4EE5\u53CA\u90E8\u7F72\u7684\u670D\u52A1\u5668\u7248\u672C\u53F7\u4FDD\u6301\u4E00\u81F4\uFF0C\u4EE5\u907F\u514D\u7248\u672C\u4E0D\u4E00\u81F4\u9020\u6210\u7684\u95EE\u9898\u98CE\u9669\u3002\n\u5047\u5982\u60A8\u6253\u5F00\u66F4\u9AD8\u8BBE\u8BA1\u5668\u7248\u672C\u5236\u4F5C\u7684\u6A21\u677F\uFF0C\u53EF\u80FD\u6253\u5F00\u51FA\u9519\uFF0C\u4E5F\u53EF\u80FD\u4E22\u5931\u539F\u6709\u6A21\u677F\u5C5E\u6027\u3002\u5047\u5982\u60A8\u5236\u4F5C\u7684\u6A21\u677F\u4F7F\u7528\u7684\u8BBE\u8BA1\u5668\u7248\u672C\u9AD8\u4E8E\u60A8\u6700\u7EC8\u90E8\u7F72\u6240\u7528\u7684\u670D\u52A1\u5668\u7248\u672C\uFF0C\u670D\u52A1\u5668\u53EF\u80FD\u65E0\u6CD5\u6B63\u5E38\u8F7D\u5165\u60A8\u5236\u4F5C\u7684\u6A21\u677F\u3002 Actions=\u4EFB\u52A1 FR-Designer-Dependence_Connect_Server_Error=\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5 @@ -1953,7 +1953,7 @@ ReportServerP-Import_JavaScript=\u5F15\u7528JavaScript Form-TableTree=\u8868\u683C\u6811 Opened=\u5DF2\u5F00\u542F M_Edit-Delete=\u5220\u9664(D) -Widget-Form_Widget_Container=\u8868\u5355\u5BB9\u5668 +Widget-Form_Widget_Container=\u51B3\u7B56\u62A5\u8868\u5BB9\u5668 BindColumn-Summary=\u6C47\u603B Sche-Second=\u79D2 Server-Open_Service_Manager=\u6253\u5F00\u670D\u52A1\u7BA1\u7406\u5668 diff --git a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties index 42817879ea..340ba8a946 100644 --- a/designer_base/src/com/fr/design/locale/designer_zh_TW.properties +++ b/designer_base/src/com/fr/design/locale/designer_zh_TW.properties @@ -103,10 +103,10 @@ FR-Designer_Fit-App=App\u81EA\u9069\u61C9 FR-Designer_Fit=\u81EA\u9069\u61C9 FR-Designer_Font-Family=\u5B57\u9AD4\u540D\u7A31 FR-Designer_Font-Size=\u5B57\u9AD4\u5927\u5C0F -FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8A72\u5C0D\u8C61\u4E0D\u5141\u8A31\u62D6\u5165\u8868\u55AE\u4E3B\u9AD4 +FR-Designer_Forbid_Drag_into_Adapt_Pane=\u8A72\u5C0D\u8C61\u4E0D\u5141\u8A31\u62D6\u5165\u6C7A\u7B56\u5831\u8868\u4E3B\u9AD4 FR-Designer_Forbid_Drag_into_Para_Pane=\u8A72\u5C0D\u8C61\u4E0D\u80FD\u62D6\u5165\u53C3\u6578\u9762\u677F FR-Designer_Foreground=\u984F\u8272 -FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u66AB\u4E0D\u652F\u6301\u8868\u55AE\u6B0A\u9650\u7DE8\u8F2F +FR-Designer_Form-AuthorityEdited_Cannot_be_Supported=\u66AB\u4E0D\u652F\u6301\u6C7A\u7B56\u5831\u8868\u6B0A\u9650\u7DE8\u8F2F FR-Designer_Form-Report=\u5831\u8868\u683C\u5F0F FR-Designer_Form_EmbeddedTD=\u5167\u5D01\u683C\u5F0F FR-Designer_Form_Module=\u6A21\u7D44\u683C\u5F0F @@ -117,7 +117,7 @@ FR-Designer_Get-Cube=\u6B63\u5728\u7372\u53D6cube FR-Designer_Help=\u8AAA\u660E FR-Designer_Hide=\u96B1\u85CF FR-Designer_Hyperlink=\u8D85\u7D1A\u93C8\u63A5 -FR-Designer_Hyperlink-Form_link=\u7576\u524D\u8868\u55AE\u5C0D\u8C61 +FR-Designer_Hyperlink-Form_link=\u7576\u524D\u6C7A\u7B56\u5831\u8868\u5C0D\u8C61 FR-Designer_IDCard=\u8EAB\u4EFD\u8B49 FR-Designer_Icon=\u5716\u793A FR-Designer_Index=\u7D22\u5F15 @@ -493,7 +493,7 @@ FR-Designer_Properties_Mobile=\u624B\u6A5F\u5C6C\u6027 FR-Designer_Button_OK=\u78BA\u5B9A FR-Designer_Button_Cancel=\u53D6\u6D88 FR-Designer_JavaScript=JavaScript\u8173\u672C -FR-Designer_JavaScript_Form_Submit=\u8868\u55AE\u63D0\u4EA4 +FR-Designer_JavaScript_Form_Submit=\u6C7A\u7B56\u5831\u8868\u63D0\u4EA4 FR-Designer_JavaScript_Commit_to_Database=\u63D0\u4EA4\u5165\u5EAB FR-Designer_JavaScript_Custom=\u81EA\u5B9A\u7FA9 FR-Designer_RWA_Submit=\u63D0\u4EA4 @@ -560,7 +560,7 @@ FR-Designer_DS_TableData=\u8CC7\u6599\u96C6 FR-Designer_Parameter-Formula=\u516C\u5F0F FR-Designer_Plugin_Should_Update_Please_Contact_Developer=\u633F\u4EF6\u7248\u672C\u904E\u4F4E\uFF0C\u5B58\u5728API\u4E0D\u76F8\u5BB9\uFF0C\u8ACB\u806F\u7CFB\u958B\u767C\u8005\u965E\u7D1A\u633F\u4EF6 FR-Designer_WidgetOrder=\u63A7\u4EF6\u9806\u5E8F -FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u8868\u55AE\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 +FR-Designer_Mobile_Form_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u6C7A\u7B56\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\u3002 FR-Designer_Mobile_Report_Analysis_Annotation=\u6CE8\u91CB\uFF1A\u53EF\u4EE5\u901A\u904E\u8A72\u5C6C\u6027\u63A7\u5236\u5831\u8868\u5728APP\u4E2D\u7684\u89E3\u6790\u65B9\u5F0F\uFF0C\u53EA\u652F\u6301\u5206\u9801\u9810\u89BD\uFF0C\u586B\u5831\u9810\u89BD\u6642\u5C6C\u6027\u7121\u6548\u3002 FR-Designer_Background_Null=\u6C92\u6709\u80CC\u666F FR-Designer_Background_Color=\u984F\u8272 @@ -622,7 +622,7 @@ Tree-Width=\u5BEC\u5EA6 alert_word=\u9078\u64C7\u4E0D\u56FA\u5B9A\u5217\u9AD8\u532F\u51FA\u6642, \u7DE8\u8F2F\u532F\u51FA\u7684word, \u5132\u5B58\u683C\u5217\u9AD8\u6703\u96A8\u8457\u5167\u5BB9\u81EA\u52D5\u62C9\u4F38, \u6B64\u60C5\u6CC1\u4E0B\u532F\u51FA\u7D50\u679C\u8207\u9810\u89BD\u7D50\u679C\u53EF\u80FD\u6703\u4E0D\u518D\u4E00\u81F4. PageSetup-Paper_Size=\u7D19\u5F35\u5927\u5C0F M-Page_Setup=\u9801\u9762\u8A2D\u5B9A -DashBoard-FormBook=\u8868\u55AE +DashBoard-FormBook=\u6C7A\u7B56\u5831\u8868 X-Coordinate=\u6A6B\u5EA7\u6A19 Style-Line_Spacing=\u5217\u9593\u8DDD FR-Designer_Plugin_Should_Update_Title=Warning @@ -698,7 +698,7 @@ WF-Name=\u540D\u7A31 RWA-Click_Cell_To_Edit_Value=\u55AE\u64CA\u6A21\u677F\u5132\u5B58\u683C\u4FEE\u6539\u503C Utils-Row_Height=\u5217\u9AD8 ReportD-Excel_Export=\u5831\u8868\u532F\u51FA\u5C6C\u6027 -Form-Please_Select_A_Kind_Of_Form_Container=\u8ACB\u9078\u64C7\u4E00\u7A2E\u8868\u55AE\u5BB9\u5668 +Form-Please_Select_A_Kind_Of_Form_Container=\u8ACB\u9078\u64C7\u4E00\u7A2E\u6C7A\u7B56\u5831\u8868\u5BB9\u5668 Column_Does_Not_Exsit=\u6B04\u4E0D\u5B58\u5728 M_Insert-Hyperlink=\u8D85\u7D1A\u93C8\u63A5 can_not_include_underline=\u4E0D\u80FD\u5305\u542B"_" @@ -833,7 +833,7 @@ Values=\u503C Not_use_a_cell_attribute_table_editing=\u60A8\u4E0D\u53EF\u4EE5\u7528\u5132\u5B58\u683C\u5C6C\u6027\u8868\u7DE8\u8F2F Root=\u6839\u7BC0\u9EDE cycle=\u5468\u671F -open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u8868\u55AE, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. +open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u6C7A\u7B56\u5831\u8868, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. Support-Current_Auto_Complete_Shortcut=Current Shortcut GROUPING_MODE=\u666E\u901A\u5206\u7D44 DBCP_MAX_IDLE=\u6700\u5927\u7A7A\u9591\u9023\u63A5\u6578 @@ -1090,7 +1090,7 @@ Form-View_Tree=\u6AA2\u8996\u8868\u6A39 M_Insert-Chart=\u63D2\u5165\u5716\u8868 HF-Even_Page=\u5076\u6578\u9801 ReportServerP-Report_server_parameter=\u5831\u8868\u4F3A\u670D\u5668\u53C3\u6578 -JavaScript-Form_Submit=\u8868\u55AE\u63D0\u4EA4 +JavaScript-Form_Submit=\u6C7A\u7B56\u5831\u8868\u63D0\u4EA4 Horizontal-Split_Layout=\u6C34\u5E73\u5206\u5272\u5E03\u5C40 BorderLayout-Center=\u4E2D INFO-Reset_Webapp=\u91CD\u7F6E\u61C9\u7528\u4F3A\u670D\u5668 @@ -1439,7 +1439,7 @@ ReportColumns-Columns_after=\u8D85\u904E FR-Designer_Undo=\u5FA9\u539F DBCP_MIN_IDLE=\u6700\u5C0F\u7A7A\u9591\u9023\u63A5\u6578 M-Data_Analysis_Settings=\u8CC7\u6599\u5206\u6790\u8A2D\u5B9A -M-Form_Preview=\u8868\u55AE\u9810\u89BD +M-Form_Preview=\u6C7A\u7B56\u5831\u8868\u9810\u89BD Form-Basic_Properties=\u57FA\u672C\u5C6C\u6027 quote=\u5F15\u7528 Thu=\u56DB @@ -1517,7 +1517,7 @@ FR-Template-Path_chooseRightPath=\u8ACB\u9078\u64C7\u6B63\u78BA\u8DEF\u5F91 FR-Remote_Re_Connect_to_Server=\u4F3A\u670D\u5668\u5DF2\u95DC\u9589\uFF0C\u662F\u5426\u91CD\u65B0\u9023\u63A5\u4F3A\u670D\u5668? Nation=\u570B\u5BB6 DBCP_MAX_WAIT=\u6700\u5927\u7B49\u5F85\u6642\u9593 -FR-App-Template_Form=\u8868\u55AE +FR-App-Template_Form=\u6C7A\u7B56\u5831\u8868 Address=\u5730\u5740 Sub_Report=\u5B50\u5831\u8868 FR-Import-Export_Word=Word\u683C\u5F0F @@ -1560,7 +1560,7 @@ Sub_Report_Description=\u5B50\u5831\u8868\u9700\u8981\u5B58\u5728\u65BC\u7236\u8 T_Insert-Float=\u63D2\u5165\u61F8\u6D6E\u5143\u7D20 BackgroundTexture-FishFossil=\u9B5A\u985E\u5316\u77F3 My_Computer=\u6211\u7684\u96FB\u8166 -FORMLET=\u8A2A\u554F\u4E0D\u540C\u8868\u55AE\u7684\u8DEF\u5F91\u7684\u53C3\u6578 +FORMLET=\u8A2A\u554F\u4E0D\u540C\u6C7A\u7B56\u5831\u8868\u7684\u8DEF\u5F91\u7684\u53C3\u6578 HF-Undefined=\u6C92\u6709\u5B9A\u7FA9 Widget-User_Defined_Widget_Config=\u9810\u5B9A\u7FA9\u63A7\u5236\u9805 Report-Write_Attributes_Group_Warning=\u8A2D\u5B9A\u7232\u5132\u5B58\u683C\u7D44\u7684\u5404\u6B04\u4F4D\u4E2D\u7684\u5132\u5B58\u683C\u500B\u6578\u5FC5\u9808\u76F8\u540C @@ -1594,7 +1594,7 @@ FS_Report_Type=\u985E\u578B HF-New_Line=\u63DB\u5217\u7B26 Privilege=\u6B0A\u9650 Export-Offline-Html=\u8F38\u51FA\u96E2\u7DDAhtml\u5831\u8868 -FR-Designer_open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u8868\u55AE, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. +FR-Designer_open-new-form-tip=\u7576\u524D\u6A21\u677F\u70BA711\u4EE5\u4E0B\u7248\u672C\u88FD\u4F5C, \u7121\u6CD5\u517C\u5BB9, \u4E0D\u80FD\u6253\u958B. \u5047\u5982\u60F3\u6253\u958B\u4FEE\u6539\u6B64\u6C7A\u7B56\u5831\u8868, \u8ACB\u4F7F\u7528\u5C0D\u61C9\u7248\u672C\u8A2D\u8A08\u5668\u6253\u958B. FR-Designer-Widget-Style_Frame_Style=\u6846\u67B6\u6A23\u5F0F Present-No_Present=\u53D6\u6D88\u6A21\u5F0F\u8A2D\u5B9A FR-Designer_Form-Password=\u5BC6\u78BC @@ -1618,7 +1618,7 @@ Above=\u4EE5\u4E0A\u7248\u672C Utils-The-Chart=\u5716\u8868 FRFont-plain=\u5E38\u898F Calculating=\u8655\u7406\u4E2D -Form-Object=\u8868\u55AE\u5C0D\u8C61 +Form-Object=\u6C7A\u7B56\u5831\u8868\u5C0D\u8C61 May=\u4E94\u6708 FR-Designer_Plugin_Normal_Update=Update FR-Hyperlink_Reportlet=\u7DB2\u8DEF\u5831\u8868 @@ -1753,7 +1753,7 @@ ReportServerP-Last=\u672B\u9801 FR-Base_Columns=\u6B04 SpecifiedG-Leave_in_their_own_groups=\u7559\u5728\u5404\u81EA\u7684\u7D44\u5167 LOG-Please_Wait=\u8ACB\u7A0D\u5019 -Form-ToolBar=\u8868\u55AE\u5DE5\u5177\u6B04 +Form-ToolBar=\u6C7A\u7B56\u5831\u8868\u5DE5\u5177\u6B04 FR-Base_sure_remove_item=\u4F60\u78BA\u5BE6\u6C7A\u5B9A\u522A\u9664\u9078\u4E2D\u7684\u9805 Component_Scale=\u5143\u4EF6\u7E2E\u653E Hyperlink-Use_CJK_to_encode_parameter=\u4F7F\u7528CJK\u8655\u7406\u53C3\u6578 @@ -1798,7 +1798,7 @@ Only_selected_cell_can_paste_only=\u53EA\u6709\u9078\u4E2D\u5132\u5B58\u683C\u66 M_Report-Report_Columns=\u5831\u8868\u5206\u6B04 Unit_Hundred=\u4F70 FR-Designer_DataTable-Build=\u6975\u901F\u5206\u5C64\u69CB\u5EFA -Widget-Form_Widget_Config=\u8868\u55AE\u63A7\u5236\u9805 +Widget-Form_Widget_Config=\u6C7A\u7B56\u5831\u8868\u63A7\u5236\u9805 Server-version-tip-moreInfo=\u5EFA\u8B70\u60A8\u6240\u5C6C\u5718\u968A\u4F7F\u7528\u7684\u6211\u65B9FineReport\u7522\u54C1\u7684\u8A2D\u8A08\u5668\u7248\u672C\u865F\u4EE5\u53CA\u90E8\u7F72\u7684\u4F3A\u670D\u5668\u7248\u672C\u865F\u4FDD\u6301\u4E00\u81F4\uFF0C\u4EE5\u907F\u514D\u7248\u672C\u4E0D\u4E00\u81F4\u9020\u6210\u7684\u554F\u984C\u98A8\u96AA\u3002\u5047\u5982\u60A8\u6253\u958B\u66F4\u9AD8\u8A2D\u8A08\u5668\u7248\u672C\u88FD\u4F5C\u7684\u6A21\u677F\uFF0C\u53EF\u80FD\u6253\u958B\u51FA\u932F\uFF0C\u4E5F\u53EF\u80FD\u4E1F\u5931\u539F\u6709\u6A21\u677F\u5C6C\u6027\u3002\u5047\u5982\u60A8\u88FD\u4F5C\u7684\u6A21\u677F\u4F7F\u7528\u7684\u8A2D\u8A08\u5668\u7248\u672C\u9AD8\u65BC\u60A8\u6700\u7D42\u90E8\u7F72\u6240\u7528\u7684\u4F3A\u670D\u5668\u7248\u672C\uFF0C\u4F3A\u670D\u5668\u53EF\u80FD\u7121\u6CD5\u6B63\u5E38\u8F09\u5165\u60A8\u88FD\u4F5C\u7684\u6A21\u677F Actions=\u4EFB\u52D9 FR-Designer-Dependence_Connect_Server_Error=\u7121\u6CD5\u9023\u63A5\u670D\u52D9\u5668\uFF0C\u8ACB\u7A0D\u5F8C\u518D\u8A66 @@ -1951,7 +1951,7 @@ ReportServerP-Import_JavaScript=\u5F15\u7528JavaScript Form-TableTree=\u8868\u683C\u6A39 Opened=\u5DF2\u958B\u5553 M_Edit-Delete=\u522A\u9664(D) -Widget-Form_Widget_Container=\u8868\u55AE\u5BB9\u5668 +Widget-Form_Widget_Container=\u6C7A\u7B56\u5831\u8868\u5BB9\u5668 BindColumn-Summary=\u532F\u7E3D Sche-Second=\u79D2 Server-Open_Service_Manager=\u6253\u958B\u4F3A\u670D\u5668\u7BA1\u7406\u5668 From f7a5ea2a5c2ae26c434be433b7c3f8de0de57975 Mon Sep 17 00:00:00 2001 From: ju Date: Thu, 7 Dec 2017 17:21:00 +0800 Subject: [PATCH 18/67] =?UTF-8?q?REPORT-6001=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?bat=E5=90=AF=E5=8A=A8=EF=BC=8C=E8=BF=9C=E7=A8=8B=E5=88=B0?= =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E6=9C=8D=E5=8A=A1=E5=99=A8=EF=BC=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=87=8C=E6=8A=9B=E9=94=99finedb=E8=A2=AB=E9=94=81?= =?UTF-8?q?=E4=BD=8F=20=E8=BF=9C=E7=A8=8B=E7=8E=AF=E5=A2=83=E4=B8=8D?= =?UTF-8?q?=E8=AE=A9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/mainframe/InformationCollector.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/InformationCollector.java b/designer/src/com/fr/design/mainframe/InformationCollector.java index 7cc6eb6c44..5b80c2ecd9 100644 --- a/designer/src/com/fr/design/mainframe/InformationCollector.java +++ b/designer/src/com/fr/design/mainframe/InformationCollector.java @@ -344,7 +344,8 @@ public class InformationCollector implements XMLReadable, XMLWriter { } private void sendUserInfoInOtherThread(){ - if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv()) { + + if (!DesignerEnvManager.getEnvManager().isJoinProductImprove() || !FRContext.isChineseEnv() || !FRContext.getCurrentEnv().isLocalEnv()) { return; } From 7eff901f2c27b7971ef00a0c22fcf2cb757e705b Mon Sep 17 00:00:00 2001 From: rinoux Date: Fri, 8 Dec 2017 14:03:35 +0800 Subject: [PATCH 19/67] =?UTF-8?q?REPORT-5942=209.0=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/SubmitVisitorListPane.java | 2 + .../batch/BatchCommit2DBJavaScript.java | 170 +++ .../batch/BatchCommit2DBJavaScriptPane.java | 186 +++ .../submit/batch/BatchCommitTabbedPane.java | 529 ++++++++ .../batch/BatchJavaScriptActionProvider.java | 23 + .../write/submit/batch/BatchSubmitPane.java | 1089 +++++++++++++++++ .../submit/batch/BatchSubmitProvider.java | 42 + .../batch/SmartInsertBatchSubmitPane.java | 591 +++++++++ .../batch/service/BatchDBCommitService.java | 288 +++++ 9 files changed, 2920 insertions(+) create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java create mode 100644 designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java create mode 100644 designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 3dfea6c15b..2b18427bdc 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -13,6 +13,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.write.submit.batch.BatchSubmitProvider; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -177,6 +178,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { for (SubmitProvider provider : providers) { addSubmitPane(provider); } + addSubmitPane(BatchSubmitProvider.getInstance()); configTypes = new ArrayList<>(); for (Map.Entry entry : customSubmitPanes.entrySet()) { diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java new file mode 100644 index 0000000000..d44a43722d --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java @@ -0,0 +1,170 @@ +package com.fr.design.write.submit.batch; + +import com.fr.general.ComparatorUtils; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.js.AbstractJavaScript; +import com.fr.js.Callback; +import com.fr.js.JavaScript; +import com.fr.js.JavaScriptXMLUtils; +import com.fr.json.JSONObject; +import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.web.Repository; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; +import com.fr.write.batch.SubmitMain; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by loy on 16/8/22. + */ +public class BatchCommit2DBJavaScript extends AbstractJavaScript implements Callback { + + public static String RECALCULATE_TAG = "shouldRecalculate"; + + /** + * 回调函数标识 + */ + public static final String CALLBACK = "callback"; + + /** + * 回调参数标识 + */ + public static final String FEEDBACKMAP = "feedbackMap"; + + /** + * javascript所使用的参数 + */ + protected ParameterProvider[] parameters; + //这个MAP里放的是提交过程生成的参数,比如提交入库,在所有回调事件里,都会将其传递进去,以供解析。 + protected Map paraMap = new HashMap(); + + private boolean recalculate; + + private List dbManipulationList = new ArrayList(); + //回调函数 + private JavaScript callBack; + + /** + * 获取数据入库配置信息 + */ + public List getDBManipulation() { + return dbManipulationList; + } + + /** + * 设置数据入库配置信息 + * + * @param dbManipulationList 数据库配置信息 + */ + public void setDBManipulation(List dbManipulationList) { + this.dbManipulationList = dbManipulationList; + } + + /** + * 回调函数,该函数将在主函数执行完毕以后开始执行 + */ + public JavaScript getCallBack() { + return callBack; + } + + /** + * 设置回调函数 + * + * @param callback 回调函数 + */ + public void setCallBack(JavaScript callback) { + this.callBack = callback; + } + + /** + * JS响应 + * + * @param repo 环境 + * @return 返回生成的JS字符串 + */ + public String actionJS(Repository repo) { + String dmlconf = GeneralXMLTools.writeXMLableAsString(this); + if (!this.paraMap.isEmpty() && callBack != null) { + callBack.addParameterMap(paraMap); + } + String js = "var fm = this.options.form;if(fm == null) {fm = new FR.BatchForm()};fm.batchCommit({" + + "xmlconf" + ":" + JSONObject.quote(dmlconf) + + (callBack != null ? "," + CALLBACK + ":" + JSONObject.quote(GeneralXMLTools.writeXMLableAsString(callBack)) : "") + + (this.paraMap.isEmpty() ? "" : "," + FEEDBACKMAP + ":" + new JSONObject(paraMap).toString()) + + "},this)"; + return js; + } + + /** + * 转化为字符串 + * + * @return 返回字符串形式 + */ + public String toString() { + return (dbManipulationList == null) ? StringUtils.EMPTY : dbManipulationList.toString(); + } + + public void writeXML(XMLPrintWriter writer) { + super.writeXML(writer); + + if (this.dbManipulationList != null) { + for (int i = 0; i < dbManipulationList.size(); i++) { + ((SubmitMain) this.dbManipulationList.get(i)).writeXML(writer); + } + + } + + if (this.callBack != null) { + GeneralXMLTools.writeXMLable(writer, this.callBack, JavaScript.XML_TAG); + } + } + + public void readXML(XMLableReader reader) { + super.readXML(reader); + + if (reader.isAttr()) { + dbManipulationList = new ArrayList(); + } else if (reader.isChildNode()) { + String tagName = reader.getTagName(); + if (JavaScript.XML_TAG.equals(tagName)) { + this.callBack = JavaScriptXMLUtils.readJavaScript(reader); + } else { + if ("Attributes".equals(tagName)) { + dbManipulationList.add(new SubmitMain()); + } + if (dbManipulationList.size() > 0) { + ((SubmitMain) dbManipulationList.get(dbManipulationList.size() - 1)).readXML(reader); + } + } + } + + } + + public boolean equals(Object obj) { + return obj instanceof BatchCommit2DBJavaScript + && super.equals(obj) + && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).callBack, this.callBack) + && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).dbManipulationList, this.dbManipulationList); + } + + public Object clone() throws CloneNotSupportedException { + BatchCommit2DBJavaScript cloned = (BatchCommit2DBJavaScript) super.clone(); + if (this.dbManipulationList != null) { + cloned.dbManipulationList = new ArrayList(); + for (int i = 0; i < this.dbManipulationList.size(); i++) { + cloned.dbManipulationList.add(((SubmitMain) this.dbManipulationList.get(i)).clone()); + } + } + + if (this.callBack != null) { + cloned.callBack = (JavaScript) this.callBack.clone(); + } + + return cloned; + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java new file mode 100644 index 0000000000..f451d09078 --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java @@ -0,0 +1,186 @@ +package com.fr.design.write.submit.batch; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.Inter; +import com.fr.write.batch.SubmitMain; + +import javax.swing.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by loy on 16/8/22. + */ +public class BatchCommit2DBJavaScriptPane extends FurtherBasicBeanPane { + private List dbmPaneList = new ArrayList(); + private BatchCommitTabbedPane commitTabbedPane; + private JavaScriptActionPane javaScriptActionPane; + private UIButton addCallbackButton; + + private JPanel cardPane; + private String[] cardNames; + + /** + * 构造函数,控件事件的提交入库面板 + */ + public BatchCommit2DBJavaScriptPane() { + init(null); + } + + // public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) { + public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane) { +// this.dbmPaneList=dbManipulationPaneList; + init(javaScriptActionPane); + } + + private void init(final JavaScriptActionPane javaScriptActionPane) { + this.dbmPaneList.add(new BatchSubmitPane()); + this.javaScriptActionPane = javaScriptActionPane; + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + commitTabbedPane = new BatchCommitTabbedPane(this, dbmPaneList); + commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20)); + this.add(commitTabbedPane, BorderLayout.NORTH); + + cardPane = new JPanel(new CardLayout()); + cardNames = new String[dbmPaneList.size()]; + for (int i = 0; i < this.dbmPaneList.size(); i++) { + if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { + cardNames[i] = ""; + } else { + cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); + } + cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); + } + this.add(cardPane, BorderLayout.CENTER); + + JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + this.add(btPane, BorderLayout.SOUTH); + + if (javaScriptActionPane != null) { + addCallbackButton = javaScriptActionPane.createCallButton(); + btPane.add(addCallbackButton); + } + } + + + /** + * 更新DBManipulationPane + */ + public void updateCardPane() { + cardNames = new String[dbmPaneList.size()]; + for (int i = 0; i < this.dbmPaneList.size(); i++) { + if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { + cardNames[i] = ""; + } else { + cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); + } + cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); + } + CardLayout cardLayout = (CardLayout) cardPane.getLayout(); + cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]); + } + + public void setList(List list) { + this.dbmPaneList = list; + } + + /** + * 新建DBManipulationPane + * + * @return 新建的DBManipulationPane + */ + public BatchSubmitPane createDBManipulationPane() { + BatchSubmitPane db = new BatchSubmitPane(); +// BatchSubmitPane db = javaScriptActionPane.createDBManipulationPane(); + db.populateBean(null); + dbmPaneList.add(db); + return db; + + } + + /** + * 窗口名称 + * + * @return 返回窗口名称 + */ + public String title4PopupWindow() { + return Inter.getLocText("Performance-plugin_submitbatch_name"); + } + + /** + * 界面重置 + */ + public void reset() { + if (javaScriptActionPane != null) { + this.javaScriptActionPane.setCall(null); + } + //重置后只保留,只留第一个tab + while (dbmPaneList.size() > 1) { + dbmPaneList.remove(1); + } + ((BatchSubmitPane) dbmPaneList.get(0)).populateBean(null); + } + + @Override + /** + * 将JavaBean内的数据输出至界面上 + */ + public void populateBean(BatchCommit2DBJavaScript commit2db) { + if (commit2db == null) { + reset(); + return; + } + //先把原来的list清除,然后再根据传入参数重新add + dbmPaneList.clear(); + if (javaScriptActionPane != null) { + this.javaScriptActionPane.setCall(commit2db.getCallBack()); + } + for (int i = 0; i < commit2db.getDBManipulation().size(); i++) { + BatchSubmitPane dbmp = new BatchSubmitPane(); +// BatchSubmitPane dbmp = javaScriptActionPane.createDBManipulationPane(); + dbmp.populateBean((SubmitMain) commit2db.getDBManipulation().get(i)); + dbmPaneList.add(dbmp); + } + commitTabbedPane.refreshTab(); + } + + /** + * 更新数据层JavaBean + * + * @return 返回JavaBean + */ + public BatchCommit2DBJavaScript updateBean() { + BatchCommit2DBJavaScript commit2dbJavaScript = new BatchCommit2DBJavaScript(); + + List dbmaniList = new ArrayList(); + for (int i = 0; i < this.dbmPaneList.size(); i++) { + BatchSubmitPane dbmpane = (BatchSubmitPane) this.dbmPaneList.get(i); + if (i > dbmPaneList.size() - 1) { + dbmPaneList.add(dbmpane); + } + SubmitMain dbManipulation = dbmpane.updateBean(); + dbmaniList.add(dbManipulation); + } + commit2dbJavaScript.setDBManipulation(dbmaniList); + + if (javaScriptActionPane != null) { + commit2dbJavaScript.setCallBack(this.javaScriptActionPane.getCall()); + } + + return commit2dbJavaScript; + } + + /** + * 判断是否是能接受的数据类型 + * + * @param ob 对象 + * @return 返回是否是能接受的数据类型 + */ + public boolean accept(Object ob) { + return ob instanceof BatchCommit2DBJavaScript; + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java new file mode 100644 index 0000000000..4c1bcaddae --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java @@ -0,0 +1,529 @@ +package com.fr.design.write.submit.batch; + +import com.fr.base.BaseUtils; +import com.fr.design.constants.UIConstants; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.general.ComparatorUtils; +import com.fr.general.Inter; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; + +/** + * Created by loy on 16/8/22. + */ +public class BatchCommitTabbedPane extends JComponent implements MouseListener, MouseMotionListener { + private Icon closeIcon = BaseUtils.readIcon("com/fr/design/images/gui/tab_delete.png"); + private static final Icon ADD_NORMAL = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_normal.png"); + private static final Icon ADD_OVER = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_hover.png"); + private static final Icon ADD_CLICK = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_click.png"); + private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); + private static final Icon LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 0, 14, 14); + private static final Icon RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 0, 14, 14); + private static final Icon DISABLED_LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 14, 14, 14); + private static final Icon DISABLED_RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 14, 14, 14); + private Icon addIcon = ADD_NORMAL; + + private static final int TOOLBAR_HEIGHT = 16; // 按钮高度 + private static final int GAP = 5; //间隔 + private static final int SMALLGAP = 3; + + private static final int FIRST_TAB_POSITION = 20; + + + // 左移和右移按钮 + private UIButton leftButton; + private UIButton rightButton; + + private JPanel buttonPane; + + private java.util.List dbManipulationPaneList ; + + private BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane; + + // 能显示的tab个数 + private int showCount = 0; + + //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 + private double specialLocation1 = 2.5; + private double specialLocation2 = 4.330127; + + private int mouseOveredIndex = -1; + + private int selectedIndex = -1; + + private static final double CORNOR_RADIUS = 5.0; + + + //tab栏可以放下的每个tab的实际宽度 + private int tabWidth = 70; + + + //当前标签页栏存放的所有标签页的index + private int scrollIndex = 0; + private int lastOneIndex = 0; + + //添加标签位置 + private int addX = -1; + private int addY = -1; + + + //各删除标签位置 + private int[] closeIconStartX; + + + public BatchCommitTabbedPane(BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane, java.util.List dbManipulationPaneList ){ + this.commit2DBJavaScriptPane = commit2DBJavaScriptPane; + this.dbManipulationPaneList = dbManipulationPaneList; + this.setLayout(new BorderLayout(0, 0)); + this.addMouseListener(this); + this.addMouseMotionListener(this); + this.setBorder(null); + this.setForeground(new Color(99, 99, 99)); + leftButton = new UIButton(LEFT_ICON) { + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); + } + }; + leftButton.set4ToolbarButton(); + leftButton.setDisabledIcon(DISABLED_LEFT_ICON); + rightButton = new UIButton(RIGHT_ICON) { + public Dimension getPreferredSize() { + return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); + } + }; + rightButton.set4ToolbarButton(); + rightButton.setDisabledIcon(DISABLED_RIGHT_ICON); + buttonPane = new JPanel(new BorderLayout(3, 0)); + buttonPane.add(rightButton, BorderLayout.EAST); + buttonPane.add(leftButton, BorderLayout.CENTER); + this.add(buttonPane, BorderLayout.EAST); + leftButton.addActionListener(createLeftButtonActionListener()); + rightButton.addActionListener(createRightButtonActionListener()); + + } + + private ActionListener createRightButtonActionListener(){ + return new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + int tabCount = getTabCount(); + if (lastOneIndex < tabCount && lastOneIndex + showCount <= tabCount) { + scrollIndex += showCount; + lastOneIndex += showCount; + selectedIndex = lastOneIndex; + } else if(lastOneIndex < tabCount && lastOneIndex + showCount > tabCount){ + lastOneIndex = tabCount -1; + scrollIndex = lastOneIndex - showCount; + selectedIndex = lastOneIndex; + } + repaint(); + } + }; + } + + private ActionListener createLeftButtonActionListener() { + return new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if(scrollIndex >= showCount) { + scrollIndex -= showCount; + selectedIndex = scrollIndex; + lastOneIndex -= showCount; + } else if (scrollIndex > 0 && scrollIndex< showCount){ + scrollIndex =0; + selectedIndex = 0; + lastOneIndex = showCount; + + } + repaint(); + } + }; + } + + private void checkButton(boolean buttonEnabled) { + leftButton.setEnabled(buttonEnabled); + rightButton.setEnabled(buttonEnabled); + } + + public int getSelectedIndex(){ + return selectedIndex; + } + + public void paintComponent(Graphics g){ + super.paintComponent(g); + double maxWidth = getWidth() - buttonPane.getWidth(); + Graphics2D g2d = (Graphics2D) g; + paintBackgroundAndLine(g2d, maxWidth); + + } + + private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { + //能画的个数 + showCount = (int) (maxWidth) / tabWidth; + //计算开始画的最小模板index和最大模板index + if (selectedIndex >= dbManipulationPaneList.size()) { + selectedIndex = dbManipulationPaneList.size() - 1; + } + if (selectedIndex < 0) { + selectedIndex = 0; + } + calMinAndMaxIndex(); + closeIconStartX = new int[lastOneIndex - scrollIndex + 1]; + + int startX = 0; + //从可以开始展示在tab面板上的tab开始画 + for (int i = scrollIndex; i <= lastOneIndex; i++) { + BatchSubmitPane dbManipulationPane = (BatchSubmitPane)dbManipulationPaneList.get(i); + String name ; + if (dbManipulationPane.getSubMitName() != null){ + name = dbManipulationPane.getSubMitName(); + } else { + name = createName(); + dbManipulationPane.setSubMitName(name); + } + if (i == selectedIndex) { + closeIconStartX[i - scrollIndex] = paintSelectedTab(g2d, startX,name, i); + } else { + closeIconStartX[i - scrollIndex] = paintUnSelectedTab(g2d,startX,name,i); + } + startX += tabWidth; + } + paintUnderLine(startX, maxWidth, g2d); + addX = startX + GAP; + addIcon.paintIcon(this,g2d,addX,0); + checkButton(getTabCount() > showCount); + } + + public int getTabCount(){ + return dbManipulationPaneList.size(); + } + + private String createName(){ + String prefix = Inter.getLocText("FR-Designer-CommitTab_Submit"); + int count = getTabCount(); + while (true) { + //从提交1开始 + count = count == 0 ? 1 : count; + String newName = prefix + count; + boolean repeated = false; + for (int i= 0;i < getTabCount();i++) { + if (ComparatorUtils.equals( ((BatchSubmitPane)dbManipulationPaneList.get(i)).getSubMitName(), newName)) { + repeated = true; + break; + } + } + + if (!repeated) { + return newName; + } + + count++; + } + } + + + + private void paintUnderLine(double startX, double maxWidth, Graphics2D g2d) { + //画下面的那条线 + if (startX < maxWidth) { + GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); + generalPath.moveTo((float) startX, (float) (getHeight() - 1)); + generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1)); + g2d.fill(generalPath); + g2d.setPaint(UIConstants.LINE_COLOR); + g2d.draw(new Line2D.Double((float) startX, (float) (getHeight() - 1), (float) maxWidth , (float) (getHeight() - 1))); + } + } + + + private void calMinAndMaxIndex() { //如果个数大于最多能容纳的个数,则多余的进行处理 + + if (dbManipulationPaneList.size() > showCount) { + + if (selectedIndex >= lastOneIndex) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 + scrollIndex = selectedIndex - showCount + 1; + lastOneIndex = selectedIndex; + if (scrollIndex <= 0) { + scrollIndex = 0; + lastOneIndex = showCount - 1; + } + } else if (selectedIndex <= scrollIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 + + scrollIndex = selectedIndex; + lastOneIndex = scrollIndex + showCount - 1; + if (lastOneIndex > dbManipulationPaneList.size() - 1) { + lastOneIndex = dbManipulationPaneList.size() - 1; + } + } else { + if (selectedIndex >= dbManipulationPaneList.size() - 1) { + selectedIndex = dbManipulationPaneList.size() - 1; + lastOneIndex = selectedIndex; + scrollIndex = selectedIndex - showCount + 1; + } else { + lastOneIndex = scrollIndex + showCount - 1; + if (lastOneIndex > dbManipulationPaneList.size() - 1) { + lastOneIndex = dbManipulationPaneList.size() - 1; + } + } + } + } else { + scrollIndex = 0; + lastOneIndex = dbManipulationPaneList.size() - 1; + } + } + + + /** + * 画选中的tab + * + * @param g2d + * @param sheetName + * @return + */ + private int paintSelectedTab(Graphics2D g2d,int startX, String sheetName, int selfIndex) { + double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; + double[] y = {-1, getHeight(), getHeight(), -1, -1}; + RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7); + g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + + GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); + generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); + + for (int index = 1; index <= 2; index++) { + generalPath.lineTo((float) x[index], (float) y[index]); + } + + generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); + generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); + generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + + generalPath.closePath(); + g2d.fill(generalPath); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setPaint(UIConstants.LINE_COLOR); + g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); + g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); + g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); + g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); + g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); + g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + // 画字符 + g2d.setPaint(getForeground()); + g2d.drawString(sheetName, startX + 2 * GAP, getHeight()-GAP); + int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; + int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; + if (canClose() && mouseOveredIndex == selfIndex){ + closeIcon.paintIcon(this, g2d, closePosition, closeY); + } + return closePosition; + + } + + /** + * 画没有选中的tab + * + * @param g2d + * @param startX + * @param sheetName + * @return + */ + private int paintUnSelectedTab(Graphics2D g2d, int startX, String sheetName, int selfIndex) { + double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; + double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; + if (selfIndex == mouseOveredIndex) { + g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + } else { + g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); + } + + + GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); + generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); + + for (int index = 1; index <= 2; index++) { + generalPath.lineTo((float) x[index], (float) y[index]); + } + + generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); + generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); + generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); + + generalPath.closePath(); + + g2d.fill(generalPath); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2d.setPaint(UIConstants.LINE_COLOR); + + g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); + g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); + g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); + g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); + g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); + g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); + + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + // 画字符 + g2d.setPaint(getForeground()); + g2d.drawString(sheetName, startX + 2 * GAP, getHeight() - GAP ); + int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; + int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; + if (canClose() && mouseOveredIndex == selfIndex){ + closeIcon.paintIcon(this, g2d, closePosition, closeY); + } + return closePosition; + } + + + /** + * 鼠标按下 + * @param e 事件 + */ + public void mouseClicked(MouseEvent e) { + } + + /** + * 鼠标按下 + * @param e 事件 + */ + public void mousePressed(MouseEvent e) { + int x = e.getX(), y = e.getY(); + if (addX!= -1 && isOverAddIcon(x, y)){ + addIcon = ADD_CLICK; + commit2DBJavaScriptPane.createDBManipulationPane(); + selectedIndex = dbManipulationPaneList.size()-1; + commit2DBJavaScriptPane.updateCardPane(); + } else if (isOverCloseIcon(x)){ + int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), Inter.getLocText("FR-Designer-CommitTab_SureToDelete")+ "?", Inter.getLocText("FR-Designer-CommitTab_Remove") + , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + if (re == JOptionPane.OK_OPTION) { + dbManipulationPaneList.remove(getTabIndex(x)); + commit2DBJavaScriptPane.setList(dbManipulationPaneList); + // 删除tab以后,获得第一个tab,再刷新一下,否则画面会停留在已删除的tab上,第一个tab是不可删除的 + selectedIndex = getTabIndex(FIRST_TAB_POSITION); + commit2DBJavaScriptPane.updateCardPane(); + + } + } else if (selectedIndex != getTabIndex(x)){ + selectedIndex = getTabIndex(x); + commit2DBJavaScriptPane.updateCardPane(); + } + repaint(); + } + + /** + * 鼠标离开 + * @param e 事件 + */ + public void mouseReleased(MouseEvent e) { + if(addX != -1 && isOverAddIcon(e.getX(), e.getY())){ + addIcon = ADD_NORMAL; + } + } + + /** + * 鼠标进入 + * @param e 事件 + */ + public void mouseEntered(MouseEvent e) { + } + + /** + * 鼠标离开 + * @param e 事件 + */ + public void mouseExited(MouseEvent e) { + mouseOveredIndex = -1; + repaint(); + } + + /** + * 鼠标拖动 + * @param e 事件 + */ + public void mouseDragged(MouseEvent e) { + } + + /** + * 鼠标移动 + * @param e 事件 + */ + public void mouseMoved(MouseEvent e) { + if(addX!= -1 && isOverAddIcon(e.getX(), e.getY())){ + addIcon = ADD_OVER; + } else { + mouseOveredIndex = getTabIndex(e.getX()); + addIcon = ADD_NORMAL; + } + repaint(); + } + + + /** + * 判断鼠标所在Tab + * @param evtX + * @return index + */ + private int getTabIndex ( int evtX ){ + int x = 0; + for( int i = scrollIndex;i <= lastOneIndex;i++){ + if(evtX > x && evtX <= x + tabWidth ){ + return i; + } + x = x + tabWidth; + } + return -1; + } + + /** + * 判断鼠标是否在添加按钮上 + * @param x 鼠标坐标x + * @param y 鼠标坐标y + * @return 返回鼠标是否在添加按钮上 + */ + private boolean isOverAddIcon(int x, int y){ + int addWidth = addIcon.getIconWidth(),addHeight = addIcon.getIconHeight(); + return x >= addX && x <= addX + addWidth && y > addY && y <= addY + addHeight; + } + + + /** + * 判断鼠标是否在关闭按钮上 + * @param evtX x + * @return 返回鼠标是否在关闭按钮上 + */ + private boolean isOverCloseIcon(int evtX) { + boolean isOverCloseIcon = false; + if( canClose()){ + for (int i = 0; i < closeIconStartX.length; i++) { + if (evtX >= closeIconStartX[i] && evtX <= closeIconStartX[i] + closeIcon.getIconWidth()) { + isOverCloseIcon = true; + break; + } + } + } + return isOverCloseIcon; + } + + /** + * 如果tab只剩下最后一个,则不画删除按钮 + * @return 返回当前tab还可否关闭 + */ + private boolean canClose(){ + return closeIconStartX.length > 1; + } + + /** + * 刷新tab,停留在第一个tab上面 + */ + public void refreshTab(){ + selectedIndex = getTabIndex(FIRST_TAB_POSITION); + commit2DBJavaScriptPane.updateCardPane(); + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java new file mode 100644 index 0000000000..b0d9a2003e --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java @@ -0,0 +1,23 @@ +package com.fr.design.write.submit.batch; + +import com.fr.design.beans.FurtherBasicBeanPane; +import com.fr.design.fun.impl.AbstractJavaScriptActionProvider; +import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.js.JavaScript; + +/** + * Created by loy on 16/8/22. + */ +public class BatchJavaScriptActionProvider extends AbstractJavaScriptActionProvider { + + @Override + public FurtherBasicBeanPane getJavaScriptActionPane() { + return new BatchCommit2DBJavaScriptPane(); + } + + @Override + public FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane) { + return new BatchCommit2DBJavaScriptPane(pane); + } + +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java new file mode 100644 index 0000000000..1d944194a3 --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java @@ -0,0 +1,1089 @@ +package com.fr.design.write.submit.batch; + +import com.fr.base.BaseUtils; +import com.fr.base.Formula; +import com.fr.base.Parameter; +import com.fr.data.DataConstants; +import com.fr.data.condition.JoinCondition; +import com.fr.data.condition.ListCondition; +import com.fr.data.core.db.dml.Table; +import com.fr.design.actions.UpdateAction; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.condition.DSColumnLiteConditionPane; +import com.fr.design.constants.UIConstants; +import com.fr.design.data.datapane.ChoosePaneSupportFormula; +import com.fr.design.data.datapane.DataBaseItems; +import com.fr.design.data.tabledata.tabledatapane.FormatExplanationPane; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editor.ValueEditorPane; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.editor.editor.Editor; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIComboBoxRenderer; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ilist.CheckBoxList; +import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; +import com.fr.design.javascript.JavaScriptActionPane; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.scrollruler.ModLineBorder; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.design.write.submit.SubmitJobListPane; +import com.fr.general.ComparatorUtils; +import com.fr.general.DateUtils; +import com.fr.general.Inter; +import com.fr.general.data.Condition; +import com.fr.stable.ColumnRow; +import com.fr.stable.ColumnRowGroup; +import com.fr.stable.fun.Level; +import com.fr.write.NameSubmitJob; +import com.fr.write.batch.SubmitMain; +import com.fr.write.config.*; + +import javax.swing.*; +import javax.swing.table.AbstractTableModel; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableColumn; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import java.awt.*; +import java.awt.event.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.EventObject; + +/** + * Created by loy on 16/8/12. + */ +public class BatchSubmitPane extends BasicBeanPane implements Level { + private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png"); + private static final Icon HEIP_ICON = BaseUtils.createIcon(ICODS_IMAGE, 193, 1, 14, 14); + private static final int DEFAULT_RETURN_VALUE = 4; + public BatchSubmitPane.KeyColumnNameValueTable keyColumnValuesTable; + private UIComboBox columnsComboBox; // 用于编辑ColumnName的Editor + private UICheckBox UpdateCheckBox; + private JPanel checkBoxUpdatePane; + /* + * 记录当前选取的DS & Table对应的ColumnName[] + * alex:以前每当tableNameComboBox改变就刷新columnsComboBox,这样每输入一个文字就会刷一遍,很不好 + */ + private BatchSubmitPane.ColumnName[] currentColumnNames = null; + + // 支持公式输入的数据表选择面板 + private ChoosePaneSupportFormula chooseTable; + + private UIComboBox dmlConfigComboBox = null; + + // 提交事件 + private NameSubmitJob[] jobs = null; + + // 提交条件 + private Condition condition = null; + + private JTree conditionsTree; + + private Editor[] v_Types; + + protected JavaScriptActionPane parentPane; + + private int keyColumnWidth = 100; + private int resizeColumnCount = 4; + private int btnWidth = 110; + private int btnHeight = 20; + private String subMitName; + + private static final String[] DML_CONFIG_TYPES = new String[]{ + Inter.getLocText(new String[]{"Smart", "Submit"}), + Inter.getLocText(new String[]{"Delete", "Submit"}), + Inter.getLocText(new String[]{"Insert", "Submit"}), + Inter.getLocText(new String[]{"Update", "Submit"})}; + + /** + * 无单元格。没有智能添加单元格等按钮 + * 有单元格的参见其子类SmartInsertDBManipulationPane + */ + public BatchSubmitPane() { + this(ValueEditorPaneFactory.extendedCellGroupEditors()); + } + + public BatchSubmitPane(Editor[] v_Types) { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + this.v_Types = v_Types; + + JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(northPane, BorderLayout.NORTH); + + dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); + + JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(Inter.getLocText(new String[]{"Choose", "Type"}) + ":"), dmlConfigComboBox}, + FlowLayout.LEFT, 10); + typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Type"}))); + northPane.add(typePane, BorderLayout.NORTH); + + chooseTable = new ChoosePaneSupportFormula(); + chooseTable.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Table"))); + chooseTable.setTableNameComboBoxPopSize(160, 320); + + northPane.add(chooseTable, BorderLayout.CENTER); + + // peter:编辑的TablePane + JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); + this.add(editTablePane, BorderLayout.CENTER); + editTablePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Value"))); + + keyColumnValuesTable = new BatchSubmitPane.KeyColumnNameValueTable(); + editTablePane.add(new JScrollPane(this.keyColumnValuesTable), BorderLayout.CENTER); + keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + keyColumnValuesTable.setPreferredScrollableViewportSize(new Dimension(280, 180)); + keyColumnValuesTable.setShowHorizontalLines(true); + + initJTableColumn(); + + addButtons(editTablePane); + + addBottomPane(); + + addListeners(); + } + + public void setSubMitName(String subMitName) { + this.subMitName = subMitName; + } + + public String getSubMitName() { + return this.subMitName; + } + + private void addButtons(JPanel editTablePane) { + // alex:添加操作按钮 + UpdateAction[] actions = this.getActions(); + if (actions != null && actions.length > 0) { + JPanel controlBtnPane = new JPanel(new GridLayout(actions.length + 1, 1, 4, 4)); + editTablePane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), BorderLayout.EAST); + + for (int i = 0; i < actions.length; i++) { + controlBtnPane.add(new UIButton(actions[i])); + } + checkBoxUpdatePane = new JPanel(new BorderLayout(0, 0)); + checkBoxUpdatePane.setPreferredSize(new Dimension(120, 20)); + controlBtnPane.add(checkBoxUpdatePane); + + UpdateCheckBox = new UICheckBox(Inter.getLocText("RWA-NotChange_Unmodified")); + UIButton helpButton = new UIButton(HEIP_ICON); + helpButton.setToolTipText(Inter.getLocText("FR-Base_Help")); + helpButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + FormatExplanationPane formatExplanation = new FormatExplanationPane(Inter.getLocText("FR-Base_Help"), Inter.getLocText("FR-Designer_RWA-Help"), 12f); + BasicDialog dlg = formatExplanation.showMediumWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), + new DialogActionAdapter() { + }); + dlg.setVisible(true); + } + }); + helpButton.set4ToolbarButton(); + checkBoxUpdatePane.add(UpdateCheckBox, BorderLayout.WEST); + checkBoxUpdatePane.add(helpButton, BorderLayout.EAST); + } + } + + protected void updateUpdateCheckBoxEnable() { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + if (model.getRowCount() == 0) { + setUpdateCheckBoxEnable(false); + UpdateCheckBox.setSelected(true); + return; + } + ArrayList columnObjects = new ArrayList(); + for (int i = 0; i < model.getRowCount(); i++) { + columnObjects.add(model.getKeyColumnNameValue(i).cv.getObj()); + } + for (int i = 0; i < columnObjects.size(); i++) { + Object ob = columnObjects.get(i); + if (!(ob instanceof ColumnRow || ob instanceof ColumnRowGroup)) { + setUpdateCheckBoxEnable(false); + UpdateCheckBox.setSelected(false); + return; + } + } + setUpdateCheckBoxEnable(true); + } + + private void setUpdateCheckBoxEnable(boolean b) { + UpdateCheckBox.setEnabled(b); + } + + private void addBottomPane() { + JPanel eventPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + eventPane.add(addEventButton()); + + JPanel conditionPane = this.createConditionPane(); + + JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); + btPane.add(eventPane, BorderLayout.CENTER); + btPane.add(conditionPane, BorderLayout.NORTH); + this.add(btPane, BorderLayout.SOUTH); + } + + private UIButton addEventButton() { + UIButton addSubmitEventButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Event")); + addSubmitEventButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + final SubmitJobListPane jobsPane = createSubmitJobListPane(); + + jobsPane.populate(jobs); + BasicDialog dialog = jobsPane.showWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + jobs = jobsPane.updateDBManipulation(); + } + }); + dialog.setVisible(true); + } + + }); + return addSubmitEventButton; + } + + private JPanel createConditionPane() { + JPanel conditionPane = new JPanel(); + conditionPane.setPreferredSize(createConditionPanePreferredSize()); + + setBorderAndLayout(conditionPane); + + conditionsTree = new JTree(new DefaultTreeModel(new ExpandMutableTreeNode())); + conditionsTree.setRootVisible(false); + conditionsTree.setShowsRootHandles(true); + conditionsTree.setBackground(UIConstants.NORMAL_BACKGROUND); + conditionsTree.setForeground(UIConstants.NORMAL_BACKGROUND); + DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); + cr.setForeground(UIConstants.NORMAL_BACKGROUND); + JScrollPane jp = new JScrollPane(conditionsTree); + addComponent(conditionPane, jp); + + UIButton addSubmitConditionButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Condition")); + addSubmitConditionButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane(); + String[] columns = chooseTable.currentColumnNames(); + if (columns != null && columns.length > 0) { + conditionPane.populateColumns(chooseTable.currentColumnNames()); + } + + conditionPane.populateBean(condition); + BasicDialog dialog = conditionPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + super.doOk(); + condition = conditionPane.updateBean(); + refreshConditionList(); + } + }); + dialog.setVisible(true); + } + }); + + JPanel controlBtnPane = new JPanel(new GridLayout(1, 1, 4, 4)); + controlBtnPane.setPreferredSize(createControlBtnPanePreferredSize()); + conditionPane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), setControlBtnPanePosition()); + controlBtnPane.add(addSubmitConditionButton); + + return conditionPane; + } + + protected void setBorderAndLayout(JPanel jPanel) { + jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); + jPanel.setBorder(BorderFactory.createTitledBorder( + new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Condition"}))); + } + + protected void addComponent(JPanel mainPane, JScrollPane addPane) { + mainPane.add(addPane, BorderLayout.CENTER); + } + + + protected Dimension createConditionPanePreferredSize() { + return new Dimension(454, 80); + } + + protected Dimension createControlBtnPanePreferredSize() { + return new Dimension(110, 20); + } + + protected String setControlBtnPanePosition() { + return BorderLayout.EAST; + } + + private void refreshConditionList() { + DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); + ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); + rootTreeNode.setUserObject(new JoinCondition(DataConstants.AND, new ListCondition())); + rootTreeNode.removeAllChildren(); + Condition liteCondition = this.condition == null ? new ListCondition() : this.condition; + if (liteCondition instanceof ListCondition) { + ListCondition listCondition = (ListCondition) liteCondition; + int joinConditionCount = listCondition.getJoinConditionCount(); + for (int i = 0; i < joinConditionCount; i++) { + addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); + } + } else { + ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); + rootTreeNode.add(newTreeNode); + } + defaultTreeModel.reload(rootTreeNode); + rootTreeNode.expandCurrentTreeNode(conditionsTree); + } + + private void addLiteConditionToListCondition(ExpandMutableTreeNode parentTreeNode, JoinCondition joinCondition) { + ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(joinCondition); + parentTreeNode.add(newTreeNode); + Condition liteCondition = joinCondition.getCondition(); + if (liteCondition instanceof ListCondition) { + ListCondition listCondition = (ListCondition) liteCondition; + int joinConditionCount = listCondition.getJoinConditionCount(); + for (int i = 0; i < joinConditionCount; i++) { + addLiteConditionToListCondition(newTreeNode, listCondition.getJoinCondition(i)); + } + } + } + + private void addListeners() { + dmlConfigComboBox.addItemListener(new ItemListener() { + @Override + public void itemStateChanged(ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + Object ob = e.getItem(); + if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) { + checkBoxUpdatePane.setVisible(true); + } else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) { + checkBoxUpdatePane.setVisible(false); + } + } + } + }); + + /* + * 当DS & Table改变时要刷新ColumnsComboBox.model,不能用ItemListener, + * 因为tableNameComboBox是可以编辑的,每写一个文字就要连,太频繁了 + * 也不能在tableNameComboBox.focusLost事件时,好像没用 + */ + keyColumnValuesTable.addFocusListener(new FocusAdapter() { + + public void focusGained(FocusEvent e) { + refreshColumnsComboBox(); + } + + }); + } + + protected UpdateAction[] getActions() { + return new UpdateAction[]{new BatchSubmitPane.SmartAddFieldsAction(), new BatchSubmitPane.AddFieldAction(), new BatchSubmitPane.RemoveFieldAction()}; + } + + protected SubmitJobListPane createSubmitJobListPane() { + return new SubmitJobListPane(); + } + + public void setParentJavaScriptActionPane(JavaScriptActionPane jsPane) { + this.parentPane = jsPane; + } + + @Override + protected String title4PopupWindow() { + return "DB"; + } + + @Override + public int currentAPILevel() { + return 1; + } + + protected class SmartAddFieldsAction extends UpdateAction { + public SmartAddFieldsAction() { + this.setName(Inter.getLocText("RWA-Smart_Add_Fields")); + } + + public void actionPerformed(ActionEvent evt) { + + BasicPane bPane = new BasicPane() { + @Override + protected String title4PopupWindow() { + return Inter.getLocText("RWA-Smart_Add_Fields"); + } + }; + bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + + final CheckBoxList list = new CheckBoxList(currentColumnNames(), CheckBoxList.SelectedState.ALL, Inter.getLocText("FR-Designer_Chart_Field_Name")) { + public String value2Text(Object value) { + if (value instanceof BatchSubmitPane.ColumnName) { + return ((BatchSubmitPane.ColumnName) value).name; + } + + return super.value2Text(value); + } + }; + bPane.add(new JScrollPane(list), BorderLayout.CENTER); + + BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { + public void doOk() { + addFields(list); + updateUpdateCheckBoxEnable(); + } + }); + dlg.setVisible(true); + } + } + + private void addFields(CheckBoxList list) { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + java.util.List keyColumnNameValueList = new ArrayList(); + keyColumnNameValueList.clear(); + for (int i = 0; i < model.getRowCount(); i++) { + keyColumnNameValueList.add(model.getKeyColumnNameValue(i)); + } + model.removeAllKeyColumnNameValue(); + Object[] selected = list.getSelectedValues(); + // Richie:用了存储新的KeyColumnNameValue的List. + java.util.List newKeyColumnNameValueList = new ArrayList(); + if (!keyColumnNameValueList.isEmpty()) { + for (int i = 0; i < selected.length; i++) { + // Richie:先填上空的. + newKeyColumnNameValueList.add(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); + } + } + // Richie:初始化 + int returnValue = DEFAULT_RETURN_VALUE; + int coverNumber = 0; + for (int i = 0; i < selected.length; i++) { + if (returnValue == 0 || returnValue == 3) { + break; + } + for (int j = 0; j < keyColumnNameValueList.size(); j++) { + if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { + Object[] options = {Inter.getLocText("FR-Designer_Covered_All"), Inter.getLocText("FR-Base_Yes"), Inter.getLocText("FR-Base_No"), Inter.getLocText("FR-Designer_Cover_None")}; + returnValue = JOptionPane.showOptionDialog(BatchSubmitPane.this, keyColumnNameValueList.get(j).cn.name + + Inter.getLocText(new String[]{"Has_Existed", "Want_To_Cover_It"}, new String[]{",", "?"}), + "", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); + // Richie:全部覆盖 + if (returnValue == 0) { + break; + // Richie:覆盖指定行 + } else if (returnValue == 1) { + coverNumber = i; + // Richie:不覆盖制定行 + } else if (returnValue == 2) { + coverNumber = i; + newKeyColumnNameValueList.remove(i); + newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); + // Richie:全部不覆盖 + } else if (returnValue == 3) { + coverNumber = i; + break; + } + } + } + } + checkTableModel(returnValue, coverNumber, model, selected, keyColumnNameValueList, newKeyColumnNameValueList); + } + + private void checkTableModel(int returnValue, int coverNumber, BatchSubmitPane.KeyColumnTableModel model, Object[] selected, java.util.List keyColumnNameValueList, java.util.List newKeyColumnNameValueList) { + if (returnValue == 0) { + model.removeAllKeyColumnNameValue(); + // Richie:全部覆盖,按selected的长度添加默认的行 + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + + } else if (returnValue == 3) { + model.removeAllKeyColumnNameValue(); + // Richie:全部不覆盖,已经存在的就保留,不存在的添加默认行 + for (int i = coverNumber; i < selected.length; i++) { + for (int j = 0; j < keyColumnNameValueList.size(); j++) { + if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { + newKeyColumnNameValueList.remove(i); + newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); + } + } + + } + + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + + } else if (returnValue == 1 || returnValue == 2) { + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); + } + } + + // Richie:初始化 + if (keyColumnNameValueList.isEmpty()) { + model.removeAllKeyColumnNameValue(); + for (int i = 0; i < selected.length; i++) { + model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); + } + } + model.fireTableDataChanged(); + keyColumnValuesTable.validate(); + } + + protected class AddFieldAction extends UpdateAction { + public AddFieldAction() { + this.setName(Inter.getLocText("RWA-Add_Field")); + } + + public void actionPerformed(ActionEvent e) { + + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + + model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, new BatchSubmitPane.ColumnName(""), new BatchSubmitPane.ColumnValue(""), false)); + updateUpdateCheckBoxEnable(); + model.fireTableDataChanged(); + + keyColumnValuesTable.getSelectionModel().setSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); + } + } + + protected class RemoveFieldAction extends UpdateAction { + public RemoveFieldAction() { + this.setName(Inter.getLocText("RWA-Remove_Field")); + } + + public void actionPerformed(ActionEvent evt) { + // DBManipulationPane target = this.getDBManipulationPane(); + + int[] selectedRows = keyColumnValuesTable.getSelectedRows(); + if (selectedRows == null || selectedRows.length == 0) { + return; + } + + int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), + Inter.getLocText("FR-Base_sure_remove_item") + "?", Inter.getLocText("FR-Base_Remove"), JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); + if (returnVal == JOptionPane.OK_OPTION) { + BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); + + // 把selectedRows从小到大排个序,先删大的再删小的 + java.util.Arrays.sort(selectedRows); + for (int i = selectedRows.length - 1; i >= 0; i--) { + keyColumnNameValueTableModel.removeKeyColumnNameValue(selectedRows[i]); + } + updateUpdateCheckBoxEnable(); + keyColumnNameValueTableModel.fireTableDataChanged(); + + // select other one. + if (keyColumnNameValueTableModel.getRowCount() > selectedRows[0]) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(selectedRows[0], selectedRows[0]); + } else if (keyColumnNameValueTableModel.getRowCount() > 0) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); + } + } + } + } + + /* + * 刷新columnsComboBox + */ + private void refreshColumnsComboBox() { + DefaultComboBoxModel model = (DefaultComboBoxModel) this.columnsComboBox.getModel(); + model.removeAllElements(); + + BatchSubmitPane.ColumnName[] columnNames = currentColumnNames(); + for (int i = 0; i < columnNames.length; i++) { + model.addElement(columnNames[i]); + } + } + + // 得到当前的ColumnName[] + private BatchSubmitPane.ColumnName[] currentColumnNames() { + // ben:清除原有的 + if (currentColumnNames != null) { + currentColumnNames = null; + } + String[] colNames = this.chooseTable.currentColumnNames(); + int len = colNames.length; + currentColumnNames = new BatchSubmitPane.ColumnName[len]; + for (int i = 0; i < len; i++) { + currentColumnNames[i] = new BatchSubmitPane.ColumnName(colNames[i]); + } + if (currentColumnNames == null) { + currentColumnNames = new BatchSubmitPane.ColumnName[0]; + } + return currentColumnNames; + } + + /* + * 设置JTable的Column + */ + private void initJTableColumn() { + TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); + column0.setMaxWidth(50); + + TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); + column1.setCellRenderer(new BatchSubmitPane.ColumnNameTableCellRenderer()); + + TableColumn column2 = this.keyColumnValuesTable.getColumnModel().getColumn(2); + column2.setCellRenderer(new BatchSubmitPane.ColumnValueTableCellRenderer()); + + // 设置column1的editor + columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); + columnsComboBox.setRenderer(new UIComboBoxRenderer() { + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof BatchSubmitPane.ColumnName) { + this.setText(((BatchSubmitPane.ColumnName) value).name); + } + + return this; + } + + }); + column1.setCellEditor(new DefaultCellEditor(columnsComboBox) { + public boolean stopCellEditing() { + if (super.stopCellEditing()) { + return true; + } + + return false; + } + }); + ((DefaultCellEditor) column1.getCellEditor()).setClickCountToStart(2); + + //设置Column 2的Editor + column2.setCellEditor(new BatchSubmitPane.ColumnValueEditor()); + } + + @Override + public void populateBean(SubmitMain submitMain) { + if (submitMain == null) { + submitMain = new SubmitMain(); + } + subMitName = submitMain.getName(); + DMLConfig dmlConfig = submitMain.getDmlConfig(); + + if (dmlConfig != null) { + if (dmlConfig instanceof IntelliDMLConfig) { + dmlConfigComboBox.setSelectedIndex(0); + } else if (dmlConfig instanceof DeleteConfig) { + dmlConfigComboBox.setSelectedIndex(1); + } else if (dmlConfig instanceof InsertConfig) { + dmlConfigComboBox.setSelectedIndex(2); + } else if (dmlConfig instanceof UpdateConfig) { + dmlConfigComboBox.setSelectedIndex(3); + } else { + dmlConfigComboBox.setSelectedIndex(0); + } + jobs = new NameSubmitJob[dmlConfig == null ? 0 : dmlConfig.getSubmitJobCount()]; + for (int i = 0; i < jobs.length; i++) { + jobs[i] = dmlConfig.getSubmitJob(i); + } + condition = dmlConfig.getCondition(); + UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected()); + } else { + jobs = null; + condition = null; + dmlConfigComboBox.setSelectedIndex(0); + UpdateCheckBox.setSelected(false); + } + + String schema = null; + String tableName = null; + Table table = null; + if (dmlConfig != null && dmlConfig.getOriTable() != null) { + table = dmlConfig.getOriTable(); + if (table != null) { + schema = table.getSchema(); + tableName = table.getName(); + } + } + chooseTable.populateBean(new DataBaseItems(submitMain.getDBName(), schema, tableName)); + + populateKeyColumnValueTable(dmlConfig); + + updateUpdateCheckBoxEnable(); + refreshConditionList(); + } + + private void populateKeyColumnValueTable(DMLConfig dmlConfig) { + BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); + keyColumnNameValueTableModel.removeAllKeyColumnNameValue(); + + if (dmlConfig != null) { + boolean acceptPara = false; + for (int i = 0; i < v_Types.length; i++) { + if (v_Types[i].accept(new Parameter())) { + acceptPara = true; + break; + } + } + for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { + ColumnConfig column = dmlConfig.getColumnConfig(i); + String columnName = column.getColumnName(); + if (!acceptPara && column.getColumnValue() instanceof Parameter) { + // 表单中,将以前的参数转换为公式 + column.setColumnValue(new Formula(((Parameter) column.getColumnValue()).getName())); + } + + BatchSubmitPane.KeyColumnNameValue newColumnNameValue = new BatchSubmitPane.KeyColumnNameValue(column.isKey(), new BatchSubmitPane.ColumnName(columnName), new BatchSubmitPane.ColumnValue(column.getColumnValue()), + column.isSkipUnmodified()); + keyColumnNameValueTableModel.addKeyColumnNameValue(newColumnNameValue); + } + } + keyColumnNameValueTableModel.fireTableDataChanged(); + + // 选择第一个 + if (keyColumnNameValueTableModel.getRowCount() > 0) { + keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); + } + } + + @Override + public SubmitMain updateBean() { + DataBaseItems para = chooseTable.updateBean(true); + SubmitMain submitMain = new SubmitMain(); + submitMain.setName(subMitName); + submitMain.setDBName(para.getDatabaseName()); + + DMLConfig dmlConfig = new IntelliDMLConfig(); + if (dmlConfigComboBox.getSelectedIndex() == 1) { + dmlConfig = new DeleteConfig(); + } else if (dmlConfigComboBox.getSelectedIndex() == 2) { + dmlConfig = new InsertConfig(); + } else if (dmlConfigComboBox.getSelectedIndex() == 3) { + dmlConfig = new UpdateConfig(); + } + + submitMain.setDmlConfig(dmlConfig); + + dmlConfig.setTable(new Table(para.getSchemaName(), para.getTableName())); + + BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); + int rowCount = keyColumnNameValueTableModel.keyColumnNameValueList.size(); + for (int i = 0; i < rowCount; i++) { + BatchSubmitPane.KeyColumnNameValue newKeyColumnNameValue = keyColumnNameValueTableModel.keyColumnNameValueList.get(i); + // peter:先添加key column name. + + dmlConfig.addColumnConfig(new ColumnConfig(newKeyColumnNameValue.cn.name, newKeyColumnNameValue.cv.obj, newKeyColumnNameValue.isKey, false)); + } + dmlConfig.setUpdateSelected(UpdateCheckBox.isSelected()); + + if (jobs != null) { + for (int i = 0; i < jobs.length; i++) { + dmlConfig.addSubmitJob(jobs[i]); + } + } + dmlConfig.setCondition(condition); + + return submitMain; + } + + protected class ValuePane extends BasicBeanPane { + ValueEditorPane vPane; + + public ValuePane() { + this(v_Types); + } + + public ValuePane(Editor[] types) { + vPane = new ValueEditorPane(types); + this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 45)); + this.add(vPane); + vPane.setPreferredSize(new Dimension(220, 25)); + } + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Values-Editor"); + } + + public void populateBean(Object object) { + vPane.populate(object); + } + + @Override + public Object updateBean() { + return vPane.update(); + } + + } + + /* + * alex:ColumnValue的编辑器,弹出对话框来编辑...个人觉得不大好 + */ + protected class ColumnValueEditor extends AbstractCellEditor implements TableCellEditor { + /** + * The Swing component being edited. + */ + private UILabel textLabel; + private BatchSubmitPane.ValuePane vPane; + private BasicDialog vPaneDLG; + + protected ColumnValueEditor() { + this(v_Types); + } + + protected ColumnValueEditor(Editor[] types) { + textLabel = new UILabel(); + textLabel.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + vPaneDLG.setVisible(true); + + } + }); + + vPane = new BatchSubmitPane.ValuePane(types); + vPaneDLG = vPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + public void doOk() { + fireEditingStopped(); // Make the renderer + // reappear. + updateUpdateCheckBoxEnable(); + } + + public void doCancel() { + fireEditingCanceled(); + } + }); + } + + /* + * 双击以编辑 + */ + public boolean isCellEditable(EventObject anEvent) { + if (anEvent instanceof MouseEvent) { + return ((MouseEvent) anEvent).getClickCount() >= 2; + } + return true; + } + + public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { + if (value instanceof BatchSubmitPane.ColumnValue) { + vPane.populateBean(((BatchSubmitPane.ColumnValue) value).obj); + + if (((BatchSubmitPane.ColumnValue) value).obj != null) { + textLabel.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); + } else { + textLabel.setText(""); + } + } + + return textLabel; + } + + public Object getCellEditorValue() { + return new BatchSubmitPane.ColumnValue(vPane.updateBean()); + } + } + + public static class ColumnName { + public String name; + + public ColumnName(String name) { + this.name = name; + } + + public boolean equals(Object obj) { + if (!(obj instanceof BatchSubmitPane.ColumnName)) { + return false; + } + + return ComparatorUtils.equals(this.name, ((BatchSubmitPane.ColumnName) obj).name); + } + } + + public static class ColumnValue { + public Object obj; + + public ColumnValue(Object obj) { + this.obj = obj; + } + + public Object getObj() { + return obj; + } + + public boolean equals(Object obj) { + if (!(obj instanceof BatchSubmitPane.ColumnValue)) { + return false; + } + + return ComparatorUtils.equals(this.obj, ((BatchSubmitPane.ColumnValue) obj).obj); + } + } + + protected static class KeyColumnNameValueTable extends JTable { + + public KeyColumnNameValueTable() { + super(new BatchSubmitPane.KeyColumnValueTableModel(null)); + } + + + public BatchSubmitPane.KeyColumnTableModel getTableModel4SmartAddCell() { + return new BatchSubmitPane.KeyColumnValueTableModel((BatchSubmitPane.KeyColumnTableModel) this.getModel()); + } + + } + + protected abstract static class KeyColumnTableModel extends AbstractTableModel { + public static final String RAW_KEY = Inter.getLocText("FR-Base_RWA-Key"); + public static final String COLUMN = Inter.getLocText("FR-Base_Column"); + public static final String VALUE = Inter.getLocText("FR-Base_Value"); + + public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE}; + + protected java.util.List keyColumnNameValueList = new ArrayList(); + + public KeyColumnTableModel(BatchSubmitPane.KeyColumnTableModel model) { + if (model != null) { + this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); + } + } + + public String getColumnName(int col) { + return COLUMN_NAMES[col]; + } + + public int getColumnCount() { + return COLUMN_NAMES.length; + } + + public int getRowCount() { + return keyColumnNameValueList.size(); + } + + public void addKeyColumnNameValue(BatchSubmitPane.KeyColumnNameValue keyColumnNameValue) { + this.keyColumnNameValueList.add(keyColumnNameValue); + } + + public void removeKeyColumnNameValue(int index) { + this.keyColumnNameValueList.remove(index); + } + + public BatchSubmitPane.KeyColumnNameValue getKeyColumnNameValue(int index) { + return this.keyColumnNameValueList.get(index); + } + + public void removeAllKeyColumnNameValue() { + this.keyColumnNameValueList.clear(); + } + } + + protected static class KeyColumnValueTableModel extends BatchSubmitPane.KeyColumnTableModel { + + public KeyColumnValueTableModel(BatchSubmitPane.KeyColumnTableModel model) { + super(model); + } + + public Object getValueAt(int row, int col) { + BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); + + switch (col) { + case 0: + return knv.isKey; + case 1: + return knv.cn; + case 2: + return knv.cv; + } + return null; + } + + public void setValueAt(Object value, int row, int col) { + BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); + + if (col == 0 && value instanceof Boolean) { + knv.isKey = ((Boolean) value).booleanValue(); + } else if (col == 1 && value instanceof BatchSubmitPane.ColumnName) { + knv.cn = (BatchSubmitPane.ColumnName) value; + } else if (col == 2 && value instanceof BatchSubmitPane.ColumnValue) { + knv.cv = (BatchSubmitPane.ColumnValue) value; + } + } + + public Class getColumnClass(int c) { + switch (c) { + case 0: + return Boolean.class; + case 1: + return BatchSubmitPane.ColumnName.class; + case 2: + return BatchSubmitPane.ColumnValue.class; + } + return String.class; + } + + public boolean isCellEditable(int row, int col) { + return true; + } + } + + + public static class KeyColumnNameValue { + private boolean isKey = false; + private BatchSubmitPane.ColumnName cn; + public BatchSubmitPane.ColumnValue cv; + + public KeyColumnNameValue(boolean isKey, BatchSubmitPane.ColumnName cn, BatchSubmitPane.ColumnValue cv, boolean skip) { + this.isKey = isKey; + this.cn = cn; + this.cv = cv; + } + + /** + * 字符串 + * + * @return 字符串z + */ + public String toString() { + return (isKey ? "* " : "") + cn + ":" + cv; + } + } + + /* + * ColumnNameTableCellRenderer + */ + public class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (value instanceof BatchSubmitPane.ColumnName) { + this.setText(((BatchSubmitPane.ColumnName) value).name); + } + + return this; + } + } + + /* + * ColumnValueTableCellRenderer + */ + private class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + if (value instanceof BatchSubmitPane.ColumnValue) { + if (((BatchSubmitPane.ColumnValue) value).obj != null) { + if (((BatchSubmitPane.ColumnValue) value).obj instanceof Date) { + this.setText(DateUtils.DATEFORMAT2.format(((BatchSubmitPane.ColumnValue) value).obj)); + } else { + this.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); + } + } else { + this.setText(""); + } + } + + return this; + } + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java new file mode 100644 index 0000000000..4044626645 --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java @@ -0,0 +1,42 @@ +package com.fr.design.write.submit.batch; + +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractSubmitProvider; +import com.fr.general.Inter; + +/** + * Created by loy on 16/8/13. + */ +public class BatchSubmitProvider extends AbstractSubmitProvider { + private volatile static BatchSubmitProvider instance; + + public static BatchSubmitProvider getInstance() { + if (instance == null) { + synchronized (BatchSubmitProvider.class) { + if (instance == null) { + instance = new BatchSubmitProvider(); + } + } + } + return instance; + } + @Override + public BasicBeanPane appearanceForSubmit() { + return new SmartInsertBatchSubmitPane(); + } + + @Override + public String dataForSubmit() { + return Inter.getLocText("Performance-plugin_submitbatch_name"); + } + + @Override + public String keyForSubmit() { + return "submitbatch"; + } + + @Override + public int currentAPILevel() { + return 1; + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java new file mode 100644 index 0000000000..791f801ede --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java @@ -0,0 +1,591 @@ +package com.fr.design.write.submit.batch; + +import com.fr.cache.list.IntList; +import com.fr.data.ClassSubmitJob; +import com.fr.design.actions.UpdateAction; +import com.fr.design.cell.smartaction.AbstractSmartJTablePaneAction; +import com.fr.design.cell.smartaction.SmartJTablePane; +import com.fr.design.cell.smartaction.SmartJTablePaneAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.editor.ValueEditorPaneFactory; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UIBasicSpinner; +import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.layout.TableLayout; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.JTemplate; +import com.fr.design.mainframe.JWorkBook; +import com.fr.design.selection.SelectionEvent; +import com.fr.design.selection.SelectionListener; +import com.fr.design.write.submit.CustomSubmitJobPane; +import com.fr.design.write.submit.SmartInsertDMLJobPane; +import com.fr.design.write.submit.SubmitJobListPane; +import com.fr.general.Inter; +import com.fr.grid.selection.CellSelection; +import com.fr.grid.selection.FloatSelection; +import com.fr.grid.selection.Selection; +import com.fr.stable.ColumnRow; +import com.fr.stable.ColumnRowGroup; +import com.fr.write.DMLConfigJob; + +import javax.swing.*; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; +import java.awt.*; +import java.awt.event.ActionEvent; + +/** + * Created by loy on 16/8/16. + */ +public class SmartInsertBatchSubmitPane extends BatchSubmitPane { + private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1); + private ElementCasePane ePane; + private static int CELL_GROUP_LIMIT = 6; + + public SmartInsertBatchSubmitPane(ElementCasePane ePane) { + super(ValueEditorPaneFactory.extendedCellGroupEditors()); + this.ePane = ePane; + } + + public SmartInsertBatchSubmitPane() { + super(ValueEditorPaneFactory.extendedCellGroupEditors()); + JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); + this.ePane = ((JWorkBook) jTemplate).getEditingElementCasePane(); + } + + @Override + protected SubmitJobListPane createSubmitJobListPane() { + return new SmartInsertSubmitJobListPane(); + } + + class SmartInsertSubmitJobListPane extends SubmitJobListPane { + + public SmartInsertSubmitJobListPane() { + super(ePane); + } + + public void hideParentDialog() { + hideDialog4AddCellAction(); + } + + public void showParentDialog() { + showDialogAfterAddCellAction(); + } + + @Override + public NameableCreator[] createNameableCreators() { + return new NameableCreator[] { + new NameObjectCreator(Inter.getLocText(new String[]{"Submit", "Event"}), + "/com/fr/web/images/reportlet.png", + DMLConfigJob.class, + SmartInsertDMLJobPane.class), + new NameObjectCreator(Inter.getLocText(new String[]{"Custom", "Event"}), + "/com/fr/web/images/reportlet.png", + ClassSubmitJob.class, + CustomSubmitJobPane.class) }; + } + } + + @Override + protected UpdateAction[] getActions() { + return new UpdateAction[] { + new BatchSubmitPane.SmartAddFieldsAction(), + new BatchSubmitPane.AddFieldAction(), + new SmartAddCellAction(), + new SmartAddCellGroupAction(), + new BatchModCellAction(), + new BatchSubmitPane.RemoveFieldAction() + }; + } + + public class BatchModCellAction extends UpdateAction { + public BatchModCellAction() { + this.setName(Inter.getLocText("RWA-Batch_Modify_Cells")); + } + + /** + * 执行事件 + * @param evt 事件对象 + */ + public void actionPerformed(ActionEvent evt) { + BasicPane bPane = new BasicPane() { + @Override + protected String title4PopupWindow() { + return Inter.getLocText("RWA-Batch_Modify_Cells"); + } + }; + bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); + bPane.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); + final UIBasicSpinner columnSpinner = new UIBasicSpinner(); + final UIBasicSpinner rowSpinner = new UIBasicSpinner(); + Component[][] coms = new Component[][] { { new UILabel(Inter.getLocText("RWA-Row_Offset")), rowSpinner },{ new UILabel(Inter.getLocText("RWA-Column_Offset")), columnSpinner } }; + double p = TableLayout.PREFERRED; + double f = TableLayout.FILL; + bPane.add(TableLayoutHelper.createTableLayoutPane(coms, new double[]{p, p}, new double[]{p, f}), BorderLayout.NORTH); + BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this), new DialogActionAdapter() { + public void doOk() { + int row_offset = ((Number)rowSpinner.getValue()).intValue(); + int column_offset = ((Number)columnSpinner.getValue()).intValue(); + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); + int[] selectedRows = keyColumnValuesTable.getSelectedRows(); + // 如果一行都没选中,取所有的行 + if (selectedRows.length == 0) { + selectedRows = IntList.range(model.getRowCount()); + } + for (int i = 0; i < selectedRows.length; i++) { + int row = selectedRows[i]; + BatchSubmitPane.KeyColumnNameValue kcnv = model.getKeyColumnNameValue(row); + if (kcnv.cv.obj instanceof ColumnRow) { + ColumnRow or = (ColumnRow)kcnv.cv.obj; + int n_column = or.getColumn() + column_offset; + if (n_column < 0) { + n_column = 0; + } + int n_row = or.getRow() + row_offset; + if (n_row < 0) { + n_row = 0; + } + kcnv.cv.obj = ColumnRow.valueOf(n_column, n_row); + } + } + model.fireTableDataChanged(); + keyColumnValuesTable.validate(); + for (int i = 0; i < selectedRows.length; i++) { + keyColumnValuesTable.addRowSelectionInterval(selectedRows[i], selectedRows[i]); + } + } + }); + dlg.setVisible(true); + } + } + + public class SmartAddCellAction extends UpdateAction { + public SmartAddCellAction() { + this.setName(Inter.getLocText("RWA-Smart_Add_Cells")); + } + + /** + * 执行事件 + * @param evt 事件s + */ + public void actionPerformed(ActionEvent evt) { + + // Grid.GridSelectionListener + if (ePane == null) { + return; + } + + /* + * 布局 + */ + BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane); + + // ReportWriteAttrDialog.this.setVisible(false); + hideDialog4AddCellAction(); + /* + * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener + */ + ePane.setSelection(NO_SELECTION); + ePane.setEditable(false); + ePane.getGrid().setNotShowingTableSelectPane(false); + + BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); + + dlg.setModal(false); + dlg.setVisible(true); + } + } + + public class SmartAddCellGroupAction extends UpdateAction { + public SmartAddCellGroupAction() { + this.setName(Inter.getLocText("RWA-Smart_Add_Cell_Group")); + } + + /** + * 智能添加单元格组 + * @param e 事件s + */ + public void actionPerformed(ActionEvent e) { + if (ePane == null) { + return; + } + + BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane, true); + + // ReportWriteAttrDialog.this.setVisible(false); + hideDialog4AddCellAction(); + /* + * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener + */ + ePane.setSelection(NO_SELECTION); + ePane.setEditable(false); + ePane.getGrid().setNotShowingTableSelectPane(false); + + BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); + + dlg.setModal(false); + dlg.setVisible(true); + } + } + + private void showDialogAfterAddCellAction() { + Container dialog = this; + if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { + ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).showDialogAfterAddCellAction(); + } + while (dialog.getParent() != null) { + dialog = dialog.getParent(); + if (dialog instanceof SmartInsertSubmitJobListPane) { + ((SmartInsertSubmitJobListPane)dialog).showParentDialog(); + } else if (dialog instanceof Dialog) { + dialog.setVisible(true); + } + } + } + + private void hideDialog4AddCellAction() { + Container dialog = this; + if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { + ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).hideDialog4AddCellAction(); + } + while (dialog.getParent() != null) { + dialog = dialog.getParent(); + if (dialog instanceof SmartInsertSubmitJobListPane) { + ((SmartInsertSubmitJobListPane)dialog).hideParentDialog(); + } else if (dialog instanceof Dialog) { + // 条件属性中添加的控件的话有两层dialog,需要都隐藏 + dialog.setVisible(false); + } + } + } + + /** + * 检测是否合法 + * @throws Exception + */ + public void checkValid() throws Exception { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); + int cnt = model.getRowCount(); + int groupLength = -1; + for (int i=0; i= model.getRowCount()) { + return; + } + BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); + ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); + Selection selection = currentReportPane.getSelection(); + if (selection == NO_SELECTION || selection instanceof FloatSelection) { + return; + } + CellSelection cellselection = (CellSelection)selection; + kcv.cv.obj = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); + + if (editingRowIndex >= model.getRowCount() - 1) { + setEditingRowIndex(0); + } else { + setEditingRowIndex(editingRowIndex + 1); + } + + model.fireTableDataChanged(); + + } + + }; + + /** + * 单元格组的点选格子事件 + */ + private SelectionListener groupListener = new SelectionListener() { + @Override + public void selectionChanged(SelectionEvent e) { + BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)table.getModel(); + if (editingRowIndex < 0 || editingRowIndex >= model.getRowCount()) { + return; + } + BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); + ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); + Selection selection = currentReportPane.getSelection(); + if (selection == NO_SELECTION || selection instanceof FloatSelection) { + return; + } + CellSelection cellselection = (CellSelection)selection; + Object oriValue = kcv.cv.obj; + ColumnRowGroup newValue = getColumnRowGroupValue(oriValue); + + // 要考虑多选的情况 要结合之前的看看 可能是增加 也可能需要减少 + ColumnRowGroup add = new ColumnRowGroup(); + int removeCount = 0; + if (oriCellSelection != null && sameStartPoint(cellselection, oriCellSelection)) { + removeCount = dealDragSelection(add, cellselection); + } else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { + dealSelectColRow(add, cellselection); + } else { + add.addColumnRow(ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow())); + } + + if (add.getSize() > 0) { + newValue.addAll(add); + } else if (removeCount > 0) { + newValue.splice(newValue.getSize()-removeCount, removeCount); + } + + kcv.cv.obj = newValue; + + model.fireTableDataChanged(); + + oriCellSelection = cellselection; + } + + private ColumnRowGroup getColumnRowGroupValue(Object oriValue) { + ColumnRowGroup newValue = new ColumnRowGroup(); + if (oriValue instanceof ColumnRowGroup) { + newValue.addAll((ColumnRowGroup)oriValue); + } else if (oriValue instanceof ColumnRow) { + newValue.addColumnRow((ColumnRow) oriValue); + } + return newValue; + } + + private boolean sameStartPoint(CellSelection cs1, CellSelection cs2) { + return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow(); + } + + private int dealDragSelection(ColumnRowGroup add, CellSelection cellselection) { + int removeCount = 0; + if (cellselection.getRowSpan() == oriCellSelection.getRowSpan() + 1) { + for (int i=0; i= CELL_GROUP_LIMIT) { + text.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, + new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); + tip = cv.toString() + " " + tip; + } else if (cv != null) { + text.setText(cv.toString()); + } else { + text.setText(""); + } + } + + if (row == SmartJTablePane4DB.this.editingRowIndex) { + pane.setBackground(Color.cyan); + } else { + pane.setBackground(Color.white); + } + + pane.setToolTipText(tip); + pane.add(text); + + return pane; + } + } + + private class ColumnRowGroupCellRenderer2 extends DefaultTableCellRenderer { + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + + String tip = Inter.getLocText("FR-Designer_Double_Click_Edit_OR_Clear"); + + if (value instanceof BatchSubmitPane.ColumnValue) { + Object cv = ((BatchSubmitPane.ColumnValue) value).obj; + if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) { + this.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, + new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); + tip = cv.toString() + " " + tip; + } else if (cv != null) { + this.setText(cv.toString()); + } else { + this.setText(""); + } + } + + this.setToolTipText(tip); + + if (row == SmartJTablePane4DB.this.editingRowIndex) { + this.setBackground(Color.cyan); + } else { + this.setBackground(Color.white); + } + + return this; + } + } + } +} diff --git a/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java b/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java new file mode 100644 index 0000000000..01ac8a155b --- /dev/null +++ b/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java @@ -0,0 +1,288 @@ +package com.fr.design.write.submit.batch.service; + +import com.fr.base.*; +import com.fr.data.NetworkHelper; +import com.fr.data.core.db.DBUtils; +import com.fr.data.impl.NameDatabaseConnection; +import com.fr.design.write.submit.batch.BatchCommit2DBJavaScript; +import com.fr.form.ui.WebContentUtils; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.js.JavaScript; +import com.fr.json.JSONException; +import com.fr.json.JSONFunction; +import com.fr.json.JSONObject; +import com.fr.script.Calculator; +import com.fr.stable.ColumnRow; +import com.fr.stable.ParameterProvider; +import com.fr.stable.StringUtils; +import com.fr.stable.UtilEvalError; +import com.fr.stable.fun.impl.NoSessionIDOPService; +import com.fr.stable.script.NameSpace; +import com.fr.web.RepositoryDeal; +import com.fr.web.core.ReportSessionIDInfor; +import com.fr.web.core.SessionDealWith; +import com.fr.web.core.SessionIDInfor; +import com.fr.web.utils.WebUtils; +import com.fr.write.batch.SubmitMain; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.sql.Connection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +/** + * Created by loy on 16/8/23. + */ +public class BatchDBCommitService extends NoSessionIDOPService { + private static BatchDBCommitService service = null; + + public static final String ARG_XMLCONF = "xmlconf"; + public static final String ARG_SESSIONID = "sessionID"; + + /** + * 构造 + * + * @return + */ + public static BatchDBCommitService getInstance() { + if (service == null) { + service = new BatchDBCommitService(); + } + + return service; + } + + /** + * OP值 + * + * @return 返回OP值 + */ + public String actionOP() { + return "batchcommit"; + } + + private Map sessionMap = new HashMap(); + + /** + * 提交入库请求处理 + * + * @param req 请求 + * @param res 响应 + * @throws Exception 抛出异常 + */ + public void process(HttpServletRequest req, HttpServletResponse res) throws Exception { + String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); + CountLock lock = getCountLock(sessionID); + try { + synchronized (lock) { + process0(req, res); + } + } finally { + releaseLock(sessionID, lock); + } + + } + + private void releaseLock(String sessionID, CountLock lock) { + synchronized (sessionMap) { + lock.reduce(); + if (lock.getCount() == 0) { + sessionMap.remove(sessionID); + } + } + } + + private CountLock getCountLock(String sessionID) { + CountLock lock; + synchronized (sessionMap) { + lock = (CountLock) sessionMap.get(sessionID); + if (lock == null) { + lock = new CountLock(); + sessionMap.put(sessionID, lock); + } + lock.increase(); + } + return lock; + } + + private void process0(HttpServletRequest req, HttpServletResponse res) throws Exception { + String dbManiXML = NetworkHelper.getHTTPRequestEncodeParameter(req, ARG_XMLCONF, false); + if (dbManiXML != null) { + BatchCommit2DBJavaScript commit2DBJS = (BatchCommit2DBJavaScript) GeneralXMLTools.readStringAsXMLable(dbManiXML); + Calculator ca = Calculator.createCalculator(); + RepositoryDeal repo = prepareRepository(req, ca); + NameSpace ns = ParameterMapNameSpace.create(WebUtils.parameters4SessionIDInfor(req)); + ca.pushNameSpace(ns); + Map feedbackMap = prepareFeedBackMap(req, ca); + boolean success = true; + JSONObject fr_submitinfo = new JSONObject(); + Map connectionMap = new HashMap(); + try { + String location = WebUtils.getHTTPRequestParameter(req, "location"); + ColumnRow cr = ColumnRow.valueOf(location); + for (int i = 0; i < commit2DBJS.getDBManipulation().size(); i++) { + if (cr != ColumnRow.ERROR) { + ca.setCurrentFromColumnRow(cr);// commit的时候, 也会去set关联格子的ColumnRow, 为防止上一个提交对下一个造成影响, 这边每次重置 + } + SubmitMain dbManipulation = (SubmitMain) commit2DBJS.getDBManipulation().get(i); + if (dbManipulation != null && dbManipulation.getDmlConfig() != null) { + String dbName = dbManipulation.getDBName(ca); + Connection conn = createConnection(dbName, connectionMap); + ca.putConnection(dbName, conn); + dbManipulation.doJob(ca); + connectionMap.put(dbName, conn); + } + } + } catch (Exception e) { + FRContext.getLogger().error(e.getMessage(), e); + Iterator iter = connectionMap.entrySet().iterator(); + while (iter.hasNext()) { + DBUtils.rollback((Connection) ((Map.Entry) iter.next()).getValue()); + } + success = false; + fr_submitinfo.put("failinfo", e.getMessage()); + } finally { + DBUtils.commitConnections(connectionMap); + } + ca.removeNameSpace(ns); + JSONObject jo = new JSONObject(); + createJo(req, jo, feedbackMap, success, fr_submitinfo, repo); + java.io.PrintWriter writer = WebUtils.createPrintWriter(res); + writer.write(jo.toString()); + writer.flush(); + writer.close(); + } + } + + private Connection createConnection(String dbName, Map connectionMap) throws Exception { + Connection conn = null; + if (connectionMap.containsKey(dbName)) { + return connectionMap.get(dbName); + } else { + NameDatabaseConnection db = new NameDatabaseConnection(dbName); + return db.createConnection(); + } + } + + private RepositoryDeal prepareRepository(HttpServletRequest req, Calculator ca) { + String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); + SessionIDInfor sessionIDInfor = SessionDealWith.getSessionIDInfor(sessionID); + + RepositoryDeal repo = null; + if (sessionIDInfor != null) { + repo = new RepositoryDeal(req, sessionIDInfor); + if (sessionIDInfor instanceof ReportSessionIDInfor) { + dealWithParaForCa(req, ca, (ReportSessionIDInfor) sessionIDInfor); + } + + NameSpace sessionNamespace = sessionIDInfor.asNameSpace(sessionID); + ca.pushNameSpace(sessionNamespace); + } + + return repo; + } + + private Map prepareFeedBackMap(HttpServletRequest req, Calculator ca) { + String feedback = WebUtils.getHTTPRequestParameter(req, "feedbackMap"); + Map feedbackMap = null; + if (StringUtils.isNotEmpty(feedback)) { + try { + feedbackMap = new JSONObject(feedback).toMap(); + } catch (JSONException e) { + FRContext.getLogger().error(e.getMessage()); + } + NameSpace feedbackNS = ParameterMapNameSpace.create(feedbackMap); + ca.pushNameSpace(feedbackNS); + } + + return feedbackMap; + } + + private void dealWithParaForCa(HttpServletRequest req, Calculator ca, ReportSessionIDInfor sessionIDInfor) { + ca.setAttribute(Calculator.SHEET_NUMBER_KEY, WebUtils.getHTTPRequestParameter(req, "sheetNum")); + sessionIDInfor.setUpAttribute4dbCommit(ca); + + // 提交入库可能用当前模板的参数 + NameSpace paras = ParameterMapNameSpace.create(sessionIDInfor.getParameterMap4Execute()); + ca.pushNameSpace(paras); + } + + private void createJo(HttpServletRequest req, JSONObject jo, Map feedbackMap, + boolean success, JSONObject fr_submitinfo, RepositoryDeal repo) throws Exception { + // 生成的时候没有encode的,用没有进行urldecode的方法获取callback语句,防止+和%出错 + String callBackXML = NetworkHelper.getHTTPRequestEncodeParameter(req, "callback", false); + JavaScript callBack = (JavaScript) GeneralXMLTools.readStringAsXMLable(callBackXML); + fr_submitinfo.put("success", success); + + if (callBack != null) { + dealWithSuccessPara(callBack, fr_submitinfo, repo); + if (feedbackMap != null) { + callBack.addParameterMap(feedbackMap); + } + jo.put("callback", new JSONFunction(new String[]{"res"}, callBack.createJS(repo), repo.getDevice())); + } + } + + private void dealWithSuccessPara(JavaScript callBack, JSONObject fr_submitinfo, RepositoryDeal repo) { + Map submitInfo = new HashMap(); + submitInfo.put(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); + if (callBack != null) { + callBack.addParameterMap(submitInfo); + ParameterProvider[] ps = new ParameterProvider[callBack.getParameters().length + 1]; + int len = callBack.getParameters().length; + for (int i = 0; i < len; i++) { + ps[i] = callBack.getParameters()[i]; + } + ps[len] = new Parameter(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); + callBack.setParameters(ps); + } + + // if the parameter contains "fr_submitinfo" then recalculate it + ParameterProvider[] paras; + if (callBack != null) { + paras = callBack.getParameters(); + } else { + paras = new Parameter[0]; + } + Calculator ca = Calculator.createCalculator(); + if (repo != null) { + NameSpace ns = ParameterMapNameSpace.create(repo.getReportParameterMap()); + ca.pushNameSpace(ns); + } + ca.pushNameSpace(ParameterMapNameSpace.create(submitInfo)); + + for (int i = 0; i < paras.length; i++) { + Object obj = paras[i].getValue(); + if (obj instanceof Formula && needToRecalculate(paras[i])) { + try { + ((Formula) obj).setResult(ca.eval((Formula) obj)); + } catch (UtilEvalError utilEvalError) { + + } + } + } + } + + private boolean needToRecalculate(ParameterProvider p) { + return Utils.objectToString(p.getValue()).toLowerCase().indexOf(WebContentUtils.FR_SUBMITINFO) != -1; + } +} + + +class CountLock { + private int count; + + public void increase() { + count++; + } + + public void reduce() { + count--; + } + + public int getCount() { + return count; + } +} From 07156f69ac5b9be63153eb744443d222c2406a22 Mon Sep 17 00:00:00 2001 From: ju Date: Fri, 8 Dec 2017 17:37:47 +0800 Subject: [PATCH 20/67] =?UTF-8?q?REPORT-5885=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=8D=B8=E8=BD=BD=E2=80=94=E2=80=94frm=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=95=8C=E9=9D=A2=E5=9B=BE=E6=A0=87=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=88=B7=E6=96=B0=20=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E8=AF=A5=E6=98=AF=E5=9C=A8=E4=B8=94=E7=8E=AF=E5=A2=83=E6=97=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=BD=93=E5=89=8D=E7=9A=84=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E6=98=AF=E5=9C=A8=E5=8C=85=E5=90=AB=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=E6=8F=92=E4=BB=B6=E5=8F=98=E5=8A=A8=E6=97=B6?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/ChartTypeInterfaceManager.java | 21 +++++++++++++++++-- .../design/mainframe/FormParaWidgetPane.java | 10 ++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index d11733e0c9..5aa68bc63a 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -81,8 +81,12 @@ import com.fr.plugin.chart.treemap.VanChartTreeMapPlot; import com.fr.plugin.chart.vanchart.imgevent.design.DesignImageEvent; import com.fr.plugin.chart.wordcloud.VanChartWordCloudPlot; import com.fr.plugin.chart.wordcloud.designer.WordCloudIndependentVanChartInterface; +import com.fr.plugin.context.PluginContext; import com.fr.plugin.injectable.PluginModule; import com.fr.plugin.injectable.PluginSingleInjection; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.solution.closeable.CloseableContainedMap; import com.fr.stable.ArrayUtils; import com.fr.stable.EnvChangedListener; @@ -125,12 +129,25 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr GeneralContext.addEnvChangedListener(new EnvChangedListener() { @Override public void envChanged() { - //重新注册designModuleFactory - DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); } }); + GeneralContext.listenPluginRunningChanged(new PluginEventListener(1) { + + @Override + public void on(PluginEvent event) { + //重新注册designModuleFactory + DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); + } + }, new PluginFilter() { + + @Override + public boolean accept(PluginContext context) { + //图表插件变化时 + return context.contain(PluginModule.ExtraChartType); + } + }); } private static WidgetOption[] initWidgetOption() { diff --git a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java index d28233d051..25c71bd32f 100644 --- a/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java +++ b/designer_form/src/com/fr/design/mainframe/FormParaWidgetPane.java @@ -16,7 +16,11 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.module.DesignModuleFactory; import com.fr.design.utils.gui.LayoutUtils; -import com.fr.form.ui.*; +import com.fr.form.ui.UserDefinedWidgetConfig; +import com.fr.form.ui.Widget; +import com.fr.form.ui.WidgetConfig; +import com.fr.form.ui.WidgetManager; +import com.fr.form.ui.WidgetManagerProvider; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.Inter; @@ -83,8 +87,8 @@ public class FormParaWidgetPane extends JPanel { @Override public boolean accept(PluginContext context) { - - return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG); + + return context.contain(PluginModule.ExtraDesign, FormWidgetOptionProvider.XML_TAG) || context.contain(PluginModule.ExtraChartType); } }); } From dbcf42a4ec911a3f03c8a30a13f6a031954189de Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Mon, 11 Dec 2017 18:57:03 +0800 Subject: [PATCH 21/67] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=AF=E5=9C=A8?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=97=B6=E7=94=A8=E7=9A=84=EF=BC=8C=E6=94=BE?= =?UTF-8?q?=E5=9C=A8chart=E6=A8=A1=E5=9D=97=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/plugin/chart/map/images/marker-icon.png | Bin 1466 -> 0 bytes .../fr/plugin/chart/map/images/marker-iconx2.png | Bin 1845 -> 0 bytes .../com/fr/plugin/chart/map/images/point-map.png | Bin 1294 -> 0 bytes .../src/com/fr/plugin/chart/map/images/point.png | Bin 336 -> 0 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/marker-icon.png delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/marker-iconx2.png delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/point-map.png delete mode 100644 designer_chart/src/com/fr/plugin/chart/map/images/point.png diff --git a/designer_chart/src/com/fr/plugin/chart/map/images/marker-icon.png b/designer_chart/src/com/fr/plugin/chart/map/images/marker-icon.png deleted file mode 100644 index 950edf24677ded147df13b26f91baa2b0fa70513..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1466 zcmV;r1x5OaP)P001cn1^@s6z>|W`000GnNklGNuHDcIX17Zdjl&3`L?0sTjIws<{((Dh&g-s0<@jYQyl?D*X^?%13;ml^gy> ziMrY_^1WI=(g@LMizu=zCoA>C`6|QEq1eV92k*7m>G65*&@&6)aC&e}G zI)pf-Za|N`DT&Cn1J|o`19mumxW~hiKiKyc-P`S@q)rdTo84@QI@;0yXrG%9uhI>A zG5QHb6s4=<6xy{1 z@NMxEkryp{LS44%z$3lP^cX!9+2-;CTt3wM4(k*#C{aiIiLuB>jJj;KPhPzIC00bL zU3a#;aJld94lCW=`4&aAy8M7PY=HQ>O%$YEP4c4UY#CRxfgbE~(|uiI=YS8q;O9y6 zmIkXzR`}p7ti|PrM3a}WMnR=3NVnWdAAR>b9X@)DKL6=YsvmH%?I24wdq?Gh54_;# z$?_LvgjEdspdQlft#4CQ z`2Zyvy?*)N1Ftw|{_hakhG9WjS?Az@I@+IZ8JbWewR!XUK4&6346+d#~gsE0SY(LX8&JfY>Aj)RxGy96nwhs2rv zzW6pTnMpFkDSkT*a*6Dx|u@ds6ISVn0@^RmIsKZ5Y;bazbc;tTSq(kg(=481ODrPyNB6n z-$+U}(w$m6U6H$w17Bw+wDaFIe~GvNMYvnw31MpY0eQKT9l>SU``8k7w4)z!GZKMI z#_cEKq7k~i%nlK@6c-K?+R;B#5$?T#YpKD`t_4bAs^#E+@5QW$@OX3*`;(#{U^d-vY)&xEE>n5lYl&T?Am+~P){n@MTvZf4_r7J`do#(jP12^;)(x!+mQw5@qJIPzD)`GEZiq?+Q9+~>3#~QS zx^K`bF2x0Z2vU_|MZ`a%C{2rPDbx*GZQ3Lz%{0l(y#3vKJ?D)XXVOVBBjT^QaCkHK z-gCZtw(q{jlv2>_Sljny7h`OR;;NfTHf9=X_}k65oM}dv%>}e>`xna@==U*DcjMkA zT;smZxlE+wQb?OIJ^~6pl1ja||H+$=whXj(<2#(?mu_NA^>yZQ%E>wz$F{-Hcy*7E z0=yssx9mler6MRPpI619r}|&oAe#bO)Az;28iS8b)4aTQ(W0zw=nx4BiBJ$rg#ZdP z&cHy?aifXgQp7McJnBYKd;&vz`~EHKf1MR*?Y6x)0q1+?&zr}4x)&H;q`->=%$3Qk zsexlMC=|w%!uYrVDevg-yX~`vK$L8d(ed-nTaveI2PT6A64`vQ=;&eI(jf?a7&<-Z zYJxBSVf(Fvw8rapis*yRj+|v#HWbPc#EHbXt2zM+8-w&YeU0{$o@H8)@9fkC7avZU zt^%#uvga<1s~fty7iA`V0it5FDu&KszGFgH&V+nMOP}ds*5)~(t4 z$%bm^uI}6C@F*NxeEu>lD;r7}vf9ys;jlCb#j|IiR4zjlCtzZM4D?W)w>k;Sx^c^Rc{i37j|Sp!#GQ{p8_!^Ruf2wF_tyOLCJLttfb*#*l@#@aPRe( zSJy7+?tsVFuY~1`=fMm64nz0SOF@g#3Gt6U*~{1#Byn+dnj@vy^@f?XBTBx4s^~fc zuUv$@$>E;smN%@l^{Xy~3m0U;oj9BJQ>{MPBfDh3QVdG1%UBLpjl%MWs_2SC7zVKV zk{;lU%~;mgT-FN-mNf0D)hByom+YsZlQMBCl!9eCohh*6vz9(<|JayEkXQ_- z#@LS~SWX^(8y<&me>&9=yH z6}mQ3FzA@j+7c~#*yVWI&R!E<{rnI-v*&y0o!<$g6J@MQY}%fSz|7`htQ13SdJWE3?Ma)hj^a^r86ArP=_U>#i2~5ELAjAhy(l7+OsC$w zt%G#O)a2;NgGXMwe{GfPl#E|06^48Zxr+hR#hMaJ#)c;%7!NcEST22zU{r{Dq^jRf z`edg#b~?b5J(o8B6i}k;dm#?6NG9!!felzgC$%F;1WcpChUJcSKqO(wHu>H<_CEH? z0}(dV8}7u2ZyQ=&nYJQR{8%mw`b^3fr>^z7`$#cuXIL8JGW3w+Gz=%SES9c8y|5(h6t(u@6))TMf^*6uk#bPBBb7rerN?_~Jj&DmUTD7Ws|?>@rr`0mg! zD?D|@tAB+4(>$$X*KJPs{~MsRWHb71DWdVnEnu#+x+0+5(7X`QSjN=epUuvkKq*%# zxk*e81ax}ND=#4QB!;GWrsU>EpDHZ@rKM|WAK?qkP~wfIUZiiL!~*UJz1R%V`dl`e z0;1F62iX&{G#KE01{thEddl*tkTbP$E^nIpw5)E#++X#`+sE|IWmkZ+2$cJ$5~WkW z9NqcgmCfikyYFOMn3YHaqo$`;aXE00000NkvXXu0mjfKKYD0 diff --git a/designer_chart/src/com/fr/plugin/chart/map/images/point-map.png b/designer_chart/src/com/fr/plugin/chart/map/images/point-map.png deleted file mode 100644 index 9c77308d26ffbcecb97078913e6a1888a01746fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1294 zcmV+p1@ZccP)400009a7bBm000XU z000XU0RWnu7ytkO8FWQhbW?9;ba!ELWdK2BZ(?O2No`?gWm08fWO;GPWjp`?1e-}j zK~#9!?3(*;+f)?CZ*1q;JnW{}fh{!cprc|fYY_vfnh@IG9sw6rB5G@*Gli5)+&v!Qh~PU6H#Z=ff#BKbPU z{`h;(x#wI3n~yA=0Zp_$HWJLN1;9k`N;7W@5b!^-9nc-n9ZqCD#2$=V zy;g$=A~_cjlf%4#X<`cm(sva1GB1URU?Fj$}foPc{fg_U)W+R_CPocrWA>?z#H^B1MAu88oZ>cj=_Oc)W$$X$x@l4{Sa3`F z@ZRvkuQ76r;gK!DW@&%A2%L>A7K?`>#KX!+9#aep{PuaxN< z&uO>Az;T>rOQw^+<1ch>d^@{pKUI$-yGi)%wSCE3=`^H`H$mXp*L~@E6DFkU@iW>( zPe8wwvdcxr4|=jc)%tsfNw|B|M+KkPOL!So?u!hvS&UPZ%(@x)n zMa_nR%Br3`K>dIrA`OF@niUMC%;zQk*w;bL24a?~Hp@JAZmM22S?LoN)<8r$Qep<= zM5^(i27{g(AIMz%`>1oZ-b)5rht1%N~+FOq2{!IH&ath zD+5llzm$b+IH=UZ3F8CIca>sQQgfmf6)&;VV2KaHvBTi+c1p2IPb-bPZS0I%HRbrb z#7-5zq1j52?ew59sif+Oe)_ChC4Xk;q_m^1bZrXgey=^YpDbM65}P*Wnp!odxdqjb zO#_wf?L)e+|E=or{=%1P6OWqdx-FnjdMt^}s;X5}p0d>@o^1t{?cEW>g@05%)<>OH zt0t6{Q7PL?>N7qUbtOgV@IE)Url#Vlv`#_=D%*QU%onJk diff --git a/designer_chart/src/com/fr/plugin/chart/map/images/point.png b/designer_chart/src/com/fr/plugin/chart/map/images/point.png deleted file mode 100644 index 4e7cd2a68d8b5959cbe67bc5370651df88915282..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 336 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP*AeO zHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkDP|;ma7srr_TS*BD3~|=8xE@SS zKeBKkL&xVviDf^T1@ajlIbHm_-2QUSq0qF-D1eV+s$T-0~gF$#!Q=QE$$pw0| z`meG&+!k%PQfqQs&FN*8%6kKc*h0o5364S`4x4$O+-D6qtnaXwjhWA(hHs-w}J7bk#%>FLu6bbzwWipsKq-f?!PC{xWt~$(6965NbyolY From 8c13f7b3b14ae0c7e1ba21a3e82bf848f556e03c Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Tue, 12 Dec 2017 16:10:56 +0800 Subject: [PATCH 22/67] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C8?= =?UTF-8?q?=20->=209?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/present/BarCodePane.java | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/designer/src/com/fr/design/present/BarCodePane.java b/designer/src/com/fr/design/present/BarCodePane.java index 04a9667860..2c10de3f80 100644 --- a/designer/src/com/fr/design/present/BarCodePane.java +++ b/designer/src/com/fr/design/present/BarCodePane.java @@ -8,7 +8,6 @@ import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.layout.FRGUIPaneFactory; @@ -22,11 +21,18 @@ import com.fr.report.cell.painter.barcode.BarcodeImpl; import com.fr.report.cell.painter.barcode.core.BarCodeUtils; import com.fr.stable.pinyin.ChineseHelper; -import javax.swing.*; +import javax.swing.JList; +import javax.swing.JPanel; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.font.FontRenderContext; @@ -49,10 +55,10 @@ public class BarCodePane extends FurtherBasicBeanPane { private UIComboBox typeComboBox; private UISpinner barWidthSpinner; private UISpinner barHeightSpinner; - private UISpinner RCodesizespinner; + private UISpinner sizeSpinner; private UICheckBox drawingTextCheckBox; - private UIComboBox RCodeVersionComboBox; - private UIComboBox RCodeErrorCorrectComboBox; + private UIComboBox versionComboBox; + private UIComboBox errorCorrectComboBox; private UILabel typeSetLabel; private String testText = "12345"; @@ -74,9 +80,9 @@ public class BarCodePane extends FurtherBasicBeanPane { borderPane.add(barCodePreviewPane, BorderLayout.CENTER); setTypeComboBox(); setSome(); - RCodesizespinner = new UISpinner(1,6,1,2); - RCodeVersionComboBox = new UIComboBox(); - RCodeErrorCorrectComboBox = new UIComboBox(); + sizeSpinner = new UISpinner(1,6,1,2); + versionComboBox = new UIComboBox(); + errorCorrectComboBox = new UIComboBox(); typeSetLabel = new UILabel(Inter.getLocText("FR-Designer_Type_Set"), UILabel.LEFT); initVersionComboBox(); initErrorCorrectComboBox(); @@ -170,13 +176,13 @@ public class BarCodePane extends FurtherBasicBeanPane { int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; UILabel uiLabel = new UILabel(Inter.getLocText("RCodeVersion"), UILabel.LEFT); uiLabel.setPreferredSize(typeSetLabel.getPreferredSize()); - RCodeVersionComboBox.setPreferredSize(new Dimension(155,20)); - RCodeErrorCorrectComboBox.setPreferredSize(new Dimension(155,20)); - RCodesizespinner.setPreferredSize(new Dimension(155,20)); + versionComboBox.setPreferredSize(new Dimension(155,20)); + errorCorrectComboBox.setPreferredSize(new Dimension(155,20)); + sizeSpinner.setPreferredSize(new Dimension(155,20)); Component[][] components_special = new Component[][]{ - new Component[]{uiLabel, RCodeVersionComboBox}, - new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect"), UILabel.LEFT), RCodeErrorCorrectComboBox}, - new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix"), UILabel.LEFT), RCodesizespinner} + new Component[]{uiLabel, versionComboBox}, + new Component[]{new UILabel(Inter.getLocText("RCodeErrorCorrect"), UILabel.LEFT), errorCorrectComboBox}, + new Component[]{new UILabel(Inter.getLocText("RCodeDrawPix"), UILabel.LEFT), sizeSpinner} }; JPanel specialPane = TableLayoutHelper.createGapTableLayoutPane(components_special, rowSize, columnSize, rowCount, LayoutConstants.VGAP_HUGER, LayoutConstants.VGAP_LARGE); @@ -184,17 +190,17 @@ public class BarCodePane extends FurtherBasicBeanPane { } private void addlistener() { - RCodesizespinner.addChangeListener(new ChangeListener() { + sizeSpinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { repaintPreviewBarCode(); } }); - RCodeVersionComboBox.addItemListener(new ItemListener() { + versionComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { repaintPreviewBarCode(); } }); - RCodeErrorCorrectComboBox.addItemListener(new ItemListener() { + errorCorrectComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { repaintPreviewBarCode(); } @@ -227,12 +233,12 @@ public class BarCodePane extends FurtherBasicBeanPane { private void initVersionComboBox() { String[] array = {Inter.getLocText(new String[]{"Auto", "Choose"}), "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16"}; - initcombobox(this.RCodeVersionComboBox, array, 0); + initcombobox(this.versionComboBox, array, 0); } private void initErrorCorrectComboBox() { String[] array = {"L" + Inter.getLocText("Level") + "7%", "M" + Inter.getLocText("Level") + "15%", "Q" + Inter.getLocText("Level") + "25%", "H" + Inter.getLocText("Level") + "30%"}; - initcombobox(this.RCodeErrorCorrectComboBox, array, 1); + initcombobox(this.errorCorrectComboBox, array, 1); } private void initcombobox(UIComboBox combobox, String[] array, int index) { @@ -270,10 +276,12 @@ public class BarCodePane extends FurtherBasicBeanPane { } this.setTestText(BarCodeUtils.getTestTextByBarCode(barcodeAttr.getType())); this.typeComboBox.setSelectedIndex(barcodeAttr.getType()); + this.versionComboBox.setSelectedIndex(barcodeAttr.getRCodeVersion()); + this.errorCorrectComboBox.setSelectedIndex(barcodeAttr.getRCodeErrorCorrect()); this.barWidthSpinner.setValue(new Double(barcodeAttr.getBarWidth()) * 10); this.barHeightSpinner.setValue(new Integer(barcodeAttr.getBarHeight())); this.drawingTextCheckBox.setSelected(barcodeAttr.isDrawingText()); - this.RCodesizespinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); + this.sizeSpinner.setValue(new Integer(barcodeAttr.getRcodeDrawPix())); this.repaintPreviewBarCode(); } @@ -281,9 +289,9 @@ public class BarCodePane extends FurtherBasicBeanPane { public BarcodePresent updateBean() { BarcodeAttr barcodeAttr = new BarcodeAttr(); if ((typeComboBox.getSelectedIndex() == NUM16)) { - barcodeAttr.setRCodeVersion(this.RCodeVersionComboBox.getSelectedIndex()); - barcodeAttr.setRCodeErrorCorrect(this.RCodeErrorCorrectComboBox.getSelectedIndex()); - barcodeAttr.setRcodeDrawPix((int) this.RCodesizespinner.getValue()); + barcodeAttr.setRCodeVersion(this.versionComboBox.getSelectedIndex()); + barcodeAttr.setRCodeErrorCorrect(this.errorCorrectComboBox.getSelectedIndex()); + barcodeAttr.setRcodeDrawPix((int) this.sizeSpinner.getValue()); } barcodeAttr.setType(this.typeComboBox.getSelectedIndex()); barcodeAttr.setBarWidth(((Double) this.barWidthSpinner.getValue()).doubleValue() / 10); From d627183a08a6392a80c25853689b935f9c76ca5d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 12 Dec 2017 16:42:57 +0800 Subject: [PATCH 23/67] =?UTF-8?q?REPORT-5945=20=E8=A1=A8=E5=8D=95=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E7=BB=84=E4=BB=B6=E7=BC=A9=E6=94=BE=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA=E5=8F=8C=E5=90=91=E8=87=AA=E9=80=82=E5=BA=94=3D>9.0?= =?UTF-8?q?=E5=9B=A0=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84=E5=8F=98=E5=8A=A8?= =?UTF-8?q?=EF=BC=8C=E5=88=87=E6=8D=A2=E4=B8=8D=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java index 246bcb7f15..c11ad24691 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/layout/FRAbsoluteBodyLayoutDefinePane.java @@ -100,6 +100,7 @@ public class FRAbsoluteBodyLayoutDefinePane extends FRAbsoluteLayoutDefinePane { } if (layoutType == WBodyLayoutType.ABSOLUTE) { + ((XWFitLayout)creator.getBackupParent()).toData().resetStyle(); if (state == WBodyLayoutType.FIT.getTypeValue()) { switch2FitBodyLayout(); } From caea2b6275afecd5f005811af68012e6d806ab00 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 12 Dec 2017 17:02:11 +0800 Subject: [PATCH 24/67] =?UTF-8?q?CHART-1844=20=20=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/condition/ConditionAttributesPane.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java b/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java index 9737856ddf..ed7d472231 100644 --- a/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java +++ b/designer_base/src/com/fr/design/condition/ConditionAttributesPane.java @@ -11,10 +11,12 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; import javax.swing.*; +import java.awt.*; import java.util.HashMap; import java.util.Iterator; public abstract class ConditionAttributesPane extends BasicBeanPane { + private static final int MIN_HEIGHT = 60; protected CellHighlightAddMenuDef menuDef; protected JPanel selectedItemPane; @@ -61,6 +63,7 @@ public abstract class ConditionAttributesPane extends BasicBeanPane { JScrollPane selectedItemScrollPane = new JScrollPane(); selectedItemScrollPane.setViewportView(selectedItemPane); selectedItemScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + selectedItemScrollPane.setMinimumSize(new Dimension((int) selectedItemScrollPane.getPreferredSize().getWidth(), MIN_HEIGHT)); propertyChangePane.add(selectedItemScrollPane); } From bf73cefa8c4ed83d383bb0b33d970a62b9d25894 Mon Sep 17 00:00:00 2001 From: rinoux Date: Wed, 13 Dec 2017 17:02:54 +0800 Subject: [PATCH 25/67] =?UTF-8?q?REPORT-5942=20=E5=9B=9E=E6=BB=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E6=94=B9=E6=8F=90=E4=BA=A4=E5=88=B0dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../write/submit/SubmitVisitorListPane.java | 10 +- .../batch/BatchCommit2DBJavaScript.java | 170 --- .../batch/BatchCommit2DBJavaScriptPane.java | 186 --- .../submit/batch/BatchCommitTabbedPane.java | 529 -------- .../batch/BatchJavaScriptActionProvider.java | 23 - .../write/submit/batch/BatchSubmitPane.java | 1089 ----------------- .../submit/batch/BatchSubmitProvider.java | 42 - .../batch/SmartInsertBatchSubmitPane.java | 591 --------- .../batch/service/BatchDBCommitService.java | 288 ----- 9 files changed, 4 insertions(+), 2924 deletions(-) delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java delete mode 100644 designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 2b18427bdc..8990170030 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -13,7 +13,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.write.submit.batch.BatchSubmitProvider; import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; @@ -69,7 +68,7 @@ public class SubmitVisitorListPane extends ObjectJControlPane { return; } - List nameObjectList = new ArrayList<>(); + List nameObjectList = new ArrayList(); int submiterCount = reportWriteAttr.getSubmitVisitorCount(); for (int i = 0; i < submiterCount; i++) { @@ -170,17 +169,16 @@ public class SubmitVisitorListPane extends ObjectJControlPane { public CustomPane() { this.setLayout(FRGUIPaneFactory.createBorderLayout()); customCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - customSubmitPanes = new HashMap<>(); - comboItemsMap = new HashMap<>(); + customSubmitPanes = new HashMap(); + comboItemsMap = new HashMap(); Set providers = ExtraDesignClassManager.getInstance().getArray(SubmitProvider.MARK_STRING); addSubmitPane(new DefaultSubmit()); for (SubmitProvider provider : providers) { addSubmitPane(provider); } - addSubmitPane(BatchSubmitProvider.getInstance()); - configTypes = new ArrayList<>(); + configTypes = new ArrayList(); for (Map.Entry entry : customSubmitPanes.entrySet()) { String key = entry.getKey(); configTypes.add(comboItemsMap.get(key)); diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java deleted file mode 100644 index d44a43722d..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScript.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.general.ComparatorUtils; -import com.fr.general.xml.GeneralXMLTools; -import com.fr.js.AbstractJavaScript; -import com.fr.js.Callback; -import com.fr.js.JavaScript; -import com.fr.js.JavaScriptXMLUtils; -import com.fr.json.JSONObject; -import com.fr.stable.ParameterProvider; -import com.fr.stable.StringUtils; -import com.fr.stable.web.Repository; -import com.fr.stable.xml.XMLPrintWriter; -import com.fr.stable.xml.XMLableReader; -import com.fr.write.batch.SubmitMain; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Created by loy on 16/8/22. - */ -public class BatchCommit2DBJavaScript extends AbstractJavaScript implements Callback { - - public static String RECALCULATE_TAG = "shouldRecalculate"; - - /** - * 回调函数标识 - */ - public static final String CALLBACK = "callback"; - - /** - * 回调参数标识 - */ - public static final String FEEDBACKMAP = "feedbackMap"; - - /** - * javascript所使用的参数 - */ - protected ParameterProvider[] parameters; - //这个MAP里放的是提交过程生成的参数,比如提交入库,在所有回调事件里,都会将其传递进去,以供解析。 - protected Map paraMap = new HashMap(); - - private boolean recalculate; - - private List dbManipulationList = new ArrayList(); - //回调函数 - private JavaScript callBack; - - /** - * 获取数据入库配置信息 - */ - public List getDBManipulation() { - return dbManipulationList; - } - - /** - * 设置数据入库配置信息 - * - * @param dbManipulationList 数据库配置信息 - */ - public void setDBManipulation(List dbManipulationList) { - this.dbManipulationList = dbManipulationList; - } - - /** - * 回调函数,该函数将在主函数执行完毕以后开始执行 - */ - public JavaScript getCallBack() { - return callBack; - } - - /** - * 设置回调函数 - * - * @param callback 回调函数 - */ - public void setCallBack(JavaScript callback) { - this.callBack = callback; - } - - /** - * JS响应 - * - * @param repo 环境 - * @return 返回生成的JS字符串 - */ - public String actionJS(Repository repo) { - String dmlconf = GeneralXMLTools.writeXMLableAsString(this); - if (!this.paraMap.isEmpty() && callBack != null) { - callBack.addParameterMap(paraMap); - } - String js = "var fm = this.options.form;if(fm == null) {fm = new FR.BatchForm()};fm.batchCommit({" + - "xmlconf" + ":" + JSONObject.quote(dmlconf) + - (callBack != null ? "," + CALLBACK + ":" + JSONObject.quote(GeneralXMLTools.writeXMLableAsString(callBack)) : "") + - (this.paraMap.isEmpty() ? "" : "," + FEEDBACKMAP + ":" + new JSONObject(paraMap).toString()) + - "},this)"; - return js; - } - - /** - * 转化为字符串 - * - * @return 返回字符串形式 - */ - public String toString() { - return (dbManipulationList == null) ? StringUtils.EMPTY : dbManipulationList.toString(); - } - - public void writeXML(XMLPrintWriter writer) { - super.writeXML(writer); - - if (this.dbManipulationList != null) { - for (int i = 0; i < dbManipulationList.size(); i++) { - ((SubmitMain) this.dbManipulationList.get(i)).writeXML(writer); - } - - } - - if (this.callBack != null) { - GeneralXMLTools.writeXMLable(writer, this.callBack, JavaScript.XML_TAG); - } - } - - public void readXML(XMLableReader reader) { - super.readXML(reader); - - if (reader.isAttr()) { - dbManipulationList = new ArrayList(); - } else if (reader.isChildNode()) { - String tagName = reader.getTagName(); - if (JavaScript.XML_TAG.equals(tagName)) { - this.callBack = JavaScriptXMLUtils.readJavaScript(reader); - } else { - if ("Attributes".equals(tagName)) { - dbManipulationList.add(new SubmitMain()); - } - if (dbManipulationList.size() > 0) { - ((SubmitMain) dbManipulationList.get(dbManipulationList.size() - 1)).readXML(reader); - } - } - } - - } - - public boolean equals(Object obj) { - return obj instanceof BatchCommit2DBJavaScript - && super.equals(obj) - && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).callBack, this.callBack) - && ComparatorUtils.equals(((BatchCommit2DBJavaScript) obj).dbManipulationList, this.dbManipulationList); - } - - public Object clone() throws CloneNotSupportedException { - BatchCommit2DBJavaScript cloned = (BatchCommit2DBJavaScript) super.clone(); - if (this.dbManipulationList != null) { - cloned.dbManipulationList = new ArrayList(); - for (int i = 0; i < this.dbManipulationList.size(); i++) { - cloned.dbManipulationList.add(((SubmitMain) this.dbManipulationList.get(i)).clone()); - } - } - - if (this.callBack != null) { - cloned.callBack = (JavaScript) this.callBack.clone(); - } - - return cloned; - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java deleted file mode 100644 index f451d09078..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchCommit2DBJavaScriptPane.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.Inter; -import com.fr.write.batch.SubmitMain; - -import javax.swing.*; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by loy on 16/8/22. - */ -public class BatchCommit2DBJavaScriptPane extends FurtherBasicBeanPane { - private List dbmPaneList = new ArrayList(); - private BatchCommitTabbedPane commitTabbedPane; - private JavaScriptActionPane javaScriptActionPane; - private UIButton addCallbackButton; - - private JPanel cardPane; - private String[] cardNames; - - /** - * 构造函数,控件事件的提交入库面板 - */ - public BatchCommit2DBJavaScriptPane() { - init(null); - } - - // public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane, List dbManipulationPaneList) { - public BatchCommit2DBJavaScriptPane(final JavaScriptActionPane javaScriptActionPane) { -// this.dbmPaneList=dbManipulationPaneList; - init(javaScriptActionPane); - } - - private void init(final JavaScriptActionPane javaScriptActionPane) { - this.dbmPaneList.add(new BatchSubmitPane()); - this.javaScriptActionPane = javaScriptActionPane; - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - commitTabbedPane = new BatchCommitTabbedPane(this, dbmPaneList); - commitTabbedPane.setPreferredSize(new Dimension(commitTabbedPane.getWidth(), 20)); - this.add(commitTabbedPane, BorderLayout.NORTH); - - cardPane = new JPanel(new CardLayout()); - cardNames = new String[dbmPaneList.size()]; - for (int i = 0; i < this.dbmPaneList.size(); i++) { - if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { - cardNames[i] = ""; - } else { - cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); - } - cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); - } - this.add(cardPane, BorderLayout.CENTER); - - JPanel btPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - this.add(btPane, BorderLayout.SOUTH); - - if (javaScriptActionPane != null) { - addCallbackButton = javaScriptActionPane.createCallButton(); - btPane.add(addCallbackButton); - } - } - - - /** - * 更新DBManipulationPane - */ - public void updateCardPane() { - cardNames = new String[dbmPaneList.size()]; - for (int i = 0; i < this.dbmPaneList.size(); i++) { - if (((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName() == null) { - cardNames[i] = ""; - } else { - cardNames[i] = ((BatchSubmitPane) this.dbmPaneList.get(i)).getSubMitName(); - } - cardPane.add((BatchSubmitPane) this.dbmPaneList.get(i), cardNames[i]); - } - CardLayout cardLayout = (CardLayout) cardPane.getLayout(); - cardLayout.show(cardPane, cardNames[commitTabbedPane.getSelectedIndex()]); - } - - public void setList(List list) { - this.dbmPaneList = list; - } - - /** - * 新建DBManipulationPane - * - * @return 新建的DBManipulationPane - */ - public BatchSubmitPane createDBManipulationPane() { - BatchSubmitPane db = new BatchSubmitPane(); -// BatchSubmitPane db = javaScriptActionPane.createDBManipulationPane(); - db.populateBean(null); - dbmPaneList.add(db); - return db; - - } - - /** - * 窗口名称 - * - * @return 返回窗口名称 - */ - public String title4PopupWindow() { - return Inter.getLocText("Performance-plugin_submitbatch_name"); - } - - /** - * 界面重置 - */ - public void reset() { - if (javaScriptActionPane != null) { - this.javaScriptActionPane.setCall(null); - } - //重置后只保留,只留第一个tab - while (dbmPaneList.size() > 1) { - dbmPaneList.remove(1); - } - ((BatchSubmitPane) dbmPaneList.get(0)).populateBean(null); - } - - @Override - /** - * 将JavaBean内的数据输出至界面上 - */ - public void populateBean(BatchCommit2DBJavaScript commit2db) { - if (commit2db == null) { - reset(); - return; - } - //先把原来的list清除,然后再根据传入参数重新add - dbmPaneList.clear(); - if (javaScriptActionPane != null) { - this.javaScriptActionPane.setCall(commit2db.getCallBack()); - } - for (int i = 0; i < commit2db.getDBManipulation().size(); i++) { - BatchSubmitPane dbmp = new BatchSubmitPane(); -// BatchSubmitPane dbmp = javaScriptActionPane.createDBManipulationPane(); - dbmp.populateBean((SubmitMain) commit2db.getDBManipulation().get(i)); - dbmPaneList.add(dbmp); - } - commitTabbedPane.refreshTab(); - } - - /** - * 更新数据层JavaBean - * - * @return 返回JavaBean - */ - public BatchCommit2DBJavaScript updateBean() { - BatchCommit2DBJavaScript commit2dbJavaScript = new BatchCommit2DBJavaScript(); - - List dbmaniList = new ArrayList(); - for (int i = 0; i < this.dbmPaneList.size(); i++) { - BatchSubmitPane dbmpane = (BatchSubmitPane) this.dbmPaneList.get(i); - if (i > dbmPaneList.size() - 1) { - dbmPaneList.add(dbmpane); - } - SubmitMain dbManipulation = dbmpane.updateBean(); - dbmaniList.add(dbManipulation); - } - commit2dbJavaScript.setDBManipulation(dbmaniList); - - if (javaScriptActionPane != null) { - commit2dbJavaScript.setCallBack(this.javaScriptActionPane.getCall()); - } - - return commit2dbJavaScript; - } - - /** - * 判断是否是能接受的数据类型 - * - * @param ob 对象 - * @return 返回是否是能接受的数据类型 - */ - public boolean accept(Object ob) { - return ob instanceof BatchCommit2DBJavaScript; - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java b/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java deleted file mode 100644 index 4c1bcaddae..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchCommitTabbedPane.java +++ /dev/null @@ -1,529 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.base.BaseUtils; -import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.general.ComparatorUtils; -import com.fr.general.Inter; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; -import java.awt.geom.*; - -/** - * Created by loy on 16/8/22. - */ -public class BatchCommitTabbedPane extends JComponent implements MouseListener, MouseMotionListener { - private Icon closeIcon = BaseUtils.readIcon("com/fr/design/images/gui/tab_delete.png"); - private static final Icon ADD_NORMAL = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_normal.png"); - private static final Icon ADD_OVER = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_hover.png"); - private static final Icon ADD_CLICK = BaseUtils.readIcon("com/fr/design/images/gui/tab_add_click.png"); - private static final Image DESIGN_IMAGE = BaseUtils.readImage("com/fr/design/images/sheet/left_right_btn.png"); - private static final Icon LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 0, 14, 14); - private static final Icon RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 0, 14, 14); - private static final Icon DISABLED_LEFT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 0, 14, 14, 14); - private static final Icon DISABLED_RIGHT_ICON = BaseUtils.createIcon(DESIGN_IMAGE, 14, 14, 14, 14); - private Icon addIcon = ADD_NORMAL; - - private static final int TOOLBAR_HEIGHT = 16; // 按钮高度 - private static final int GAP = 5; //间隔 - private static final int SMALLGAP = 3; - - private static final int FIRST_TAB_POSITION = 20; - - - // 左移和右移按钮 - private UIButton leftButton; - private UIButton rightButton; - - private JPanel buttonPane; - - private java.util.List dbManipulationPaneList ; - - private BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane; - - // 能显示的tab个数 - private int showCount = 0; - - //选了30度和60度的特殊角度的x,y作为经过的两个点的坐标 - private double specialLocation1 = 2.5; - private double specialLocation2 = 4.330127; - - private int mouseOveredIndex = -1; - - private int selectedIndex = -1; - - private static final double CORNOR_RADIUS = 5.0; - - - //tab栏可以放下的每个tab的实际宽度 - private int tabWidth = 70; - - - //当前标签页栏存放的所有标签页的index - private int scrollIndex = 0; - private int lastOneIndex = 0; - - //添加标签位置 - private int addX = -1; - private int addY = -1; - - - //各删除标签位置 - private int[] closeIconStartX; - - - public BatchCommitTabbedPane(BatchCommit2DBJavaScriptPane commit2DBJavaScriptPane, java.util.List dbManipulationPaneList ){ - this.commit2DBJavaScriptPane = commit2DBJavaScriptPane; - this.dbManipulationPaneList = dbManipulationPaneList; - this.setLayout(new BorderLayout(0, 0)); - this.addMouseListener(this); - this.addMouseMotionListener(this); - this.setBorder(null); - this.setForeground(new Color(99, 99, 99)); - leftButton = new UIButton(LEFT_ICON) { - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); - } - }; - leftButton.set4ToolbarButton(); - leftButton.setDisabledIcon(DISABLED_LEFT_ICON); - rightButton = new UIButton(RIGHT_ICON) { - public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width, TOOLBAR_HEIGHT); - } - }; - rightButton.set4ToolbarButton(); - rightButton.setDisabledIcon(DISABLED_RIGHT_ICON); - buttonPane = new JPanel(new BorderLayout(3, 0)); - buttonPane.add(rightButton, BorderLayout.EAST); - buttonPane.add(leftButton, BorderLayout.CENTER); - this.add(buttonPane, BorderLayout.EAST); - leftButton.addActionListener(createLeftButtonActionListener()); - rightButton.addActionListener(createRightButtonActionListener()); - - } - - private ActionListener createRightButtonActionListener(){ - return new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - int tabCount = getTabCount(); - if (lastOneIndex < tabCount && lastOneIndex + showCount <= tabCount) { - scrollIndex += showCount; - lastOneIndex += showCount; - selectedIndex = lastOneIndex; - } else if(lastOneIndex < tabCount && lastOneIndex + showCount > tabCount){ - lastOneIndex = tabCount -1; - scrollIndex = lastOneIndex - showCount; - selectedIndex = lastOneIndex; - } - repaint(); - } - }; - } - - private ActionListener createLeftButtonActionListener() { - return new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if(scrollIndex >= showCount) { - scrollIndex -= showCount; - selectedIndex = scrollIndex; - lastOneIndex -= showCount; - } else if (scrollIndex > 0 && scrollIndex< showCount){ - scrollIndex =0; - selectedIndex = 0; - lastOneIndex = showCount; - - } - repaint(); - } - }; - } - - private void checkButton(boolean buttonEnabled) { - leftButton.setEnabled(buttonEnabled); - rightButton.setEnabled(buttonEnabled); - } - - public int getSelectedIndex(){ - return selectedIndex; - } - - public void paintComponent(Graphics g){ - super.paintComponent(g); - double maxWidth = getWidth() - buttonPane.getWidth(); - Graphics2D g2d = (Graphics2D) g; - paintBackgroundAndLine(g2d, maxWidth); - - } - - private void paintBackgroundAndLine(Graphics2D g2d, double maxWidth) { - //能画的个数 - showCount = (int) (maxWidth) / tabWidth; - //计算开始画的最小模板index和最大模板index - if (selectedIndex >= dbManipulationPaneList.size()) { - selectedIndex = dbManipulationPaneList.size() - 1; - } - if (selectedIndex < 0) { - selectedIndex = 0; - } - calMinAndMaxIndex(); - closeIconStartX = new int[lastOneIndex - scrollIndex + 1]; - - int startX = 0; - //从可以开始展示在tab面板上的tab开始画 - for (int i = scrollIndex; i <= lastOneIndex; i++) { - BatchSubmitPane dbManipulationPane = (BatchSubmitPane)dbManipulationPaneList.get(i); - String name ; - if (dbManipulationPane.getSubMitName() != null){ - name = dbManipulationPane.getSubMitName(); - } else { - name = createName(); - dbManipulationPane.setSubMitName(name); - } - if (i == selectedIndex) { - closeIconStartX[i - scrollIndex] = paintSelectedTab(g2d, startX,name, i); - } else { - closeIconStartX[i - scrollIndex] = paintUnSelectedTab(g2d,startX,name,i); - } - startX += tabWidth; - } - paintUnderLine(startX, maxWidth, g2d); - addX = startX + GAP; - addIcon.paintIcon(this,g2d,addX,0); - checkButton(getTabCount() > showCount); - } - - public int getTabCount(){ - return dbManipulationPaneList.size(); - } - - private String createName(){ - String prefix = Inter.getLocText("FR-Designer-CommitTab_Submit"); - int count = getTabCount(); - while (true) { - //从提交1开始 - count = count == 0 ? 1 : count; - String newName = prefix + count; - boolean repeated = false; - for (int i= 0;i < getTabCount();i++) { - if (ComparatorUtils.equals( ((BatchSubmitPane)dbManipulationPaneList.get(i)).getSubMitName(), newName)) { - repeated = true; - break; - } - } - - if (!repeated) { - return newName; - } - - count++; - } - } - - - - private void paintUnderLine(double startX, double maxWidth, Graphics2D g2d) { - //画下面的那条线 - if (startX < maxWidth) { - GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, 2); - generalPath.moveTo((float) startX, (float) (getHeight() - 1)); - generalPath.lineTo((float) maxWidth, (float) (getHeight() - 1)); - g2d.fill(generalPath); - g2d.setPaint(UIConstants.LINE_COLOR); - g2d.draw(new Line2D.Double((float) startX, (float) (getHeight() - 1), (float) maxWidth , (float) (getHeight() - 1))); - } - } - - - private void calMinAndMaxIndex() { //如果个数大于最多能容纳的个数,则多余的进行处理 - - if (dbManipulationPaneList.size() > showCount) { - - if (selectedIndex >= lastOneIndex) { //所点击列表中的标签页处在标签页栏最后一个标签页之后,则标签页栏左移至所点击标签页出现 - scrollIndex = selectedIndex - showCount + 1; - lastOneIndex = selectedIndex; - if (scrollIndex <= 0) { - scrollIndex = 0; - lastOneIndex = showCount - 1; - } - } else if (selectedIndex <= scrollIndex) { //所点击列表中的标签页处在标签页栏第一个标签页之前,则标签页栏右移至所点击标签页出现 - - scrollIndex = selectedIndex; - lastOneIndex = scrollIndex + showCount - 1; - if (lastOneIndex > dbManipulationPaneList.size() - 1) { - lastOneIndex = dbManipulationPaneList.size() - 1; - } - } else { - if (selectedIndex >= dbManipulationPaneList.size() - 1) { - selectedIndex = dbManipulationPaneList.size() - 1; - lastOneIndex = selectedIndex; - scrollIndex = selectedIndex - showCount + 1; - } else { - lastOneIndex = scrollIndex + showCount - 1; - if (lastOneIndex > dbManipulationPaneList.size() - 1) { - lastOneIndex = dbManipulationPaneList.size() - 1; - } - } - } - } else { - scrollIndex = 0; - lastOneIndex = dbManipulationPaneList.size() - 1; - } - } - - - /** - * 画选中的tab - * - * @param g2d - * @param sheetName - * @return - */ - private int paintSelectedTab(Graphics2D g2d,int startX, String sheetName, int selfIndex) { - double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; - double[] y = {-1, getHeight(), getHeight(), -1, -1}; - RoundRectangle2D.Double rect1 = new RoundRectangle2D.Double(startX, 1, this.getWidth(), this.getHeight(), 7, 7); - g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); - - GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); - generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); - - for (int index = 1; index <= 2; index++) { - generalPath.lineTo((float) x[index], (float) y[index]); - } - - generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); - generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); - generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - - generalPath.closePath(); - g2d.fill(generalPath); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setPaint(UIConstants.LINE_COLOR); - g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); - g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); - g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); - g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); - g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); - g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - // 画字符 - g2d.setPaint(getForeground()); - g2d.drawString(sheetName, startX + 2 * GAP, getHeight()-GAP); - int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; - int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; - if (canClose() && mouseOveredIndex == selfIndex){ - closeIcon.paintIcon(this, g2d, closePosition, closeY); - } - return closePosition; - - } - - /** - * 画没有选中的tab - * - * @param g2d - * @param startX - * @param sheetName - * @return - */ - private int paintUnSelectedTab(Graphics2D g2d, int startX, String sheetName, int selfIndex) { - double[] x = {startX, startX, startX + tabWidth, startX + tabWidth, startX}; - double[] y = {-1, getHeight() - 1, getHeight() - 1, -1, -1}; - if (selfIndex == mouseOveredIndex) { - g2d.setPaint(new GradientPaint(1, 1, new Color(255, 255, 255), 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); - } else { - g2d.setPaint(new GradientPaint(1, 1, UIConstants.NORMAL_BACKGROUND, 1, getHeight() - 1, UIConstants.NORMAL_BACKGROUND)); - } - - - GeneralPath generalPath = new GeneralPath(Path2D.WIND_EVEN_ODD, x.length); - generalPath.moveTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - generalPath.curveTo(((float) x[0] + CORNOR_RADIUS - specialLocation1), (y[0] + CORNOR_RADIUS - specialLocation2), ((float) x[0] + CORNOR_RADIUS - specialLocation2), (y[0] + CORNOR_RADIUS - specialLocation1), (double) x[0], y[0] + CORNOR_RADIUS); - - for (int index = 1; index <= 2; index++) { - generalPath.lineTo((float) x[index], (float) y[index]); - } - - generalPath.lineTo((float) x[3], (float) y[3] + CORNOR_RADIUS); - generalPath.curveTo(((float) x[3] - CORNOR_RADIUS + specialLocation1), ((float) y[3] + CORNOR_RADIUS - specialLocation2), ((float) x[3] - CORNOR_RADIUS + specialLocation2), ((float) y[3] + CORNOR_RADIUS - specialLocation1), (float) x[3] - CORNOR_RADIUS, (float) y[3]); - generalPath.lineTo((float) x[0] + CORNOR_RADIUS, (float) y[0]); - - generalPath.closePath(); - - g2d.fill(generalPath); - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - g2d.setPaint(UIConstants.LINE_COLOR); - - g2d.draw(new Arc2D.Double(x[0], y[0], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, 90, 0)); - g2d.draw(new Line2D.Double(x[0], y[0] + CORNOR_RADIUS, x[1], y[1])); - g2d.draw(new Line2D.Double(x[1], y[1], x[2], y[2])); - g2d.draw(new Line2D.Double(x[2], y[2], x[3], y[3] + CORNOR_RADIUS)); - g2d.draw(new Line2D.Double(x[0] + 3 ,0,x[2] - 3,0)); - g2d.draw(new Arc2D.Double(x[3] - CORNOR_RADIUS * 2, y[3], CORNOR_RADIUS * 2, CORNOR_RADIUS * 2, 90, -90, 0)); - - g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); - // 画字符 - g2d.setPaint(getForeground()); - g2d.drawString(sheetName, startX + 2 * GAP, getHeight() - GAP ); - int closeY = (getHeight() - closeIcon.getIconHeight()) / 2; - int closePosition = startX + tabWidth - closeIcon.getIconWidth() - SMALLGAP; - if (canClose() && mouseOveredIndex == selfIndex){ - closeIcon.paintIcon(this, g2d, closePosition, closeY); - } - return closePosition; - } - - - /** - * 鼠标按下 - * @param e 事件 - */ - public void mouseClicked(MouseEvent e) { - } - - /** - * 鼠标按下 - * @param e 事件 - */ - public void mousePressed(MouseEvent e) { - int x = e.getX(), y = e.getY(); - if (addX!= -1 && isOverAddIcon(x, y)){ - addIcon = ADD_CLICK; - commit2DBJavaScriptPane.createDBManipulationPane(); - selectedIndex = dbManipulationPaneList.size()-1; - commit2DBJavaScriptPane.updateCardPane(); - } else if (isOverCloseIcon(x)){ - int re = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(this), Inter.getLocText("FR-Designer-CommitTab_SureToDelete")+ "?", Inter.getLocText("FR-Designer-CommitTab_Remove") - , JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); - if (re == JOptionPane.OK_OPTION) { - dbManipulationPaneList.remove(getTabIndex(x)); - commit2DBJavaScriptPane.setList(dbManipulationPaneList); - // 删除tab以后,获得第一个tab,再刷新一下,否则画面会停留在已删除的tab上,第一个tab是不可删除的 - selectedIndex = getTabIndex(FIRST_TAB_POSITION); - commit2DBJavaScriptPane.updateCardPane(); - - } - } else if (selectedIndex != getTabIndex(x)){ - selectedIndex = getTabIndex(x); - commit2DBJavaScriptPane.updateCardPane(); - } - repaint(); - } - - /** - * 鼠标离开 - * @param e 事件 - */ - public void mouseReleased(MouseEvent e) { - if(addX != -1 && isOverAddIcon(e.getX(), e.getY())){ - addIcon = ADD_NORMAL; - } - } - - /** - * 鼠标进入 - * @param e 事件 - */ - public void mouseEntered(MouseEvent e) { - } - - /** - * 鼠标离开 - * @param e 事件 - */ - public void mouseExited(MouseEvent e) { - mouseOveredIndex = -1; - repaint(); - } - - /** - * 鼠标拖动 - * @param e 事件 - */ - public void mouseDragged(MouseEvent e) { - } - - /** - * 鼠标移动 - * @param e 事件 - */ - public void mouseMoved(MouseEvent e) { - if(addX!= -1 && isOverAddIcon(e.getX(), e.getY())){ - addIcon = ADD_OVER; - } else { - mouseOveredIndex = getTabIndex(e.getX()); - addIcon = ADD_NORMAL; - } - repaint(); - } - - - /** - * 判断鼠标所在Tab - * @param evtX - * @return index - */ - private int getTabIndex ( int evtX ){ - int x = 0; - for( int i = scrollIndex;i <= lastOneIndex;i++){ - if(evtX > x && evtX <= x + tabWidth ){ - return i; - } - x = x + tabWidth; - } - return -1; - } - - /** - * 判断鼠标是否在添加按钮上 - * @param x 鼠标坐标x - * @param y 鼠标坐标y - * @return 返回鼠标是否在添加按钮上 - */ - private boolean isOverAddIcon(int x, int y){ - int addWidth = addIcon.getIconWidth(),addHeight = addIcon.getIconHeight(); - return x >= addX && x <= addX + addWidth && y > addY && y <= addY + addHeight; - } - - - /** - * 判断鼠标是否在关闭按钮上 - * @param evtX x - * @return 返回鼠标是否在关闭按钮上 - */ - private boolean isOverCloseIcon(int evtX) { - boolean isOverCloseIcon = false; - if( canClose()){ - for (int i = 0; i < closeIconStartX.length; i++) { - if (evtX >= closeIconStartX[i] && evtX <= closeIconStartX[i] + closeIcon.getIconWidth()) { - isOverCloseIcon = true; - break; - } - } - } - return isOverCloseIcon; - } - - /** - * 如果tab只剩下最后一个,则不画删除按钮 - * @return 返回当前tab还可否关闭 - */ - private boolean canClose(){ - return closeIconStartX.length > 1; - } - - /** - * 刷新tab,停留在第一个tab上面 - */ - public void refreshTab(){ - selectedIndex = getTabIndex(FIRST_TAB_POSITION); - commit2DBJavaScriptPane.updateCardPane(); - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java deleted file mode 100644 index b0d9a2003e..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchJavaScriptActionProvider.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.design.beans.FurtherBasicBeanPane; -import com.fr.design.fun.impl.AbstractJavaScriptActionProvider; -import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.js.JavaScript; - -/** - * Created by loy on 16/8/22. - */ -public class BatchJavaScriptActionProvider extends AbstractJavaScriptActionProvider { - - @Override - public FurtherBasicBeanPane getJavaScriptActionPane() { - return new BatchCommit2DBJavaScriptPane(); - } - - @Override - public FurtherBasicBeanPane getJavaScriptActionPane(JavaScriptActionPane pane) { - return new BatchCommit2DBJavaScriptPane(pane); - } - -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java deleted file mode 100644 index 1d944194a3..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchSubmitPane.java +++ /dev/null @@ -1,1089 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.base.BaseUtils; -import com.fr.base.Formula; -import com.fr.base.Parameter; -import com.fr.data.DataConstants; -import com.fr.data.condition.JoinCondition; -import com.fr.data.condition.ListCondition; -import com.fr.data.core.db.dml.Table; -import com.fr.design.actions.UpdateAction; -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.condition.DSColumnLiteConditionPane; -import com.fr.design.constants.UIConstants; -import com.fr.design.data.datapane.ChoosePaneSupportFormula; -import com.fr.design.data.datapane.DataBaseItems; -import com.fr.design.data.tabledata.tabledatapane.FormatExplanationPane; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.editor.ValueEditorPane; -import com.fr.design.editor.ValueEditorPaneFactory; -import com.fr.design.editor.editor.Editor; -import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.icheckbox.UICheckBox; -import com.fr.design.gui.icombobox.UIComboBox; -import com.fr.design.gui.icombobox.UIComboBoxRenderer; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ilist.CheckBoxList; -import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; -import com.fr.design.javascript.JavaScriptActionPane; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.scrollruler.ModLineBorder; -import com.fr.design.utils.gui.GUICoreUtils; -import com.fr.design.write.submit.SubmitJobListPane; -import com.fr.general.ComparatorUtils; -import com.fr.general.DateUtils; -import com.fr.general.Inter; -import com.fr.general.data.Condition; -import com.fr.stable.ColumnRow; -import com.fr.stable.ColumnRowGroup; -import com.fr.stable.fun.Level; -import com.fr.write.NameSubmitJob; -import com.fr.write.batch.SubmitMain; -import com.fr.write.config.*; - -import javax.swing.*; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableColumn; -import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; -import java.awt.*; -import java.awt.event.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.EventObject; - -/** - * Created by loy on 16/8/12. - */ -public class BatchSubmitPane extends BasicBeanPane implements Level { - private static final Image ICODS_IMAGE = BaseUtils.readImage("/com/fr/web/core/css/images/icons.png"); - private static final Icon HEIP_ICON = BaseUtils.createIcon(ICODS_IMAGE, 193, 1, 14, 14); - private static final int DEFAULT_RETURN_VALUE = 4; - public BatchSubmitPane.KeyColumnNameValueTable keyColumnValuesTable; - private UIComboBox columnsComboBox; // 用于编辑ColumnName的Editor - private UICheckBox UpdateCheckBox; - private JPanel checkBoxUpdatePane; - /* - * 记录当前选取的DS & Table对应的ColumnName[] - * alex:以前每当tableNameComboBox改变就刷新columnsComboBox,这样每输入一个文字就会刷一遍,很不好 - */ - private BatchSubmitPane.ColumnName[] currentColumnNames = null; - - // 支持公式输入的数据表选择面板 - private ChoosePaneSupportFormula chooseTable; - - private UIComboBox dmlConfigComboBox = null; - - // 提交事件 - private NameSubmitJob[] jobs = null; - - // 提交条件 - private Condition condition = null; - - private JTree conditionsTree; - - private Editor[] v_Types; - - protected JavaScriptActionPane parentPane; - - private int keyColumnWidth = 100; - private int resizeColumnCount = 4; - private int btnWidth = 110; - private int btnHeight = 20; - private String subMitName; - - private static final String[] DML_CONFIG_TYPES = new String[]{ - Inter.getLocText(new String[]{"Smart", "Submit"}), - Inter.getLocText(new String[]{"Delete", "Submit"}), - Inter.getLocText(new String[]{"Insert", "Submit"}), - Inter.getLocText(new String[]{"Update", "Submit"})}; - - /** - * 无单元格。没有智能添加单元格等按钮 - * 有单元格的参见其子类SmartInsertDBManipulationPane - */ - public BatchSubmitPane() { - this(ValueEditorPaneFactory.extendedCellGroupEditors()); - } - - public BatchSubmitPane(Editor[] v_Types) { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - this.v_Types = v_Types; - - JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(northPane, BorderLayout.NORTH); - - dmlConfigComboBox = new UIComboBox(DML_CONFIG_TYPES); - - JPanel typePane = GUICoreUtils.createFlowPane(new Component[]{new UILabel(Inter.getLocText(new String[]{"Choose", "Type"}) + ":"), dmlConfigComboBox}, - FlowLayout.LEFT, 10); - typePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Type"}))); - northPane.add(typePane, BorderLayout.NORTH); - - chooseTable = new ChoosePaneSupportFormula(); - chooseTable.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Table"))); - chooseTable.setTableNameComboBoxPopSize(160, 320); - - northPane.add(chooseTable, BorderLayout.CENTER); - - // peter:编辑的TablePane - JPanel editTablePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); - this.add(editTablePane, BorderLayout.CENTER); - editTablePane.setBorder(BorderFactory.createTitledBorder(new ModLineBorder(ModLineBorder.TOP), Inter.getLocText("FR-Base_Value"))); - - keyColumnValuesTable = new BatchSubmitPane.KeyColumnNameValueTable(); - editTablePane.add(new JScrollPane(this.keyColumnValuesTable), BorderLayout.CENTER); - keyColumnValuesTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - keyColumnValuesTable.setPreferredScrollableViewportSize(new Dimension(280, 180)); - keyColumnValuesTable.setShowHorizontalLines(true); - - initJTableColumn(); - - addButtons(editTablePane); - - addBottomPane(); - - addListeners(); - } - - public void setSubMitName(String subMitName) { - this.subMitName = subMitName; - } - - public String getSubMitName() { - return this.subMitName; - } - - private void addButtons(JPanel editTablePane) { - // alex:添加操作按钮 - UpdateAction[] actions = this.getActions(); - if (actions != null && actions.length > 0) { - JPanel controlBtnPane = new JPanel(new GridLayout(actions.length + 1, 1, 4, 4)); - editTablePane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), BorderLayout.EAST); - - for (int i = 0; i < actions.length; i++) { - controlBtnPane.add(new UIButton(actions[i])); - } - checkBoxUpdatePane = new JPanel(new BorderLayout(0, 0)); - checkBoxUpdatePane.setPreferredSize(new Dimension(120, 20)); - controlBtnPane.add(checkBoxUpdatePane); - - UpdateCheckBox = new UICheckBox(Inter.getLocText("RWA-NotChange_Unmodified")); - UIButton helpButton = new UIButton(HEIP_ICON); - helpButton.setToolTipText(Inter.getLocText("FR-Base_Help")); - helpButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - FormatExplanationPane formatExplanation = new FormatExplanationPane(Inter.getLocText("FR-Base_Help"), Inter.getLocText("FR-Designer_RWA-Help"), 12f); - BasicDialog dlg = formatExplanation.showMediumWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), - new DialogActionAdapter() { - }); - dlg.setVisible(true); - } - }); - helpButton.set4ToolbarButton(); - checkBoxUpdatePane.add(UpdateCheckBox, BorderLayout.WEST); - checkBoxUpdatePane.add(helpButton, BorderLayout.EAST); - } - } - - protected void updateUpdateCheckBoxEnable() { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - if (model.getRowCount() == 0) { - setUpdateCheckBoxEnable(false); - UpdateCheckBox.setSelected(true); - return; - } - ArrayList columnObjects = new ArrayList(); - for (int i = 0; i < model.getRowCount(); i++) { - columnObjects.add(model.getKeyColumnNameValue(i).cv.getObj()); - } - for (int i = 0; i < columnObjects.size(); i++) { - Object ob = columnObjects.get(i); - if (!(ob instanceof ColumnRow || ob instanceof ColumnRowGroup)) { - setUpdateCheckBoxEnable(false); - UpdateCheckBox.setSelected(false); - return; - } - } - setUpdateCheckBoxEnable(true); - } - - private void setUpdateCheckBoxEnable(boolean b) { - UpdateCheckBox.setEnabled(b); - } - - private void addBottomPane() { - JPanel eventPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - eventPane.add(addEventButton()); - - JPanel conditionPane = this.createConditionPane(); - - JPanel btPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); - btPane.add(eventPane, BorderLayout.CENTER); - btPane.add(conditionPane, BorderLayout.NORTH); - this.add(btPane, BorderLayout.SOUTH); - } - - private UIButton addEventButton() { - UIButton addSubmitEventButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Event")); - addSubmitEventButton.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent e) { - final SubmitJobListPane jobsPane = createSubmitJobListPane(); - - jobsPane.populate(jobs); - BasicDialog dialog = jobsPane.showWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - jobs = jobsPane.updateDBManipulation(); - } - }); - dialog.setVisible(true); - } - - }); - return addSubmitEventButton; - } - - private JPanel createConditionPane() { - JPanel conditionPane = new JPanel(); - conditionPane.setPreferredSize(createConditionPanePreferredSize()); - - setBorderAndLayout(conditionPane); - - conditionsTree = new JTree(new DefaultTreeModel(new ExpandMutableTreeNode())); - conditionsTree.setRootVisible(false); - conditionsTree.setShowsRootHandles(true); - conditionsTree.setBackground(UIConstants.NORMAL_BACKGROUND); - conditionsTree.setForeground(UIConstants.NORMAL_BACKGROUND); - DefaultTreeCellRenderer cr = (DefaultTreeCellRenderer) conditionsTree.getCellRenderer(); - cr.setForeground(UIConstants.NORMAL_BACKGROUND); - JScrollPane jp = new JScrollPane(conditionsTree); - addComponent(conditionPane, jp); - - UIButton addSubmitConditionButton = new UIButton(Inter.getLocText("FR-Designer_Set_Submit_Condition")); - addSubmitConditionButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane(); - String[] columns = chooseTable.currentColumnNames(); - if (columns != null && columns.length > 0) { - conditionPane.populateColumns(chooseTable.currentColumnNames()); - } - - conditionPane.populateBean(condition); - BasicDialog dialog = conditionPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - @Override - public void doOk() { - super.doOk(); - condition = conditionPane.updateBean(); - refreshConditionList(); - } - }); - dialog.setVisible(true); - } - }); - - JPanel controlBtnPane = new JPanel(new GridLayout(1, 1, 4, 4)); - controlBtnPane.setPreferredSize(createControlBtnPanePreferredSize()); - conditionPane.add(GUICoreUtils.createBorderPane(controlBtnPane, BorderLayout.NORTH), setControlBtnPanePosition()); - controlBtnPane.add(addSubmitConditionButton); - - return conditionPane; - } - - protected void setBorderAndLayout(JPanel jPanel) { - jPanel.setLayout(FRGUIPaneFactory.createBorderLayout()); - jPanel.setBorder(BorderFactory.createTitledBorder( - new ModLineBorder(ModLineBorder.TOP), Inter.getLocText(new String[]{"Submit", "Condition"}))); - } - - protected void addComponent(JPanel mainPane, JScrollPane addPane) { - mainPane.add(addPane, BorderLayout.CENTER); - } - - - protected Dimension createConditionPanePreferredSize() { - return new Dimension(454, 80); - } - - protected Dimension createControlBtnPanePreferredSize() { - return new Dimension(110, 20); - } - - protected String setControlBtnPanePosition() { - return BorderLayout.EAST; - } - - private void refreshConditionList() { - DefaultTreeModel defaultTreeModel = (DefaultTreeModel) conditionsTree.getModel(); - ExpandMutableTreeNode rootTreeNode = (ExpandMutableTreeNode) defaultTreeModel.getRoot(); - rootTreeNode.setUserObject(new JoinCondition(DataConstants.AND, new ListCondition())); - rootTreeNode.removeAllChildren(); - Condition liteCondition = this.condition == null ? new ListCondition() : this.condition; - if (liteCondition instanceof ListCondition) { - ListCondition listCondition = (ListCondition) liteCondition; - int joinConditionCount = listCondition.getJoinConditionCount(); - for (int i = 0; i < joinConditionCount; i++) { - addLiteConditionToListCondition(rootTreeNode, listCondition.getJoinCondition(i)); - } - } else { - ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(new JoinCondition(DataConstants.AND, liteCondition)); - rootTreeNode.add(newTreeNode); - } - defaultTreeModel.reload(rootTreeNode); - rootTreeNode.expandCurrentTreeNode(conditionsTree); - } - - private void addLiteConditionToListCondition(ExpandMutableTreeNode parentTreeNode, JoinCondition joinCondition) { - ExpandMutableTreeNode newTreeNode = new ExpandMutableTreeNode(joinCondition); - parentTreeNode.add(newTreeNode); - Condition liteCondition = joinCondition.getCondition(); - if (liteCondition instanceof ListCondition) { - ListCondition listCondition = (ListCondition) liteCondition; - int joinConditionCount = listCondition.getJoinConditionCount(); - for (int i = 0; i < joinConditionCount; i++) { - addLiteConditionToListCondition(newTreeNode, listCondition.getJoinCondition(i)); - } - } - } - - private void addListeners() { - dmlConfigComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - Object ob = e.getItem(); - if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[0])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[3])) { - checkBoxUpdatePane.setVisible(true); - } else if ((ComparatorUtils.equals(ob, DML_CONFIG_TYPES[1])) || ComparatorUtils.equals(ob, DML_CONFIG_TYPES[2])) { - checkBoxUpdatePane.setVisible(false); - } - } - } - }); - - /* - * 当DS & Table改变时要刷新ColumnsComboBox.model,不能用ItemListener, - * 因为tableNameComboBox是可以编辑的,每写一个文字就要连,太频繁了 - * 也不能在tableNameComboBox.focusLost事件时,好像没用 - */ - keyColumnValuesTable.addFocusListener(new FocusAdapter() { - - public void focusGained(FocusEvent e) { - refreshColumnsComboBox(); - } - - }); - } - - protected UpdateAction[] getActions() { - return new UpdateAction[]{new BatchSubmitPane.SmartAddFieldsAction(), new BatchSubmitPane.AddFieldAction(), new BatchSubmitPane.RemoveFieldAction()}; - } - - protected SubmitJobListPane createSubmitJobListPane() { - return new SubmitJobListPane(); - } - - public void setParentJavaScriptActionPane(JavaScriptActionPane jsPane) { - this.parentPane = jsPane; - } - - @Override - protected String title4PopupWindow() { - return "DB"; - } - - @Override - public int currentAPILevel() { - return 1; - } - - protected class SmartAddFieldsAction extends UpdateAction { - public SmartAddFieldsAction() { - this.setName(Inter.getLocText("RWA-Smart_Add_Fields")); - } - - public void actionPerformed(ActionEvent evt) { - - BasicPane bPane = new BasicPane() { - @Override - protected String title4PopupWindow() { - return Inter.getLocText("RWA-Smart_Add_Fields"); - } - }; - bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - - final CheckBoxList list = new CheckBoxList(currentColumnNames(), CheckBoxList.SelectedState.ALL, Inter.getLocText("FR-Designer_Chart_Field_Name")) { - public String value2Text(Object value) { - if (value instanceof BatchSubmitPane.ColumnName) { - return ((BatchSubmitPane.ColumnName) value).name; - } - - return super.value2Text(value); - } - }; - bPane.add(new JScrollPane(list), BorderLayout.CENTER); - - BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), new DialogActionAdapter() { - public void doOk() { - addFields(list); - updateUpdateCheckBoxEnable(); - } - }); - dlg.setVisible(true); - } - } - - private void addFields(CheckBoxList list) { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - java.util.List keyColumnNameValueList = new ArrayList(); - keyColumnNameValueList.clear(); - for (int i = 0; i < model.getRowCount(); i++) { - keyColumnNameValueList.add(model.getKeyColumnNameValue(i)); - } - model.removeAllKeyColumnNameValue(); - Object[] selected = list.getSelectedValues(); - // Richie:用了存储新的KeyColumnNameValue的List. - java.util.List newKeyColumnNameValueList = new ArrayList(); - if (!keyColumnNameValueList.isEmpty()) { - for (int i = 0; i < selected.length; i++) { - // Richie:先填上空的. - newKeyColumnNameValueList.add(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); - } - } - // Richie:初始化 - int returnValue = DEFAULT_RETURN_VALUE; - int coverNumber = 0; - for (int i = 0; i < selected.length; i++) { - if (returnValue == 0 || returnValue == 3) { - break; - } - for (int j = 0; j < keyColumnNameValueList.size(); j++) { - if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { - Object[] options = {Inter.getLocText("FR-Designer_Covered_All"), Inter.getLocText("FR-Base_Yes"), Inter.getLocText("FR-Base_No"), Inter.getLocText("FR-Designer_Cover_None")}; - returnValue = JOptionPane.showOptionDialog(BatchSubmitPane.this, keyColumnNameValueList.get(j).cn.name - + Inter.getLocText(new String[]{"Has_Existed", "Want_To_Cover_It"}, new String[]{",", "?"}), - "", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]); - // Richie:全部覆盖 - if (returnValue == 0) { - break; - // Richie:覆盖指定行 - } else if (returnValue == 1) { - coverNumber = i; - // Richie:不覆盖制定行 - } else if (returnValue == 2) { - coverNumber = i; - newKeyColumnNameValueList.remove(i); - newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); - // Richie:全部不覆盖 - } else if (returnValue == 3) { - coverNumber = i; - break; - } - } - } - } - checkTableModel(returnValue, coverNumber, model, selected, keyColumnNameValueList, newKeyColumnNameValueList); - } - - private void checkTableModel(int returnValue, int coverNumber, BatchSubmitPane.KeyColumnTableModel model, Object[] selected, java.util.List keyColumnNameValueList, java.util.List newKeyColumnNameValueList) { - if (returnValue == 0) { - model.removeAllKeyColumnNameValue(); - // Richie:全部覆盖,按selected的长度添加默认的行 - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - - } else if (returnValue == 3) { - model.removeAllKeyColumnNameValue(); - // Richie:全部不覆盖,已经存在的就保留,不存在的添加默认行 - for (int i = coverNumber; i < selected.length; i++) { - for (int j = 0; j < keyColumnNameValueList.size(); j++) { - if (ComparatorUtils.equals(selected[i], keyColumnNameValueList.get(j).cn)) { - newKeyColumnNameValueList.remove(i); - newKeyColumnNameValueList.add(i, keyColumnNameValueList.get(j)); - } - } - - } - - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - - } else if (returnValue == 1 || returnValue == 2) { - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(newKeyColumnNameValueList.get(i)); - } - } - - // Richie:初始化 - if (keyColumnNameValueList.isEmpty()) { - model.removeAllKeyColumnNameValue(); - for (int i = 0; i < selected.length; i++) { - model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, (BatchSubmitPane.ColumnName) selected[i], new BatchSubmitPane.ColumnValue(""), false)); - } - } - model.fireTableDataChanged(); - keyColumnValuesTable.validate(); - } - - protected class AddFieldAction extends UpdateAction { - public AddFieldAction() { - this.setName(Inter.getLocText("RWA-Add_Field")); - } - - public void actionPerformed(ActionEvent e) { - - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - - model.addKeyColumnNameValue(new BatchSubmitPane.KeyColumnNameValue(false, new BatchSubmitPane.ColumnName(""), new BatchSubmitPane.ColumnValue(""), false)); - updateUpdateCheckBoxEnable(); - model.fireTableDataChanged(); - - keyColumnValuesTable.getSelectionModel().setSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); - } - } - - protected class RemoveFieldAction extends UpdateAction { - public RemoveFieldAction() { - this.setName(Inter.getLocText("RWA-Remove_Field")); - } - - public void actionPerformed(ActionEvent evt) { - // DBManipulationPane target = this.getDBManipulationPane(); - - int[] selectedRows = keyColumnValuesTable.getSelectedRows(); - if (selectedRows == null || selectedRows.length == 0) { - return; - } - - int returnVal = JOptionPane.showConfirmDialog(SwingUtilities.getWindowAncestor(BatchSubmitPane.this), - Inter.getLocText("FR-Base_sure_remove_item") + "?", Inter.getLocText("FR-Base_Remove"), JOptionPane.OK_CANCEL_OPTION, - JOptionPane.QUESTION_MESSAGE); - if (returnVal == JOptionPane.OK_OPTION) { - BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) keyColumnValuesTable.getModel(); - - // 把selectedRows从小到大排个序,先删大的再删小的 - java.util.Arrays.sort(selectedRows); - for (int i = selectedRows.length - 1; i >= 0; i--) { - keyColumnNameValueTableModel.removeKeyColumnNameValue(selectedRows[i]); - } - updateUpdateCheckBoxEnable(); - keyColumnNameValueTableModel.fireTableDataChanged(); - - // select other one. - if (keyColumnNameValueTableModel.getRowCount() > selectedRows[0]) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(selectedRows[0], selectedRows[0]); - } else if (keyColumnNameValueTableModel.getRowCount() > 0) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - } - } - - /* - * 刷新columnsComboBox - */ - private void refreshColumnsComboBox() { - DefaultComboBoxModel model = (DefaultComboBoxModel) this.columnsComboBox.getModel(); - model.removeAllElements(); - - BatchSubmitPane.ColumnName[] columnNames = currentColumnNames(); - for (int i = 0; i < columnNames.length; i++) { - model.addElement(columnNames[i]); - } - } - - // 得到当前的ColumnName[] - private BatchSubmitPane.ColumnName[] currentColumnNames() { - // ben:清除原有的 - if (currentColumnNames != null) { - currentColumnNames = null; - } - String[] colNames = this.chooseTable.currentColumnNames(); - int len = colNames.length; - currentColumnNames = new BatchSubmitPane.ColumnName[len]; - for (int i = 0; i < len; i++) { - currentColumnNames[i] = new BatchSubmitPane.ColumnName(colNames[i]); - } - if (currentColumnNames == null) { - currentColumnNames = new BatchSubmitPane.ColumnName[0]; - } - return currentColumnNames; - } - - /* - * 设置JTable的Column - */ - private void initJTableColumn() { - TableColumn column0 = this.keyColumnValuesTable.getColumnModel().getColumn(0); - column0.setMaxWidth(50); - - TableColumn column1 = this.keyColumnValuesTable.getColumnModel().getColumn(1); - column1.setCellRenderer(new BatchSubmitPane.ColumnNameTableCellRenderer()); - - TableColumn column2 = this.keyColumnValuesTable.getColumnModel().getColumn(2); - column2.setCellRenderer(new BatchSubmitPane.ColumnValueTableCellRenderer()); - - // 设置column1的editor - columnsComboBox = new UIComboBox(new DefaultComboBoxModel()); - columnsComboBox.setRenderer(new UIComboBoxRenderer() { - - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof BatchSubmitPane.ColumnName) { - this.setText(((BatchSubmitPane.ColumnName) value).name); - } - - return this; - } - - }); - column1.setCellEditor(new DefaultCellEditor(columnsComboBox) { - public boolean stopCellEditing() { - if (super.stopCellEditing()) { - return true; - } - - return false; - } - }); - ((DefaultCellEditor) column1.getCellEditor()).setClickCountToStart(2); - - //设置Column 2的Editor - column2.setCellEditor(new BatchSubmitPane.ColumnValueEditor()); - } - - @Override - public void populateBean(SubmitMain submitMain) { - if (submitMain == null) { - submitMain = new SubmitMain(); - } - subMitName = submitMain.getName(); - DMLConfig dmlConfig = submitMain.getDmlConfig(); - - if (dmlConfig != null) { - if (dmlConfig instanceof IntelliDMLConfig) { - dmlConfigComboBox.setSelectedIndex(0); - } else if (dmlConfig instanceof DeleteConfig) { - dmlConfigComboBox.setSelectedIndex(1); - } else if (dmlConfig instanceof InsertConfig) { - dmlConfigComboBox.setSelectedIndex(2); - } else if (dmlConfig instanceof UpdateConfig) { - dmlConfigComboBox.setSelectedIndex(3); - } else { - dmlConfigComboBox.setSelectedIndex(0); - } - jobs = new NameSubmitJob[dmlConfig == null ? 0 : dmlConfig.getSubmitJobCount()]; - for (int i = 0; i < jobs.length; i++) { - jobs[i] = dmlConfig.getSubmitJob(i); - } - condition = dmlConfig.getCondition(); - UpdateCheckBox.setSelected(dmlConfig.isUpdateSelected()); - } else { - jobs = null; - condition = null; - dmlConfigComboBox.setSelectedIndex(0); - UpdateCheckBox.setSelected(false); - } - - String schema = null; - String tableName = null; - Table table = null; - if (dmlConfig != null && dmlConfig.getOriTable() != null) { - table = dmlConfig.getOriTable(); - if (table != null) { - schema = table.getSchema(); - tableName = table.getName(); - } - } - chooseTable.populateBean(new DataBaseItems(submitMain.getDBName(), schema, tableName)); - - populateKeyColumnValueTable(dmlConfig); - - updateUpdateCheckBoxEnable(); - refreshConditionList(); - } - - private void populateKeyColumnValueTable(DMLConfig dmlConfig) { - BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); - keyColumnNameValueTableModel.removeAllKeyColumnNameValue(); - - if (dmlConfig != null) { - boolean acceptPara = false; - for (int i = 0; i < v_Types.length; i++) { - if (v_Types[i].accept(new Parameter())) { - acceptPara = true; - break; - } - } - for (int i = 0; i < dmlConfig.getColumnConfigCount(); i++) { - ColumnConfig column = dmlConfig.getColumnConfig(i); - String columnName = column.getColumnName(); - if (!acceptPara && column.getColumnValue() instanceof Parameter) { - // 表单中,将以前的参数转换为公式 - column.setColumnValue(new Formula(((Parameter) column.getColumnValue()).getName())); - } - - BatchSubmitPane.KeyColumnNameValue newColumnNameValue = new BatchSubmitPane.KeyColumnNameValue(column.isKey(), new BatchSubmitPane.ColumnName(columnName), new BatchSubmitPane.ColumnValue(column.getColumnValue()), - column.isSkipUnmodified()); - keyColumnNameValueTableModel.addKeyColumnNameValue(newColumnNameValue); - } - } - keyColumnNameValueTableModel.fireTableDataChanged(); - - // 选择第一个 - if (keyColumnNameValueTableModel.getRowCount() > 0) { - keyColumnValuesTable.getSelectionModel().setSelectionInterval(0, 0); - } - } - - @Override - public SubmitMain updateBean() { - DataBaseItems para = chooseTable.updateBean(true); - SubmitMain submitMain = new SubmitMain(); - submitMain.setName(subMitName); - submitMain.setDBName(para.getDatabaseName()); - - DMLConfig dmlConfig = new IntelliDMLConfig(); - if (dmlConfigComboBox.getSelectedIndex() == 1) { - dmlConfig = new DeleteConfig(); - } else if (dmlConfigComboBox.getSelectedIndex() == 2) { - dmlConfig = new InsertConfig(); - } else if (dmlConfigComboBox.getSelectedIndex() == 3) { - dmlConfig = new UpdateConfig(); - } - - submitMain.setDmlConfig(dmlConfig); - - dmlConfig.setTable(new Table(para.getSchemaName(), para.getTableName())); - - BatchSubmitPane.KeyColumnTableModel keyColumnNameValueTableModel = (BatchSubmitPane.KeyColumnTableModel) this.keyColumnValuesTable.getModel(); - int rowCount = keyColumnNameValueTableModel.keyColumnNameValueList.size(); - for (int i = 0; i < rowCount; i++) { - BatchSubmitPane.KeyColumnNameValue newKeyColumnNameValue = keyColumnNameValueTableModel.keyColumnNameValueList.get(i); - // peter:先添加key column name. - - dmlConfig.addColumnConfig(new ColumnConfig(newKeyColumnNameValue.cn.name, newKeyColumnNameValue.cv.obj, newKeyColumnNameValue.isKey, false)); - } - dmlConfig.setUpdateSelected(UpdateCheckBox.isSelected()); - - if (jobs != null) { - for (int i = 0; i < jobs.length; i++) { - dmlConfig.addSubmitJob(jobs[i]); - } - } - dmlConfig.setCondition(condition); - - return submitMain; - } - - protected class ValuePane extends BasicBeanPane { - ValueEditorPane vPane; - - public ValuePane() { - this(v_Types); - } - - public ValuePane(Editor[] types) { - vPane = new ValueEditorPane(types); - this.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 45)); - this.add(vPane); - vPane.setPreferredSize(new Dimension(220, 25)); - } - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("FR-Designer_Values-Editor"); - } - - public void populateBean(Object object) { - vPane.populate(object); - } - - @Override - public Object updateBean() { - return vPane.update(); - } - - } - - /* - * alex:ColumnValue的编辑器,弹出对话框来编辑...个人觉得不大好 - */ - protected class ColumnValueEditor extends AbstractCellEditor implements TableCellEditor { - /** - * The Swing component being edited. - */ - private UILabel textLabel; - private BatchSubmitPane.ValuePane vPane; - private BasicDialog vPaneDLG; - - protected ColumnValueEditor() { - this(v_Types); - } - - protected ColumnValueEditor(Editor[] types) { - textLabel = new UILabel(); - textLabel.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - vPaneDLG.setVisible(true); - - } - }); - - vPane = new BatchSubmitPane.ValuePane(types); - vPaneDLG = vPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { - public void doOk() { - fireEditingStopped(); // Make the renderer - // reappear. - updateUpdateCheckBoxEnable(); - } - - public void doCancel() { - fireEditingCanceled(); - } - }); - } - - /* - * 双击以编辑 - */ - public boolean isCellEditable(EventObject anEvent) { - if (anEvent instanceof MouseEvent) { - return ((MouseEvent) anEvent).getClickCount() >= 2; - } - return true; - } - - public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { - if (value instanceof BatchSubmitPane.ColumnValue) { - vPane.populateBean(((BatchSubmitPane.ColumnValue) value).obj); - - if (((BatchSubmitPane.ColumnValue) value).obj != null) { - textLabel.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); - } else { - textLabel.setText(""); - } - } - - return textLabel; - } - - public Object getCellEditorValue() { - return new BatchSubmitPane.ColumnValue(vPane.updateBean()); - } - } - - public static class ColumnName { - public String name; - - public ColumnName(String name) { - this.name = name; - } - - public boolean equals(Object obj) { - if (!(obj instanceof BatchSubmitPane.ColumnName)) { - return false; - } - - return ComparatorUtils.equals(this.name, ((BatchSubmitPane.ColumnName) obj).name); - } - } - - public static class ColumnValue { - public Object obj; - - public ColumnValue(Object obj) { - this.obj = obj; - } - - public Object getObj() { - return obj; - } - - public boolean equals(Object obj) { - if (!(obj instanceof BatchSubmitPane.ColumnValue)) { - return false; - } - - return ComparatorUtils.equals(this.obj, ((BatchSubmitPane.ColumnValue) obj).obj); - } - } - - protected static class KeyColumnNameValueTable extends JTable { - - public KeyColumnNameValueTable() { - super(new BatchSubmitPane.KeyColumnValueTableModel(null)); - } - - - public BatchSubmitPane.KeyColumnTableModel getTableModel4SmartAddCell() { - return new BatchSubmitPane.KeyColumnValueTableModel((BatchSubmitPane.KeyColumnTableModel) this.getModel()); - } - - } - - protected abstract static class KeyColumnTableModel extends AbstractTableModel { - public static final String RAW_KEY = Inter.getLocText("FR-Base_RWA-Key"); - public static final String COLUMN = Inter.getLocText("FR-Base_Column"); - public static final String VALUE = Inter.getLocText("FR-Base_Value"); - - public static final String[] COLUMN_NAMES = new String[]{RAW_KEY, COLUMN, VALUE}; - - protected java.util.List keyColumnNameValueList = new ArrayList(); - - public KeyColumnTableModel(BatchSubmitPane.KeyColumnTableModel model) { - if (model != null) { - this.keyColumnNameValueList.addAll(model.keyColumnNameValueList); - } - } - - public String getColumnName(int col) { - return COLUMN_NAMES[col]; - } - - public int getColumnCount() { - return COLUMN_NAMES.length; - } - - public int getRowCount() { - return keyColumnNameValueList.size(); - } - - public void addKeyColumnNameValue(BatchSubmitPane.KeyColumnNameValue keyColumnNameValue) { - this.keyColumnNameValueList.add(keyColumnNameValue); - } - - public void removeKeyColumnNameValue(int index) { - this.keyColumnNameValueList.remove(index); - } - - public BatchSubmitPane.KeyColumnNameValue getKeyColumnNameValue(int index) { - return this.keyColumnNameValueList.get(index); - } - - public void removeAllKeyColumnNameValue() { - this.keyColumnNameValueList.clear(); - } - } - - protected static class KeyColumnValueTableModel extends BatchSubmitPane.KeyColumnTableModel { - - public KeyColumnValueTableModel(BatchSubmitPane.KeyColumnTableModel model) { - super(model); - } - - public Object getValueAt(int row, int col) { - BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); - - switch (col) { - case 0: - return knv.isKey; - case 1: - return knv.cn; - case 2: - return knv.cv; - } - return null; - } - - public void setValueAt(Object value, int row, int col) { - BatchSubmitPane.KeyColumnNameValue knv = keyColumnNameValueList.get(row); - - if (col == 0 && value instanceof Boolean) { - knv.isKey = ((Boolean) value).booleanValue(); - } else if (col == 1 && value instanceof BatchSubmitPane.ColumnName) { - knv.cn = (BatchSubmitPane.ColumnName) value; - } else if (col == 2 && value instanceof BatchSubmitPane.ColumnValue) { - knv.cv = (BatchSubmitPane.ColumnValue) value; - } - } - - public Class getColumnClass(int c) { - switch (c) { - case 0: - return Boolean.class; - case 1: - return BatchSubmitPane.ColumnName.class; - case 2: - return BatchSubmitPane.ColumnValue.class; - } - return String.class; - } - - public boolean isCellEditable(int row, int col) { - return true; - } - } - - - public static class KeyColumnNameValue { - private boolean isKey = false; - private BatchSubmitPane.ColumnName cn; - public BatchSubmitPane.ColumnValue cv; - - public KeyColumnNameValue(boolean isKey, BatchSubmitPane.ColumnName cn, BatchSubmitPane.ColumnValue cv, boolean skip) { - this.isKey = isKey; - this.cn = cn; - this.cv = cv; - } - - /** - * 字符串 - * - * @return 字符串z - */ - public String toString() { - return (isKey ? "* " : "") + cn + ":" + cv; - } - } - - /* - * ColumnNameTableCellRenderer - */ - public class ColumnNameTableCellRenderer extends DefaultTableCellRenderer { - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - if (value instanceof BatchSubmitPane.ColumnName) { - this.setText(((BatchSubmitPane.ColumnName) value).name); - } - - return this; - } - } - - /* - * ColumnValueTableCellRenderer - */ - private class ColumnValueTableCellRenderer extends DefaultTableCellRenderer { - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - if (value instanceof BatchSubmitPane.ColumnValue) { - if (((BatchSubmitPane.ColumnValue) value).obj != null) { - if (((BatchSubmitPane.ColumnValue) value).obj instanceof Date) { - this.setText(DateUtils.DATEFORMAT2.format(((BatchSubmitPane.ColumnValue) value).obj)); - } else { - this.setText(((BatchSubmitPane.ColumnValue) value).obj.toString()); - } - } else { - this.setText(""); - } - } - - return this; - } - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java b/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java deleted file mode 100644 index 4044626645..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/BatchSubmitProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.design.beans.BasicBeanPane; -import com.fr.design.fun.impl.AbstractSubmitProvider; -import com.fr.general.Inter; - -/** - * Created by loy on 16/8/13. - */ -public class BatchSubmitProvider extends AbstractSubmitProvider { - private volatile static BatchSubmitProvider instance; - - public static BatchSubmitProvider getInstance() { - if (instance == null) { - synchronized (BatchSubmitProvider.class) { - if (instance == null) { - instance = new BatchSubmitProvider(); - } - } - } - return instance; - } - @Override - public BasicBeanPane appearanceForSubmit() { - return new SmartInsertBatchSubmitPane(); - } - - @Override - public String dataForSubmit() { - return Inter.getLocText("Performance-plugin_submitbatch_name"); - } - - @Override - public String keyForSubmit() { - return "submitbatch"; - } - - @Override - public int currentAPILevel() { - return 1; - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java b/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java deleted file mode 100644 index 791f801ede..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/SmartInsertBatchSubmitPane.java +++ /dev/null @@ -1,591 +0,0 @@ -package com.fr.design.write.submit.batch; - -import com.fr.cache.list.IntList; -import com.fr.data.ClassSubmitJob; -import com.fr.design.actions.UpdateAction; -import com.fr.design.cell.smartaction.AbstractSmartJTablePaneAction; -import com.fr.design.cell.smartaction.SmartJTablePane; -import com.fr.design.cell.smartaction.SmartJTablePaneAction; -import com.fr.design.dialog.BasicDialog; -import com.fr.design.dialog.BasicPane; -import com.fr.design.dialog.DialogActionAdapter; -import com.fr.design.editor.ValueEditorPaneFactory; -import com.fr.design.gui.controlpane.NameObjectCreator; -import com.fr.design.gui.controlpane.NameableCreator; -import com.fr.design.gui.ilable.UILabel; -import com.fr.design.gui.ispinner.UIBasicSpinner; -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.layout.TableLayout; -import com.fr.design.layout.TableLayoutHelper; -import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.ElementCasePane; -import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.JWorkBook; -import com.fr.design.selection.SelectionEvent; -import com.fr.design.selection.SelectionListener; -import com.fr.design.write.submit.CustomSubmitJobPane; -import com.fr.design.write.submit.SmartInsertDMLJobPane; -import com.fr.design.write.submit.SubmitJobListPane; -import com.fr.general.Inter; -import com.fr.grid.selection.CellSelection; -import com.fr.grid.selection.FloatSelection; -import com.fr.grid.selection.Selection; -import com.fr.stable.ColumnRow; -import com.fr.stable.ColumnRowGroup; -import com.fr.write.DMLConfigJob; - -import javax.swing.*; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellRenderer; -import javax.swing.table.TableColumn; -import java.awt.*; -import java.awt.event.ActionEvent; - -/** - * Created by loy on 16/8/16. - */ -public class SmartInsertBatchSubmitPane extends BatchSubmitPane { - private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1); - private ElementCasePane ePane; - private static int CELL_GROUP_LIMIT = 6; - - public SmartInsertBatchSubmitPane(ElementCasePane ePane) { - super(ValueEditorPaneFactory.extendedCellGroupEditors()); - this.ePane = ePane; - } - - public SmartInsertBatchSubmitPane() { - super(ValueEditorPaneFactory.extendedCellGroupEditors()); - JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); - this.ePane = ((JWorkBook) jTemplate).getEditingElementCasePane(); - } - - @Override - protected SubmitJobListPane createSubmitJobListPane() { - return new SmartInsertSubmitJobListPane(); - } - - class SmartInsertSubmitJobListPane extends SubmitJobListPane { - - public SmartInsertSubmitJobListPane() { - super(ePane); - } - - public void hideParentDialog() { - hideDialog4AddCellAction(); - } - - public void showParentDialog() { - showDialogAfterAddCellAction(); - } - - @Override - public NameableCreator[] createNameableCreators() { - return new NameableCreator[] { - new NameObjectCreator(Inter.getLocText(new String[]{"Submit", "Event"}), - "/com/fr/web/images/reportlet.png", - DMLConfigJob.class, - SmartInsertDMLJobPane.class), - new NameObjectCreator(Inter.getLocText(new String[]{"Custom", "Event"}), - "/com/fr/web/images/reportlet.png", - ClassSubmitJob.class, - CustomSubmitJobPane.class) }; - } - } - - @Override - protected UpdateAction[] getActions() { - return new UpdateAction[] { - new BatchSubmitPane.SmartAddFieldsAction(), - new BatchSubmitPane.AddFieldAction(), - new SmartAddCellAction(), - new SmartAddCellGroupAction(), - new BatchModCellAction(), - new BatchSubmitPane.RemoveFieldAction() - }; - } - - public class BatchModCellAction extends UpdateAction { - public BatchModCellAction() { - this.setName(Inter.getLocText("RWA-Batch_Modify_Cells")); - } - - /** - * 执行事件 - * @param evt 事件对象 - */ - public void actionPerformed(ActionEvent evt) { - BasicPane bPane = new BasicPane() { - @Override - protected String title4PopupWindow() { - return Inter.getLocText("RWA-Batch_Modify_Cells"); - } - }; - bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); - bPane.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); - final UIBasicSpinner columnSpinner = new UIBasicSpinner(); - final UIBasicSpinner rowSpinner = new UIBasicSpinner(); - Component[][] coms = new Component[][] { { new UILabel(Inter.getLocText("RWA-Row_Offset")), rowSpinner },{ new UILabel(Inter.getLocText("RWA-Column_Offset")), columnSpinner } }; - double p = TableLayout.PREFERRED; - double f = TableLayout.FILL; - bPane.add(TableLayoutHelper.createTableLayoutPane(coms, new double[]{p, p}, new double[]{p, f}), BorderLayout.NORTH); - BasicDialog dlg = bPane.showSmallWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this), new DialogActionAdapter() { - public void doOk() { - int row_offset = ((Number)rowSpinner.getValue()).intValue(); - int column_offset = ((Number)columnSpinner.getValue()).intValue(); - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); - int[] selectedRows = keyColumnValuesTable.getSelectedRows(); - // 如果一行都没选中,取所有的行 - if (selectedRows.length == 0) { - selectedRows = IntList.range(model.getRowCount()); - } - for (int i = 0; i < selectedRows.length; i++) { - int row = selectedRows[i]; - BatchSubmitPane.KeyColumnNameValue kcnv = model.getKeyColumnNameValue(row); - if (kcnv.cv.obj instanceof ColumnRow) { - ColumnRow or = (ColumnRow)kcnv.cv.obj; - int n_column = or.getColumn() + column_offset; - if (n_column < 0) { - n_column = 0; - } - int n_row = or.getRow() + row_offset; - if (n_row < 0) { - n_row = 0; - } - kcnv.cv.obj = ColumnRow.valueOf(n_column, n_row); - } - } - model.fireTableDataChanged(); - keyColumnValuesTable.validate(); - for (int i = 0; i < selectedRows.length; i++) { - keyColumnValuesTable.addRowSelectionInterval(selectedRows[i], selectedRows[i]); - } - } - }); - dlg.setVisible(true); - } - } - - public class SmartAddCellAction extends UpdateAction { - public SmartAddCellAction() { - this.setName(Inter.getLocText("RWA-Smart_Add_Cells")); - } - - /** - * 执行事件 - * @param evt 事件s - */ - public void actionPerformed(ActionEvent evt) { - - // Grid.GridSelectionListener - if (ePane == null) { - return; - } - - /* - * 布局 - */ - BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane); - - // ReportWriteAttrDialog.this.setVisible(false); - hideDialog4AddCellAction(); - /* - * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener - */ - ePane.setSelection(NO_SELECTION); - ePane.setEditable(false); - ePane.getGrid().setNotShowingTableSelectPane(false); - - BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); - - dlg.setModal(false); - dlg.setVisible(true); - } - } - - public class SmartAddCellGroupAction extends UpdateAction { - public SmartAddCellGroupAction() { - this.setName(Inter.getLocText("RWA-Smart_Add_Cell_Group")); - } - - /** - * 智能添加单元格组 - * @param e 事件s - */ - public void actionPerformed(ActionEvent e) { - if (ePane == null) { - return; - } - - BasicPane bPane = new SmartJTablePane4DB(keyColumnValuesTable.getTableModel4SmartAddCell(), ePane, true); - - // ReportWriteAttrDialog.this.setVisible(false); - hideDialog4AddCellAction(); - /* - * 当前的ReportPane不可编辑,不可切换Sheet,加GridSelectionChangeListener - */ - ePane.setSelection(NO_SELECTION); - ePane.setEditable(false); - ePane.getGrid().setNotShowingTableSelectPane(false); - - BasicDialog dlg = bPane.showWindow(SwingUtilities.getWindowAncestor(SmartInsertBatchSubmitPane.this)); - - dlg.setModal(false); - dlg.setVisible(true); - } - } - - private void showDialogAfterAddCellAction() { - Container dialog = this; - if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { - ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).showDialogAfterAddCellAction(); - } - while (dialog.getParent() != null) { - dialog = dialog.getParent(); - if (dialog instanceof SmartInsertSubmitJobListPane) { - ((SmartInsertSubmitJobListPane)dialog).showParentDialog(); - } else if (dialog instanceof Dialog) { - dialog.setVisible(true); - } - } - } - - private void hideDialog4AddCellAction() { - Container dialog = this; - if (parentPane != null && parentPane.getContentDBManiPane() instanceof SmartInsertBatchSubmitPane && parentPane.getContentDBManiPane() != this) { - ((SmartInsertBatchSubmitPane)parentPane.getContentDBManiPane()).hideDialog4AddCellAction(); - } - while (dialog.getParent() != null) { - dialog = dialog.getParent(); - if (dialog instanceof SmartInsertSubmitJobListPane) { - ((SmartInsertSubmitJobListPane)dialog).hideParentDialog(); - } else if (dialog instanceof Dialog) { - // 条件属性中添加的控件的话有两层dialog,需要都隐藏 - dialog.setVisible(false); - } - } - } - - /** - * 检测是否合法 - * @throws Exception - */ - public void checkValid() throws Exception { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)keyColumnValuesTable.getModel(); - int cnt = model.getRowCount(); - int groupLength = -1; - for (int i=0; i= model.getRowCount()) { - return; - } - BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); - ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); - Selection selection = currentReportPane.getSelection(); - if (selection == NO_SELECTION || selection instanceof FloatSelection) { - return; - } - CellSelection cellselection = (CellSelection)selection; - kcv.cv.obj = ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow()); - - if (editingRowIndex >= model.getRowCount() - 1) { - setEditingRowIndex(0); - } else { - setEditingRowIndex(editingRowIndex + 1); - } - - model.fireTableDataChanged(); - - } - - }; - - /** - * 单元格组的点选格子事件 - */ - private SelectionListener groupListener = new SelectionListener() { - @Override - public void selectionChanged(SelectionEvent e) { - BatchSubmitPane.KeyColumnTableModel model = (BatchSubmitPane.KeyColumnTableModel)table.getModel(); - if (editingRowIndex < 0 || editingRowIndex >= model.getRowCount()) { - return; - } - BatchSubmitPane.KeyColumnNameValue kcv = model.getKeyColumnNameValue(editingRowIndex); - ElementCasePane currentReportPane = (ElementCasePane)e.getSource(); - Selection selection = currentReportPane.getSelection(); - if (selection == NO_SELECTION || selection instanceof FloatSelection) { - return; - } - CellSelection cellselection = (CellSelection)selection; - Object oriValue = kcv.cv.obj; - ColumnRowGroup newValue = getColumnRowGroupValue(oriValue); - - // 要考虑多选的情况 要结合之前的看看 可能是增加 也可能需要减少 - ColumnRowGroup add = new ColumnRowGroup(); - int removeCount = 0; - if (oriCellSelection != null && sameStartPoint(cellselection, oriCellSelection)) { - removeCount = dealDragSelection(add, cellselection); - } else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { - dealSelectColRow(add, cellselection); - } else { - add.addColumnRow(ColumnRow.valueOf(cellselection.getColumn(), cellselection.getRow())); - } - - if (add.getSize() > 0) { - newValue.addAll(add); - } else if (removeCount > 0) { - newValue.splice(newValue.getSize()-removeCount, removeCount); - } - - kcv.cv.obj = newValue; - - model.fireTableDataChanged(); - - oriCellSelection = cellselection; - } - - private ColumnRowGroup getColumnRowGroupValue(Object oriValue) { - ColumnRowGroup newValue = new ColumnRowGroup(); - if (oriValue instanceof ColumnRowGroup) { - newValue.addAll((ColumnRowGroup)oriValue); - } else if (oriValue instanceof ColumnRow) { - newValue.addColumnRow((ColumnRow) oriValue); - } - return newValue; - } - - private boolean sameStartPoint(CellSelection cs1, CellSelection cs2) { - return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow(); - } - - private int dealDragSelection(ColumnRowGroup add, CellSelection cellselection) { - int removeCount = 0; - if (cellselection.getRowSpan() == oriCellSelection.getRowSpan() + 1) { - for (int i=0; i= CELL_GROUP_LIMIT) { - text.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, - new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); - tip = cv.toString() + " " + tip; - } else if (cv != null) { - text.setText(cv.toString()); - } else { - text.setText(""); - } - } - - if (row == SmartJTablePane4DB.this.editingRowIndex) { - pane.setBackground(Color.cyan); - } else { - pane.setBackground(Color.white); - } - - pane.setToolTipText(tip); - pane.add(text); - - return pane; - } - } - - private class ColumnRowGroupCellRenderer2 extends DefaultTableCellRenderer { - @Override - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - String tip = Inter.getLocText("FR-Designer_Double_Click_Edit_OR_Clear"); - - if (value instanceof BatchSubmitPane.ColumnValue) { - Object cv = ((BatchSubmitPane.ColumnValue) value).obj; - if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) { - this.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, - new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); - tip = cv.toString() + " " + tip; - } else if (cv != null) { - this.setText(cv.toString()); - } else { - this.setText(""); - } - } - - this.setToolTipText(tip); - - if (row == SmartJTablePane4DB.this.editingRowIndex) { - this.setBackground(Color.cyan); - } else { - this.setBackground(Color.white); - } - - return this; - } - } - } -} diff --git a/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java b/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java deleted file mode 100644 index 01ac8a155b..0000000000 --- a/designer/src/com/fr/design/write/submit/batch/service/BatchDBCommitService.java +++ /dev/null @@ -1,288 +0,0 @@ -package com.fr.design.write.submit.batch.service; - -import com.fr.base.*; -import com.fr.data.NetworkHelper; -import com.fr.data.core.db.DBUtils; -import com.fr.data.impl.NameDatabaseConnection; -import com.fr.design.write.submit.batch.BatchCommit2DBJavaScript; -import com.fr.form.ui.WebContentUtils; -import com.fr.general.xml.GeneralXMLTools; -import com.fr.js.JavaScript; -import com.fr.json.JSONException; -import com.fr.json.JSONFunction; -import com.fr.json.JSONObject; -import com.fr.script.Calculator; -import com.fr.stable.ColumnRow; -import com.fr.stable.ParameterProvider; -import com.fr.stable.StringUtils; -import com.fr.stable.UtilEvalError; -import com.fr.stable.fun.impl.NoSessionIDOPService; -import com.fr.stable.script.NameSpace; -import com.fr.web.RepositoryDeal; -import com.fr.web.core.ReportSessionIDInfor; -import com.fr.web.core.SessionDealWith; -import com.fr.web.core.SessionIDInfor; -import com.fr.web.utils.WebUtils; -import com.fr.write.batch.SubmitMain; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.sql.Connection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * Created by loy on 16/8/23. - */ -public class BatchDBCommitService extends NoSessionIDOPService { - private static BatchDBCommitService service = null; - - public static final String ARG_XMLCONF = "xmlconf"; - public static final String ARG_SESSIONID = "sessionID"; - - /** - * 构造 - * - * @return - */ - public static BatchDBCommitService getInstance() { - if (service == null) { - service = new BatchDBCommitService(); - } - - return service; - } - - /** - * OP值 - * - * @return 返回OP值 - */ - public String actionOP() { - return "batchcommit"; - } - - private Map sessionMap = new HashMap(); - - /** - * 提交入库请求处理 - * - * @param req 请求 - * @param res 响应 - * @throws Exception 抛出异常 - */ - public void process(HttpServletRequest req, HttpServletResponse res) throws Exception { - String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); - CountLock lock = getCountLock(sessionID); - try { - synchronized (lock) { - process0(req, res); - } - } finally { - releaseLock(sessionID, lock); - } - - } - - private void releaseLock(String sessionID, CountLock lock) { - synchronized (sessionMap) { - lock.reduce(); - if (lock.getCount() == 0) { - sessionMap.remove(sessionID); - } - } - } - - private CountLock getCountLock(String sessionID) { - CountLock lock; - synchronized (sessionMap) { - lock = (CountLock) sessionMap.get(sessionID); - if (lock == null) { - lock = new CountLock(); - sessionMap.put(sessionID, lock); - } - lock.increase(); - } - return lock; - } - - private void process0(HttpServletRequest req, HttpServletResponse res) throws Exception { - String dbManiXML = NetworkHelper.getHTTPRequestEncodeParameter(req, ARG_XMLCONF, false); - if (dbManiXML != null) { - BatchCommit2DBJavaScript commit2DBJS = (BatchCommit2DBJavaScript) GeneralXMLTools.readStringAsXMLable(dbManiXML); - Calculator ca = Calculator.createCalculator(); - RepositoryDeal repo = prepareRepository(req, ca); - NameSpace ns = ParameterMapNameSpace.create(WebUtils.parameters4SessionIDInfor(req)); - ca.pushNameSpace(ns); - Map feedbackMap = prepareFeedBackMap(req, ca); - boolean success = true; - JSONObject fr_submitinfo = new JSONObject(); - Map connectionMap = new HashMap(); - try { - String location = WebUtils.getHTTPRequestParameter(req, "location"); - ColumnRow cr = ColumnRow.valueOf(location); - for (int i = 0; i < commit2DBJS.getDBManipulation().size(); i++) { - if (cr != ColumnRow.ERROR) { - ca.setCurrentFromColumnRow(cr);// commit的时候, 也会去set关联格子的ColumnRow, 为防止上一个提交对下一个造成影响, 这边每次重置 - } - SubmitMain dbManipulation = (SubmitMain) commit2DBJS.getDBManipulation().get(i); - if (dbManipulation != null && dbManipulation.getDmlConfig() != null) { - String dbName = dbManipulation.getDBName(ca); - Connection conn = createConnection(dbName, connectionMap); - ca.putConnection(dbName, conn); - dbManipulation.doJob(ca); - connectionMap.put(dbName, conn); - } - } - } catch (Exception e) { - FRContext.getLogger().error(e.getMessage(), e); - Iterator iter = connectionMap.entrySet().iterator(); - while (iter.hasNext()) { - DBUtils.rollback((Connection) ((Map.Entry) iter.next()).getValue()); - } - success = false; - fr_submitinfo.put("failinfo", e.getMessage()); - } finally { - DBUtils.commitConnections(connectionMap); - } - ca.removeNameSpace(ns); - JSONObject jo = new JSONObject(); - createJo(req, jo, feedbackMap, success, fr_submitinfo, repo); - java.io.PrintWriter writer = WebUtils.createPrintWriter(res); - writer.write(jo.toString()); - writer.flush(); - writer.close(); - } - } - - private Connection createConnection(String dbName, Map connectionMap) throws Exception { - Connection conn = null; - if (connectionMap.containsKey(dbName)) { - return connectionMap.get(dbName); - } else { - NameDatabaseConnection db = new NameDatabaseConnection(dbName); - return db.createConnection(); - } - } - - private RepositoryDeal prepareRepository(HttpServletRequest req, Calculator ca) { - String sessionID = WebUtils.getHTTPRequestParameter(req, ARG_SESSIONID); - SessionIDInfor sessionIDInfor = SessionDealWith.getSessionIDInfor(sessionID); - - RepositoryDeal repo = null; - if (sessionIDInfor != null) { - repo = new RepositoryDeal(req, sessionIDInfor); - if (sessionIDInfor instanceof ReportSessionIDInfor) { - dealWithParaForCa(req, ca, (ReportSessionIDInfor) sessionIDInfor); - } - - NameSpace sessionNamespace = sessionIDInfor.asNameSpace(sessionID); - ca.pushNameSpace(sessionNamespace); - } - - return repo; - } - - private Map prepareFeedBackMap(HttpServletRequest req, Calculator ca) { - String feedback = WebUtils.getHTTPRequestParameter(req, "feedbackMap"); - Map feedbackMap = null; - if (StringUtils.isNotEmpty(feedback)) { - try { - feedbackMap = new JSONObject(feedback).toMap(); - } catch (JSONException e) { - FRContext.getLogger().error(e.getMessage()); - } - NameSpace feedbackNS = ParameterMapNameSpace.create(feedbackMap); - ca.pushNameSpace(feedbackNS); - } - - return feedbackMap; - } - - private void dealWithParaForCa(HttpServletRequest req, Calculator ca, ReportSessionIDInfor sessionIDInfor) { - ca.setAttribute(Calculator.SHEET_NUMBER_KEY, WebUtils.getHTTPRequestParameter(req, "sheetNum")); - sessionIDInfor.setUpAttribute4dbCommit(ca); - - // 提交入库可能用当前模板的参数 - NameSpace paras = ParameterMapNameSpace.create(sessionIDInfor.getParameterMap4Execute()); - ca.pushNameSpace(paras); - } - - private void createJo(HttpServletRequest req, JSONObject jo, Map feedbackMap, - boolean success, JSONObject fr_submitinfo, RepositoryDeal repo) throws Exception { - // 生成的时候没有encode的,用没有进行urldecode的方法获取callback语句,防止+和%出错 - String callBackXML = NetworkHelper.getHTTPRequestEncodeParameter(req, "callback", false); - JavaScript callBack = (JavaScript) GeneralXMLTools.readStringAsXMLable(callBackXML); - fr_submitinfo.put("success", success); - - if (callBack != null) { - dealWithSuccessPara(callBack, fr_submitinfo, repo); - if (feedbackMap != null) { - callBack.addParameterMap(feedbackMap); - } - jo.put("callback", new JSONFunction(new String[]{"res"}, callBack.createJS(repo), repo.getDevice())); - } - } - - private void dealWithSuccessPara(JavaScript callBack, JSONObject fr_submitinfo, RepositoryDeal repo) { - Map submitInfo = new HashMap(); - submitInfo.put(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); - if (callBack != null) { - callBack.addParameterMap(submitInfo); - ParameterProvider[] ps = new ParameterProvider[callBack.getParameters().length + 1]; - int len = callBack.getParameters().length; - for (int i = 0; i < len; i++) { - ps[i] = callBack.getParameters()[i]; - } - ps[len] = new Parameter(WebContentUtils.FR_SUBMITINFO, fr_submitinfo); - callBack.setParameters(ps); - } - - // if the parameter contains "fr_submitinfo" then recalculate it - ParameterProvider[] paras; - if (callBack != null) { - paras = callBack.getParameters(); - } else { - paras = new Parameter[0]; - } - Calculator ca = Calculator.createCalculator(); - if (repo != null) { - NameSpace ns = ParameterMapNameSpace.create(repo.getReportParameterMap()); - ca.pushNameSpace(ns); - } - ca.pushNameSpace(ParameterMapNameSpace.create(submitInfo)); - - for (int i = 0; i < paras.length; i++) { - Object obj = paras[i].getValue(); - if (obj instanceof Formula && needToRecalculate(paras[i])) { - try { - ((Formula) obj).setResult(ca.eval((Formula) obj)); - } catch (UtilEvalError utilEvalError) { - - } - } - } - } - - private boolean needToRecalculate(ParameterProvider p) { - return Utils.objectToString(p.getValue()).toLowerCase().indexOf(WebContentUtils.FR_SUBMITINFO) != -1; - } -} - - -class CountLock { - private int count; - - public void increase() { - count++; - } - - public void reduce() { - count--; - } - - public int getCount() { - return count; - } -} From 473bb799abba1bf962cdd546b401843eb554acc2 Mon Sep 17 00:00:00 2001 From: ju Date: Thu, 14 Dec 2017 16:24:30 +0800 Subject: [PATCH 26/67] =?UTF-8?q?REPORT-5885=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=8D=B8=E8=BD=BD=E2=80=94=E2=80=94frm=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E7=95=8C=E9=9D=A2=E5=9B=BE=E6=A0=87=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=88=B7=E6=96=B0=20=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=92=8C=E6=8F=92=E4=BB=B6=E5=8F=98=E6=9B=B4=E6=97=B6=E9=83=BD?= =?UTF-8?q?=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 5aa68bc63a..5b7a7bccc8 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java @@ -129,6 +129,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr GeneralContext.addEnvChangedListener(new EnvChangedListener() { @Override public void envChanged() { + DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); } From e26f3bbd522e956ddae2e01e0b166dbdda807f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Thu, 14 Dec 2017 19:32:29 +0800 Subject: [PATCH 27/67] =?UTF-8?q?MOBILE-7081=20=E4=BF=AE=E5=A4=8D9.0?= =?UTF-8?q?=E8=A1=A8=E5=8D=95body=E9=87=8C=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E6=8E=A7=E4=BB=B6=E9=A1=BA=E5=BA=8F=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/MobileWidgetTable.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java index 982f5aad0d..3188630689 100644 --- a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java +++ b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java @@ -258,8 +258,6 @@ public class MobileWidgetTable extends JTable { return new String[0][0]; } - body.setSorted(false); - if (body.getWidgetCount() > 0 && body.getWidget(0).acceptType(WAbsoluteBodyLayout.class)) { WAbsoluteBodyLayout absoluteBodyLayout = (WAbsoluteBodyLayout) ((WAbsoluteLayout.BoundsWidget) body.getWidget(0)).getWidget(); mobileWidgetList = absoluteBodyLayout.getOrderedMobileWidgetList(); @@ -272,7 +270,6 @@ public class MobileWidgetTable extends JTable { widgetName[i + 1][0] = mobileWidgetList.get(i); } - body.setSorted(true); return widgetName; } From 199a9931859268a8d9bb24298ee058d78440213c Mon Sep 17 00:00:00 2001 From: MoMeak Date: Fri, 15 Dec 2017 10:53:59 +0800 Subject: [PATCH 28/67] =?UTF-8?q?REPORT-6090=20=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=B6=85=E9=93=BE=E6=8E=A5-=E6=82=AC?= =?UTF-8?q?=E6=B5=AE=E7=AA=97=E5=9B=BE=E8=A1=A8=E5=92=8C=E8=B6=85=E9=93=BE?= =?UTF-8?q?=E6=8E=A5-=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E6=9C=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ChartHyperRelateFloatLinkPane.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java index 0ad4b8d321..c30e3af1c1 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java +++ b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperRelateFloatLinkPane.java @@ -19,6 +19,7 @@ import javax.swing.border.Border; import javax.swing.border.LineBorder; import javax.swing.border.TitledBorder; import java.awt.*; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -92,9 +93,16 @@ public class ChartHyperRelateFloatLinkPane extends AbstractHyperLinkPane Date: Fri, 15 Dec 2017 11:56:26 +0800 Subject: [PATCH 29/67] =?UTF-8?q?REPORT-6096=20Tab=E9=A1=B5=E4=B8=AD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9C=A8=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E5=90=8E=E4=BC=9A=E4=BD=8D=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/FormSelectionUtils.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java index ebf7328a2f..275691f880 100644 --- a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java @@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWScaleLayout; import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WTitleLayout; @@ -107,6 +108,7 @@ public class FormSelectionUtils { designer.showMessageDialog(Inter.getLocText("FR-Designer_Too_Large_To_Paste")); return; } + resetTabSub2RealSize(copiedCreator); boolean addSuccess = adapter.addBean(copiedCreator, point.x, point.y); if (addSuccess) { designer.getSelectionModel().getSelection().addSelectedCreator(copiedCreator); @@ -121,6 +123,27 @@ public class FormSelectionUtils { } + /** + * REPORT-6096 复制得到的是显示的大小,如果因屏幕分辨率问题存在缩放的话,显示大小和实际大小会有区别,粘贴后tab内部调整大小时会再次缩放导致问题。 + * 因此在粘贴之前将tab内部的组件调整成实际的大小。 + * + * @param copiedCreator 复制的组件 + */ + private static void resetTabSub2RealSize(XCreator copiedCreator) { + ArrayList childrenList = copiedCreator.getTargetChildrenList(); + if (!childrenList.isEmpty()) { + for (Object aChildrenList : childrenList) { + XWTabFitLayout tabLayout = (XWTabFitLayout) aChildrenList; + double percent = tabLayout.getContainerPercent(); + Component[] components = tabLayout.getComponents(); + for (Component component : components) { + Rectangle show = component.getBounds(); + component.setBounds(new Rectangle((int) (show.x * percent), (int) (show.y * percent), (int) (show.width * percent), (int) (show.height * percent))); + } + } + } + } + /** * 相对布局粘贴 */ @@ -178,9 +201,9 @@ public class FormSelectionUtils { */ private static Point getPasteLocation(AbstractLayoutAdapter layoutAdapter, XCreator copiedCreator, int x, int y) { //当宽度为奇数时 设置偏移 - int xoffset = (copiedCreator.getWidth() & 1) == 1 ? 1 : 0; + int xoffset = copiedCreator.getWidth() & 1; //当高度为奇数时 设置偏移 - int yoffset = (copiedCreator.getHeight() & 1) == 1 ? 1 : 0; + int yoffset = copiedCreator.getHeight() & 1; if (!layoutAdapter.accept(copiedCreator, x, y)) { XLayoutContainer container = layoutAdapter.getContainer(); From a5279b0a077611e53d73084304b99c3f0173710b Mon Sep 17 00:00:00 2001 From: MoMeak Date: Fri, 15 Dec 2017 17:15:13 +0800 Subject: [PATCH 30/67] =?UTF-8?q?REPORT-6048=20[=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8]=E7=BB=9D=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E7=BB=84=E4=BB=B6=E4=B8=8D=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XWAbsoluteLayout.java | 10 ++++------ .../creator/cardlayout/XWCardMainBorderLayout.java | 8 +++++++- .../ui/designer/component/WidgetAbsoluteBoundPane.java | 9 +++++++++ .../widget/ui/designer/component/WidgetBoundPane.java | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 852cdf1220..8e654b7886 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -171,16 +171,14 @@ public class XWAbsoluteLayout extends XLayoutContainer { tabLayout.updateBoundsWidget(); } } - BoundsWidget boundsWidget = (BoundsWidget) layout.getBoundsWidget(xCreator.toData()); - Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); } private Rectangle calculateBound(Rectangle rec, double pw, double ph) { Rectangle calRec = new Rectangle(0, 0, 0, 0); - calRec.x = (int) (rec.x / pw); - calRec.y = (int) (rec.y / ph); - calRec.width = (int) (rec.width / pw); - calRec.height = (int) (rec.height / ph); + calRec.x = (int) Math.round(rec.x / pw); + calRec.y = (int) Math.round(rec.y / ph); + calRec.width = (int) Math.round(rec.width / pw); + calRec.height = (int) Math.round(rec.height / ph); return calRec; } diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 8f60672eca..2e6d82fb3d 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -17,7 +17,6 @@ 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.*; @@ -274,4 +273,11 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ return this; } } + + /** + * data属性改变触发其他操作 + * + */ + public void firePropertyChange(){ + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java index 262e52588a..3b64c4a8e8 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java @@ -1,7 +1,11 @@ package com.fr.design.widget.ui.designer.component; import com.fr.design.designer.creator.XCreator; +import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.widget.WidgetBoundsPaneFactory; import com.fr.form.ui.container.WLayout; import com.fr.general.Inter; @@ -35,6 +39,8 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { @Override public void update() { + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + formDesigner.getSelectionModel().getSelection().backupBounds(); super.update(); Rectangle bounds = new Rectangle(creator.getBounds()); bounds.x = (int) x.getValue(); @@ -45,6 +51,9 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane { WLayout wabs = parent.toData(); wabs.setBounds(creator.toData(), bounds); creator.setBounds(bounds); + LayoutUtils.layoutContainer(creator); + XWAbsoluteLayout layout = (XWAbsoluteLayout) parent; + layout.updateBoundsWidget(creator); } @Override diff --git a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java index db2f634e93..9ca135f78a 100644 --- a/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java +++ b/designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java @@ -81,6 +81,7 @@ public class WidgetBoundPane extends BasicPane { public void fix() { Rectangle bounds = new Rectangle(creator.getBounds()); + creator.setBackupBound(creator.getBounds()); int w = (int) width.getValue(); int h = (int) height.getValue(); Rectangle rec = ComponentUtils.getRelativeBounds(parent); From 113f86e8ae80ce5e731ec6b02eb7fc74809b5a9a Mon Sep 17 00:00:00 2001 From: MoMeak Date: Fri, 15 Dec 2017 17:54:39 +0800 Subject: [PATCH 31/67] =?UTF-8?q?REPORT-6133=20[=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8]9.0=E5=AF=8C=E6=96=87=E6=9C=AC=E7=82=B9=E5=BC=80?= =?UTF-8?q?=E5=90=8E=E5=8F=96=E6=B6=88=E5=AF=8C=E6=96=87=E6=9C=AC=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E5=8F=B3=E4=BE=A7=E7=9A=84=E5=8D=95=E5=85=83=E6=A0=BC?= =?UTF-8?q?=E5=85=83=E7=B4=A0=E4=B8=AD=E5=8E=9F=E6=9C=AC=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E6=8C=89=E9=92=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/ElementCasePane.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/ElementCasePane.java b/designer/src/com/fr/design/mainframe/ElementCasePane.java index 46c363c380..547fdcf480 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePane.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePane.java @@ -522,15 +522,15 @@ public abstract class ElementCasePane extends Tar * 因为这边判断selection是一个selection,所以不会触发fireSelectionChanged */ public void setSelection(Selection selection) { - try { - //旧选中内容编辑器释放模板对象 - this.getCurrentEditor().release(); - } catch (UnsupportedOperationException e) { - FRLogger.getLogger().info("Nothing to release"); - } if (!ComparatorUtils.equals(this.selection, selection) || !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) { + try { + //旧选中内容编辑器释放模板对象 + this.getCurrentEditor().release(); + } catch (UnsupportedOperationException e) { + FRLogger.getLogger().info("Nothing to release"); + } this.selection = selection; fireSelectionChanged(); } From 32757ebd7a1a69d156902c19faf8d4b26936a88a Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 18 Dec 2017 11:31:49 +0800 Subject: [PATCH 32/67] =?UTF-8?q?REPORT-6096=20TAB=E9=A1=B5=E4=B8=AD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=9C=A8=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E5=90=8E=E4=BC=9A=E4=BD=8D=E7=A7=BB=20tab=E5=B5=8C=E5=A5=97?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/FormSelectionUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java index 275691f880..86a7536e2f 100644 --- a/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java +++ b/designer_form/src/com/fr/design/mainframe/FormSelectionUtils.java @@ -142,6 +142,13 @@ public class FormSelectionUtils { } } } + Component[] components = copiedCreator.getComponents(); + for (Component component : components) { + try { + resetTabSub2RealSize((XCreator) component); + } catch (ClassCastException ignored) { + } + } } /** From 568997cfb10bfd4a450a5af3c5bb31b636581ff4 Mon Sep 17 00:00:00 2001 From: vito Date: Mon, 18 Dec 2017 15:31:00 +0800 Subject: [PATCH 33/67] =?UTF-8?q?REPORT-6160=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E6=8E=A8=E8=8D=90=E9=A1=B5=E9=9D=A2=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginTask.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginTask.java b/designer_base/src/com/fr/design/extra/PluginTask.java index f91001cc7e..3e24f57bff 100644 --- a/designer_base/src/com/fr/design/extra/PluginTask.java +++ b/designer_base/src/com/fr/design/extra/PluginTask.java @@ -74,14 +74,22 @@ public class PluginTask extends Task { * 2.js字符串中的\n会导致js字符串变成多行,而js字符串不支持多行拼接 * 3.由JSONObject.toString()得到的字符串中html标签的属性会自动加上\造成替换难度加大, * 这边建议去除所有的html标签 - * + * 字符\在java中实际存储的是\\,替换字符串\\n, 需要用\\\\n; + * "\t"、"\n"、"\t" 转义成""; + * "\\"需要转换成"\\\"; + * * @param old 原始字符串 * @return 处理之后的字符串 */ private String trimText(String old) { if (StringUtils.isNotBlank(old)) { String b = filterHtmlTag(old); - return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); + return b.replaceAll("\\\\n", StringUtils.EMPTY) + .replaceAll("\\\\r", StringUtils.EMPTY) + .replaceAll("\\\\t", StringUtils.EMPTY) + .replaceAll("\"", "\\\\\"") + .replaceAll("\'", "\\\\\'") + .replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); } return StringUtils.EMPTY; } From 0a2407f7f5b3a466559c49f2dc39756f18a1425f Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 19 Dec 2017 09:14:37 +0800 Subject: [PATCH 34/67] =?UTF-8?q?CHART-1882=20=20=20=E5=A0=86=E7=A7=AF?= =?UTF-8?q?=E5=92=8C=E5=9D=90=E6=A0=87=E8=BD=B4=E7=95=8C=E9=9D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../column/VanChartCustomStackAndAxisConditionPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java index 708d4f4a33..3824cc2473 100644 --- a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -95,8 +95,10 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane(seriesStackAndAxis.getXAxisNamesArray()); - YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); + if (XAxis == null || YAxis == null) { + XAxis = new UIButtonGroup(seriesStackAndAxis.getXAxisNamesArray()); + YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); + } doLayoutPane(); XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex()); From baa0c4bd2f985b4634e125217e7c607a37a06a27 Mon Sep 17 00:00:00 2001 From: mengao <283296419@qq.com> Date: Tue, 19 Dec 2017 17:06:59 +0800 Subject: [PATCH 35/67] =?UTF-8?q?CHART-1882=20=20=20=E5=A0=86=E7=A7=AF?= =?UTF-8?q?=E5=92=8C=E5=9D=90=E6=A0=87=E8=BD=B4=E7=95=8C=E9=9D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VanChartCustomStackAndAxisConditionPane.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java index 3824cc2473..5bdd0829d8 100644 --- a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -31,6 +31,8 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane isStacked; protected UIButtonGroup isPercentStacked; + private ConditionAttr conditionAttr; + private LiteConditionPane liteConditionPane; public VanChartCustomStackAndAxisConditionPane() { @@ -94,11 +96,10 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane(seriesStackAndAxis.getXAxisNamesArray()); - YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); - } + XAxis = new UIButtonGroup(seriesStackAndAxis.getXAxisNamesArray()); + YAxis = new UIButtonGroup(seriesStackAndAxis.getYAxisNameArray()); doLayoutPane(); XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex()); @@ -125,7 +126,6 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane Date: Tue, 19 Dec 2017 18:24:09 +0800 Subject: [PATCH 36/67] =?UTF-8?q?CHART-1882=20=20=20=E5=A0=86=E7=A7=AF?= =?UTF-8?q?=E5=92=8C=E5=9D=90=E6=A0=87=E8=BD=B4=E7=95=8C=E9=9D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/column/VanChartCustomStackAndAxisConditionPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java index 5bdd0829d8..7f5429294e 100644 --- a/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java +++ b/designer_chart/src/com/fr/plugin/chart/column/VanChartCustomStackAndAxisConditionPane.java @@ -126,7 +126,7 @@ public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane Date: Thu, 21 Dec 2017 10:55:06 +0800 Subject: [PATCH 37/67] =?UTF-8?q?REPORT-6095=209.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=97=A5=E5=BF=97=20REPORT-6123=20=E5=8F=96=E8=89=B2=E6=A1=86?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=97=AE=E9=A2=98=20REPORT-6217=20=E3=80=909?= =?UTF-8?q?.0=E3=80=91=E6=9C=AC=E5=9C=B0=E5=88=87=E6=8D=A2=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=90=8E=E8=AE=BE=E8=AE=A1=E5=99=A8=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=BF=A1=E6=81=AF=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/loghandler/DesignerLogHandler.java | 10 +++++----- designer_base/src/com/fr/env/RemoteEnv.java | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 9a2aed712f..672fc988c9 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -6,11 +6,7 @@ import com.fr.base.FRContext; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogLevel; -import com.fr.general.FRLogger; -import com.fr.general.GeneralContext; -import com.fr.general.Inter; +import com.fr.general.*; import com.fr.log.LogHandler; import com.fr.stable.EnvChangedListener; import com.fr.stable.xml.LogRecordTimeProvider; @@ -159,6 +155,10 @@ public class DesignerLogHandler { logHandlerArea.printStackTrace(message, level, date); } + public void printRemoteLog(LogRecordTime logRecordTime) { + logHandlerArea.printStackTrace(logRecordTime); + } + private class LogHandlerArea extends JPanel { private static final long serialVersionUID = 8215630927304621660L; diff --git a/designer_base/src/com/fr/env/RemoteEnv.java b/designer_base/src/com/fr/env/RemoteEnv.java index 65733b1dfd..66da6253bf 100644 --- a/designer_base/src/com/fr/env/RemoteEnv.java +++ b/designer_base/src/com/fr/env/RemoteEnv.java @@ -25,6 +25,7 @@ import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.fun.DesignerEnvProcessor; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrameFileDealerPane; +import com.fr.design.mainframe.loghandler.DesignerLogHandler; import com.fr.file.CacheManager; import com.fr.file.DatasourceManager; import com.fr.file.DatasourceManagerProvider; @@ -1838,7 +1839,7 @@ public class RemoteEnv extends AbstractEnv { } LogRecordTime[] records = LogUtils.readXMLLogRecords(input); for (LogRecordTime logRecordTime : records) { - //TODO + DesignerLogHandler.getInstance().printRemoteLog(logRecordTime); } } From f48dfb6baacb3b2ba00c541d50d3d781b95da2f4 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 21 Dec 2017 11:03:50 +0800 Subject: [PATCH 38/67] =?UTF-8?q?REPORT-6123=20=E5=8F=96=E8=89=B2=E6=A1=86?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/style/color/ColorSelectDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java b/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java index 3d986fa718..02b742ad3f 100644 --- a/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java +++ b/designer_base/src/com/fr/design/style/color/ColorSelectDialog.java @@ -84,7 +84,7 @@ public class ColorSelectDialog extends MiddleChartDialog{ this.setLayout(new BorderLayout()); this.add(pane,BorderLayout.NORTH); this.setBasicDialogSize(545,500); - + this.setResizable(false); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); From da708fd8d3845e57525eeb4f90048f34fca19696 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 21 Dec 2017 13:45:06 +0800 Subject: [PATCH 39/67] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F-?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E5=B7=A5=E5=85=B7=E9=85=8D=E7=BD=AE=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/mainframe/loghandler/DesignerLogHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java index 672fc988c9..6a4f6b92f3 100644 --- a/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java +++ b/designer_base/src/com/fr/design/mainframe/loghandler/DesignerLogHandler.java @@ -6,7 +6,12 @@ import com.fr.base.FRContext; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.general.*; +import com.fr.general.ComparatorUtils; +import com.fr.general.FRLogLevel; +import com.fr.general.FRLogger; +import com.fr.general.GeneralContext; +import com.fr.general.Inter; +import com.fr.general.LogRecordTime; import com.fr.log.LogHandler; import com.fr.stable.EnvChangedListener; import com.fr.stable.xml.LogRecordTimeProvider; From dbdc5cbc065f9270a15f49cc7c152addaa9e84d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 22 Dec 2017 16:29:38 +0800 Subject: [PATCH 40/67] =?UTF-8?q?MOBILE-7257=20=E6=8A=8A=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E7=9A=84=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E5=9B=9E=E5=8E=BB=EF=BC=8C=E5=B7=B2=E7=BB=8F=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E8=BF=87=E6=B2=A1=E6=9C=89=E4=BB=A5=E5=89=8D=E7=9A=84bug?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/MobileWidgetTable.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java index 3188630689..0f0f3bd45e 100644 --- a/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java +++ b/designer_form/src/com/fr/design/mainframe/MobileWidgetTable.java @@ -247,31 +247,30 @@ public class MobileWidgetTable extends JTable { * @return String[][] 二维数组,[0][0]widgetName */ private String[][] getData() { - List mobileWidgetList = new ArrayList(); if (designer.isFormParaDesigner()) { return new String[0][0]; } - WSortLayout body = (WSortLayout) designer.getRootComponent().toData(); + //选择的控件 + XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator(); + Widget selectedModel = selectedCreator != null ? selectedCreator.toData() : null; - if (body == null) { + if (selectedModel == null) { return new String[0][0]; } - if (body.getWidgetCount() > 0 && body.getWidget(0).acceptType(WAbsoluteBodyLayout.class)) { - WAbsoluteBodyLayout absoluteBodyLayout = (WAbsoluteBodyLayout) ((WAbsoluteLayout.BoundsWidget) body.getWidget(0)).getWidget(); - mobileWidgetList = absoluteBodyLayout.getOrderedMobileWidgetList(); + // 选择的控件有两种类型,一种是WLayout,代表容器,一种是Widget,代表控件 + if (selectedModel.acceptType(WSortLayout.class)) { + List mobileWidgetList = ((WSortLayout) selectedModel).getOrderedMobileWidgetList(); + String[][] widgetName = new String[mobileWidgetList.size() + 1][1]; + widgetName[0][0] = Inter.getLocText("FR-Designer_WidgetOrder"); + for (int i = 0; i < mobileWidgetList.size(); i++) { + widgetName[i + 1][0] = mobileWidgetList.get(i); + } + return widgetName; } else { - mobileWidgetList = body.getOrderedMobileWidgetList(); - } - String[][] widgetName = new String[mobileWidgetList.size() + 1][1]; - widgetName[0][0] = Inter.getLocText("FR-Designer_WidgetOrder"); - for (int i = 0; i < mobileWidgetList.size(); i++) { - widgetName[i + 1][0] = mobileWidgetList.get(i); + return new String[0][0]; } - - return widgetName; - } public boolean isCollapsed() { From 03677be8966141d8afa319e0d2c32708da30ec59 Mon Sep 17 00:00:00 2001 From: zack Date: Fri, 22 Dec 2017 17:06:38 +0800 Subject: [PATCH 41/67] =?UTF-8?q?REPORT-5979=20=E5=A4=9A=E6=AC=A1=E5=AF=BC?= =?UTF-8?q?=E5=85=A5excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/webattr/EditToolBar.java | 1251 +++++++++-------- .../webattr/ReportWebWidgetConstants.java | 6 +- 2 files changed, 651 insertions(+), 606 deletions(-) diff --git a/designer/src/com/fr/design/webattr/EditToolBar.java b/designer/src/com/fr/design/webattr/EditToolBar.java index 938fd4509b..a8ebd932fc 100644 --- a/designer/src/com/fr/design/webattr/EditToolBar.java +++ b/designer/src/com/fr/design/webattr/EditToolBar.java @@ -34,13 +34,12 @@ import com.fr.report.web.button.Export; import com.fr.report.web.button.PDFPrint; import com.fr.report.web.button.Print; import com.fr.report.web.button.write.AppendColumnRow; +import com.fr.report.web.button.write.ExcelImport; import com.fr.report.web.button.write.Submit; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import javax.swing.*; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import java.awt.*; @@ -52,488 +51,512 @@ import java.util.Set; public class EditToolBar extends BasicPane { - private JWorkBook jwb; - private JList list; - private DefaultListModel listModel; - private JPanel right; - private CardLayout card; - private ButtonPane bp; - private ToolBarButton lastButton; - private Background background = null; - private UICheckBox defaultCheckBox; - - private ListSelectionListener listSelectionListener = new ListSelectionListener() { - public void valueChanged(ListSelectionEvent evt) { - if (lastButton != null) { - lastButton.setWidget(bp.update()); - } - if (list.getSelectedValue() instanceof ToolBarButton) { - lastButton = (ToolBarButton) list.getSelectedValue(); - if (lastButton.getWidget() instanceof Button) { - card.show(right, "button"); - bp.populate(lastButton.getWidget()); - } else { - bp.populate(lastButton.getWidget()); - card.show(right, "none"); - } - } - } - }; - - - private ActionListener actioner = new ActionListener() { - /** - * - */ - public void actionPerformed(ActionEvent arg0) { - final BackgroundPane backgroundPane = new BackgroundPane(); - BasicDialog dialog = backgroundPane.showWindow(DesignerContext.getDesignerFrame()); - backgroundPane.populate(EditToolBar.this.background); - dialog.addDialogActionListener(new DialogActionAdapter() { - public void doOk() { - EditToolBar.this.background = backgroundPane.update(); - if (EditToolBar.this.background != null) { - EditToolBar.this.defaultCheckBox.setSelected(false); - } - } - }); - dialog.setVisible(true); - } - }; - - public EditToolBar() { - initComponent(); - } - - /** - * 初始化 - */ - public void initComponent() { - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel left = FRGUIPaneFactory.createBorderLayout_S_Pane(); - listModel = new DefaultListModel(); - list = new JList(listModel); - list.setCellRenderer(render); - left.add(new JScrollPane(list), BorderLayout.CENTER); - if (listModel.getSize() > 0) { - list.setSelectedIndex(0); - } - - ToolBarDef toolbarDef = new ToolBarDef(); - toolbarDef.addShortCut(new MoveUpItemAction()); - toolbarDef.addShortCut(new MoveDownItemAction()); - toolbarDef.addShortCut(new RemoveAction()); - UIToolbar toolBar = ToolBarDef.createJToolBar(); - toolbarDef.updateToolBar(toolBar); - left.add(toolBar, BorderLayout.NORTH); - - right = FRGUIPaneFactory.createCardLayout_S_Pane(); - card = new CardLayout(); - right.setLayout(card); - bp = new ButtonPane(); - right.add("none", FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()); - right.add("button", bp); - - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right); - // splitPane.setDividerLocation(left.getMinimumSize().width); - splitPane.setDividerLocation(120); - this.add(splitPane); - list.addListSelectionListener(listSelectionListener); - JPanel backgroundPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - UIButton bgButton = new UIButton(Inter.getLocText(new String[]{"Background", "Set"})); - defaultCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Default", "Background"})); - bgButton.addActionListener(actioner); - backgroundPane.add(defaultCheckBox); - backgroundPane.add(bgButton); - backgroundPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText(new String[]{"Background", "Set"}))); - this.add(backgroundPane, BorderLayout.SOUTH); - } - - ListCellRenderer render = new DefaultListCellRenderer() { - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - - if (value instanceof ToolBarButton) { - ToolBarButton button = (ToolBarButton) value; - this.setText(button.getNameOption().optionName()); - this.setIcon(button.getNameOption().optionIcon()); - } - return this; - } - }; - - @Override - protected String title4PopupWindow() { - return Inter.getLocText("FR-Designer_Edit"); - } - - public void populate(FToolBar ftoolbar) { - this.populate(ftoolbar, null); - } - - public void populate(FToolBar ftoolbar, ToolBarButton button) { - if (ftoolbar == null) { - return; - } - for (int i = 0; i < ftoolbar.getButtonlist().size(); i++) { - listModel.addElement(ftoolbar.getButtonlist().get(i)); - } - this.list.validate(); - this.list.repaint(); - if (ftoolbar.getButtonlist().size() > 0) { - this.list.setSelectedIndex(0); - } - if (button != null) { - this.list.setSelectedValue(button, true); - } - this.background = ftoolbar.getBackground(); - - this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false); - } - - public FToolBar update() { - if (this.list.getSelectedIndex() > -1) { - for (int i = 0; i < listModel.getSize(); i++) { - this.list.setSelectedIndex(i); - ToolBarButton toolBarButton = (ToolBarButton) this.list.getSelectedValue(); - Widget widget = this.bp.update(); - toolBarButton.setWidget(widget); - if (widget instanceof Button) { - String iconname = ((Button) widget).getIconName(); - if (StringUtils.isNotBlank(iconname)) { - Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconname); - toolBarButton.setIcon(new ImageIcon(iimage)); - } - } - } - } - List list = new ArrayList(); - for (int i = 0; i < listModel.size(); i++) { - list.add((ToolBarButton) listModel.get(i)); - } - FToolBar ftoolBar = new FToolBar(); - ftoolBar.setButtonlist(list); - - ftoolBar.setDefault(this.defaultCheckBox.isSelected()); - if (!ftoolBar.isDefault()) { - ftoolBar.setBackground(this.background); - } - return ftoolBar; - } - - private class MoveUpItemAction extends UpdateAction { - public MoveUpItemAction() { - this.setName(Inter.getLocText("Utils-Move_Up")); - this.setMnemonic('U'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); - } - - /** - * - */ - public void actionPerformed(ActionEvent evt) { - int selectedIndex = list.getSelectedIndex(); - if (selectedIndex == -1) { - return; - } - - // 上移 - if (selectedIndex > 0) { - DefaultListModel listModel = (DefaultListModel) list.getModel(); - - Object selecteObj1 = listModel.get(selectedIndex - 1); - listModel.set(selectedIndex - 1, listModel.get(selectedIndex)); - listModel.set(selectedIndex, selecteObj1); - - list.setSelectedIndex(selectedIndex - 1); - list.ensureIndexIsVisible(selectedIndex - 1); - list.validate(); - } - } - } - - private class MoveDownItemAction extends UpdateAction { - public MoveDownItemAction() { - this.setName(Inter.getLocText("Utils-Move_Down")); - this.setMnemonic('D'); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); - } - - /** - * - */ - public void actionPerformed(ActionEvent evt) { - int selectedIndex = list.getSelectedIndex(); - if (selectedIndex == -1) { - return; - } - - // 下移 - if (selectedIndex == -1) { - return; - } - - if (selectedIndex < list.getModel().getSize() - 1) { - DefaultListModel listModel = (DefaultListModel) list.getModel(); - - Object selecteObj1 = listModel.get(selectedIndex + 1); - listModel.set(selectedIndex + 1, listModel.get(selectedIndex)); - listModel.set(selectedIndex, selecteObj1); - - list.setSelectedIndex(selectedIndex + 1); - list.ensureIndexIsVisible(selectedIndex + 1); - list.validate(); - } - } - } - - public class RemoveAction extends UpdateAction { - public RemoveAction() { - this.setName(Inter.getLocText("FR-Designer_Delete")); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); - } - - /** - * 动作 - * @param e 事件 - */ - public void actionPerformed(ActionEvent e) { - int i = list.getSelectedIndex(); - if (i < 0 || !(listModel.getElementAt(i) instanceof ToolBarButton)) { - return; - } - int val = JOptionPane.showConfirmDialog(EditToolBar.this, Inter.getLocText("FR-Designer_Are_You_Sure_To_Delete_The_Data") + "?", "Message", JOptionPane.YES_NO_OPTION); - if (val != JOptionPane.YES_OPTION) { - return; - } - listModel.removeElementAt(i); - list.validate(); - if (listModel.size() > 0) { - list.setSelectedIndex(0); - } else { - card.show(right, "none"); - } - } - } - - public class ButtonPane extends BasicPane { - private CardLayout card; - private JPanel centerPane; - private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word, - flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit, isCurSheet; - private UIBasicSpinner count; - private Widget widget; - private UITextField nameField; - private IconDefinePane iconPane; - private UIButton button; - private JavaScriptActionPane javaScriptPane; - private ExportToolBarProvider[] exportToolBarProviders; - - private ActionListener actionListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - if (isVerify.isSelected()) { - failSubmit.setVisible(true); - } else { - failSubmit.setVisible(false); - failSubmit.setSelected(false); - } - } - }; - - public ButtonPane() { - this.initComponents(); - } - - /** - * 初始化元素 - */ - public void initComponents() { - Set set = ExtraDesignClassManager.getInstance().getArray(ExportToolBarProvider.XML_TAG); - exportToolBarProviders = set.toArray(new ExportToolBarProvider[set.size()]); - this.setLayout(FRGUIPaneFactory.createBorderLayout()); - JPanel north = FRGUIPaneFactory.createBorderLayout_S_Pane(); - icon = new UICheckBox(Inter.getLocText("FR-Designer_Show_Icon")); - text = new UICheckBox(Inter.getLocText("FR-Designer_Show_Text")); - - north.add(icon, BorderLayout.NORTH); - north.add(text, BorderLayout.CENTER); - - nameField = new UITextField(8); - iconPane = new IconDefinePane(); - javaScriptPane = JavaScriptActionPane.createDefault(); - - double p = TableLayout.PREFERRED; - double rowSize[] = {p, p}; - double columnSize[] = {p, p}; - - Component[][] coms = new Component[][]{{new UILabel(Inter.getLocText(new String[]{"Widget", "Printer-Alias"}) + ":"), nameField}, {new UILabel(Inter.getLocText(new String[]{"Widget", "Icon"}) + ":"), iconPane}}; - - JPanel nameIconPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize); - - north.add(nameIconPane, BorderLayout.SOUTH); - - north.setBorder(BorderFactory.createTitledBorder(Inter.getLocText(new String[]{"Form-Button", "Property", "Set"}))); - this.add(north, BorderLayout.NORTH); - JPanel none = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); - centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); - card = new CardLayout(); - centerPane.setLayout(card); - centerPane.add("custom", getCustomPane()); - centerPane.add("export", getExport()); - centerPane.add("print", getPrint()); - centerPane.add("none", none); - centerPane.add("pdfprint", getPdfPrintSetting()); - // centerPane.add("editexcel", editExcel); - centerPane.add(getCpane(), "appendcount"); - centerPane.add(getSubmitPane(), "submit"); + private JWorkBook jwb; + private JList list; + private DefaultListModel listModel; + private JPanel right; + private CardLayout card; + private ButtonPane bp; + private ToolBarButton lastButton; + private Background background = null; + private UICheckBox defaultCheckBox; + + private ListSelectionListener listSelectionListener = new ListSelectionListener() { + public void valueChanged(ListSelectionEvent evt) { + if (lastButton != null) { + lastButton.setWidget(bp.update()); + } + if (list.getSelectedValue() instanceof ToolBarButton) { + lastButton = (ToolBarButton) list.getSelectedValue(); + if (lastButton.getWidget() instanceof Button) { + card.show(right, "button"); + bp.populate(lastButton.getWidget()); + } else { + bp.populate(lastButton.getWidget()); + card.show(right, "none"); + } + } + } + }; + + + private ActionListener actioner = new ActionListener() { + /** + * + */ + public void actionPerformed(ActionEvent arg0) { + final BackgroundPane backgroundPane = new BackgroundPane(); + BasicDialog dialog = backgroundPane.showWindow(DesignerContext.getDesignerFrame()); + backgroundPane.populate(EditToolBar.this.background); + dialog.addDialogActionListener(new DialogActionAdapter() { + public void doOk() { + EditToolBar.this.background = backgroundPane.update(); + if (EditToolBar.this.background != null) { + EditToolBar.this.defaultCheckBox.setSelected(false); + } + } + }); + dialog.setVisible(true); + } + }; + + public EditToolBar() { + initComponent(); + } + + /** + * 初始化 + */ + public void initComponent() { + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel left = FRGUIPaneFactory.createBorderLayout_S_Pane(); + listModel = new DefaultListModel(); + list = new JList(listModel); + list.setCellRenderer(render); + left.add(new JScrollPane(list), BorderLayout.CENTER); + if (listModel.getSize() > 0) { + list.setSelectedIndex(0); + } + + ToolBarDef toolbarDef = new ToolBarDef(); + toolbarDef.addShortCut(new MoveUpItemAction()); + toolbarDef.addShortCut(new MoveDownItemAction()); + toolbarDef.addShortCut(new RemoveAction()); + UIToolbar toolBar = ToolBarDef.createJToolBar(); + toolbarDef.updateToolBar(toolBar); + left.add(toolBar, BorderLayout.NORTH); + + right = FRGUIPaneFactory.createCardLayout_S_Pane(); + card = new CardLayout(); + right.setLayout(card); + bp = new ButtonPane(); + right.add("none", FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane()); + right.add("button", bp); + + JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right); + // splitPane.setDividerLocation(left.getMinimumSize().width); + splitPane.setDividerLocation(120); + this.add(splitPane); + list.addListSelectionListener(listSelectionListener); + JPanel backgroundPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + UIButton bgButton = new UIButton(Inter.getLocText(new String[]{"Background", "Set"})); + defaultCheckBox = new UICheckBox(Inter.getLocText(new String[]{"Default", "Background"})); + bgButton.addActionListener(actioner); + backgroundPane.add(defaultCheckBox); + backgroundPane.add(bgButton); + backgroundPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText(new String[]{"Background", "Set"}))); + this.add(backgroundPane, BorderLayout.SOUTH); + } + + ListCellRenderer render = new DefaultListCellRenderer() { + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + + if (value instanceof ToolBarButton) { + ToolBarButton button = (ToolBarButton) value; + this.setText(button.getNameOption().optionName()); + this.setIcon(button.getNameOption().optionIcon()); + } + return this; + } + }; + + @Override + protected String title4PopupWindow() { + return Inter.getLocText("FR-Designer_Edit"); + } + + public void populate(FToolBar ftoolbar) { + this.populate(ftoolbar, null); + } + + public void populate(FToolBar ftoolbar, ToolBarButton button) { + if (ftoolbar == null) { + return; + } + for (int i = 0; i < ftoolbar.getButtonlist().size(); i++) { + listModel.addElement(ftoolbar.getButtonlist().get(i)); + } + this.list.validate(); + this.list.repaint(); + if (ftoolbar.getButtonlist().size() > 0) { + this.list.setSelectedIndex(0); + } + if (button != null) { + this.list.setSelectedValue(button, true); + } + this.background = ftoolbar.getBackground(); + + this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false); + } + + public FToolBar update() { + if (this.list.getSelectedIndex() > -1) { + for (int i = 0; i < listModel.getSize(); i++) { + this.list.setSelectedIndex(i); + ToolBarButton toolBarButton = (ToolBarButton) this.list.getSelectedValue(); + Widget widget = this.bp.update(); + toolBarButton.setWidget(widget); + if (widget instanceof Button) { + String iconname = ((Button) widget).getIconName(); + if (StringUtils.isNotBlank(iconname)) { + Image iimage = WidgetManager.getProviderInstance().getIconManager().getIconImage(iconname); + toolBarButton.setIcon(new ImageIcon(iimage)); + } + } + } + } + List list = new ArrayList(); + for (int i = 0; i < listModel.size(); i++) { + list.add((ToolBarButton) listModel.get(i)); + } + FToolBar ftoolBar = new FToolBar(); + ftoolBar.setButtonlist(list); + + ftoolBar.setDefault(this.defaultCheckBox.isSelected()); + if (!ftoolBar.isDefault()) { + ftoolBar.setBackground(this.background); + } + return ftoolBar; + } + + private class MoveUpItemAction extends UpdateAction { + public MoveUpItemAction() { + this.setName(Inter.getLocText("Utils-Move_Up")); + this.setMnemonic('U'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/up.png")); + } + + /** + * + */ + public void actionPerformed(ActionEvent evt) { + int selectedIndex = list.getSelectedIndex(); + if (selectedIndex == -1) { + return; + } + + // 上移 + if (selectedIndex > 0) { + DefaultListModel listModel = (DefaultListModel) list.getModel(); + + Object selecteObj1 = listModel.get(selectedIndex - 1); + listModel.set(selectedIndex - 1, listModel.get(selectedIndex)); + listModel.set(selectedIndex, selecteObj1); + + list.setSelectedIndex(selectedIndex - 1); + list.ensureIndexIsVisible(selectedIndex - 1); + list.validate(); + } + } + } + + private class MoveDownItemAction extends UpdateAction { + public MoveDownItemAction() { + this.setName(Inter.getLocText("Utils-Move_Down")); + this.setMnemonic('D'); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/down.png")); + } + + /** + * + */ + public void actionPerformed(ActionEvent evt) { + int selectedIndex = list.getSelectedIndex(); + if (selectedIndex == -1) { + return; + } + + // 下移 + if (selectedIndex == -1) { + return; + } + + if (selectedIndex < list.getModel().getSize() - 1) { + DefaultListModel listModel = (DefaultListModel) list.getModel(); + + Object selecteObj1 = listModel.get(selectedIndex + 1); + listModel.set(selectedIndex + 1, listModel.get(selectedIndex)); + listModel.set(selectedIndex, selecteObj1); + + list.setSelectedIndex(selectedIndex + 1); + list.ensureIndexIsVisible(selectedIndex + 1); + list.validate(); + } + } + } + + public class RemoveAction extends UpdateAction { + public RemoveAction() { + this.setName(Inter.getLocText("FR-Designer_Delete")); + this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png")); + } + + /** + * 动作 + * + * @param e 事件 + */ + public void actionPerformed(ActionEvent e) { + int i = list.getSelectedIndex(); + if (i < 0 || !(listModel.getElementAt(i) instanceof ToolBarButton)) { + return; + } + int val = JOptionPane.showConfirmDialog(EditToolBar.this, Inter.getLocText("FR-Designer_Are_You_Sure_To_Delete_The_Data") + "?", "Message", JOptionPane.YES_NO_OPTION); + if (val != JOptionPane.YES_OPTION) { + return; + } + listModel.removeElementAt(i); + list.validate(); + if (listModel.size() > 0) { + list.setSelectedIndex(0); + } else { + card.show(right, "none"); + } + } + } + + public class ButtonPane extends BasicPane { + private CardLayout card; + private JPanel centerPane; + private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word, + flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit, + isCurSheet, excelImClean, excelImCover, excelImAppend, excelImCust; + private UIBasicSpinner count; + private Widget widget; + private UITextField nameField; + private IconDefinePane iconPane; + private UIButton button; + private JavaScriptActionPane javaScriptPane; + private ExportToolBarProvider[] exportToolBarProviders; + + private ActionListener actionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (isVerify.isSelected()) { + failSubmit.setVisible(true); + } else { + failSubmit.setVisible(false); + failSubmit.setSelected(false); + } + } + }; + + public ButtonPane() { + this.initComponents(); + } + + /** + * 初始化元素 + */ + public void initComponents() { + Set set = ExtraDesignClassManager.getInstance().getArray(ExportToolBarProvider.XML_TAG); + exportToolBarProviders = set.toArray(new ExportToolBarProvider[set.size()]); + this.setLayout(FRGUIPaneFactory.createBorderLayout()); + JPanel north = FRGUIPaneFactory.createBorderLayout_S_Pane(); + icon = new UICheckBox(Inter.getLocText("FR-Designer_Show_Icon")); + text = new UICheckBox(Inter.getLocText("FR-Designer_Show_Text")); + + north.add(icon, BorderLayout.NORTH); + north.add(text, BorderLayout.CENTER); + + nameField = new UITextField(8); + iconPane = new IconDefinePane(); + javaScriptPane = JavaScriptActionPane.createDefault(); + + double p = TableLayout.PREFERRED; + double rowSize[] = {p, p}; + double columnSize[] = {p, p}; + + Component[][] coms = new Component[][]{{new UILabel(Inter.getLocText(new String[]{"Widget", "Printer-Alias"}) + ":"), nameField}, {new UILabel(Inter.getLocText(new String[]{"Widget", "Icon"}) + ":"), iconPane}}; + + JPanel nameIconPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize); + + north.add(nameIconPane, BorderLayout.SOUTH); + + north.setBorder(BorderFactory.createTitledBorder(Inter.getLocText(new String[]{"Form-Button", "Property", "Set"}))); + this.add(north, BorderLayout.NORTH); + JPanel none = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); + centerPane = FRGUIPaneFactory.createCardLayout_S_Pane(); + card = new CardLayout(); + centerPane.setLayout(card); + centerPane.add("custom", getCustomPane()); + centerPane.add("export", getExport()); + centerPane.add("import", getImport()); + centerPane.add("print", getPrint()); + centerPane.add("none", none); + centerPane.add("pdfprint", getPdfPrintSetting()); + // centerPane.add("editexcel", editExcel); + centerPane.add(getCpane(), "appendcount"); + centerPane.add(getSubmitPane(), "submit"); Set extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); for (ExtraButtonToolBarProvider provider : extraButtonSet) { provider.updateCenterPane(centerPane); } - this.add(centerPane, BorderLayout.CENTER); - } - - - private JPanel getCustomPane() { - JPanel customPane = FRGUIPaneFactory.createCenterFlowInnerContainer_S_Pane(); - - button = new UIButton(Inter.getLocText("FR-Designer_User_Defined_Event")); - customPane.add(button); - customPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("FR-Designer_Edit") + "JS", null)); - button.addActionListener(l); - return customPane; - } - - private JPanel getExport() { - JPanel export = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane(); - // export.setLayout(new BoxLayout(export, BoxLayout.Y_AXIS)); - pdf = new UICheckBox(Inter.getLocText("FR-Designer_Output_PDF")); - excelP = new UICheckBox(Inter.getLocText("FR-Designer-Output_Excel_Page")); - excelO = new UICheckBox(Inter.getLocText("FR-Designer-Output_Excel_Simple")); - excelS = new UICheckBox(Inter.getLocText("FR-Designer-Output_Excel_Sheet")); - word = new UICheckBox(Inter.getLocText("FR-Designer_Output_Word")); - image = new UICheckBox(Inter.getLocText("FR-Designer_Image")); - export.add(pdf); - export.add(Box.createVerticalStrut(2)); - export.add(excelP); - export.add(Box.createVerticalStrut(2)); - export.add(excelO); - export.add(Box.createVerticalStrut(2)); - export.add(excelS); - export.add(Box.createVerticalStrut(2)); - export.add(word); - export.add(Box.createVerticalStrut(2)); - export.add(image); - for(int i=0; i extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); for (ExtraButtonToolBarProvider provider : extraButtonSet) { @@ -541,137 +564,157 @@ public class EditToolBar extends BasicPane { } } - private void populateAppendColumnRow(){ - card.show(centerPane, "appendcount"); - count.setValue(((AppendColumnRow) widget).getCount()); - } - - private void populateExport(){ - card.show(centerPane, "export"); - Export export = (Export) widget; - this.pdf.setSelected(export.isPdfAvailable()); - this.excelP.setSelected(export.isExcelPAvailable()); - this.excelO.setSelected(export.isExcelOAvailable()); - this.excelS.setSelected(export.isExcelSAvailable()); - this.word.setSelected(export.isWordAvailable()); - this.image.setSelected(export.isImageAvailable()); - if(exportToolBarProviders != null){ - for(int i=0; i extraButtonSet = ExtraDesignClassManager.getInstance().getArray(ExtraButtonToolBarProvider.XML_TAG); for (ExtraButtonToolBarProvider provider : extraButtonSet) { provider.update(widget); } - return widget; - } - - private void updateDefault(){ - ((Button) widget).setShowIcon(this.icon.isSelected()); - ((Button) widget).setShowText(this.text.isSelected()); - ((Button) widget).setText(this.nameField.getText()); - ((Button) widget).setIconName(this.iconPane.update()); - } - - private void updateSubmit(){ - Submit submit = ((Submit) widget); - submit.setVerify(this.isVerify.isSelected()); - submit.setFailVerifySubmit(this.failSubmit.isSelected()); - submit.setOnlySubmitSelect(this.isCurSheet.isSelected()); - } - - private void updatePrint(){ - Print print = (Print) widget; - print.setAppletPrint(this.appletPrint.isSelected()); - print.setFlashPrint(this.flashPrint.isSelected()); - print.setPDFPrint(this.pdfPrint.isSelected()); - print.setServerPrint(this.serverPrint.isSelected()); - } - - private void updateExport(){ - Export export = (Export) widget; - export.setPdfAvailable(this.pdf.isSelected()); - export.setExcelPAvailable(this.excelP.isSelected()); - export.setExcelOAvailable(this.excelO.isSelected()); - export.setExcelSAvailable(this.excelS.isSelected()); - export.setWordAvailable(this.word.isSelected()); - export.setImageAvailable(this.image.isSelected()); - if(exportToolBarProviders != null){ - for(int i=0; i Date: Mon, 25 Dec 2017 11:37:14 +0800 Subject: [PATCH 42/67] =?UTF-8?q?REPORT-5979=20=E5=AF=BC=E5=85=A5=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=8F=A6=E5=A4=96=E5=8D=95=E7=8B=AC=E6=8F=90=E4=BE=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/webattr/ReportWebWidgetConstants.java | 12 +++++++++++- .../src/com/fr/design/webattr/ToolBarDragPane.java | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java b/designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java index a4b9a32598..12dd2dcb76 100644 --- a/designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java +++ b/designer/src/com/fr/design/webattr/ReportWebWidgetConstants.java @@ -32,7 +32,8 @@ public class ReportWebWidgetConstants { public static WidgetOption[] getWriteToolBarInstance() { return new WidgetOption[]{SUBMIT, VERIFY, EMAIL, EXPORT, PDF, EXCELP, EXCELO, EXCELS, WORD, PRINT, FLASHPRINT, APPLETPRINT, PDFPRINT, IMPORTEXCELDATA, SHOWCELLVALUE, - APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED, IMPORTEXCEL}; + APPENDCOLUMNROW, DELETECOLUMNROW, SETPRINTEROFFSET, WRITEOFFLINEHTML, CUSTOM_BUTTON, WRITESTASH, WRITESTASHCLEAR, IMPORTEXCELDATA_CUSTOMIZED, + IMPORTEXCEL, IMPORTEXCEL_COVER, IMPORTEXCEL_CLEAN, IMPORTEXCEL_APPEND}; } public static WidgetOption[] getFormToolBarInstance() { @@ -151,4 +152,13 @@ public class ReportWebWidgetConstants { //Excel导入 public static final WidgetOption IMPORTEXCEL= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Repeat"), BaseUtils.readIcon("/com/fr/web/images/excel.png"), ExcelImport.class); + //Excel导入_覆盖 + public static final WidgetOption IMPORTEXCEL_COVER= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Cover"), + BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelCover.class); + //Excel导入_清空 + public static final WidgetOption IMPORTEXCEL_CLEAN= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Clean"), + BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelClean.class); + //Excel导入_增量 + public static final WidgetOption IMPORTEXCEL_APPEND= WidgetOptionFactory.createByWidgetClass(Inter.getLocText("FR-Engine_Excel_Import_Append"), + BaseUtils.readIcon("/com/fr/web/images/excel.png"), ImExcelAppend.class); } \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/ToolBarDragPane.java b/designer/src/com/fr/design/webattr/ToolBarDragPane.java index f6d07cc37b..7b760f7f33 100644 --- a/designer/src/com/fr/design/webattr/ToolBarDragPane.java +++ b/designer/src/com/fr/design/webattr/ToolBarDragPane.java @@ -34,7 +34,7 @@ import java.awt.image.ImageObserver; public class ToolBarDragPane extends WidgetToolBarPane { private static final int COLUMN = 4; - private int row = 6; + private int row = 7; private DefaultTableModel toolbarButtonTableModel; private JTable layoutTable; private UICheckBox isUseToolBarCheckBox = new UICheckBox(Inter.getLocText("FR-Designer_Use_ToolBar") + ":"); // 是否使用工具栏 From 9b84c7761eb42218bb27c439239cef06efe9cb19 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 26 Dec 2017 10:33:13 +0800 Subject: [PATCH 43/67] =?UTF-8?q?REPORT-6245=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=82=AC=E6=B5=AE=E5=85=83=E7=B4=A0=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A1=AE=E5=AE=9A=EF=BC=8C=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=8A=9B=E9=94=99=20=E4=BC=98=E5=8C=96=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=A8=A1=E6=9D=BF=E9=80=9F=E5=BA=A6=E6=97=B6=E5=9B=9E?= =?UTF-8?q?=E9=80=80=E4=BA=86=20REPORT-5084=E7=9A=84pr=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/edit/EditFloatElementNameAction.java | 2 +- .../src/com/fr/design/mainframe/ElementCasePaneDelegate.java | 4 +--- designer/src/com/fr/design/widget/WidgetEventPane.java | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/designer/src/com/fr/design/actions/edit/EditFloatElementNameAction.java b/designer/src/com/fr/design/actions/edit/EditFloatElementNameAction.java index 6f235307e1..15a0b07d18 100644 --- a/designer/src/com/fr/design/actions/edit/EditFloatElementNameAction.java +++ b/designer/src/com/fr/design/actions/edit/EditFloatElementNameAction.java @@ -39,7 +39,7 @@ public class EditFloatElementNameAction extends FloatSelectionAction { if (report.getFloatElement(name) == null) { selectedFloatElement.setName(name); } - reportPane.setSelection(new FloatSelection(name)); + ((FloatSelection) reportPane.getSelection()).setFloatName(name); } }); nameDialog.setVisible(true); diff --git a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java index 8d25463ab8..cc57b7a852 100644 --- a/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java +++ b/designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java @@ -75,9 +75,7 @@ public class ElementCasePaneDelegate extends ElementCasePane { EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); return; } - if (DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) { - CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); - } + CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this); QuickEditorRegion.getInstance().populate(getCurrentEditor()); JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); diff --git a/designer/src/com/fr/design/widget/WidgetEventPane.java b/designer/src/com/fr/design/widget/WidgetEventPane.java index f1342f9dea..f1139210cb 100644 --- a/designer/src/com/fr/design/widget/WidgetEventPane.java +++ b/designer/src/com/fr/design/widget/WidgetEventPane.java @@ -91,7 +91,7 @@ public class WidgetEventPane extends ObjectUIControlPane { @Override protected DBManipulationPane createDBManipulationPane() { - if(epane == null) { + if(epane == null && DesignerContext.getDesignerFrame().getSelectedJTemplate() != null) { return autoCreateDBManipulationInWidgetEventPane(); } From 96b5a506a0fdcc5465b2fcebcf69c074b5016bdb Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 26 Dec 2017 11:20:20 +0800 Subject: [PATCH 44/67] =?UTF-8?q?=E6=97=A0jira=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E8=BF=99=E6=AE=B5=E4=BB=A3=E7=A0=81=EF=BC=8C=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E5=9C=B0=E6=96=B9=E6=94=B9=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/mainframe/DesignerFrame.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java index 92489c598a..1218f65cad 100644 --- a/designer_base/src/com/fr/design/mainframe/DesignerFrame.java +++ b/designer_base/src/com/fr/design/mainframe/DesignerFrame.java @@ -944,8 +944,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta } else { this.addAndActivateJTemplate(jt); } - //REPORT-5084:激活后刷新一下右側面板 - jt.refreshEastPropertiesPane(); } /** From 1f699b0ee325dc5b550b0b9393cf519c3f8626d9 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 28 Dec 2017 11:10:28 +0800 Subject: [PATCH 45/67] =?UTF-8?q?REPORT-6186=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=97=EF=BC=8C=E7=AC=AC=E4=B8=80=E6=AC=A1=E7=82=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=97=E4=B8=8B=E6=8B=89=E6=A1=86=EF=BC=8C?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BC=9A=E8=87=AA=E5=8A=A8=E6=94=B6=E5=9B=9E?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E5=86=8D=E6=AC=A1=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/dscolumn/SelectedDataColumnPane.java | 13 ++++++++++++- .../com/fr/design/gui/icombobox/LazyComboBox.java | 9 +++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index bb52b766c3..0c3f9ad9c8 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -26,6 +26,7 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; +import javax.swing.SwingWorker; import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -262,7 +263,17 @@ public class SelectedDataColumnPane extends BasicPane { tableNameComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { - columnNameComboBox.setLoaded(false); + if (e.getStateChange() == ItemEvent.SELECTED) { + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + columnNameComboBox.loadInstant(); + return null; + } + + }.execute(); + } } }); tableNameComboBox.setPreferredSize(new Dimension(100, 20)); diff --git a/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java b/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java index 2d69c2fc83..43711b0118 100644 --- a/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer_base/src/com/fr/design/gui/icombobox/LazyComboBox.java @@ -59,14 +59,11 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen } /** - * 通过调用该方法,在点击下拉框按钮之前就加载好数据 + * 通过调用该方法,在点击下拉框按钮之前就加载好数据,不需要出现loading了 */ public void loadInstant() { - if (loaded) { - return; - } - setModel(new DefaultComboBoxModel(load())); - loaded = true; + setLoaded(true); + loadList(); } @Override From 742aaf4a1b0ab81cc965778e173f1c71da9867a4 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 28 Dec 2017 12:34:56 +0800 Subject: [PATCH 46/67] =?UTF-8?q?REPORT-6186=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=EF=BC=8C=E5=8D=95=E5=85=83=E6=A0=BC=E6=B7=BB=E5=8A=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=88=97=EF=BC=8C=E7=AC=AC=E4=B8=80=E6=AC=A1=E7=82=B9?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=97=E4=B8=8B=E6=8B=89=E6=A1=86=EF=BC=8C?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BC=9A=E8=87=AA=E5=8A=A8=E6=94=B6=E5=9B=9E?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E5=86=8D=E6=AC=A1=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=89=8D=E8=83=BD=E9=80=89=E6=8B=A9=E6=95=B0=E6=8D=AE=E5=88=97?= =?UTF-8?q?=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/dscolumn/SelectedDataColumnPane.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index 0c3f9ad9c8..4a269baab5 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -26,7 +26,6 @@ import com.fr.report.cell.cellattr.core.group.DSColumn; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; -import javax.swing.SwingWorker; import javax.swing.DefaultComboBoxModel; import javax.swing.JPanel; import java.awt.BorderLayout; @@ -38,6 +37,8 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.regex.Pattern; /** @@ -260,19 +261,19 @@ public class SelectedDataColumnPane extends BasicPane { protected void initTableNameComboBox() { tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); + ExecutorService executorService = Executors.newSingleThreadExecutor(); tableNameComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { - new SwingWorker() { - + executorService.execute(new Runnable() { @Override - protected Void doInBackground() throws Exception { - columnNameComboBox.loadInstant(); - return null; + public void run() { + synchronized (columnNameComboBox) { + columnNameComboBox.loadInstant(); + } } - - }.execute(); + }); } } }); From b573eb5e1bc436e69ab46a909e74e9b070a713dc Mon Sep 17 00:00:00 2001 From: MoMeak Date: Thu, 28 Dec 2017 16:12:03 +0800 Subject: [PATCH 47/67] =?UTF-8?q?=E6=97=A0jira=EF=BC=8C=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index 4a269baab5..9332301a63 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -261,7 +261,7 @@ public class SelectedDataColumnPane extends BasicPane { protected void initTableNameComboBox() { tableNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); - ExecutorService executorService = Executors.newSingleThreadExecutor(); + final ExecutorService executorService = Executors.newSingleThreadExecutor(); tableNameComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { From 537822e070fd655d8ae42ddfb753651f073866d0 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 29 Dec 2017 09:14:34 +0800 Subject: [PATCH 48/67] =?UTF-8?q?REPORT-6233=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=BA=90=E7=A0=81=E7=9A=84javadoc=E8=BE=93=E5=87=BA=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E5=8C=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/actions/package.html | 5 +++++ designer/src/com/fr/design/cell/editor/package.html | 8 ++------ designer/src/com/fr/design/condition/package.html | 5 +++++ designer/src/com/fr/design/dscolumn/package.html | 5 +++++ designer/src/com/fr/design/expand/package.html | 5 +++++ designer/src/com/fr/design/report/package.html | 5 +++++ designer/src/com/fr/design/webattr/package.html | 5 +++++ designer/src/com/fr/design/widget/package.html | 5 +++++ designer/src/com/fr/grid/event/package.html | 3 +-- designer/src/com/fr/grid/package.html | 5 +++++ designer/src/com/fr/grid/selection/package.html | 5 +++++ designer/src/com/fr/poly/package.html | 5 +++++ designer/src/com/fr/quickeditor/package.html | 5 +++++ designer_base/src/com/fr/common/inputevent/package.html | 5 +++++ designer_base/src/com/fr/design/bbs/package.html | 5 +++++ designer_base/src/com/fr/design/border/package.html | 5 +++++ designer_base/src/com/fr/design/bridge/package.html | 5 +++++ designer_base/src/com/fr/design/constants/package.html | 5 +++++ designer_base/src/com/fr/design/data/package.html | 5 +++++ designer_base/src/com/fr/design/dialog/package.html | 4 ++-- designer_base/src/com/fr/design/editor/package.html | 5 +++++ designer_base/src/com/fr/design/event/package.html | 5 +++++ designer_base/src/com/fr/design/extra/package.html | 5 +++++ designer_base/src/com/fr/design/file/package.html | 5 +++++ designer_base/src/com/fr/design/foldablepane/package.html | 5 +++++ designer_base/src/com/fr/design/formula/package.html | 5 +++++ designer_base/src/com/fr/design/fun/package.html | 5 +++++ designer_base/src/com/fr/design/gui/package.html | 5 +++++ designer_base/src/com/fr/design/icon/package.html | 5 +++++ designer_base/src/com/fr/design/javascript/package.html | 5 +++++ designer_base/src/com/fr/design/layout/package.html | 5 +++++ designer_base/src/com/fr/design/menu/package.html | 5 +++++ designer_base/src/com/fr/design/module/package.html | 5 +++++ designer_base/src/com/fr/design/object/package.html | 5 +++++ designer_base/src/com/fr/design/preview/package.html | 5 +++++ .../src/com/fr/design/roleAuthority/package.html | 5 +++++ designer_base/src/com/fr/design/scrollruler/package.html | 5 +++++ designer_base/src/com/fr/design/selection/package.html | 5 +++++ designer_base/src/com/fr/design/style/package.html | 5 +++++ designer_base/src/com/fr/design/utils/package.html | 5 +++++ designer_base/src/com/fr/design/web/package.html | 5 +++++ designer_base/src/com/fr/env/package.html | 5 +++++ designer_base/src/com/fr/file/filter/package.html | 5 +++++ designer_base/src/com/fr/file/package.html | 5 +++++ designer_base/src/com/fr/start/package.html | 5 +++++ designer_chart/src/com/fr/design/chart/package.html | 5 +++++ designer_chart/src/com/fr/plugin/chart/package.html | 5 +++++ .../src/com/fr/design/designer/creator/package.html | 5 +++++ designer_form/src/com/fr/design/designer/package.html | 5 +++++ .../src/com/fr/design/designer/properties/package.html | 5 +++++ designer_form/src/com/fr/design/form/package.html | 5 +++++ designer_form/src/com/fr/design/mainframe/package.html | 5 +++++ designer_form/src/com/fr/design/parameter/package.html | 5 +++++ 53 files changed, 255 insertions(+), 10 deletions(-) create mode 100644 designer/src/com/fr/design/actions/package.html create mode 100644 designer/src/com/fr/design/condition/package.html create mode 100644 designer/src/com/fr/design/dscolumn/package.html create mode 100644 designer/src/com/fr/design/expand/package.html create mode 100644 designer/src/com/fr/design/report/package.html create mode 100644 designer/src/com/fr/design/webattr/package.html create mode 100644 designer/src/com/fr/design/widget/package.html create mode 100644 designer/src/com/fr/grid/package.html create mode 100644 designer/src/com/fr/grid/selection/package.html create mode 100644 designer/src/com/fr/poly/package.html create mode 100644 designer/src/com/fr/quickeditor/package.html create mode 100644 designer_base/src/com/fr/common/inputevent/package.html create mode 100644 designer_base/src/com/fr/design/bbs/package.html create mode 100644 designer_base/src/com/fr/design/border/package.html create mode 100644 designer_base/src/com/fr/design/bridge/package.html create mode 100644 designer_base/src/com/fr/design/constants/package.html create mode 100644 designer_base/src/com/fr/design/data/package.html create mode 100644 designer_base/src/com/fr/design/editor/package.html create mode 100644 designer_base/src/com/fr/design/event/package.html create mode 100644 designer_base/src/com/fr/design/extra/package.html create mode 100644 designer_base/src/com/fr/design/file/package.html create mode 100644 designer_base/src/com/fr/design/foldablepane/package.html create mode 100644 designer_base/src/com/fr/design/formula/package.html create mode 100644 designer_base/src/com/fr/design/fun/package.html create mode 100644 designer_base/src/com/fr/design/gui/package.html create mode 100644 designer_base/src/com/fr/design/icon/package.html create mode 100644 designer_base/src/com/fr/design/javascript/package.html create mode 100644 designer_base/src/com/fr/design/layout/package.html create mode 100644 designer_base/src/com/fr/design/menu/package.html create mode 100644 designer_base/src/com/fr/design/module/package.html create mode 100644 designer_base/src/com/fr/design/object/package.html create mode 100644 designer_base/src/com/fr/design/preview/package.html create mode 100644 designer_base/src/com/fr/design/roleAuthority/package.html create mode 100644 designer_base/src/com/fr/design/scrollruler/package.html create mode 100644 designer_base/src/com/fr/design/selection/package.html create mode 100644 designer_base/src/com/fr/design/style/package.html create mode 100644 designer_base/src/com/fr/design/utils/package.html create mode 100644 designer_base/src/com/fr/design/web/package.html create mode 100644 designer_base/src/com/fr/env/package.html create mode 100644 designer_base/src/com/fr/file/filter/package.html create mode 100644 designer_base/src/com/fr/file/package.html create mode 100644 designer_base/src/com/fr/start/package.html create mode 100644 designer_chart/src/com/fr/design/chart/package.html create mode 100644 designer_chart/src/com/fr/plugin/chart/package.html create mode 100644 designer_form/src/com/fr/design/designer/creator/package.html create mode 100644 designer_form/src/com/fr/design/designer/package.html create mode 100644 designer_form/src/com/fr/design/designer/properties/package.html create mode 100644 designer_form/src/com/fr/design/form/package.html create mode 100644 designer_form/src/com/fr/design/mainframe/package.html create mode 100644 designer_form/src/com/fr/design/parameter/package.html diff --git a/designer/src/com/fr/design/actions/package.html b/designer/src/com/fr/design/actions/package.html new file mode 100644 index 0000000000..b3f9a9493e --- /dev/null +++ b/designer/src/com/fr/design/actions/package.html @@ -0,0 +1,5 @@ + + +定义了响应各种事件的 Action + + \ No newline at end of file diff --git a/designer/src/com/fr/design/cell/editor/package.html b/designer/src/com/fr/design/cell/editor/package.html index 181bdb68cf..f44232f536 100644 --- a/designer/src/com/fr/design/cell/editor/package.html +++ b/designer/src/com/fr/design/cell/editor/package.html @@ -1,13 +1,9 @@ - - +文本单元格编辑器({@link com.fr.cell.editor.GeneralCellEditor GeneralCellEditor})类. \ No newline at end of file diff --git a/designer/src/com/fr/design/condition/package.html b/designer/src/com/fr/design/condition/package.html new file mode 100644 index 0000000000..7ad30f8025 --- /dev/null +++ b/designer/src/com/fr/design/condition/package.html @@ -0,0 +1,5 @@ + + +条件属性悬浮编辑框中的相关面板 + + \ No newline at end of file diff --git a/designer/src/com/fr/design/dscolumn/package.html b/designer/src/com/fr/design/dscolumn/package.html new file mode 100644 index 0000000000..7c3869f2a7 --- /dev/null +++ b/designer/src/com/fr/design/dscolumn/package.html @@ -0,0 +1,5 @@ + + +数据列相关面板 + + \ No newline at end of file diff --git a/designer/src/com/fr/design/expand/package.html b/designer/src/com/fr/design/expand/package.html new file mode 100644 index 0000000000..038eb5319c --- /dev/null +++ b/designer/src/com/fr/design/expand/package.html @@ -0,0 +1,5 @@ + + +"单元格属性"->"扩展"的界面 + + \ No newline at end of file diff --git a/designer/src/com/fr/design/report/package.html b/designer/src/com/fr/design/report/package.html new file mode 100644 index 0000000000..c956ed1f36 --- /dev/null +++ b/designer/src/com/fr/design/report/package.html @@ -0,0 +1,5 @@ + + +包含制作模版过程中可能用到的各种面板(如页面设置、富文本编辑、Excel导出、移动端自适应等) + + \ No newline at end of file diff --git a/designer/src/com/fr/design/webattr/package.html b/designer/src/com/fr/design/webattr/package.html new file mode 100644 index 0000000000..5601fe2458 --- /dev/null +++ b/designer/src/com/fr/design/webattr/package.html @@ -0,0 +1,5 @@ + + +模版web属性相关界面 + + \ No newline at end of file diff --git a/designer/src/com/fr/design/widget/package.html b/designer/src/com/fr/design/widget/package.html new file mode 100644 index 0000000000..8142e0c77c --- /dev/null +++ b/designer/src/com/fr/design/widget/package.html @@ -0,0 +1,5 @@ + + +控件设置相关面板 + + \ No newline at end of file diff --git a/designer/src/com/fr/grid/event/package.html b/designer/src/com/fr/grid/event/package.html index d15343f20c..ebef1b8a03 100644 --- a/designer/src/com/fr/grid/event/package.html +++ b/designer/src/com/fr/grid/event/package.html @@ -1,6 +1,5 @@ - - +这个包中定义了监听单元格变化的接口和类. \ No newline at end of file diff --git a/designer/src/com/fr/grid/package.html b/designer/src/com/fr/grid/package.html new file mode 100644 index 0000000000..16f8010a5c --- /dev/null +++ b/designer/src/com/fr/grid/package.html @@ -0,0 +1,5 @@ + + +表格相关 + + \ No newline at end of file diff --git a/designer/src/com/fr/grid/selection/package.html b/designer/src/com/fr/grid/selection/package.html new file mode 100644 index 0000000000..15eaca8aea --- /dev/null +++ b/designer/src/com/fr/grid/selection/package.html @@ -0,0 +1,5 @@ + + +定义了表格的选择模型 + + \ No newline at end of file diff --git a/designer/src/com/fr/poly/package.html b/designer/src/com/fr/poly/package.html new file mode 100644 index 0000000000..ddfd9937f4 --- /dev/null +++ b/designer/src/com/fr/poly/package.html @@ -0,0 +1,5 @@ + + +聚合报表的设计器、控件、事件处理等 + + \ No newline at end of file diff --git a/designer/src/com/fr/quickeditor/package.html b/designer/src/com/fr/quickeditor/package.html new file mode 100644 index 0000000000..301e71daf9 --- /dev/null +++ b/designer/src/com/fr/quickeditor/package.html @@ -0,0 +1,5 @@ + + +这个包定义了各种单元格元素(如数据列、公式、富文本等)、图表块以及悬浮元素的编辑器 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/common/inputevent/package.html b/designer_base/src/com/fr/common/inputevent/package.html new file mode 100644 index 0000000000..562cdcdeca --- /dev/null +++ b/designer_base/src/com/fr/common/inputevent/package.html @@ -0,0 +1,5 @@ + + +处理输入事件的工具类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/bbs/package.html b/designer_base/src/com/fr/design/bbs/package.html new file mode 100644 index 0000000000..9101172d98 --- /dev/null +++ b/designer_base/src/com/fr/design/bbs/package.html @@ -0,0 +1,5 @@ + + +论坛相关的工具类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/border/package.html b/designer_base/src/com/fr/design/border/package.html new file mode 100644 index 0000000000..bdf291c80a --- /dev/null +++ b/designer_base/src/com/fr/design/border/package.html @@ -0,0 +1,5 @@ + + +边框组件 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/bridge/package.html b/designer_base/src/com/fr/design/bridge/package.html new file mode 100644 index 0000000000..d7546aef5f --- /dev/null +++ b/designer_base/src/com/fr/design/bridge/package.html @@ -0,0 +1,5 @@ + + +沟通 designer 和 designer_form 的接口类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/constants/package.html b/designer_base/src/com/fr/design/constants/package.html new file mode 100644 index 0000000000..30d428c7ea --- /dev/null +++ b/designer_base/src/com/fr/design/constants/package.html @@ -0,0 +1,5 @@ + + +全局常量 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/data/package.html b/designer_base/src/com/fr/design/data/package.html new file mode 100644 index 0000000000..353e9e8bca --- /dev/null +++ b/designer_base/src/com/fr/design/data/package.html @@ -0,0 +1,5 @@ + + +数据集相关的面板和组件 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/dialog/package.html b/designer_base/src/com/fr/design/dialog/package.html index 77262d5417..2b2874cd98 100644 --- a/designer_base/src/com/fr/design/dialog/package.html +++ b/designer_base/src/com/fr/design/dialog/package.html @@ -1,8 +1,8 @@ -Defined some dialogs that can be used in your applications of applets, For example: +定义了一些对话框,使用示例: PageSetupDialog({@link com.fr.dialog.PageSetupDialog PageSetupDialog}), StyleDialog({@link com.fr.dialog.core.ColorSelectBox ColorSelectBox}), -CellBorderDialog({@link com.fr.dialog.CellBorderDialog CellBorderDialog}).]!> +CellBorderDialog({@link com.fr.dialog.CellBorderDialog CellBorderDialog})> \ No newline at end of file diff --git a/designer_base/src/com/fr/design/editor/package.html b/designer_base/src/com/fr/design/editor/package.html new file mode 100644 index 0000000000..1613b51712 --- /dev/null +++ b/designer_base/src/com/fr/design/editor/package.html @@ -0,0 +1,5 @@ + + +各种编辑器(文本、日期、数字等)组件 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/event/package.html b/designer_base/src/com/fr/design/event/package.html new file mode 100644 index 0000000000..92e2c3605c --- /dev/null +++ b/designer_base/src/com/fr/design/event/package.html @@ -0,0 +1,5 @@ + + +事件处理的工具类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/extra/package.html b/designer_base/src/com/fr/design/extra/package.html new file mode 100644 index 0000000000..d4eda58e08 --- /dev/null +++ b/designer_base/src/com/fr/design/extra/package.html @@ -0,0 +1,5 @@ + + +用户登录、插件商城等功能 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/file/package.html b/designer_base/src/com/fr/design/file/package.html new file mode 100644 index 0000000000..4b2390a080 --- /dev/null +++ b/designer_base/src/com/fr/design/file/package.html @@ -0,0 +1,5 @@ + + +历史模版、新建模版、保存模版、模版tab、模版树等界面和功能 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/foldablepane/package.html b/designer_base/src/com/fr/design/foldablepane/package.html new file mode 100644 index 0000000000..bf8d8f383b --- /dev/null +++ b/designer_base/src/com/fr/design/foldablepane/package.html @@ -0,0 +1,5 @@ + + +可折叠面板组件 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/formula/package.html b/designer_base/src/com/fr/design/formula/package.html new file mode 100644 index 0000000000..2bd49a3187 --- /dev/null +++ b/designer_base/src/com/fr/design/formula/package.html @@ -0,0 +1,5 @@ + + +公式编辑相关面板 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/fun/package.html b/designer_base/src/com/fr/design/fun/package.html new file mode 100644 index 0000000000..f064c57bf3 --- /dev/null +++ b/designer_base/src/com/fr/design/fun/package.html @@ -0,0 +1,5 @@ + + +提供一些 UI 接口 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/gui/package.html b/designer_base/src/com/fr/design/gui/package.html new file mode 100644 index 0000000000..8a70f1dd23 --- /dev/null +++ b/designer_base/src/com/fr/design/gui/package.html @@ -0,0 +1,5 @@ + + +包含一些 UI 组件 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/icon/package.html b/designer_base/src/com/fr/design/icon/package.html new file mode 100644 index 0000000000..82749915b3 --- /dev/null +++ b/designer_base/src/com/fr/design/icon/package.html @@ -0,0 +1,5 @@ + + +定义一些 icon + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/javascript/package.html b/designer_base/src/com/fr/design/javascript/package.html new file mode 100644 index 0000000000..dbfe28451f --- /dev/null +++ b/designer_base/src/com/fr/design/javascript/package.html @@ -0,0 +1,5 @@ + + +javascript 编辑面板 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/layout/package.html b/designer_base/src/com/fr/design/layout/package.html new file mode 100644 index 0000000000..d16f5f7ee7 --- /dev/null +++ b/designer_base/src/com/fr/design/layout/package.html @@ -0,0 +1,5 @@ + + +这个包定义了一些布局 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/menu/package.html b/designer_base/src/com/fr/design/menu/package.html new file mode 100644 index 0000000000..00934e263a --- /dev/null +++ b/designer_base/src/com/fr/design/menu/package.html @@ -0,0 +1,5 @@ + + +菜单组件 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/module/package.html b/designer_base/src/com/fr/design/module/package.html new file mode 100644 index 0000000000..8eb0720824 --- /dev/null +++ b/designer_base/src/com/fr/design/module/package.html @@ -0,0 +1,5 @@ + + +设计器模块相关 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/object/package.html b/designer_base/src/com/fr/design/object/package.html new file mode 100644 index 0000000000..fd245d3eee --- /dev/null +++ b/designer_base/src/com/fr/design/object/package.html @@ -0,0 +1,5 @@ + + +包含与对象有关的工具类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/preview/package.html b/designer_base/src/com/fr/design/preview/package.html new file mode 100644 index 0000000000..ed9564d89e --- /dev/null +++ b/designer_base/src/com/fr/design/preview/package.html @@ -0,0 +1,5 @@ + + +模版预览方式 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/roleAuthority/package.html b/designer_base/src/com/fr/design/roleAuthority/package.html new file mode 100644 index 0000000000..79db356fe8 --- /dev/null +++ b/designer_base/src/com/fr/design/roleAuthority/package.html @@ -0,0 +1,5 @@ + + +权限编辑相关代码 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/scrollruler/package.html b/designer_base/src/com/fr/design/scrollruler/package.html new file mode 100644 index 0000000000..867402e2c7 --- /dev/null +++ b/designer_base/src/com/fr/design/scrollruler/package.html @@ -0,0 +1,5 @@ + + +标尺的实现类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/selection/package.html b/designer_base/src/com/fr/design/selection/package.html new file mode 100644 index 0000000000..10c7be1a7c --- /dev/null +++ b/designer_base/src/com/fr/design/selection/package.html @@ -0,0 +1,5 @@ + + +与选择模型有关的接口和抽象类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/style/package.html b/designer_base/src/com/fr/design/style/package.html new file mode 100644 index 0000000000..579503c487 --- /dev/null +++ b/designer_base/src/com/fr/design/style/package.html @@ -0,0 +1,5 @@ + + +与样式(颜色、边框、字体、对齐方式等)有关的面板和功能 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/utils/package.html b/designer_base/src/com/fr/design/utils/package.html new file mode 100644 index 0000000000..d71a5c6cc2 --- /dev/null +++ b/designer_base/src/com/fr/design/utils/package.html @@ -0,0 +1,5 @@ + + +提供一些工具类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/design/web/package.html b/designer_base/src/com/fr/design/web/package.html new file mode 100644 index 0000000000..da2d797788 --- /dev/null +++ b/designer_base/src/com/fr/design/web/package.html @@ -0,0 +1,5 @@ + + +定义与web端展示有关的类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/env/package.html b/designer_base/src/com/fr/env/package.html new file mode 100644 index 0000000000..4401234800 --- /dev/null +++ b/designer_base/src/com/fr/env/package.html @@ -0,0 +1,5 @@ + + +报表工作环境相关(本地设计、远程设计) + + \ No newline at end of file diff --git a/designer_base/src/com/fr/file/filter/package.html b/designer_base/src/com/fr/file/filter/package.html new file mode 100644 index 0000000000..7eb6a630f7 --- /dev/null +++ b/designer_base/src/com/fr/file/filter/package.html @@ -0,0 +1,5 @@ + + +文件过滤器 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/file/package.html b/designer_base/src/com/fr/file/package.html new file mode 100644 index 0000000000..c831ea79e3 --- /dev/null +++ b/designer_base/src/com/fr/file/package.html @@ -0,0 +1,5 @@ + + +与文件有关的工具类 + + \ No newline at end of file diff --git a/designer_base/src/com/fr/start/package.html b/designer_base/src/com/fr/start/package.html new file mode 100644 index 0000000000..eae1644a58 --- /dev/null +++ b/designer_base/src/com/fr/start/package.html @@ -0,0 +1,5 @@ + + +包含启动设计器的相关类(其中 Designer 是整个设计器程序的入口) + + \ No newline at end of file diff --git a/designer_chart/src/com/fr/design/chart/package.html b/designer_chart/src/com/fr/design/chart/package.html new file mode 100644 index 0000000000..1ed1e80174 --- /dev/null +++ b/designer_chart/src/com/fr/design/chart/package.html @@ -0,0 +1,5 @@ + + +图表相关的代码 + + \ No newline at end of file diff --git a/designer_chart/src/com/fr/plugin/chart/package.html b/designer_chart/src/com/fr/plugin/chart/package.html new file mode 100644 index 0000000000..0be2d1f190 --- /dev/null +++ b/designer_chart/src/com/fr/plugin/chart/package.html @@ -0,0 +1,5 @@ + + +图表(新特性) + + \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/package.html b/designer_form/src/com/fr/design/designer/creator/package.html new file mode 100644 index 0000000000..9fee75cdf8 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/creator/package.html @@ -0,0 +1,5 @@ + + +各种表单控件 + + \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/package.html b/designer_form/src/com/fr/design/designer/package.html new file mode 100644 index 0000000000..a8eddbdc58 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/package.html @@ -0,0 +1,5 @@ + + +设计器 + + \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/package.html b/designer_form/src/com/fr/design/designer/properties/package.html new file mode 100644 index 0000000000..e00f151da1 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/package.html @@ -0,0 +1,5 @@ + + +控件属性相关 + + \ No newline at end of file diff --git a/designer_form/src/com/fr/design/form/package.html b/designer_form/src/com/fr/design/form/package.html new file mode 100644 index 0000000000..68ad2d2702 --- /dev/null +++ b/designer_form/src/com/fr/design/form/package.html @@ -0,0 +1,5 @@ + + +表单特有的类和文件 + + \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/package.html b/designer_form/src/com/fr/design/mainframe/package.html new file mode 100644 index 0000000000..85078ef8bb --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/package.html @@ -0,0 +1,5 @@ + + +设计器整体框架 + + \ No newline at end of file diff --git a/designer_form/src/com/fr/design/parameter/package.html b/designer_form/src/com/fr/design/parameter/package.html new file mode 100644 index 0000000000..3391411335 --- /dev/null +++ b/designer_form/src/com/fr/design/parameter/package.html @@ -0,0 +1,5 @@ + + +参数面板 + + \ No newline at end of file From 11bb15139a2effb1d787264c47d9bb1ae1e0563e Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 1 Jan 2018 22:01:08 +0800 Subject: [PATCH 49/67] =?UTF-8?q?REPORT-6307=20=E5=8F=B3=E4=BE=A7=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E8=AE=BE=E7=BD=AE=E5=8A=A8=E6=80=81=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=EF=BC=8C=E5=86=8D=E6=AC=A1=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=90=8E=E8=AE=BE=E7=BD=AE=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/dscolumn/SelectedDataColumnPane.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java index 9332301a63..62538e7d05 100644 --- a/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java +++ b/designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java @@ -59,6 +59,7 @@ public class SelectedDataColumnPane extends BasicPane { private UIButton paramButton; private ElementCasePane casePane; + private CellElement cellElement; // 保存当前选中的 CE public SelectedDataColumnPane() { this(true, false, null); @@ -161,6 +162,7 @@ public class SelectedDataColumnPane extends BasicPane { if (cellElement == null) { return; } + this.cellElement = cellElement; if (itemListener != null) { removeListener(itemListener); } @@ -315,7 +317,7 @@ public class SelectedDataColumnPane extends BasicPane { public void doOk() { List parameterList = editorPane.update(); ps = parameterList.toArray(new Parameter[parameterList.size()]); - update(cellElement); + update(SelectedDataColumnPane.this.cellElement); casePane.fireTargetModified(); } }); From 68537da66777ae642c2406cfedd0a457ca84505c Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 2 Jan 2018 15:17:33 +0800 Subject: [PATCH 50/67] rt --- .../alphafine/search/manager/impl/FileSearchManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 8da604ab13..659eba7449 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -106,8 +106,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { if (moreModelList != null && !moreModelList.isEmpty()) { return moreModelList; } + searchText = dealWithSearchText(searchText); this.filterModelList = new SearchResult(); - this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); searchText = dealWithSearchText(searchText); Env env = FRContext.getCurrentEnv(); From a92b17618e3bdabfdbcfaed638878816063f4f50 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 2 Jan 2018 15:42:43 +0800 Subject: [PATCH 51/67] rt --- .../search/manager/impl/FileSearchManager.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 659eba7449..69ca500705 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -40,6 +40,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { private SearchResult filterModelList; private SearchResult lessModelList; private SearchResult moreModelList; + private String searchText; private List fileNodes = null; //停止搜索 private boolean stopSearch = false; @@ -80,6 +81,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates"))); return lessModelList; } + this.searchText = searchText; Env env = FRContext.getCurrentEnv(); fileNodes = new ArrayList<>(); fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); @@ -106,15 +108,13 @@ public class FileSearchManager implements AlphaFineSearchProvider { if (moreModelList != null && !moreModelList.isEmpty()) { return moreModelList; } - searchText = dealWithSearchText(searchText); this.filterModelList = new SearchResult(); this.moreModelList = new SearchResult(); - searchText = dealWithSearchText(searchText); Env env = FRContext.getCurrentEnv(); AlphaFineHelper.checkCancel(); isContainCpt = true; isContainFrm = true; - doSearch(searchText, false, env); + doSearch(this.searchText, false, env); moreModelList.addAll(filterModelList.subList(AlphaFineConstants.SHOW_SIZE, filterModelList.size())); return moreModelList; } @@ -286,4 +286,12 @@ public class FileSearchManager implements AlphaFineSearchProvider { public void setMoreModelList(SearchResult moreModelList) { this.moreModelList = moreModelList; } + + public String getSearchText() { + return searchText; + } + + public void setSearchText(String searchText) { + this.searchText = searchText; + } } \ No newline at end of file From 3bdac54599b1a49af4fd136ba352f1a370760473 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 2 Jan 2018 16:12:21 +0800 Subject: [PATCH 52/67] =?UTF-8?q?=E6=90=9C=E7=B4=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/FileSearchManager.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 69ca500705..799321a182 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -76,19 +76,18 @@ public class FileSearchManager implements AlphaFineSearchProvider { this.filterModelList = new SearchResult(); this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); - searchText = dealWithSearchText(searchText); - if (StringUtils.isBlank(searchText) || ComparatorUtils.equals(searchText, DS_NAME)) { + this.searchText = dealWithSearchText(searchText); + if (StringUtils.isBlank(this.searchText) || ComparatorUtils.equals(this.searchText, DS_NAME)) { lessModelList.add(new MoreModel(Inter.getLocText("FR-Designer_Templates"))); return lessModelList; } - this.searchText = searchText; Env env = FRContext.getCurrentEnv(); fileNodes = new ArrayList<>(); fileNodes = listTpl(env, ProjectConstants.REPORTLETS_NAME, true); AlphaFineHelper.checkCancel(); isContainCpt = true; isContainFrm = true; - doSearch(searchText, true, env); + doSearch(this.searchText, true, env); if (stopSearch) { lessModelList.add(0, new MoreModel(Inter.getLocText("FR-Designer_Templates"), Inter.getLocText("FR-Designer_AlphaFine_ShowAll"), true, CellType.FILE)); lessModelList.addAll(filterModelList.subList(0, AlphaFineConstants.SHOW_SIZE)); From 852c2f8e2eec98a543c13abea06aa2f223936f5b Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 2 Jan 2018 17:24:40 +0800 Subject: [PATCH 53/67] =?UTF-8?q?REPORT-6270=20=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=87=8C=E7=9A=84=E7=9B=B8=E5=85=B3bug=3D>1=20?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=9D=A2=E6=9D=BF=E9=99=90=E9=AB=98=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/EastRegionContainerPane.java | 3 --- .../fr/design/parameter/ParameterPropertyPane.java | 13 ++++++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java index 5c37e53202..0c9d536d99 100644 --- a/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java @@ -499,7 +499,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private boolean isEnabled = true; // 是否可用 private Set visibleModes; private Set enableModes; - private static final int MAX_PARA_HEIGHT = 240; // 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/"; @@ -621,8 +620,6 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public void replaceHeaderPane(JComponent pane) { contentArea.remove(headerPane); - int height = Math.min(pane.getPreferredSize().height, MAX_PARA_HEIGHT); - pane.setPreferredSize(new Dimension(pane.getPreferredSize().width, height)); headerPane = pane; contentArea.add(headerPane, BorderLayout.NORTH); diff --git a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java index 6ce5a2ff9e..052f7cc2f5 100644 --- a/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java @@ -26,6 +26,7 @@ public class ParameterPropertyPane extends JPanel{ private static final int PADDING_SMALL = 5; private static final int PADDING_MIDDLE = 10; private static final int PADDING_LARGE = 15; + private static final int ADD_PARA_PANE_MAX_HEIGHT = 95; public static final ParameterPropertyPane getInstance() { if (THIS == null) { @@ -86,6 +87,7 @@ public class ParameterPropertyPane extends JPanel{ // 显示或隐藏添加参数面板 public void refreshState(JTemplate jt) { setAddParaPaneVisible(toolbarPane.hasSelectedLabelItem(), jt); + updateAddParaPaneSize(); } // 显示或隐藏添加参数面板 @@ -93,6 +95,16 @@ public class ParameterPropertyPane extends JPanel{ refreshState(DesignerContext.getDesignerFrame().getSelectedJTemplate()); } + private void updateAddParaPaneSize() { + if (!addParaPane.isVisible()) { + return; + } + addParaPane.setPreferredSize(null); + int height = Math.min(addParaPane.getPreferredSize().height, ADD_PARA_PANE_MAX_HEIGHT); + addParaPane.setPreferredSize(new Dimension(addParaPane.getPreferredSize().width, height)); + repaintContainer(); + } + public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) { if (isVisible == addParaPane.isVisible() || formHierarchyTreePaneWrapper == null) { return; @@ -112,7 +124,6 @@ public class ParameterPropertyPane extends JPanel{ addParaPane.setVisible(false); this.setPreferredSize(new Dimension(getWidth(), formHierarchyTreePaneWrapper.getPreferredSize().height + UIConstants.GAP_NORMAL)); } - repaintContainer(); } private void setEditor(FormDesigner editor) { From 62d6574e6689cf21b682be70c264667b0c44a2d1 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Tue, 2 Jan 2018 20:07:54 +0800 Subject: [PATCH 54/67] =?UTF-8?q?=E8=BF=9C=E7=A8=8B=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E6=90=9C=E7=B4=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manager/impl/FileSearchManager.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 799321a182..9dfec93df3 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -24,6 +24,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; @@ -121,10 +122,11 @@ public class FileSearchManager implements AlphaFineSearchProvider { private void doSearch(String searchText, boolean needMore, Env env) { for (FileNode node : fileNodes) { boolean isAlreadyContain = false; - String fileEnvPath = node.getEnvPath(); - String filePath = StableUtils.pathJoin(env.getPath(), fileEnvPath); isAlreadyContain = searchFile(searchText, node, isAlreadyContain, needMore); - searchFileContent(searchText, node, isAlreadyContain, filePath, needMore); + searchFileContent(env, searchText, node, isAlreadyContain, needMore); + if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && stopSearch) { + return; + } } } @@ -146,13 +148,11 @@ public class FileSearchManager implements AlphaFineSearchProvider { * @param searchText * @param node * @param isAlreadyContain - * @param filePath */ - private void searchFileContent(String searchText, FileNode node, boolean isAlreadyContain, String filePath, boolean needMore) { + private void searchFileContent(Env env, String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) { if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { - try { - InputStreamReader isr = new InputStreamReader(new FileInputStream(new File(filePath)), "UTF-8"); + InputStreamReader isr = new InputStreamReader(env.readBean(node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1), ProjectConstants.REPORTLETS_NAME), "UTF-8"); BufferedReader reader = new BufferedReader(isr); String line; int columnNumber; @@ -167,6 +167,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { if (isFoundInContent && !isAlreadyContain) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); if (!AlphaFineHelper.getFilterResult().contains(model)) { + AlphaFineHelper.checkCancel(); filterModelList.add(model); } if (this.filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) { @@ -175,10 +176,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { } isr.close(); reader.close(); - } catch (FileNotFoundException e) { - FRLogger.getLogger().error(e.getMessage()); - } catch (IOException e) { - FRLogger.getLogger().error(e.getMessage()); + } catch (Exception e) { + FRLogger.getLogger().error("file read error: " + e.getMessage()); } } } @@ -196,6 +195,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { if (node.getName().toLowerCase().contains(searchText)) { FileModel model = new FileModel(node.getName(), node.getEnvPath()); if (!AlphaFineHelper.getFilterResult().contains(model)) { + AlphaFineHelper.checkCancel(); filterModelList.add(model); } if(filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) { From 677cb9a4f134b295101ee3b3c6f7b32f9e8dff1d Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 2 Jan 2018 21:20:22 +0800 Subject: [PATCH 55/67] =?UTF-8?q?REPORT-6270=20=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=87=8C=E7=9A=84=E7=9B=B8=E5=85=B3bug=3D>2=20frm?= =?UTF-8?q?=E9=87=8C=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E5=90=8E=EF=BC=8C=E5=8F=B3=E4=BE=A7=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E6=A0=91=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6=E9=80=89?= =?UTF-8?q?=E4=B8=AD=E5=88=B0para=EF=BC=9B=E8=80=8C=E4=B8=94=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=88=96=E8=80=85=E5=88=A0=E9=99=A4=E4=BA=86=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=8F=82=E6=95=B0=EF=BC=8C=E4=B9=9F=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E9=80=89=E4=B8=ADpara?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormHierarchyTreePane.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index 212fe33897..e908bb9f0d 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -96,8 +96,7 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree formDesigner.addDesignerEditListener(new DesignerEditListener() { @Override public void fireCreatorModified(DesignerEvent evt) { - componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); - componentTree.refreshUI(); + refreshComponentTree(); } }); @@ -110,6 +109,21 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree } add(getWidgetPane(), BorderLayout.CENTER); + + try { + // 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态 + refreshComponentTree(); + } catch (Throwable th) { + // do nothing + } + } + + private void refreshComponentTree() { + if (DesignerContext.getDesignerFrame().getSelectedJTemplate() == null) { // 还在初始化状态 + return; + } + componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); + componentTree.refreshUI(); } private JPanel getWidgetPane() { From 2bc81a3c5ad529c53dd26a402c0fde0253c615a0 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 3 Jan 2018 10:18:57 +0800 Subject: [PATCH 56/67] =?UTF-8?q?REPORT-6258=20tab=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=8F=B3=E5=87=BB=E6=97=B6=E5=8E=9F=E6=9C=AC=E7=9A=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=8A=9F=E8=83=BD=E8=A2=AB=E8=A6=86=E7=9B=96=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/designer/creator/cardlayout/XCardAddButton.java | 7 ++++++- .../designer/creator/cardlayout/XCardSwitchButton.java | 5 +++++ .../designer/creator/cardlayout/XWCardTagLayout.java | 6 ++++++ .../design/designer/creator/cardlayout/XWTabFitLayout.java | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index 5ab71c3d2e..0f9c744623 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -6,7 +6,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseEvent; -import javax.swing.Icon; +import javax.swing.*; import com.fr.base.BaseUtils; import com.fr.base.background.ColorBackground; @@ -110,6 +110,11 @@ public class XCardAddButton extends XButton{ tagLayout.setTabsAndAdjust(); LayoutUtils.layoutRootContainer(designer.getRootComponent()); } + + @Override + public JPopupMenu createPopupMenu(FormDesigner formDesigner) { + return null; // 不要菜单 + } private void initRelateLayout(){ XWCardTitleLayout titleLayout = (XWCardTitleLayout)this.getBackupParent(); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index 784fd61fe8..daa8d339f1 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -224,6 +224,11 @@ public class XCardSwitchButton extends XButton { GUICoreUtils.showPopupMenu(jPopupMenu, editingMouseListener.getDesigner(), e.getX(), e.getY()); } + @Override + public JPopupMenu createPopupMenu(FormDesigner formDesigner) { + return null; // 自己有一个showPopupMenu,不需要使用通用的弹出菜单 + } + //删除card,同时修改其他switchbutton和tabfit的index private void deleteCard(XCardSwitchButton button,int index){ String titleName = button.getContentLabel().getText(); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 5c3d80de6e..9490f73c42 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -12,6 +12,7 @@ import java.awt.event.MouseEvent; import java.util.HashMap; import java.util.Map; +import javax.swing.*; import javax.swing.border.Border; import com.fr.base.GraphHelper; @@ -242,6 +243,11 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { } } + @Override + public JPopupMenu createPopupMenu(FormDesigner formDesigner) { + return null; // 不要菜单 + } + @Override public int[] getDirections() { return ((XCreator)getParent()).getDirections(); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index 90e85b2533..8555d03f6e 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -26,6 +26,7 @@ import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; +import javax.swing.*; import javax.swing.border.Border; import java.awt.Color; import java.awt.Component; @@ -103,6 +104,11 @@ public class XWTabFitLayout extends XWFitLayout { super(widget, initSize); } + @Override + public JPopupMenu createPopupMenu(FormDesigner formDesigner) { + return null; // 不要菜单 + } + /** * 得到属性名 * @return 属性名 From 8d36dd3794758d4c9871f0fe296eeac9595c0e6c Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 3 Jan 2018 10:33:35 +0800 Subject: [PATCH 57/67] =?UTF-8?q?REPORT-6258=20tab=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=8F=B3=E5=87=BB=E6=97=B6=E5=8E=9F=E6=9C=AC=E7=9A=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=8A=9F=E8=83=BD=E8=A2=AB=E8=A6=86=E7=9B=96=E4=BA=86?= =?UTF-8?q?=3D>=E9=9D=9E=E7=BB=9D=E5=AF=B9=E5=B8=83=E5=B1=80=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E6=8E=92=E5=BA=8F=E6=8C=89=E9=92=AE=E7=81=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/designer/creator/XLayoutContainer.java | 8 ++++++++ .../com/fr/design/designer/creator/XWAbsoluteLayout.java | 5 +++++ .../src/com/fr/design/mainframe/FormDesigner.java | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java b/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java index e4281174b6..4f0476388d 100644 --- a/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java +++ b/designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java @@ -564,4 +564,12 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme return false; } + /** + * 内部组件是否支持叠加顺序的调整 + * return boolean + */ + public boolean supportInnerOrderChangeActions() { + return false; + } + } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 58c5f74dda..afaaf2fef0 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -515,4 +515,9 @@ public class XWAbsoluteLayout extends XLayoutContainer { widget.setBounds(xCreator.getBounds()); } } + + @Override + public boolean supportInnerOrderChangeActions() { + return true; + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 851a2cdee6..19425b18b2 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -1139,8 +1139,8 @@ public class FormDesigner extends TargetComponent
implements TreeSelection // 当前选中控件可以上移一层吗? public boolean isCurrentComponentMovableUp() { XCreator creator = getSelectionModel().getSelection().getSelectedCreator(); - Container container = creator.getParent(); - if (container == null) { + XLayoutContainer container = (XLayoutContainer) creator.getParent(); + if (container == null || !container.supportInnerOrderChangeActions()) { return false; } return creator.isMovable() && container.getComponentZOrder(creator) > 0; @@ -1149,8 +1149,8 @@ public class FormDesigner extends TargetComponent implements TreeSelection // 当前选中控件可以下移一层吗? public boolean isCurrentComponentMovableDown() { XCreator creator = getSelectionModel().getSelection().getSelectedCreator(); - Container container = creator.getParent(); - if (container == null) { + XLayoutContainer container = (XLayoutContainer) creator.getParent(); + if (container == null || !container.supportInnerOrderChangeActions()) { return false; } return creator.isMovable() && container.getComponentZOrder(creator) < container.getComponentCount() - 1; From c93be9aad33ea946c226e8bcad9fda7695509c37 Mon Sep 17 00:00:00 2001 From: neil <459208047@qq.com> Date: Wed, 3 Jan 2018 11:49:04 +0800 Subject: [PATCH 58/67] =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/grid/selection/FloatSelection.java | 38 ++-- .../fr/design/file/MutilTempalteTabPane.java | 73 ++++---- .../com/fr/design/mainframe/JSliderPane.java | 115 ++++++------ .../cardlayout/XWCardMainBorderLayout.java | 169 +++++++++++++----- 4 files changed, 227 insertions(+), 168 deletions(-) diff --git a/designer/src/com/fr/grid/selection/FloatSelection.java b/designer/src/com/fr/grid/selection/FloatSelection.java index 60fe54b7cb..0d441a1f7a 100644 --- a/designer/src/com/fr/grid/selection/FloatSelection.java +++ b/designer/src/com/fr/grid/selection/FloatSelection.java @@ -5,17 +5,16 @@ import com.fr.base.FRContext; import com.fr.design.actions.cell.CleanAuthorityAction; import com.fr.design.actions.cell.FloatStyleAction; import com.fr.design.actions.core.ActionFactory; -import com.fr.design.actions.edit.CopyAction; -import com.fr.design.actions.edit.CutAction; -import com.fr.design.actions.edit.DeleteAction; -import com.fr.design.actions.edit.EditFloatElementNameAction; -import com.fr.design.actions.edit.HyperlinkAction; -import com.fr.design.actions.edit.PasteAction; -import com.fr.design.actions.utils.DeprecatedActionManager; +import com.fr.design.actions.edit.*; +import com.fr.design.actions.edit.order.BringFloatElementForwardAction; +import com.fr.design.actions.edit.order.BringFloatElementToFrontAction; +import com.fr.design.actions.edit.order.SendFloatElementBackwardAction; +import com.fr.design.actions.edit.order.SendFloatElementToBackAction; import com.fr.design.cell.clipboard.CellElementsClip; import com.fr.design.cell.clipboard.ElementsTransferable; import com.fr.design.cell.clipboard.FloatElementsClip; import com.fr.design.designer.TargetComponent; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.CellElementPropertyPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane.Clear; @@ -29,12 +28,10 @@ import com.fr.stable.ColumnRow; import com.fr.stable.unit.FU; import com.fr.stable.unit.OLDPIX; -import javax.swing.JPopupMenu; -import java.awt.Toolkit; - +import javax.swing.*; +import java.awt.*; /** * the float selection - * * @editor zhou * 2012-3-22下午2:09:20 */ @@ -120,24 +117,28 @@ public class FloatSelection extends Selection { @Override public JPopupMenu createPopupMenu(ElementCasePane ePane) { - JPopupMenu popup = new JPopupMenu(); + UIPopupMenu popup = new UIPopupMenu(); if (BaseUtils.isAuthorityEditing()) { popup.add(new CleanAuthorityAction(ePane).createMenuItem()); return popup; } - popup.add(DeprecatedActionManager.getCellMenu(ePane).createJMenu()); popup.add(new FloatStyleAction(ePane).createMenuItem()); popup.add(new HyperlinkAction().createMenuItem()); - // cut, copy and paste popup.addSeparator(); + popup.add(new CutAction(ePane).createMenuItem()); popup.add(new CopyAction(ePane).createMenuItem()); popup.add(new PasteAction(ePane).createMenuItem()); popup.add(new DeleteAction(ePane).createMenuItem()); + popup.addSeparator(); + popup.add(new BringFloatElementToFrontAction(ePane).createMenuItem()); + popup.add(new SendFloatElementToBackAction(ePane).createMenuItem()); + popup.add(new BringFloatElementForwardAction(ePane).createMenuItem()); + popup.add(new SendFloatElementBackwardAction(ePane).createMenuItem()); popup.addSeparator(); - popup.add(DeprecatedActionManager.getOrderMenu(ePane)); + popup.add(new EditFloatElementNameAction(ePane).createMenuItem()); return popup; @@ -148,8 +149,8 @@ public class FloatSelection extends Selection { TemplateElementCase ec = ePane.getEditingElementCase(); FloatElement fe = ec.getFloatElement(selectedFloatName); if (fe != null) { - ePane.setSelection(new CellSelection(0, 0, 1, 1)); ec.removeFloatElement(fe); + ePane.setSelection(new CellSelection(0, 0, 1, 1)); return true; } @@ -215,7 +216,6 @@ public class FloatSelection extends Selection { public boolean isSelectedOneCell(ElementCasePane ePane) { return false; } - //TODO:august 这儿不比较FloatElement会不会有问题啊 @Override public boolean equals(Object obj) { @@ -239,8 +239,8 @@ public class FloatSelection extends Selection { CellElementPropertyPane.getInstance().removeAll(); } - public void populateWidgetPropertyPane(ElementCasePane ePane) { - + public void populateWidgetPropertyPane(ElementCasePane ePane){ + return; } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java b/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java index 796071ce23..eb93f09fd3 100644 --- a/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer_base/src/com/fr/design/file/MutilTempalteTabPane.java @@ -3,7 +3,7 @@ package com.fr.design.file; import com.fr.base.BaseUtils; import com.fr.base.GraphHelper; -import com.fr.design.actions.core.ActionFactory; +import com.fr.base.vcs.DesignerMode; import com.fr.design.constants.UIConstants; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIScrollPopUpMenu; @@ -17,41 +17,15 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.Constants; +import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.project.ProjectConstants; -import javax.swing.Action; -import javax.swing.BorderFactory; -import javax.swing.ButtonModel; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSeparator; +import javax.swing.*; import javax.swing.plaf.basic.BasicMenuItemUI; -import java.awt.AWTEvent; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.GradientPaint; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.RenderingHints; -import java.awt.Toolkit; -import java.awt.event.AWTEventListener; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; -import java.awt.geom.Arc2D; -import java.awt.geom.GeneralPath; -import java.awt.geom.Line2D; -import java.awt.geom.Path2D; -import java.awt.geom.RoundRectangle2D; +import java.awt.*; +import java.awt.event.*; +import java.awt.geom.*; import java.io.File; import java.util.logging.Level; @@ -247,12 +221,10 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M templates[i].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { selectedIndex = index; - DesignerContext.getDesignerFrame().addAndActivateJTemplate(tem); + tem.activeNewJTemplate(); } }); } - - return templates; } @@ -661,6 +633,11 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M * @param e 鼠标事件 */ public void mousePressed(MouseEvent e) { + //如果在版本管理情况下,不允许切换tab + if (DesignerMode.isVcsMode()) { + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Vcs_tab_click"), Inter.getLocText("FR-Designer_Alert"), JOptionPane.WARNING_MESSAGE); + return; + } int evtX = e.getX(); int evtY = e.getY(); @@ -700,7 +677,8 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M this.repaint(); return; } - DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(getTemplateIndex(evtX))); + JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX)); + evtXTemplate.activeNewJTemplate(); } isShowList = false; } @@ -729,8 +707,7 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M if (filename.startsWith(ProjectConstants.REPORTLETS_NAME)) { filename = ((FileNodeFILE) openedTemplate.get(selectedIndex).getEditingFILE()).getEnvPath() + File.separator + filename; } - - filename = filename.replaceAll("/", "\\\\"); + filename = OperatingSystem.isWindows() ? filename.replaceAll("/", "\\\\") : filename.replaceAll("\\\\", "/"); if (!specifiedTemplate.isALLSaved()) { specifiedTemplate.stopEditing(); @@ -739,10 +716,21 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M if (returnVal == JOptionPane.YES_OPTION && specifiedTemplate.saveTemplate()) { specifiedTemplate.saveTemplate(); FRLogger.getLogger().log(Level.INFO, Inter.getLocText(new String[]{"Template", "already-saved"}, new String[]{specifiedTemplate.getEditingFILE().getName(), "."})); + HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); + activeTemplate(filename); + } else if (returnVal == JOptionPane.NO_OPTION) { + //不保存 + HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); + activeTemplate(filename); } + //若是点击取消关闭,则什么都不做 + } else { + //若是已经保存过了,则关闭即可 + HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); + activeTemplate(filename); } - HistoryTemplateListPane.getInstance().closeSelectedReport(specifiedTemplate); - activeTemplate(filename); + + } /** @@ -796,7 +784,8 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M //如果关闭的模板不是当前选中的模板,则激活的模板不变 selectedIndex = HistoryTemplateListPane.getInstance().contains(fileName); } - DesignerContext.getDesignerFrame().activateJTemplate(openedTemplate.get(selectedIndex)); + //如果是已后台关闭的模板,则重新打开文件 + openedTemplate.get(selectedIndex).activeOldJTemplate(); } } @@ -968,6 +957,4 @@ public class MutilTempalteTabPane extends JComponent implements MouseListener, M } } } - - } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index 2562755e57..ff30054b45 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -6,6 +6,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UISliderButton; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UISpinnerUI; @@ -15,33 +16,13 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; -import javax.swing.BorderFactory; -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFormattedTextField; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JSpinner; -import javax.swing.SpinnerNumberModel; +import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.EventQueue; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Rectangle; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -54,30 +35,25 @@ import java.math.BigDecimal; */ public class JSliderPane extends JPanel { + public static final Image APPFIT_V0 = BaseUtils.readImage("com/fr/design/images/control/icon_thumb_normal.png"); private static final double ONEPOINTEIGHT = 1.8; private static final int SIX = 6; private static final int TEN = 10; - private static final int ONE_EIGHT = 18; private static final int FONT_SIZE = 12; private static final int SPINNER_WIDTH = 45; private static final int SPINNER_HEIGHT = 20; private static final int HALF_HUNDRED = 50; private static final int HUNDRED = 100; private static final int TWO_HUNDRED = 200; - private static final int THREE_HUNDRED = 300; private static final int FOUR_HUNDRED = 400; - private static final int DIALOG_WIDTH = 157; - private static final int DIALOG_HEIGHT = 192; - private static final int SLIDER_WIDTH = 220; - private static final int SLIDER_HEIGHT = 20; private static final int SHOWVALBUTTON_WIDTH = 40; private static final int SHOWVALBUTTON_HEIGHTH = 20; - private static final int SLIDER_GAP = 5; private static final int TOOLTIP_Y = 30; private static final Color BACK_COLOR = new Color(245, 245, 247); public int showValue = 100; public double resolutionTimes = 1.0; + private static JSliderPane THIS; private UITextField showVal; private JSpinner showValSpinner; private UISlider slider; @@ -88,14 +64,12 @@ public class JSliderPane extends JPanel { private UISliderButton showValButton; private UIRadioButton twoHundredButton; private UIRadioButton oneHundredButton; - private UIRadioButton sevenFiveButton; + private UIRadioButton SevenFiveButton; private UIRadioButton fiveTenButton; private UIRadioButton twoFiveButton; private UIRadioButton selfAdaptButton; private UIRadioButton customButton; - /** - * 拖动条处理和button、直接输入不一样 - */ + //拖动条处理和button、直接输入不一样 private boolean isButtonOrIsTxt = true; private PopupPane dialog; private int upButtonX; @@ -111,7 +85,7 @@ public class JSliderPane extends JPanel { showValSpinner.setEditor(editor); JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField(); textField.setEditable(true); - DefaultFormatterFactory factory = (DefaultFormatterFactory) textField.getFormatterFactory(); + DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory(); NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter(); formatter.setAllowsInvalid(false); @@ -119,7 +93,7 @@ public class JSliderPane extends JPanel { initShowValButton(); initUIRadioButton(); initPane(); - JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); + JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); panel.add(downButton); panel.add(slider); panel.add(upButton); @@ -129,8 +103,12 @@ public class JSliderPane extends JPanel { } - public static JSliderPane getInstance() { - return new JSliderPane(); + public static final JSliderPane getInstance() { +// if (THIS == null) { +// THIS = new JSliderPane(); +// } + THIS = new JSliderPane(); + return THIS; } private void initSlider() { @@ -194,7 +172,7 @@ public class JSliderPane extends JPanel { private void initUIRadioButton() { twoHundredButton = new UIRadioButton("200%"); oneHundredButton = new UIRadioButton("100%"); - sevenFiveButton = new UIRadioButton("75%"); + SevenFiveButton = new UIRadioButton("75%"); fiveTenButton = new UIRadioButton("50%"); twoFiveButton = new UIRadioButton("25%"); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); @@ -203,7 +181,7 @@ public class JSliderPane extends JPanel { customButton.setFont(new Font("SimSun", Font.PLAIN, FONT_SIZE)); twoHundredButton.addItemListener(radioButtonItemListener); oneHundredButton.addItemListener(radioButtonItemListener); - sevenFiveButton.addItemListener(radioButtonItemListener); + SevenFiveButton.addItemListener(radioButtonItemListener); fiveTenButton.addItemListener(radioButtonItemListener); twoFiveButton.addItemListener(radioButtonItemListener); customButton.addItemListener(new ItemListener() { @@ -221,7 +199,7 @@ public class JSliderPane extends JPanel { ButtonGroup bg = new ButtonGroup();// 初始化按钮组 bg.add(twoHundredButton);// 加入按钮组 bg.add(oneHundredButton); - bg.add(sevenFiveButton); + bg.add(SevenFiveButton); bg.add(fiveTenButton); bg.add(twoFiveButton); bg.add(selfAdaptButton); @@ -244,7 +222,7 @@ public class JSliderPane extends JPanel { septPane.setBackground(BACK_COLOR); twoHundredButton.setBackground(BACK_COLOR); oneHundredButton.setBackground(BACK_COLOR); - sevenFiveButton.setBackground(BACK_COLOR); + SevenFiveButton.setBackground(BACK_COLOR); fiveTenButton.setBackground(BACK_COLOR); twoFiveButton.setBackground(BACK_COLOR); selfAdaptButton.setBackground(BACK_COLOR); @@ -254,7 +232,7 @@ public class JSliderPane extends JPanel { new Component[]{septPane, null}, new Component[]{twoHundredButton, null}, new Component[]{oneHundredButton, null}, - new Component[]{sevenFiveButton, null}, + new Component[]{SevenFiveButton, null}, new Component[]{fiveTenButton, null}, new Component[]{twoFiveButton, null}, new Component[]{selfAdaptButton, null}, @@ -275,14 +253,14 @@ public class JSliderPane extends JPanel { return spinnerPanel; } - private ActionListener showValButtonActionListener = new ActionListener() { + ActionListener showValButtonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { popupDialog(); } }; - private ChangeListener showValSpinnerChangeListener = new ChangeListener() { + ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); @@ -305,7 +283,7 @@ public class JSliderPane extends JPanel { //定义一个监听器,用于监听所有滑动条 - private ChangeListener listener = new ChangeListener() { + ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent event) { //取出滑动条的值,并在文本中显示出来 if (!isButtonOrIsTxt) { @@ -325,7 +303,7 @@ public class JSliderPane extends JPanel { } }; - private ItemListener radioButtonItemListener = new ItemListener() { + ItemListener radioButtonItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JRadioButton temp = (JRadioButton) e.getSource(); @@ -341,7 +319,7 @@ public class JSliderPane extends JPanel { slider.setValue((int) (showValue + TWO_HUNDRED) / SIX); } else if (showValue < HUNDRED) { slider.setValue((int) ((showValue - TEN) / ONEPOINTEIGHT)); - } else { + } else if (showValue == HUNDRED) { slider.setValue(HALF_HUNDRED); } } @@ -359,7 +337,7 @@ public class JSliderPane extends JPanel { return this.showValue; } - public void reset() { + public void reset(){ this.showValSpinner.setValue(HUNDRED); } @@ -369,7 +347,7 @@ public class JSliderPane extends JPanel { return b1.divide(b2, scale).doubleValue(); } - private ActionListener buttonActionListener = new ActionListener() { + ActionListener buttonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showValue = (int) showValSpinner.getValue(); @@ -406,7 +384,7 @@ public class JSliderPane extends JPanel { } else if (value < HALF_HUNDRED) { times = (int) Math.round(ONEPOINTEIGHT * value + TEN); } else { - times = SIX * value - TWO_HUNDRED; + times = (int) (SIX * value - TWO_HUNDRED); } } @@ -425,14 +403,14 @@ public class JSliderPane extends JPanel { dialog = new PopupPane(upButton, dialogContentPanel); if (upButtonX == 0) { upButtonX = btnCoords.x; - GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); + GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height); } } else { if (upButtonX == 0) { upButtonX = btnCoords.x; - GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); + GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height); } else { - GUICoreUtils.showPopupMenu(dialog, upButton, -DIALOG_WIDTH + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -DIALOG_HEIGHT); + GUICoreUtils.showPopupMenu(dialog, upButton, -dialog.getPreferredSize().width + upButton.getWidth() + SHOWVALBUTTON_WIDTH, -dialog.getPreferredSize().height); } } } @@ -453,8 +431,8 @@ public class JSliderPane extends JPanel { class JSliderPaneUI extends BasicSliderUI { private static final Color BACK_COLOR = new Color(245, 245, 247); - private static final int VERTICAL_WIDTH = 11; - private static final int VERTICAL_HEIGHT = 16; + private static final int THUMB_XOFFSET = 8; + private static final int THUMB_YOFFSET = 3; private static final int FOUR = 4; private static final int FIVE = 5; private static final int SIX = 6; @@ -464,20 +442,19 @@ class JSliderPaneUI extends BasicSliderUI { super(b); } + /** */ /** * 绘制指示物 */ + public void paintThumb(Graphics g) { Rectangle knobBounds = thumbRect; - int w = knobBounds.width; - int h = knobBounds.height; Graphics2D g2d = (Graphics2D) g; - - g2d.translate(knobBounds.x, knobBounds.y); - g2d.setColor(new Color(51, 51, 52)); - g2d.fillRoundRect(0, SIX, FOUR, 9, 2, 2); + g2d.drawImage(JSliderPane.APPFIT_V0, knobBounds.x - THUMB_XOFFSET, knobBounds.y + THUMB_YOFFSET, null); + g2d.dispose(); } + /** */ /** * 绘制刻度轨迹 */ @@ -498,11 +475,19 @@ class JSliderPaneUI extends BasicSliderUI { } } + public void setThumbLocation(int x, int y) { + super.setThumbLocation(x, y); + slider.repaint(); + } + } -class PopupPane extends JPopupMenu { +class PopupPane extends UIPopupMenu { + private static final float REC = 8f; + private static final int INSERT_TOPBOTTOM = 10; + private static final int INSERT_LEFTRIGHT = 2; private static final int DIALOG_WIDTH = 157; - private static final int DIALOG_HEIGHT = 192; + private static final int DIALOG_HEIGHT = 205; PopupPane(JButton b, JPanel dialogContentPanel) { this.add(dialogContentPanel, BorderLayout.CENTER); @@ -510,5 +495,7 @@ class PopupPane extends JPopupMenu { this.setBackground(new Color(245, 245, 247)); } - + public Insets getInsets() { + return new Insets(INSERT_TOPBOTTOM, INSERT_LEFTRIGHT, INSERT_TOPBOTTOM, INSERT_LEFTRIGHT); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 2e6d82fb3d..c6b8381472 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -1,5 +1,5 @@ /** - * + * */ package com.fr.design.designer.creator.cardlayout; @@ -15,34 +15,43 @@ 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.WTabDisplayPosition; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; +import com.fr.general.ComparatorUtils; import com.fr.general.IOUtils; import com.fr.general.Inter; - -import java.awt.*; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Component; +import java.awt.Composite; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.util.ArrayList; +import java.util.List; /** * card布局主体框架 - * + * * * * @date: 2014-12-9-下午9:59:31 */ public class XWCardMainBorderLayout extends XWBorderLayout{ - + private static final int CENTER = 1; private static final int NORTH = 0; - public static final Color DEFAULT_BORDER_COLOR = new Color(210,210,210); - private static final int LAYOUT_INDEX = 0; private static final int TITLE_STYLE = 2; - private static final int NORMAL_STYLE = 1; private static final int EDIT_BTN_WIDTH = 60; private static final int EDIT_BTN_HEIGHT = 24; - + + private final int CARDMAINLAYOUT_CHILD_COUNT = 1; + /** * 构造函数 */ @@ -52,38 +61,65 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ /** * 获取当前组件里的控件 - * + * * @return 控件 - * + * * * @date 2014-12-10-下午1:46:33 - * + * */ + @Override public WCardMainBorderLayout toData() { return (WCardMainBorderLayout) super.toData(); } - + /** * 添加标题区域 - * + * * @param title 标题区域 - * + * * * @date 2014-12-10-下午1:50:56 - * + * */ - public void addTitlePart(XWCardTitleLayout title){ - this.add(title, WBorderLayout.NORTH); + public void addTitlePart(XWCardTitleLayout title, String position){ + toData().setTabPosition(position); + this.add(title, position); } - + + public int getTitleWidth(){ + String position = toData().getTabPosition(); + if(ComparatorUtils.equals(WBorderLayout.NORTH, position) || ComparatorUtils.equals(WBorderLayout.SOUTH, position)){ + return getTitlePart().getHeight(); + } + return getTitlePart().getWidth(); + } + + public void add(Component comp, String position) { + super.add(comp, position); + } + + + /** + * 切换到非添加状态 + * + * @return designer 表单设计器 + */ + @Override + public void stopAddingState(FormDesigner designer){ + designer.stopAddingState(); + return; + } + + /** * 添加card区域 - * + * * @param card card区域 - * + * * * @date 2014-12-10-下午1:50:37 - * + * */ public void addCardPart(XWCardLayout card){ this.add(card, WBorderLayout.CENTER); @@ -92,11 +128,17 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ public XWCardLayout getCardPart(){ return this.getComponentCount() == TITLE_STYLE ? (XWCardLayout)this.getComponent(CENTER) : (XWCardLayout)this.getComponent(NORTH); } - + public XWCardTitleLayout getTitlePart(){ + Component[] components = this.getComponents(); + for(Component component : components){ + if(component instanceof XWCardTitleLayout){ + return (XWCardTitleLayout)component; + } + } return (XWCardTitleLayout)this.getComponent(NORTH); } - + /** * 控件树里需要隐藏xwcardmainLayout,返回其子组件xwcardLayout; * 标题样式下,this.getComponent(1)==xwcardLayout @@ -105,23 +147,23 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ */ @Override public XCreator getXCreator() { - switch(this.getComponentCount()){ - case TITLE_STYLE: - return (XCreator)this.getComponent(TITLE_STYLE-1); - case NORMAL_STYLE: - return (XCreator)this.getComponent(NORMAL_STYLE-1); - default: - return this; - } + return this; } + /** * 控件树不显示此组件 * @param path 控件树list */ - public void notShowInComponentTree(ArrayList path) { - path.remove(LAYOUT_INDEX); + @Override + public void notShowInComponentTree(List path) { + return; } - + + @Override + public int getShowXCreatorCount() { + return CARDMAINLAYOUT_CHILD_COUNT; + } + @Override public ArrayList getTargetChildrenList() { ArrayList tabLayoutList = new ArrayList(); @@ -132,12 +174,13 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ } return tabLayoutList; } - + /** * 重新调整子组件的宽度 * @param width 宽度 */ - public void recalculateChildWidth(int width){ + @Override + public void recalculateChildWidth(int width){ ArrayList childrenList = this.getTargetChildrenList(); int size = childrenList.size(); if (size > 0) { @@ -163,12 +206,13 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ } } } - + /** * 重新调整子组件的高度 * @param height 高度 */ - public void recalculateChildHeight(int height){ + @Override + public void recalculateChildHeight(int height){ ArrayList childrenList = this.getTargetChildrenList(); int size = childrenList.size(); if (size > 0) { @@ -197,9 +241,10 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ tabLayout.adjustCreatorsHeight(percent); } } - + } + @Override public void paint(Graphics g) { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 @@ -242,10 +287,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ * @param editingMouseListener 鼠标点击,位置处理器 * @param e 鼠标点击事件 */ - public void respondClick(EditingMouseListener editingMouseListener,MouseEvent e){ + @Override + public void respondClick(EditingMouseListener editingMouseListener, MouseEvent e){ FormDesigner designer = editingMouseListener.getDesigner(); SelectionModel selectionModel = editingMouseListener.getSelectionModel(); - boolean isEditing = designer.getCursor().getType() == Cursor.HAND_CURSOR || e.getClickCount() == 2; + boolean isEditing = e.getButton() == MouseEvent.BUTTON1 && + (designer.getCursor().getType() == Cursor.HAND_CURSOR || e.getClickCount() == 2); setEditable(isEditing); selectionModel.selectACreatorAtMouseEvent(e); @@ -274,10 +321,48 @@ public class XWCardMainBorderLayout extends XWBorderLayout{ } } + @Override + public int getIndexOfChild(Object child) { + XWCardTitleLayout titlePart = this.getTitlePart(); + return titlePart.getIndexOfChild(child); + } + /** * data属性改变触发其他操作 * */ + @Override public void firePropertyChange(){ + getCardPart().initStyle(); + } + + + public void resetTabDisplayPosition(WTabDisplayPosition wTabDisplayPosition){ + XWCardTitleLayout xwCardTitleLayout = getTitlePart(); + int titleSize = getTitleWidth(); + xwCardTitleLayout.resetNewBtnPosition(wTabDisplayPosition); + Rectangle parentBounds = new Rectangle(xwCardTitleLayout.getBounds()); + switch (wTabDisplayPosition){ + case TOP_POSITION: + this.addTitlePart(xwCardTitleLayout,WBorderLayout.NORTH); + parentBounds.height = titleSize; + break; + case LEFT_POSITION: + this.addTitlePart(xwCardTitleLayout,WBorderLayout.WEST); + parentBounds.width = titleSize; + break; + case BOTTOM_POSITION: + this.addTitlePart(xwCardTitleLayout,WBorderLayout.SOUTH); + parentBounds.height = titleSize; + break; + case RIGHT_POSITION: + this.addTitlePart(xwCardTitleLayout,WBorderLayout.EAST); + parentBounds.width = titleSize; + break; + default: + break; + } + xwCardTitleLayout.setBounds(parentBounds); + this.addCardPart((XWCardLayout)this.getComponent(0)); } } \ No newline at end of file From a7ce8e87d007b9190f907109392f25a38ec125dd Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 3 Jan 2018 11:53:16 +0800 Subject: [PATCH 59/67] =?UTF-8?q?REPORT-6270=20=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E9=87=8C=E7=9A=84=E7=9B=B8=E5=85=B3bug=3D>=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/mainframe/FormDesigner.java | 5 +++-- .../fr/design/mainframe/FormHierarchyTreePane.java | 12 ++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/designer_form/src/com/fr/design/mainframe/FormDesigner.java b/designer_form/src/com/fr/design/mainframe/FormDesigner.java index 19425b18b2..4b2c664b40 100644 --- a/designer_form/src/com/fr/design/mainframe/FormDesigner.java +++ b/designer_form/src/com/fr/design/mainframe/FormDesigner.java @@ -46,7 +46,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; -import com.fr.stable.CoreGraphHelper; import com.fr.stable.bridge.StableFactory; import javax.swing.*; @@ -148,7 +147,6 @@ public class FormDesigner extends TargetComponent implements TreeSelection new FormDesignerDropTarget(this);// 添加Drag and Drop. this.switchAction = switchAction; - populateParameterPropertyPane(); } /** @@ -1013,6 +1011,9 @@ public class FormDesigner extends TargetComponent implements TreeSelection */ @Override public void valueChanged(TreeSelectionEvent e) { + if (DesignerContext.getDesignerFrame().getSelectedJTemplate() == null) { // 初始化完成前,不响应事件 + return; + } ComponentTree tree = (ComponentTree) e.getSource(); TreePath[] paths = tree.getSelectionPaths(); diff --git a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java index e908bb9f0d..c5a27044df 100644 --- a/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -13,7 +13,6 @@ import com.fr.design.gui.controlpane.ShortCut4JControlPane; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolbar; -import com.fr.design.gui.style.BorderPane; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.menu.ShortCut; import com.fr.design.menu.ToolBarDef; @@ -110,18 +109,11 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree add(getWidgetPane(), BorderLayout.CENTER); - try { - // 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态 - refreshComponentTree(); - } catch (Throwable th) { - // do nothing - } + // 这里要刷新一下,否则控件树中没有任何一个控件处于选中状态 + refreshComponentTree(); } private void refreshComponentTree() { - if (DesignerContext.getDesignerFrame().getSelectedJTemplate() == null) { // 还在初始化状态 - return; - } componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); componentTree.refreshUI(); } From 2b12e492c25d5c1c4dc3d2c9efff01cf8ad7efcf Mon Sep 17 00:00:00 2001 From: vito Date: Wed, 3 Jan 2018 11:57:31 +0800 Subject: [PATCH 60/67] =?UTF-8?q?REPORT-3786=20=E7=9F=AD=E4=BF=A1=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=B8=8A=E7=9A=84=E8=B6=85=E9=93=BE=E6=8E=A5=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=BA=94=E7=94=A8=E4=B8=AD=E5=BF=83=EF=BC=8C?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=97=A0=E6=B3=95=E5=90=8C=E6=AD=A5=E7=99=BB?= =?UTF-8?q?=E5=BD=95=202/2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/ucenter/Client.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/ucenter/Client.java b/designer_base/src/com/fr/design/extra/ucenter/Client.java index cceba006d2..17fafbb3bb 100644 --- a/designer_base/src/com/fr/design/extra/ucenter/Client.java +++ b/designer_base/src/com/fr/design/extra/ucenter/Client.java @@ -15,17 +15,21 @@ import java.util.Map; import java.util.Objects; /** + * 用于和Ucenter通信的客户端 * * @author lp * @date 2016/9/9 + * 1.client借用的是id为9的应用,信息为fanruan官网http://www.fanruan.com, + * 2.借用当前的应用id就会导致无法同步登陆到该应用所在的网站,权衡之后这个影响是比较小的 + * 3.key和appid是成对匹配的 */ public class Client extends AbstractClient { - private static String UC_IP = ""; - private static String UC_API = ""; + private static String UC_API = SiteCenter.getInstance().acquireUrlByKind("bbs.ucapi"); + private static String UC_IP = SiteCenter.getInstance().acquireUrlByKind("bbs.ip"); private static String UC_CONNECT = ""; - private static String UC_KEY = "Rc85U37411p4zdvcedm8D4t4D3l9Sa42H0kd98Gbd82aA99a61S2Z5LbQ9u430M0"; - private static String UC_APPID = "4"; + private static String UC_KEY = SiteCenter.getInstance().acquireUrlByKind("bbs.uc.key", "1v12H473J2Y99935473T4360w5L014522281007621223O1708wv870273fB0200"); + private static String UC_APPID = SiteCenter.getInstance().acquireUrlByKind("bbs.uc.appid", "9"); private static String UC_CLIENT_RELEASE = "20090212"; public static String UC_ROOT = ""; private static String UC_API_FUNC = "mysql".equals(UC_CONNECT) ? UC_API_MYSQL : UC_API_POST; @@ -92,8 +96,6 @@ public class Client extends AbstractClient { sep = "&"; } String postData = ucApiRequestdata(module, action, str.toString(), ""); - UC_API = SiteCenter.getInstance().acquireUrlByKind("bbs.ucapi"); - UC_IP = SiteCenter.getInstance().acquireUrlByKind("bbs.ip"); return ucFopen2(UC_API + "/index.php", 500000, postData, "", true, UC_IP, 20, true); } From 6e4273a6633ff168b75c926003cd5d99235b7075 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 3 Jan 2018 12:01:22 +0800 Subject: [PATCH 61/67] =?UTF-8?q?REPORT-6258=20tab=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=8F=B3=E5=87=BB=E6=97=B6=E5=8E=9F=E6=9C=AC=E7=9A=84=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=8A=9F=E8=83=BD=E8=A2=AB=E8=A6=86=E7=9B=96=E4=BA=86?= =?UTF-8?q?=3D>=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/imenu/UIPopupMenu.java | 1 + .../fr/design/designer/creator/XCreator.java | 4 +-- .../creator/cardlayout/XCardAddButton.java | 17 +++++------ .../creator/cardlayout/XCardSwitchButton.java | 19 ++++-------- .../creator/cardlayout/XWCardTagLayout.java | 30 +++++++------------ .../creator/cardlayout/XWTabFitLayout.java | 15 ++++------ .../mainframe/EditingMouseListener.java | 5 ++-- 7 files changed, 34 insertions(+), 57 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/imenu/UIPopupMenu.java b/designer_base/src/com/fr/design/gui/imenu/UIPopupMenu.java index 9fcf821e0c..492d241cd2 100644 --- a/designer_base/src/com/fr/design/gui/imenu/UIPopupMenu.java +++ b/designer_base/src/com/fr/design/gui/imenu/UIPopupMenu.java @@ -10,6 +10,7 @@ import com.fr.design.constants.UIConstants; public class UIPopupMenu extends JPopupMenu{ private static final float REC = 8f; private boolean onlyText = false; + public static UIPopupMenu EMPTY = new UIPopupMenu(); public UIPopupMenu() { super(); setBackground(UIConstants.NORMAL_BACKGROUND); diff --git a/designer_form/src/com/fr/design/designer/creator/XCreator.java b/designer_form/src/com/fr/design/designer/creator/XCreator.java index 7a49657918..f337ea14ff 100644 --- a/designer_form/src/com/fr/design/designer/creator/XCreator.java +++ b/designer_form/src/com/fr/design/designer/creator/XCreator.java @@ -688,9 +688,9 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo * 创建右击弹出菜单 * */ - public JPopupMenu createPopupMenu(FormDesigner formDesigner) { + public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { UpdateAction[] actions = formDesigner.getActions(); - JPopupMenu popup = new UIPopupMenu(); + UIPopupMenu popup = new UIPopupMenu(); for (int i = 0; i < actions.length; i++) { if (i == SHORTS_SEPARATOR_POS) { popup.addSeparator(); diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java index 0f9c744623..3d52b2beff 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardAddButton.java @@ -1,13 +1,5 @@ package com.fr.design.designer.creator.cardlayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.event.MouseEvent; - -import javax.swing.*; - import com.fr.base.BaseUtils; import com.fr.base.background.ColorBackground; import com.fr.design.designer.beans.AdapterBus; @@ -15,6 +7,7 @@ import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XButton; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormHierarchyTreePane; @@ -25,6 +18,10 @@ import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.general.ComparatorUtils; import com.fr.general.Inter; +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; + public class XCardAddButton extends XButton{ private XWCardTagLayout tagLayout; @@ -112,8 +109,8 @@ public class XCardAddButton extends XButton{ } @Override - public JPopupMenu createPopupMenu(FormDesigner formDesigner) { - return null; // 不要菜单 + public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { + return UIPopupMenu.EMPTY; // 不要菜单 } private void initRelateLayout(){ diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java index daa8d339f1..cfa60b9fc4 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XCardSwitchButton.java @@ -14,6 +14,7 @@ import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormHierarchyTreePane; @@ -32,19 +33,9 @@ import com.fr.general.FRFont; import com.fr.general.Inter; import com.fr.stable.unit.PT; -import javax.swing.Action; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import javax.swing.SwingUtilities; +import javax.swing.*; import javax.swing.plaf.basic.BasicLabelUI; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; +import java.awt.*; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; import java.util.ArrayList; @@ -225,8 +216,8 @@ public class XCardSwitchButton extends XButton { } @Override - public JPopupMenu createPopupMenu(FormDesigner formDesigner) { - return null; // 自己有一个showPopupMenu,不需要使用通用的弹出菜单 + public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { + return UIPopupMenu.EMPTY; // 自己有一个showPopupMenu,不需要使用通用的弹出菜单 } //删除card,同时修改其他switchbutton和tabfit的index diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index 9490f73c42..7a8ed5440e 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -3,18 +3,6 @@ */ package com.fr.design.designer.creator.cardlayout; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Rectangle; -import java.awt.event.ContainerEvent; -import java.awt.event.MouseEvent; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.*; -import javax.swing.border.Border; - import com.fr.base.GraphHelper; import com.fr.base.ScreenResolution; import com.fr.design.designer.beans.AdapterBus; @@ -23,15 +11,12 @@ import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRHorizontalLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRVerticalLayoutAdapter; import com.fr.design.designer.beans.models.SelectionModel; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWHorizontalBoxLayout; -import com.fr.design.designer.creator.XWidgetCreator; +import com.fr.design.designer.creator.*; import com.fr.design.form.layout.FRFlowLayout; import com.fr.design.form.layout.FRHorizontalLayout; import com.fr.design.form.layout.FRVerticalLayout; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; @@ -44,6 +29,13 @@ import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; +import javax.swing.border.Border; +import java.awt.*; +import java.awt.event.ContainerEvent; +import java.awt.event.MouseEvent; +import java.util.HashMap; +import java.util.Map; + /** * @date: 2014-11-25-下午3:11:14 */ @@ -244,8 +236,8 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { } @Override - public JPopupMenu createPopupMenu(FormDesigner formDesigner) { - return null; // 不要菜单 + public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { + return UIPopupMenu.EMPTY; // 不要菜单 } @Override diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index 8555d03f6e..ecdf55e84b 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -11,29 +11,24 @@ import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.fun.WidgetPropertyUIProvider; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.widget.editors.ButtonTypeEditor; import com.fr.design.mainframe.widget.editors.ImgBackgroundEditor; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.CardSwitchButton; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.general.Background; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; import javax.swing.border.Border; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Rectangle; +import java.awt.*; import java.beans.IntrospectionException; @@ -105,8 +100,8 @@ public class XWTabFitLayout extends XWFitLayout { } @Override - public JPopupMenu createPopupMenu(FormDesigner formDesigner) { - return null; // 不要菜单 + public UIPopupMenu createPopupMenu(FormDesigner formDesigner) { + return UIPopupMenu.EMPTY; // 不要菜单 } /** diff --git a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java index a6dbc913cd..5f45afa501 100644 --- a/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer_form/src/com/fr/design/mainframe/EditingMouseListener.java @@ -14,6 +14,7 @@ import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.xpane.ToolTipEditor; import com.fr.design.icon.IconPathConstants; import com.fr.design.utils.ComponentUtils; @@ -540,8 +541,8 @@ public class EditingMouseListener extends MouseInputAdapter { if (creator != null) { creator.respondClick(this, e); if (e.getButton() == MouseEvent.BUTTON3) { - JPopupMenu cellPopupMenu = creator.createPopupMenu(designer); - if (cellPopupMenu != null) { + UIPopupMenu cellPopupMenu = creator.createPopupMenu(designer); + if (cellPopupMenu != UIPopupMenu.EMPTY) { GUICoreUtils.showPopupMenu(cellPopupMenu, designer, e.getX(), e.getY()); } } From fb1fb3f0d8b4fb69f7927c3a53ed00795ad41957 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 3 Jan 2018 12:32:47 +0800 Subject: [PATCH 62/67] =?UTF-8?q?=E6=97=A0jira=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/JSliderPane.java | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/designer_base/src/com/fr/design/mainframe/JSliderPane.java b/designer_base/src/com/fr/design/mainframe/JSliderPane.java index ff30054b45..b98cd9e3c7 100644 --- a/designer_base/src/com/fr/design/mainframe/JSliderPane.java +++ b/designer_base/src/com/fr/design/mainframe/JSliderPane.java @@ -16,7 +16,16 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.Inter; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JFormattedTextField; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JSeparator; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.plaf.basic.BasicSliderUI; @@ -69,7 +78,9 @@ public class JSliderPane extends JPanel { private UIRadioButton twoFiveButton; private UIRadioButton selfAdaptButton; private UIRadioButton customButton; - //拖动条处理和button、直接输入不一样 + /** + * 拖动条处理和button、直接输入不一样 + */ private boolean isButtonOrIsTxt = true; private PopupPane dialog; private int upButtonX; @@ -93,7 +104,7 @@ public class JSliderPane extends JPanel { initShowValButton(); initUIRadioButton(); initPane(); - JPanel panel = new JPanel(new FlowLayout(1, 0, 0)); + JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0)); panel.add(downButton); panel.add(slider); panel.add(upButton); @@ -103,12 +114,8 @@ public class JSliderPane extends JPanel { } - public static final JSliderPane getInstance() { -// if (THIS == null) { -// THIS = new JSliderPane(); -// } - THIS = new JSliderPane(); - return THIS; + public static JSliderPane getInstance() { + return new JSliderPane(); } private void initSlider() { @@ -253,14 +260,14 @@ public class JSliderPane extends JPanel { return spinnerPanel; } - ActionListener showValButtonActionListener = new ActionListener() { + private ActionListener showValButtonActionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { popupDialog(); } }; - ChangeListener showValSpinnerChangeListener = new ChangeListener() { + private ChangeListener showValSpinnerChangeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int val = (int) ((UIBasicSpinner) e.getSource()).getValue(); @@ -283,7 +290,7 @@ public class JSliderPane extends JPanel { //定义一个监听器,用于监听所有滑动条 - ChangeListener listener = new ChangeListener() { + private ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent event) { //取出滑动条的值,并在文本中显示出来 if (!isButtonOrIsTxt) { @@ -303,7 +310,7 @@ public class JSliderPane extends JPanel { } }; - ItemListener radioButtonItemListener = new ItemListener() { + private ItemListener radioButtonItemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { JRadioButton temp = (JRadioButton) e.getSource(); @@ -384,7 +391,7 @@ public class JSliderPane extends JPanel { } else if (value < HALF_HUNDRED) { times = (int) Math.round(ONEPOINTEIGHT * value + TEN); } else { - times = (int) (SIX * value - TWO_HUNDRED); + times = SIX * value - TWO_HUNDRED; } } From 7b6dd4bde3a5aaaa404153cfb252b2feeae6afbd Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 3 Jan 2018 13:54:31 +0800 Subject: [PATCH 63/67] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8Cr?= =?UTF-8?q?elease=E5=90=88=E5=B9=B6=E5=88=B0feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/grid/selection/FloatSelection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/grid/selection/FloatSelection.java b/designer/src/com/fr/grid/selection/FloatSelection.java index 0d441a1f7a..cff3a4a642 100644 --- a/designer/src/com/fr/grid/selection/FloatSelection.java +++ b/designer/src/com/fr/grid/selection/FloatSelection.java @@ -149,8 +149,9 @@ public class FloatSelection extends Selection { TemplateElementCase ec = ePane.getEditingElementCase(); FloatElement fe = ec.getFloatElement(selectedFloatName); if (fe != null) { - ec.removeFloatElement(fe); + // REPORT-5955 [Report]删除悬浮元素后,设计器卡死;之前wu做了释放内存,删除悬浮元素会报npe;删除悬浮元素逻辑改为先setSelection 再 remove ePane.setSelection(new CellSelection(0, 0, 1, 1)); + ec.removeFloatElement(fe); return true; } @@ -240,7 +241,6 @@ public class FloatSelection extends Selection { } public void populateWidgetPropertyPane(ElementCasePane ePane){ - return; } } \ No newline at end of file From f15a19b19be33bc1fc8915daa83c310e0840ff73 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 3 Jan 2018 15:30:00 +0800 Subject: [PATCH 64/67] rt --- .../manager/impl/FileSearchManager.java | 61 +++++++++---------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 9dfec93df3..9a858a73dd 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -15,16 +15,11 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogger; import com.fr.general.Inter; import com.fr.json.JSONObject; -import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; @@ -123,7 +118,9 @@ public class FileSearchManager implements AlphaFineSearchProvider { for (FileNode node : fileNodes) { boolean isAlreadyContain = false; isAlreadyContain = searchFile(searchText, node, isAlreadyContain, needMore); - searchFileContent(env, searchText, node, isAlreadyContain, needMore); + if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent() && node.getLock() == null) { + searchFileContent(env, searchText, node, isAlreadyContain, needMore); + } if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && stopSearch) { return; } @@ -150,35 +147,33 @@ public class FileSearchManager implements AlphaFineSearchProvider { * @param isAlreadyContain */ private void searchFileContent(Env env, String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) { - if (DesignerEnvManager.getEnvManager().getAlphaFineConfigManager().isContainFileContent()) { - try { - InputStreamReader isr = new InputStreamReader(env.readBean(node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1), ProjectConstants.REPORTLETS_NAME), "UTF-8"); - BufferedReader reader = new BufferedReader(isr); - String line; - int columnNumber; - boolean isFoundInContent = false; - while ((line = reader.readLine()) != null) { - columnNumber = line.toLowerCase().indexOf(searchText); - if (columnNumber != -1) { - isFoundInContent = true; - break; - } + try { + InputStreamReader isr = new InputStreamReader(env.readBean(node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1), ProjectConstants.REPORTLETS_NAME), "UTF-8"); + BufferedReader reader = new BufferedReader(isr); + String line; + int columnNumber; + boolean isFoundInContent = false; + while ((line = reader.readLine()) != null) { + columnNumber = line.toLowerCase().indexOf(searchText); + if (columnNumber != -1) { + isFoundInContent = true; + break; + } + } + if (isFoundInContent && !isAlreadyContain) { + FileModel model = new FileModel(node.getName(), node.getEnvPath()); + if (!AlphaFineHelper.getFilterResult().contains(model)) { + AlphaFineHelper.checkCancel(); + filterModelList.add(model); } - if (isFoundInContent && !isAlreadyContain) { - FileModel model = new FileModel(node.getName(), node.getEnvPath()); - if (!AlphaFineHelper.getFilterResult().contains(model)) { - AlphaFineHelper.checkCancel(); - filterModelList.add(model); - } - if (this.filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) { - stopSearch = true; - } + if (this.filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) { + stopSearch = true; } - isr.close(); - reader.close(); - } catch (Exception e) { - FRLogger.getLogger().error("file read error: " + e.getMessage()); } + isr.close(); + reader.close(); + } catch (Exception e) { + FRLogger.getLogger().error("file read error: " + e.getMessage()); } } @@ -198,7 +193,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { AlphaFineHelper.checkCancel(); filterModelList.add(model); } - if(filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) { + if (filterModelList.size() > AlphaFineConstants.SHOW_SIZE && needMore) { stopSearch = true; } isAlreadyContain = true; From 2502fc6da4e63f35acec9de6628be054ced10114 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 3 Jan 2018 15:38:32 +0800 Subject: [PATCH 65/67] =?UTF-8?q?REPORT-4634=20=E7=BB=84=E4=BB=B6=E5=8F=A0?= =?UTF-8?q?=E5=8A=A0=E4=BD=93=E9=AA=8C=E4=BC=98=E5=8C=96=3D>=E5=9F=8B?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/actions/CopyAction.java | 2 +- .../designer/beans/actions/CutAction.java | 2 +- .../beans/actions/FormDeleteAction.java | 7 +--- .../beans/actions/FormEditAction.java | 17 -------- .../beans/actions/FormWidgetEditAction.java | 40 +++++++++++++++++++ .../beans/actions/MoveDownAction.java | 2 +- .../beans/actions/MoveToBottomAction.java | 2 +- .../beans/actions/MoveToTopAction.java | 2 +- .../designer/beans/actions/MoveUpAction.java | 2 +- .../designer/beans/actions/PasteAction.java | 2 +- 10 files changed, 48 insertions(+), 30 deletions(-) delete mode 100644 designer_form/src/com/fr/design/designer/beans/actions/FormEditAction.java create mode 100644 designer_form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java diff --git a/designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java b/designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java index d3906040da..a93da2a60d 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/CopyAction.java @@ -10,7 +10,7 @@ import java.awt.event.KeyEvent; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; -public class CopyAction extends FormEditAction { +public class CopyAction extends FormWidgetEditAction { public CopyAction(FormDesigner t) { super(t); diff --git a/designer_form/src/com/fr/design/designer/beans/actions/CutAction.java b/designer_form/src/com/fr/design/designer/beans/actions/CutAction.java index 1f81c12807..39b7ee47d6 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/CutAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/CutAction.java @@ -11,7 +11,7 @@ import com.fr.design.mainframe.FormDesigner; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; -public class CutAction extends FormEditAction { +public class CutAction extends FormWidgetEditAction { public CutAction(FormDesigner t) { super(t); diff --git a/designer_form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java b/designer_form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java index 6678200cfd..d799fed63b 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/FormDeleteAction.java @@ -17,7 +17,7 @@ import com.fr.design.mainframe.FormSelection; * @author richer * @since 6.5.3 */ -public class FormDeleteAction extends FormUndoableAction { +public class FormDeleteAction extends FormWidgetEditAction { public FormDeleteAction(FormDesigner t) { super(t); @@ -55,9 +55,4 @@ public class FormDeleteAction extends FormUndoableAction { creator.deleteRelatedComponent(creator, designer); return false; } - - @Override - public void update() { - this.setEnabled(true); - } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/actions/FormEditAction.java b/designer_form/src/com/fr/design/designer/beans/actions/FormEditAction.java deleted file mode 100644 index da7847fdad..0000000000 --- a/designer_form/src/com/fr/design/designer/beans/actions/FormEditAction.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.fr.design.designer.beans.actions; - -import com.fr.design.actions.TemplateComponentAction; -import com.fr.design.mainframe.FormDesigner; - -public abstract class FormEditAction extends TemplateComponentAction { - - protected FormEditAction(FormDesigner t) { - super(t); - } - - @Override - public void update() { - this.setEnabled(true); - } - -} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java b/designer_form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java new file mode 100644 index 0000000000..765980b296 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/beans/actions/FormWidgetEditAction.java @@ -0,0 +1,40 @@ +package com.fr.design.designer.beans.actions; + +import com.fr.design.actions.TemplateComponentAction; +import com.fr.design.mainframe.FormDesigner; +import com.fr.general.Inter; +import com.fr.plugin.ExtraClassManager; +import com.fr.stable.ReportFunctionProcessor; +import com.fr.stable.fun.FunctionProcessor; + +import javax.swing.*; +import java.awt.event.ActionEvent; + +public abstract class FormWidgetEditAction extends TemplateComponentAction { + + protected FormWidgetEditAction(FormDesigner t) { + super(t); + } + + @Override + public void update() { + this.setEnabled(true); + } + + @Override + public void actionPerformed(ActionEvent evt) { + super.actionPerformed(evt); + // 记录功能点 + FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); + if (processor != null) { + FunctionProcessor functionProcessor; + if (evt.getSource() instanceof JButton) { + functionProcessor = ReportFunctionProcessor.FORM_WIDGET_EDIT_TOOLBAR; + } else { + functionProcessor = ReportFunctionProcessor.FORM_WIDGET_EDIT_POPUPMENU; + } + processor.recordFunction(functionProcessor); + } + } + +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java index ce57343c29..03e7657ab0 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveDownAction.java @@ -20,7 +20,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M * Created by plough on 2017/12/4. */ -public class MoveDownAction extends FormEditAction { +public class MoveDownAction extends FormWidgetEditAction { public MoveDownAction(FormDesigner t) { super(t); diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java index 5a69805253..ab8f813282 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveToBottomAction.java @@ -20,7 +20,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M * Created by plough on 2017/12/4. */ -public class MoveToBottomAction extends FormEditAction { +public class MoveToBottomAction extends FormWidgetEditAction { public MoveToBottomAction(FormDesigner t) { super(t); diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java index 0995df3ca1..1a2e4be8f6 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveToTopAction.java @@ -20,7 +20,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M * Created by plough on 2017/12/4. */ -public class MoveToTopAction extends FormEditAction { +public class MoveToTopAction extends FormWidgetEditAction { public MoveToTopAction(FormDesigner t) { super(t); diff --git a/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java b/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java index 654b39d695..4700a87eea 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/MoveUpAction.java @@ -19,7 +19,7 @@ import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_M * Created by plough on 2017/12/4. */ -public class MoveUpAction extends FormEditAction { +public class MoveUpAction extends FormWidgetEditAction { public MoveUpAction(FormDesigner t) { super(t); diff --git a/designer_form/src/com/fr/design/designer/beans/actions/PasteAction.java b/designer_form/src/com/fr/design/designer/beans/actions/PasteAction.java index 351a809f62..89a30235be 100644 --- a/designer_form/src/com/fr/design/designer/beans/actions/PasteAction.java +++ b/designer_form/src/com/fr/design/designer/beans/actions/PasteAction.java @@ -11,7 +11,7 @@ import com.fr.design.mainframe.FormDesigner; import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; -public class PasteAction extends FormEditAction { +public class PasteAction extends FormWidgetEditAction { public PasteAction(FormDesigner t) { super(t); From ba4afc50ae8f2a803265660ac90c024a3a0c65c7 Mon Sep 17 00:00:00 2001 From: XiaXiang Date: Wed, 3 Jan 2018 15:40:29 +0800 Subject: [PATCH 66/67] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/search/manager/impl/FileSearchManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 9a858a73dd..8cc5786833 100644 --- a/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer/src/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -20,6 +20,7 @@ import com.fr.stable.project.ProjectConstants; import java.io.BufferedReader; import java.io.File; +import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; @@ -148,7 +149,8 @@ public class FileSearchManager implements AlphaFineSearchProvider { */ private void searchFileContent(Env env, String searchText, FileNode node, boolean isAlreadyContain, boolean needMore) { try { - InputStreamReader isr = new InputStreamReader(env.readBean(node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1), ProjectConstants.REPORTLETS_NAME), "UTF-8"); + InputStream inputStream = env.readBean(node.getEnvPath().substring(ProjectConstants.REPORTLETS_NAME.length() + 1), ProjectConstants.REPORTLETS_NAME); + InputStreamReader isr = new InputStreamReader(inputStream, "UTF-8"); BufferedReader reader = new BufferedReader(isr); String line; int columnNumber; From 5c572170242b350f788a047551e7f95be83c2ffa Mon Sep 17 00:00:00 2001 From: hzzz Date: Wed, 3 Jan 2018 17:40:16 +0800 Subject: [PATCH 67/67] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=B8=A6?= =?UTF-8?q?=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/actions/file/WebPreviewUtils.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/designer_base/src/com/fr/design/actions/file/WebPreviewUtils.java b/designer_base/src/com/fr/design/actions/file/WebPreviewUtils.java index f682f7ddf1..2f62fad5a4 100644 --- a/designer_base/src/com/fr/design/actions/file/WebPreviewUtils.java +++ b/designer_base/src/com/fr/design/actions/file/WebPreviewUtils.java @@ -34,15 +34,17 @@ public final class WebPreviewUtils { if (map == null || map == Collections.EMPTY_MAP) { map = new HashMap<>(); } - map.put("mode", DesignerMode.getMode().toString()); + if (DesignerMode.isVcsMode()) { + map.put("mode", DesignerMode.getMode().toString()); + } DesignerContext.getDesignerFrame().refreshToolbar(); jt.stopEditing(); /* * alex:如果没有保存,先保存到Env - * - * 如果保存失败,不执行下面的WebPreview - */ + * + * 如果保存失败,不执行下面的WebPreview + */ if (!jt.isSaved() && !jt.saveTemplate2Env()) { return; } @@ -98,4 +100,4 @@ public final class WebPreviewUtils { } } } -} \ No newline at end of file +}