Browse Source

Merge pull request #1000 in BA/design from ~MOMEAK/design9.0:9.0 to 9.0

* commit 'cad0a13b56b0d0ef2d84ea515198ba80a4df17d1': (32 commits)
  REPORT-3163 合作开发9.0设计器=>左侧可伸缩面板调整按钮位置
  REPORT-2897 9.0设计器修改 PMD
  REPORT-2897 9.0设计器修改 PMD
  REPORT-3163 合作开发9.0设计器=>修正一处错误
  REPORT-3163 合作开发9.0设计器=>pmd
  REPORT-2897 9.0设计器修改 缩放条部分
  REPORT-3163 合作开发9.0设计器=>左侧可伸缩面板改回原有设计
  REPORT-2897 9.0设计器修改 缩放条部分
  REPORT-2897 9.0设计器修改 缩放条部分
  REPORT-3163 合作开发9.0设计器=>属性面板tab项动态变化(权限编辑)
  REPORT-3163 合作开发9.0设计器=>属性面板tab项动态变化(聚合报表部分)
  REPORT-3163 合作开发9.0设计器=>属性面板tab项动态变化(部分)
  REPORT-2897 9.0设计器修改 缩放条部分
  REPORT-3163 合作开发9.0设计器=>propertyItemList 改为 propertyItemMap(有序map)
  REPORT-3163 合作开发9.0设计器=>所有tab弹出后,显示“无可用配置项”
  REPORT-3163 合作开发9.0设计器=>交换弹出工具条的上下按钮
  REPORT-3163 合作开发9.0设计器=>红色标出可拖动区域
  REPORT-3163 合作开发9.0设计器=>面板标题国际化
  REPORT-3163 合作开发9.0设计器=>修复弹窗bug:1、失焦后被设计器覆盖;2、弹出后,点击不同单元格,面板没有更新;3、弹出后,点击不同单元格,弹回,面板消失;4、切换面板时,内容不应被遮挡
  REPORT-3163 合作开发9.0设计器=>弹出对话框可调整高度
  ...
master
superman 7 years ago
parent
commit
2c35f4c0fa
  1. 2
      designer/src/com/fr/design/cell/editor/RichTextToolBar.java
  2. 22
      designer/src/com/fr/design/expand/ExpandFatherPane.java
  3. 19
      designer/src/com/fr/design/mainframe/CellElementPropertyPane.java
  4. 16
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  5. 17
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  6. 5
      designer/src/com/fr/design/mainframe/JPolyWorkBook.java
  7. 49
      designer/src/com/fr/design/mainframe/JWorkBook.java
  8. 57
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  9. 46
      designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java
  10. 2
      designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java
  11. 95
      designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java
  12. 3
      designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java
  13. 3
      designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java
  14. 20
      designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java
  15. 12
      designer/src/com/fr/grid/Grid.java
  16. 13
      designer/src/com/fr/grid/GridColumn.java
  17. 19
      designer/src/com/fr/grid/GridColumnUI.java
  18. 38
      designer/src/com/fr/grid/GridMouseAdapter.java
  19. 18
      designer/src/com/fr/grid/GridRow.java
  20. 16
      designer/src/com/fr/grid/GridRowUI.java
  21. 7
      designer/src/com/fr/grid/GridUI.java
  22. 82
      designer/src/com/fr/grid/GridUtils.java
  23. 9
      designer/src/com/fr/poly/PolyDesigner.java
  24. 2
      designer/src/com/fr/poly/creator/ECBlockEditor.java
  25. 2
      designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java
  26. 111
      designer_base/src/com/fr/design/foldablepane/HeaderPane.java
  27. 95
      designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java
  28. 310
      designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  29. 6
      designer_base/src/com/fr/design/gui/icontainer/UIResizableContainer.java
  30. 24
      designer_base/src/com/fr/design/gui/style/BackgroundPane.java
  31. 83
      designer_base/src/com/fr/design/gui/style/BorderPane.java
  32. 146
      designer_base/src/com/fr/design/gui/style/FRFontPane.java
  33. 151
      designer_base/src/com/fr/design/gui/style/FormatPane.java
  34. 29
      designer_base/src/com/fr/design/locale/designer.properties
  35. 29
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  36. 28
      designer_base/src/com/fr/design/locale/designer_ja_JP.properties
  37. 28
      designer_base/src/com/fr/design/locale/designer_ko_KR.properties
  38. 28
      designer_base/src/com/fr/design/locale/designer_zh_CN.properties
  39. 27
      designer_base/src/com/fr/design/locale/designer_zh_TW.properties
  40. 10
      designer_base/src/com/fr/design/mainframe/DesignerFrame.java
  41. 854
      designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java
  42. 417
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  43. 7
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  44. 2
      designer_base/src/com/fr/design/roleAuthority/RoleTree.java
  45. 5
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  46. 52
      designer_form/src/com/fr/design/mainframe/FormArea.java
  47. 35
      designer_form/src/com/fr/design/mainframe/JForm.java

2
designer/src/com/fr/design/cell/editor/RichTextToolBar.java

@ -81,7 +81,7 @@ public class RichTextToolBar extends BasicPane{
private void initAllButton(){
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontSizeComboBox = new UIComboBox(FRFontPane.getFontSizes());
colorSelectPane = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));
colorSelectPane.set4Toolbar();

22
designer/src/com/fr/design/expand/ExpandFatherPane.java

@ -22,6 +22,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
public abstract class ExpandFatherPane extends JPanel implements GlobalNameObserver {
@ -33,15 +35,16 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
private String expandFatherName = "";
private GlobalNameListener globalNameListener = null;
private boolean isAlreadyAddListener = false;
private final JPanel customPane;
public ExpandFatherPane() {
this.setLayout(new BorderLayout(0, LayoutConstants.VGAP_SMALL));
comboBox = new UIComboBox(new String[]{
Inter.getLocText("None"),
Inter.getLocText("Default"),
Inter.getLocText("Custom")});
Inter.getLocText("FR-Designer_None"),
Inter.getLocText("FR-Designer_DEFAULT"),
Inter.getLocText("FR-Designer_Custom")});
final CardLayout cardLayout = new CardLayout();
final JPanel customPane = new JPanel(cardLayout);
customPane = new JPanel(cardLayout);
customParentColumnRowPane = new ColumnRowPane() {
@Override
@ -63,13 +66,22 @@ public abstract class ExpandFatherPane extends JPanel implements GlobalNameObser
cc.add(imageButton, BorderLayout.EAST);
customPane.add(cc, "content");
customPane.add(new JPanel(), "none");
customPane.setPreferredSize(new Dimension(0, 0) );
this.add(comboBox, BorderLayout.NORTH);
this.add(customPane, BorderLayout.CENTER);
comboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
if(comboBox.getSelectedIndex() == 2){
customPane.setPreferredSize(new Dimension(100, 20) );
cardLayout.show(customPane,"content");
}else {
cardLayout.show(customPane,"none");
customPane.setPreferredSize(new Dimension(0, 0) );
}
// cardLayout.show(customPane, comboBox.getSelectedIndex() == 2 ? "content" : "none");
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(expandFatherName);
}

19
designer/src/com/fr/design/mainframe/CellElementPropertyPane.java

@ -3,7 +3,13 @@
*/
package com.fr.design.mainframe;
import java.awt.*;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.fun.PresentKindProvider;
import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
@ -22,9 +28,6 @@ import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.Elem;
import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*;
import java.awt.*;
/**
* 所有组件一次全部加载不存在延迟加载 原因设计器打开第一张模板的时候会初始化许多许多东西这个过程需要很长时间快的3-5s
@ -43,7 +46,7 @@ public class CellElementPropertyPane extends DockingView {
public void on(PluginEvent event) {
synchronized (CellElementPropertyPane.class) {
singleton = null;
singleton = new CellElementPropertyPane();
}
}
}, new PluginFilter() {
@ -51,11 +54,13 @@ public class CellElementPropertyPane extends DockingView {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraDesign);
return context.contain(PluginModule.ExtraDesign, PresentKindProvider.MARK_STRING) ||
context.contain(PluginModule.ExtraDesign, CellAttributeProvider.MARK_STRING);
}
});
}
public synchronized static CellElementPropertyPane getInstance() {
if (singleton == null) {
singleton = new CellElementPropertyPane();
@ -97,7 +102,7 @@ public class CellElementPropertyPane extends DockingView {
title.setVerticalAlignment(SwingConstants.CENTER);
titlePane.add(title, BorderLayout.CENTER);
titlePane.setBorder(BorderFactory.createEmptyBorder(0,0,1,0));
this.add(titlePane, BorderLayout.NORTH);
// this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
}
@ -130,7 +135,7 @@ public class CellElementPropertyPane extends DockingView {
public void reInit(ElementCasePane ePane) {
if (titlePane.getParent() == null) { // 如果处于隐藏状态,则让其显示
this.add(titlePane, BorderLayout.NORTH);
// this.add(titlePane, BorderLayout.NORTH);
this.add(cellElementEditPane, BorderLayout.CENTER);
}
cellElementEditPane.populate(ePane);

16
designer/src/com/fr/design/mainframe/ElementCasePane.java

@ -11,12 +11,9 @@ import java.awt.Rectangle;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Constructor;
import java.util.Set;
@ -213,6 +210,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
protected void initComponents() {
this.setLayout(new RGridLayout());
//todo 直接修改分辨率
this.resolution = ScreenResolution.getScreenResolution();
this.initGridComponent();
@ -504,7 +502,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*/
public void setSelection(Selection selection) {
if (!ComparatorUtils.equals(this.selection, selection) ||
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getDownPane(), CellElementPropertyPane.getInstance())) {
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
this.selection = selection;
fireSelectionChanged();
}
@ -1049,7 +1047,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false;
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(this, evt.getX(), evt.getY());
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(), this.resolution);
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();
ElementCase report = this.getEditingElementCase();
if (reportPageAttr != null) {
@ -1142,7 +1140,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
HeadColumnAction headcolumnAction = new HeadColumnAction(this);
FootColumnAction footcolumnAction = new FootColumnAction(this);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(this, evt.getX(), evt.getY());
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(this, evt.getX(), evt.getY(),this.resolution);
ElementCase elementCase = this.getEditingElementCase();
boolean cancel = false;
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr();

17
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler;
import com.fr.design.menu.KeySetUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.FloatSelection;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.DesignState;
@ -47,8 +48,9 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().replaceUpPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return;
}
@ -56,8 +58,15 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceUpPane(QuickEditorRegion.getInstance());
if (((ElementCasePaneDelegate)e.getSource()).getSelection() instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
// EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceFloatElementPane(QuickEditorRegion.getInstance());
} else {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
}
EastRegionContainerPane.getInstance().removeParameterPane();
}
}

5
designer/src/com/fr/design/mainframe/JPolyWorkBook.java

@ -38,4 +38,9 @@ public class JPolyWorkBook extends JWorkBook {
public SheetNameTabPane createSheetNameTabPane(ReportComponentComposite reportCompositeX){
return new PolySheetNameTabPane(reportCompositeX);
}
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
}
}

49
designer/src/com/fr/design/mainframe/JWorkBook.java

@ -1,9 +1,9 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction;
@ -51,16 +51,17 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.general.ModuleContext;
import com.fr.general.web.ParameterConsts;
import com.fr.grid.Grid;
import com.fr.grid.GridUtils;
import com.fr.io.exporter.EmbeddedTableDataExporter;
import com.fr.main.TemplateWorkBook;
import com.fr.main.impl.WorkBook;
import com.fr.main.parameter.ReportParameterAttr;
import com.fr.poly.PolyDesigner;
import com.fr.privilege.finegrain.WorkSheetPrivilegeControl;
import com.fr.report.cellcase.CellCase;
import com.fr.report.ReportHelper;
import com.fr.report.elementcase.ElementCase;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.report.poly.PolyWorkSheet;
import com.fr.report.report.Report;
import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
@ -86,6 +87,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
private UIModeControlContainer centerPane;
private ReportComponentComposite reportComposite;
private ParameterDefinitePane parameterPane;
private int resolution;
public JWorkBook() {
super(new WorkBook(new WorkSheet()), "WorkBook");
@ -102,6 +104,13 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
populateReportParameterAttr();
}
@Override
public void refreshEastPropertiesPane() {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellElementPane(getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(getEastDownPane());
}
@Override
protected UIModeControlContainer createCenterPane() {
parameterPane = ModuleContext.isModuleStarted(Module.FORM_MODULE) ? new ParameterDefinitePane() : null;
@ -159,6 +168,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
}
}
/**
* 无条件取消格式刷
*/
@ -317,6 +327,34 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
parameterPane.getParaDesigner().removeSelection();
}
/**
* 缩放条
*/
@Override
public void setScale(int resolution) {
//更新resolution
this.resolution = resolution;
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setResolution(resolution);
//更新Grid
Grid grid = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid();
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase());
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().updateUI();
//更新Column和Row
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().setResolution(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().updateUI();
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().setResolution(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().updateUI();
}
@Override
public int getScale() {
return this.resolution;
}
public int getToolBarHeight() {
return TOOLBARPANEDIMHEIGHT;
}
@ -746,7 +784,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
if (delegate4ToolbarMenuAdapter() instanceof PolyDesigner) {
PolyDesigner polyDesigner = (PolyDesigner) delegate4ToolbarMenuAdapter();
if (polyDesigner.getSelectionType() == PolyDesigner.SelectionType.NONE || polyDesigner.getSelection() == null) {
EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
QuickEditorRegion.getInstance().populate(QuickEditor.DEFAULT_EDITOR);
} else {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());

57
designer/src/com/fr/design/mainframe/ReportComponentComposite.java

@ -6,10 +6,14 @@ import java.util.ArrayList;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.base.FRContext;
import com.fr.base.ScreenResolution;
import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
@ -24,6 +28,10 @@ import com.fr.report.report.TemplateReport;
* @since 2012-3-27下午12:12:05
*/
public class ReportComponentComposite extends JComponent {
private static final int MAX = 400;
private static final int HUND = 100;
private static final int MIN = 10;
private JWorkBook parent;
private UIModeControlContainer parentContainer = null;
@ -36,11 +44,12 @@ public class ReportComponentComposite extends JComponent {
private JPanel hbarContainer;
private JSliderPane jSliderContainer;
/**
* Constructor with workbook..
*
* @param workBook the current workbook.
*/
public ReportComponentComposite(JWorkBook jwb) {
this.parent = jwb;
@ -51,8 +60,28 @@ public class ReportComponentComposite extends JComponent {
CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(CellElementRegion, BorderLayout.NORTH);
this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().getDocument().addDocumentListener(jSliderContainerListener);
}
DocumentListener jSliderContainerListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
double value = Integer.parseInt(jSliderContainer.getShowVal().getText().substring(0, jSliderContainer.getShowVal().getText().indexOf("%")));
value = value>MAX ? MAX : value;
value = value<MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
}
@Override
public void removeUpdate(DocumentEvent e) {
}
@Override
public void changedUpdate(DocumentEvent e) {
}
};
protected void doBeforeChange(int oldIndex) {
if (oldIndex >= 0) {
templateStateList.set(oldIndex, centerCardPane.editingComponet.createEditingState());
@ -62,7 +91,7 @@ public class ReportComponentComposite extends JComponent {
protected void doAfterChange(int newIndex) {
WorkBook workbook = getEditingWorkBook();
if (workbook == null) {
FRContext.getLogger().error(Inter.getLocText("Read_failure") + "!");
FRContext.getLogger().error(Inter.getLocText("FR-Designer_Read_failure") + "!");
//AUGUST:加个报错,不然测试总是SB的认为打不开一个坏的excel文件就是BUG,也不知道去检查下源文件。
return;
}
@ -153,13 +182,31 @@ public class ReportComponentComposite extends JComponent {
}
private JComponent createSouthControlPane() {
// hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
// hbarContainer.add(createSouthControlPaneWithJSliderPane());
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
// JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, hbarContainer);
JPanel southPane = new JPanel(new BorderLayout());
jSliderContainer = JSliderPane.getInstance();
JSplitPane splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sheetNameTab, jSliderContainer);
splitpane.setBorder(null);
splitpane.setDividerSize(3);
splitpane.setResizeWeight(0.6);
return splitpane;
splitpane.setResizeWeight(1);
southPane.add(hbarContainer,BorderLayout.NORTH);
southPane.add(splitpane,BorderLayout.CENTER);
return southPane;
}
private JComponent createSouthControlPaneWithJSliderPane() {
hbarContainer = FRGUIPaneFactory.createBorderLayout_S_Pane();
hbarContainer.add(centerCardPane.editingComponet.getHorizontalScrollBar());
JSplitPane splitWithJSliderPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, hbarContainer, JSliderPane.getInstance());
splitWithJSliderPane.setBorder(null);
splitWithJSliderPane.setDividerLocation(0.9);
splitWithJSliderPane.setDividerSize(3);
splitWithJSliderPane.setResizeWeight(1);
return splitWithJSliderPane;
}
public void setSelectedIndex(int selectedIndex) {

46
designer/src/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -1,21 +1,21 @@
package com.fr.design.mainframe.cell;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.awt.*;
import java.util.*;
import java.util.List;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.*;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.CellAttributeProvider;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.dialog.BasicPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane;
@ -44,21 +44,33 @@ public class CellElementEditPane extends BasicPane {
private int PaneListIndex;
private CardLayout card;
private JPanel center;
private JPanel downTitle;
private JPanel title;
private UILabel titlename;
private TitleChangeListener titleChangeListener = null;
private CellAttributeProvider cellAttributeProvider = null;
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel)jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CellElementEditPane(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
public CellElementEditPane() {
setLayout(new BorderLayout());
initPaneList();
Icon[] iconArray = new Icon[paneList.size()];
String[] iconArray = new String[paneList.size()];
card = new CardLayout();
center = new JPanel(card);
for (int i = 0; i < paneList.size(); i++) {
AbstractCellAttrPane pane = paneList.get(i);
iconArray[i] = BaseUtils.readIcon(pane.getIconPath());
iconArray[i] = pane.getIconPath();
center.add(pane, pane.title4PopupWindow());
}
@ -74,8 +86,22 @@ public class CellElementEditPane extends BasicPane {
}
};
tabsHeaderIconPane.setNeedLeftRightOutLine(false);
this.add(tabsHeaderIconPane, BorderLayout.NORTH);
this.add(center, BorderLayout.CENTER);
titlename = new UILabel(Inter.getLocText("Cell-Cell_Attributes"));
titlename.setFont(new Font("Dialog", 1, 14));
titlename.setForeground(new Color(30,190,245));
title = new JPanel();
title.setLayout(new BorderLayout());
title.add(titlename, BorderLayout.NORTH);
downTitle = new JPanel();
downTitle.setLayout(new BorderLayout());
downTitle.add(tabsHeaderIconPane, BorderLayout.NORTH);
downTitle.add(center, BorderLayout.CENTER);
this.add(title, BorderLayout.NORTH);
this.add(downTitle, BorderLayout.CENTER);
}

2
designer/src/com/fr/design/mainframe/cell/QuickEditorRegion.java

@ -35,7 +35,7 @@ public class QuickEditorRegion extends JPanel {
private static QuickEditorRegion singleton = new QuickEditorRegion();
private static JPanel EMPTY;
private QuickEditorRegion() {
public QuickEditorRegion() {
this.setLayout(new BorderLayout());
}

95
designer/src/com/fr/design/mainframe/cell/settingpane/CellExpandAttrPane.java

@ -10,6 +10,8 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
@ -31,6 +33,9 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
private UICheckBox horizontalExpandableCheckBox;
private UICheckBox verticalExpandableCheckBox;
private SortExpandAttrPane sortAfterExpand;
private JPanel layoutPane;
private JPanel basicPane;
private JPanel seniorPane;
/**
*
@ -56,33 +61,83 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
}
public static void main(String[] args){
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
// content.add(new CellExpandAttrPane().layoutPane(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(290, 400);
// jf.setVisible(true);
}
private void initAllNames() {
expandDirectionButton.setGlobalName(Inter.getLocText("ExpandD-Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("LeftParent"));
rightFatherPane.setGlobalName(Inter.getLocText("ExpandD-Up_Father_Cell"));
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable"));
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("ExpandD-Expandable"));
expandDirectionButton.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"));
leftFatherPane.setGlobalName(Inter.getLocText("FR-Designer_LeftParent"));
rightFatherPane.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"));
horizontalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
verticalExpandableCheckBox.setGlobalName(Inter.getLocText("FR-Designer_ExpandD_Expandable"));
}
private JPanel layoutPane() {
layoutPane = new JPanel(new BorderLayout());
basicPane = new JPanel();
seniorPane = new JPanel();
basicPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Basic"),290,20,basicPane());
seniorPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Advanced"),290,20,seniorPane());
layoutPane.add(basicPane,BorderLayout.NORTH);
layoutPane.add(seniorPane,BorderLayout.CENTER);
return layoutPane;
// double f = TableLayout.FILL;
// double p = TableLayout.PREFERRED;
// Component[][] components = new Component[][]{
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
// new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
// new Component[]{new JSeparator(), null},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
// new Component[]{null, verticalExpandableCheckBox},
// new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
// };
// double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
// double[] columnSize = {p, f};
// int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel basicPane(){
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Expand_Direction")+" ", SwingConstants.LEFT), expandDirectionButton},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_LeftParent"), SwingConstants.LEFT), leftFatherPane},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"), SwingConstants.LEFT), rightFatherPane},
};
double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1},{1, 1}, {1, 3}, {1, 3}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel seniorPane() {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("ExpandD-Expand_Direction") + ":", SwingConstants.RIGHT), expandDirectionButton},
new Component[]{new UILabel(Inter.getLocText("LeftParent") + ":", SwingConstants.RIGHT), leftFatherPane},
new Component[]{new UILabel(Inter.getLocText("ExpandD-Up_Father_Cell") + ":", SwingConstants.RIGHT), rightFatherPane},
new Component[]{new JSeparator(), null},
new Component[]{new UILabel(Inter.getLocText("ExpandD-Expandable") + ":", SwingConstants.RIGHT), horizontalExpandableCheckBox},
new Component[]{null, verticalExpandableCheckBox},
new Component[]{new UILabel(Inter.getLocText("ExpandD-Sort_After_Expand") + ":", SwingConstants.RIGHT), sortAfterExpand},
new Component[]{null,null},
new Component[]{horizontalExpandableCheckBox, null},
new Component[]{verticalExpandableCheckBox, null},
new Component[]{new UILabel(" "+Inter.getLocText("FR-Designer_ExpendSort"), SwingConstants.RIGHT), sortAfterExpand},
};
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p, p, p};
double[] rowSize = {p, p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 3}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 3}, {1, 3}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
@Override
protected void populateBean() {
this.leftFatherPane.setElementCasePane(elementCasePane);
@ -120,9 +175,11 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
return "com/fr/design/images/expand/cellAttr.gif";
// return "com/fr/design/images/expand/cellAttr.gif";
return Inter.getLocText("FR-Designer_Expand");
}
@Override
public void updateBean(TemplateCellElement cellElement) {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
@ -130,19 +187,19 @@ public class CellExpandAttrPane extends AbstractCellAttrPane {
cellExpandAttr = new CellExpandAttr();
cellElement.setCellExpandAttr(cellExpandAttr);
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expand_Direction"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Expand_Direction"))) {
cellExpandAttr.setDirection(expandDirectionButton.getSelectedItem());
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("LeftParent"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_LeftParent"))) {
this.leftFatherPane.update(cellExpandAttr);
}
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Up_Father_Cell"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD_Up_Father_Cell"))) {
this.rightFatherPane.update(cellExpandAttr);
}
// extendable
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("ExpandD-Expandable"))) {
if (ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_ExpandD-Expandable"))) {
if (horizontalExpandableCheckBox.isSelected()) {
if (verticalExpandableCheckBox.isSelected()) {
cellExpandAttr.setExtendable(CellExpandAttr.Both_EXTENDABLE);

3
designer/src/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java

@ -214,7 +214,8 @@ public class CellOtherSetPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
return "com/fr/design/images/m_format/cellstyle/otherset.png";
// return "com/fr/design/images/m_format/cellstyle/otherset.png";
return Inter.getLocText("FR-Designer_Other");
}
@Override

3
designer/src/com/fr/design/mainframe/cell/settingpane/CellPresentPane.java

@ -39,7 +39,8 @@ public class CellPresentPane extends AbstractCellAttrPane {
@Override
public String getIconPath() {
return "com/fr/design/images/data/source/dataDictionary.png";
// return "com/fr/design/images/data/source/dataDictionary.png";
return Inter.getLocText("FR-Designer_Present");
}
@Override

20
designer/src/com/fr/design/mainframe/cell/settingpane/CellStylePane.java

@ -2,12 +2,13 @@ package com.fr.design.mainframe.cell.settingpane;
import java.awt.*;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.Style;
import com.fr.design.mainframe.cell.settingpane.style.StylePane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement;
@ -40,11 +41,24 @@ public class CellStylePane extends AbstractCellAttrPane {
return content;
}
public static void main(String[] args){
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
// content.add(new CellStylePane().createContentPane(), BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(290, 400);
// jf.setVisible(true);
}
@Override
public String getIconPath() {
return "com/fr/design/images/m_format/cell.png";
// return "com/fr/design/images/m_format/cell.png";
return Inter.getLocText("FR-Designer_Style");
}
@Override
public void updateBean(TemplateCellElement cellElement) {
cellElement.setStyle(stylePane.updateBean());
@ -106,7 +120,7 @@ public class CellStylePane extends AbstractCellAttrPane {
@Override
public String title4PopupWindow() {
return Inter.getLocText("Style");
return Inter.getLocText(Inter.getLocText("FR-Designer_Style"));
}
public void setSelectedByIds(int level, String... id) {

12
designer/src/com/fr/grid/Grid.java

@ -114,6 +114,7 @@ public class Grid extends BaseGridComponent {
private int resolution;
// 判断SmartJTablePane是否显示,做为动态虚线标识符
private boolean notShowingTableSelectPane = true;
private GridMouseAdapter gridMouseAdapter;
public Grid(int resolution) {
this.resolution = resolution;
@ -121,7 +122,7 @@ public class Grid extends BaseGridComponent {
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
GridKeyAction.initGridInputActionMap(this);
GridMouseAdapter gridMouseAdapter = new GridMouseAdapter(this);
gridMouseAdapter = new GridMouseAdapter(this);
this.addMouseListener(gridMouseAdapter);
this.addMouseMotionListener(gridMouseAdapter);
@ -136,6 +137,10 @@ public class Grid extends BaseGridComponent {
this.updateUI();
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
/**
* 应用界面设置
*
@ -149,6 +154,7 @@ public class Grid extends BaseGridComponent {
setUI(localComponentUI);
}
/**
* 是否显示格子线
*
@ -173,6 +179,10 @@ public class Grid extends BaseGridComponent {
this.getElementCasePane().repaint();
}
public GridMouseAdapter getGridMouseAdapter(){
return this.gridMouseAdapter;
}
/**
* Gets grid line color.
*

13
designer/src/com/fr/grid/GridColumn.java

@ -6,9 +6,14 @@ package com.fr.grid;
import java.awt.Dimension;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.stable.StableUtils;
import javax.swing.plaf.ComponentUI;
/**
* GridColumn used to paint and edit grid column.
*
@ -17,6 +22,8 @@ import com.fr.stable.StableUtils;
*/
public class GridColumn extends GridHeader<String> {
private int resolution = ScreenResolution.getScreenResolution();
@Override
protected void initByConstructor() {
GridColumnMouseHandler gridColumnMouseHandler = new GridColumnMouseHandler(this);
@ -32,7 +39,11 @@ public class GridColumn extends GridHeader<String> {
@Override
public void updateUI() {
this.setUI(new GridColumnUI());
this.setUI(new GridColumnUI(resolution));
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
/**

19
designer/src/com/fr/grid/GridColumnUI.java

@ -16,6 +16,8 @@ import com.fr.base.ScreenResolution;
import com.fr.cache.list.IntList;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.GridScaleEdit;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.ColumnRowPrivilegeControl;
@ -29,7 +31,14 @@ import com.fr.report.elementcase.ElementCase;
public class GridColumnUI extends ComponentUI {
protected Color withoutDetailsBackground = Color.lightGray;
protected int resolution = ScreenResolution.getScreenResolution();
private int resolution ;
public GridColumnUI(int resolution){
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
this.resolution = resolution;
}
@Override
public void paint(Graphics g, JComponent c) {
@ -154,11 +163,11 @@ public class GridColumnUI extends ComponentUI {
}
double stringWidth = gridColumn.getFont().getStringBounds(columnContent, fontRenderContext).getWidth();
if (stringWidth > tmpIncreaseWidth) {
paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
} else {
// if (stringWidth > tmpIncreaseWidth) {
// paintMoreContent(i, g2d, tmpWidth1, size, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
// } else {
paintNormalContent(i, g2d, tmpWidth1, tmpIncreaseWidth, isSelectedBounds, gridColumn, elementCase, columnContent, stringWidth, fmAscent);
}
// }
}

38
designer/src/com/fr/grid/GridMouseAdapter.java

@ -7,6 +7,8 @@ import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.GridScaleEdit;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.present.CellWriteAttrPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.grid.selection.CellSelection;
@ -71,6 +73,8 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private int ECBlockGap = 40;
private int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
protected GridMouseAdapter(Grid grid) {
this.grid = grid;
}
@ -101,7 +105,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// 用户没有按住Shift键时,tempOldSelectedCell是一直变化的。如果一直按住shift,是不变的
ElementCasePane ePane = grid.getElementCasePane();
if (!evt.isShiftDown() && ePane.getSelection() instanceof CellSelection) {
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow(ePane, oldEvtX, oldEvtY);
tempOldSelectedCell = GridUtils.getAdjustEventColumnRow_withresolution(ePane, oldEvtX, oldEvtY,resolution);
}
}
@ -118,7 +122,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
int horizentalScrollValue = grid.getHorizontalValue();
int verticalScrollValue = grid.getVerticalValue();
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
FU evtX_fu = FU.valueOfPix(this.oldEvtX, resolution);
FU evtY_fu = FU.valueOfPix(this.oldEvtY, resolution);
@ -142,7 +146,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
FloatElement selectedFloatElement = (FloatElement) tmpFloatElementCursor[0];
reportPane.setSelection(new FloatSelection(selectedFloatElement.getName()));
} else {
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
if (!reportPane.getSelection().containsColumnRow(selectedCellPoint)) {
GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow());
}
@ -187,7 +191,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
// peter:选择GridSelection,支持Shift
doOneClickSelection(this.oldEvtX, this.oldEvtY, isShiftDown, isControlDown);
// 得到点击所在的column and row
ColumnRow columnRow = GridUtils.getEventColumnRow(reportPane, this.oldEvtX, this.oldEvtY);
ColumnRow columnRow = GridUtils.getEventColumnRow_withresolution(reportPane, this.oldEvtX, this.oldEvtY, this.resolution);
TemplateCellElement cellElement = report.getTemplateCellElement(columnRow.getColumn(), columnRow.getRow());
if (clickCount >= 2 && !BaseUtils.isAuthorityEditing()) {
grid.startEditing();
@ -206,7 +210,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
*/
private void showWidetWindow(TemplateCellElement cellElement, TemplateElementCase report) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
double fixed_pos_x = this.oldEvtX - columnWidthList.getRangeValue(grid.getHorizontalValue(), cellElement.getColumn()).toPixD(resolution);
@ -223,6 +227,10 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
&& cell_width - fixed_pos_x < WIDGET_WIDTH && cell_height - fixed_pos_y < WIDGET_WIDTH;
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
/**
* @param evt
*/
@ -372,7 +380,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
doWithCellElementDragged(evtX, evtY, (CellSelection) selection);
} else if (grid.getDragType() == GridUtils.DRAG_CELLSELECTION && !BaseUtils.isAuthorityEditing()) {
// peter:获得调整过的Selected Column Row.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (selectedCellPoint.getColumn() != grid.getDragRectangle().x || selectedCellPoint.getRow() != grid.getDragRectangle().y) {
grid.getDragRectangle().x = selectedCellPoint.getColumn();
grid.getDragRectangle().y = selectedCellPoint.getRow();
@ -393,7 +401,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
private void doWithFloatElementDragged(int evtX, int evtY, FloatSelection fs) {
ElementCase report = grid.getElementCasePane().getEditingElementCase();
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
String floatName = fs.getSelectedFloatName();
FloatElement floatElement = report.getFloatElement(floatName);
int cursorType = grid.getCursor().getType();
@ -453,7 +461,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
ElementCasePane reportPane = grid.getElementCasePane();
java.awt.Rectangle cellRectangle = cs.toRectangle();
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
if (cellRectangle.contains(selectedCellPoint.getColumn(), selectedCellPoint.getRow())) {
grid.getDragRectangle().setBounds(cellRectangle);
} else {
@ -507,7 +515,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
if (s instanceof FloatSelection) {
return;
}
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int selectedCellPointX = selectedCellPoint.getColumn();
int selectedCellPointY = selectedCellPoint.getRow();
CellSelection gridSelection = ((CellSelection) s).clone();
@ -543,7 +551,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
return;
}
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
//拷贝,而不是直接强制使用以监听单元格选择变化
CellSelection gridSelection = ((CellSelection) s).clone();
gridSelection.setSelectedType(((CellSelection) s).getSelectedType());
@ -606,7 +614,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} else {
grid.setCursor(UIConstants.CELL_DEFAULT_CURSOR);
}
ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellColumnRow = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
TemplateCellElement curCellElement = report.getTemplateCellElement(selectedCellColumnRow.getColumn(), selectedCellColumnRow.getRow());
if (curCellElement != null) {
@ -630,7 +638,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
* @param report
*/
private void setCursorAndToolTips(TemplateCellElement curCellElement, TemplateElementCase report) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
// 计算相对Grid的显示位置.
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
@ -674,7 +682,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
double leftColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn()).toPixD(resolution);
double rightColDistance = columnWidthList.getRangeValue(grid.getHorizontalValue(), cs.getColumn() + cs.getColumnSpan()).toPixD(resolution);
@ -725,7 +733,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
} else if (isControlDown) {
doControlSelectCell(evtX, evtY);
} else {
ColumnRow selectedCellPoint = GridUtils.getEventColumnRow(reportPane, evtX, evtY);
ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int type = reportPane.ensureColumnRowVisible(selectedCellPoint.getColumn(), selectedCellPoint.getRow());
if (type == ElementCasePane.NO_OVER) {
GridUtils.doSelectCell(reportPane, selectedCellPoint.getColumn(), selectedCellPoint.getRow());
@ -766,7 +774,7 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous
this.oldEvtX = evtX;
this.oldEvtY = evtY;
FloatElement el = report.getFloatElement(floatName);
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int verticalValue = grid.getVerticalValue();
int horizentalValue = grid.getHorizontalValue();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);

18
designer/src/com/fr/grid/GridRow.java

@ -6,8 +6,13 @@ package com.fr.grid;
import java.awt.Dimension;
import com.fr.base.GraphHelper;
import com.fr.base.ScreenResolution;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane;
import javax.swing.plaf.ComponentUI;
/**
* GridRow used to paint and edit grid row.
*
@ -15,6 +20,10 @@ import com.fr.design.mainframe.ElementCasePane;
* @since 2012-3-22下午6:12:03
*/
public class GridRow extends GridHeader<Integer> {
private static final int MAX = 5;
private int resolution = ScreenResolution.getScreenResolution();
@Override
protected void initByConstructor() {
GridRowMouseHandler gridRowMouseHandler = new GridRowMouseHandler(this);
@ -30,9 +39,14 @@ public class GridRow extends GridHeader<Integer> {
@Override
public void updateUI() {
this.setUI(new GridRowUI());
this.setUI(new GridRowUI(resolution));
}
public void setResolution(int resolution) {
this.resolution = resolution;
}
/**
* Gets the preferred size.
*/
@ -52,7 +66,7 @@ public class GridRow extends GridHeader<Integer> {
* Calculates max char number.
*/
private int caculateMaxCharNumber(ElementCasePane reportPane) {
int maxCharNumber = 5;
int maxCharNumber = MAX;
maxCharNumber = Math.max(maxCharNumber, ("" + (reportPane.getGrid().getVerticalValue() + reportPane.getGrid().getVerticalExtent())).length() + 1);
return maxCharNumber;

16
designer/src/com/fr/grid/GridRowUI.java

@ -15,6 +15,8 @@ import com.fr.base.ScreenResolution;
import com.fr.cache.list.IntList;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.GridScaleEdit;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.grid.selection.Selection;
import com.fr.privilege.finegrain.ColumnRowPrivilegeControl;
@ -27,6 +29,14 @@ import com.fr.report.elementcase.ElementCase;
*/
public class GridRowUI extends ComponentUI {
private Color detailsBackground = Color.lightGray;
private int resolution ;
GridRowUI(int resolution){
if (resolution == 0){
resolution = ScreenResolution.getScreenResolution();
}
this.resolution = resolution;
}
@Override
public void paint(Graphics g, JComponent c) {
@ -49,7 +59,6 @@ public class GridRowUI extends ComponentUI {
// paint more rows(double extent), for dragging.
int verticalEndValue = verticalValue + verticalExtent + 1;
double horizontalLineHeight = size.getHeight();
int resolution = ScreenResolution.getScreenResolution();
// use background to paint first.
// denny: 用来标识已有数据
@ -149,9 +158,6 @@ public class GridRowUI extends ComponentUI {
float fmAscent = GraphHelper.getFontMetrics(gridRow.getFont()).getAscent();
double stringWidth = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getWidth();
double stringHeight = gridRow.getFont().getStringBounds(paintText, fontRenderContext).getHeight();
// AUGUST:如果高度太小了就不画了
if (stringHeight <= tmpIncreaseHeight + 2) {
if (isSelectedBounds) {
g2d.setColor(gridRow.getSelectedForeground());
} else {
@ -165,7 +171,7 @@ public class GridRowUI extends ComponentUI {
GraphHelper.drawString(g2d, paintText, (size.width - stringWidth) / 2, tmpHeight1 + (tmpIncreaseHeight - stringHeight) / 2 + GridHeader.SIZE_ADJUST / 2 + fmAscent
- 2);
}
}
}

7
designer/src/com/fr/grid/GridUI.java

@ -429,6 +429,7 @@ public class GridUI extends ComponentUI {
this.calculateForcedPagingOfCellElement(reportPane, tmpCellElement, hideWidth, hideHeight);
storeFatherLocation(selectedCellElement, tmpCellElement);
// element bounds
// TODO: 2017/7/13 tmpRectangle : 72*19
this.caculateScrollVisibleBounds(this.tmpRectangle, tmpCellElement.getColumn(),
tmpCellElement.getRow(), tmpCellElement.getColumnSpan(),
tmpCellElement.getRowSpan());
@ -455,8 +456,9 @@ public class GridUI extends ComponentUI {
paintCellElementList.add(tmpCellElement);
paintCellElementRectangleList.add(this.tmpRectangle.clone());
int cellWidth = (int) this.tmpRectangle.getWidth(), cellHeight = (int) this.tmpRectangle
.getHeight();
int cellWidth = (int) this.tmpRectangle.getWidth();
int cellHeight = (int) this.tmpRectangle.getHeight();
// denny_Grid: 画Grid中单元格的内容(包括单元格的背景Content + Background), 不包括边框
painter.paintBackground(g2d, report, tmpCellElement, cellWidth, cellHeight);
@ -1077,6 +1079,7 @@ public class GridUI extends ComponentUI {
grid.ajustEditorComponentBounds(); // refresh size
}
private void dealWithSizeBeforePaint(Grid grid, TemplateElementCase elementCase) {
// 取出所有的行高和列宽的List
this.rowHeightList = ReportHelper.getRowHeightList(elementCase);

82
designer/src/com/fr/grid/GridUtils.java

@ -6,6 +6,8 @@ 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.mainframe.ElementCasePane;
import com.fr.design.mainframe.GridScaleEdit;
import com.fr.design.mainframe.JSliderPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection;
@ -48,6 +50,7 @@ public class GridUtils {
//peter:下面这几个量是在Drag列的时候用.
public final static int DRAG_CELL_SIZE = 1; //peter:drag的时候改变格子的宽度.
public final static int DRAG_SELECT_UNITS = 2; //peter:drag的时候,选中单元格.
// public static int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
/**
* Is above float element.(the return may be null). <br>
@ -67,7 +70,8 @@ public class GridUtils {
double[] floatArray = caculateFloatElementLocations(tmpFloatElement, ReportHelper.getColumnWidthList(report),
ReportHelper.getRowHeightList(report), reportPane.getGrid().getVerticalValue(), reportPane.getGrid().getHorizontalValue());
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
//peter:悬浮元素的范围.
Rectangle2D floatElementRect = new Rectangle2D.Double(floatArray[0], floatArray[1], tmpFloatElement.getWidth().toPixD(resolution), tmpFloatElement.getHeight().toPixD(resolution));
//peter:不是当前选中的悬浮元素,不支持六个改变大小的点.
@ -123,8 +127,8 @@ public class GridUtils {
*/
public static double[] caculateFloatElementLocations(FloatElement floatElement, DynamicUnitList columnWidthList, DynamicUnitList rowHeightList,
int verticalValue, int horizentalValue) {
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
double floatX = columnWidthList.getRangeValue(horizentalValue, 0).toPixD(resolution) + floatElement.getLeftDistance().toPixD(resolution);
double floatY = rowHeightList.getRangeValue(verticalValue, 0).toPixD(resolution) + floatElement.getTopDistance().toPixD(resolution);
@ -166,7 +170,66 @@ public class GridUtils {
private static int cc_selected_column_or_row(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList) {
double tmpIntIndex = 0;
int selectedCellIndex = 0;
int resolution = ScreenResolution.getScreenResolution();
// int resolution = ScreenResolution.getScreenResolution();
int resolution = (int) (ScreenResolution.getScreenResolution()* JSliderPane.getInstance().resolutionTimes);
if (mouseEvtPosition < 0) {
selectedCellIndex = value;
for (; true; selectedCellIndex--) {
if (tmpIntIndex < mouseEvtPosition) {
break;
}
tmpIntIndex -= sizeList.get(selectedCellIndex).toPixD(resolution);
}
} else {
boolean isInnerFrozen = false;
for (int i = beginValue; i < 0; i++) {
tmpIntIndex += sizeList.get(i).toPixD(resolution);
if (tmpIntIndex > mouseEvtPosition) {
selectedCellIndex = i;
isInnerFrozen = true;
break;
}
}
if (!isInnerFrozen) {
selectedCellIndex = value;
for (; true; selectedCellIndex++) {
tmpIntIndex += sizeList.get(selectedCellIndex).toPixD(resolution);
if (tmpIntIndex > mouseEvtPosition) {
break;
}
}
}
}
return selectedCellIndex;
}
public static ColumnRow getEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) {
ElementCase report = reportPane.getEditingElementCase();
// Width and height list.
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report);
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report);
int verticalValue = reportPane.getGrid().getVerticalValue();
int horizentalValue = reportPane.getGrid().getHorizontalValue();
// denny: get verticalBeginValue and horizontalBeginValue;
int verticalBeginValue = reportPane.getGrid().getVerticalBeginValue();
int horizontalBeginValue = reportPane.getGrid().getHorizontalBeginValue();
return ColumnRow.valueOf(
cc_selected_column_or_row_withresolution(evtX, horizontalBeginValue, horizentalValue, columnWidthList, resolution),
cc_selected_column_or_row_withresolution(evtY, verticalBeginValue, verticalValue, rowHeightList, resolution)
);
}
private static int cc_selected_column_or_row_withresolution(double mouseEvtPosition, int beginValue, int value, DynamicUnitList sizeList, int resolution) {
double tmpIntIndex = 0;
int selectedCellIndex = 0;
// int resolution = ScreenResolution.getScreenResolution();
if (mouseEvtPosition < 0) {
selectedCellIndex = value;
for (; true; selectedCellIndex--) {
@ -222,6 +285,16 @@ public class GridUtils {
return ColumnRow.valueOf(col, row);
}
public static ColumnRow getAdjustEventColumnRow_withresolution(ElementCasePane reportPane, double evtX, double evtY, int resolution) {
ColumnRow selectedCellPoint = GridUtils.getEventColumnRow_withresolution(reportPane, evtX, evtY, resolution);
int col = Math.max(selectedCellPoint.getColumn(), 0);
int row = Math.max(selectedCellPoint.getRow(), 0);
return ColumnRow.valueOf(col, row);
}
/**
* 是否可将当前单元格变为可见的格子
*/
@ -395,4 +468,5 @@ public class GridUtils {
}
}
}

9
designer/src/com/fr/poly/PolyDesigner.java

@ -842,11 +842,14 @@ public class PolyDesigner extends ReportComponent<PolyWorkSheet, PolyElementCase
if (BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance());
} else if (isChooseBlock()) {
EastRegionContainerPane.getInstance().replaceDownPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_CHART);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(PolyBlockProperPane.getInstance(PolyDesigner.this));
} else if (type != SelectionType.NONE) {
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY_REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
} else {
EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.POLY);
// EastRegionContainerPane.getInstance().replaceDownPane(new JPanel());
}
}
}

2
designer/src/com/fr/poly/creator/ECBlockEditor.java

@ -142,6 +142,6 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
}
QuickEditorRegion.getInstance().populate(editComponent.getCurrentEditor());
CellElementPropertyPane.getInstance().populate(editComponent);
EastRegionContainerPane.getInstance().replaceDownPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
}
}

2
designer_base/src/com/fr/design/actions/AllowAuthorityEditAction.java

@ -1 +1 @@
package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceDownPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } }
package com.fr.design.actions; import com.fr.base.BaseUtils; import com.fr.design.constants.UIConstants; import com.fr.design.menu.KeySetUtils; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.designer.TargetComponent; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.*; /** * Author : daisy * Date: 13-8-30 * Time: 上午10:12 */ public class AllowAuthorityEditAction extends TemplateComponentAction { public AllowAuthorityEditAction(TargetComponent t) { super(t); this.setMenuKeySet(KeySetUtils.ALLOW_AUTHORITY_EDIT); this.setName(getMenuKeySet().getMenuName()); this.setMnemonic(getMenuKeySet().getMnemonic()); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/allow_authority_edit.png")); } /** * 撤销 */ public void prepare4Undo() { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().iniAuthorityUndoState(); } /** * 执行动作 * * @return 是否执行成功 */ public boolean executeActionReturnUndoRecordNeeded() { TargetComponent tc = getEditingComponent(); if (tc == null) { return false; } cleanAuthorityCondition(); //进入时是格式刷则取消格式刷 if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { tc.cancelFormat(); } BaseUtils.setAuthorityEditing(true); ReportAndFSManagePane.getInstance().refreshDockingView(); RolesAlreadyEditedPane.getInstance().refreshDockingView(); WestRegionContainerPane.getInstance().replaceDownPane(ReportAndFSManagePane.getInstance()); DesignerContext.getDesignerFrame().setCloseMode(UIConstants.CLOSE_OF_AUTHORITY); DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION); EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(tc.getEastUpPane()); DesignerContext.getDesignerFrame().refreshDottedLine(); EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance()); EastRegionContainerPane.getInstance().removeParameterPane(); //画虚线 return true; } /** * 进入权限编辑之前将权限编辑界面重置一下工具栏 */ private void cleanAuthorityCondition() { java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); for (int i = 0; i < opendedTemplate.size(); i++) { opendedTemplate.get(i).cleanAuthorityUndo(); } } }

111
designer_base/src/com/fr/design/foldablepane/HeaderPane.java

@ -0,0 +1,111 @@
package com.fr.design.foldablepane;
import com.fr.design.constants.UIConstants;
import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;
/**
* Created by MoMeak on 2017/7/5.
*/
public class HeaderPane extends JPanel {
private static final long serialVersionUID = 1L;
private int headWidth = 280;
private int headHeight = 25;
private Color bgColor;
private boolean isShow;
private String title;
private Image image;
private int fontSize = 13;
public void setShow(boolean isShow) {
this.isShow = isShow;
}
public void setTitle(String title)
{
this.title = title;
}
public void setHeadWidth(int headwidth){
this.headWidth = headwidth;
}
public void setheadHeight(int headHeight){
this.headHeight = headHeight;
}
public void setFontSize(int fontSize){
this.fontSize = fontSize;
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
BufferedImage panelImage = createPanelImage();
g2d.drawImage(panelImage, null, 0, 0);
}
private BufferedImage createPanelImage() {
BufferedImage panelImage = new BufferedImage(getWidth(), headHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = panelImage.createGraphics();
g2d.fillRect(0, 0, headWidth, headHeight);
g2d.drawImage(UIConstants.DRAG_BAR, 0, 0, headWidth, headHeight, null);
g2d.setFont(new Font("SimSun", 0, fontSize));
g2d.setPaint(bgColor);
// g2d.drawString(this.title, fontSize/2, headHeight-fontSize/3);
g2d.drawString(this.title, 0, headHeight-fontSize/3);
if(this.isShow)
{
image = UIConstants.DRAG_DOWN_PRESS;
g2d.drawImage(image, title.length() * fontSize, headHeight/2-1, null);
}
else
{
image = UIConstants.DRAG_RIGHT_PRESS;
g2d.drawImage(image, title.length() * fontSize, headHeight/3, null);
}
return panelImage;
}
@Override
public Dimension getPreferredSize() {
return new Dimension(this.getWidth(), headHeight);
}
@Override
public Dimension getSize() {
return new Dimension(this.getWidth(), headHeight);
}
public HeaderPane(Color bgColor) {
this.bgColor = bgColor;
this.isShow = true;
}
public HeaderPane(Color bgColor, String title , int headWidth, int headHeight) {
this(bgColor);
this.title = title;
this.headHeight = headHeight;
this.headWidth = headWidth;
}
public static void main(String[] args)
{
// JFrame mainFrame = new JFrame("UI Demo - Gloomyfish");
// mainFrame.getContentPane().setLayout(new BorderLayout());
// mainFrame.getContentPane().add(new HeaderPane(Color.black, "基本",280,25), BorderLayout.CENTER);
// mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// mainFrame.pack();
// mainFrame.setSize(280, 400);
// mainFrame.setVisible(true);
}
}

95
designer_base/src/com/fr/design/foldablepane/UIExpandablePane.java

@ -0,0 +1,95 @@
package com.fr.design.foldablepane;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
/**
* Created by MoMeak on 2017/7/5.
*/
public class UIExpandablePane extends JPanel {
private static final long serialVersionUID = 1L;
private HeaderPane headerPanel;
private JPanel contentPanel;
private Color color = Color.black;
private String title;
private int headWidth;
private int headHeight;
public UIExpandablePane(String title,int headWidth,int headHeight,JPanel contentPanel)
{
super();
this.title = title;
this.headWidth = headWidth;
this.headHeight = headHeight;
this.contentPanel = contentPanel;
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
headerPanel = new HeaderPane(color, title,headWidth,headHeight);
headerPanel.addMouseListener(new PanelAction());
this.add(headerPanel, BorderLayout.NORTH);
this.add(contentPanel, BorderLayout.CENTER);
setOpaque(false);
}
class PanelAction extends MouseAdapter
{
public void mousePressed(MouseEvent e)
{
HeaderPane hp = (HeaderPane)e.getSource();
if(contentPanel.isShowing())
{
contentPanel.setVisible(false);
hp.setShow(false);
}
else
{
contentPanel.setVisible(true);
hp.setShow(true);
}
hp.getParent().validate();
hp.getParent().repaint();
}
}
public static void main(String[] args)
{
// JFrame jf = new JFrame("test");
// jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JPanel content = (JPanel) jf.getContentPane();
// content.setLayout(new BorderLayout());
//
// JPanel myPanel = new JPanel();
// myPanel.setLayout(new BorderLayout());
// JPanel Panel = new JPanel();
// Panel.setBackground(Color.blue);
// myPanel.add(new UIExpandablePane("基本",280,25,Panel),BorderLayout.CENTER);
//// myPanel.setLayout(new GridBagLayout());
//// myPanel.add(new JExpandablePanel());
//// GridBagConstraints gbc = new GridBagConstraints();
//// JPanel[] panels = new JPanel[4]; //
//// gbc.insets = new Insets(1,3,0,3);
//// gbc.weightx = 1.0;
//// gbc.fill = GridBagConstraints.HORIZONTAL;
//// gbc.gridwidth = GridBagConstraints.REMAINDER;
//// for(int j = 0; j < panels.length; j++)
//// {
//// panels[j] = new JExpandablePanel();
//// myPanel.add(panels[j], gbc);
//// }
// content.add(myPanel, BorderLayout.CENTER);
// GUICoreUtils.centerWindow(jf);
// jf.setSize(280, 400);
// jf.setVisible(true);
}
}

310
designer_base/src/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -0,0 +1,310 @@
package com.fr.design.gui.icontainer;
import com.fr.base.BaseUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
/**
* Created by plough on 2017/7/7.
*/
public class UIEastResizableContainer extends JPanel {
private static final long serialVersionUID = 1854340560790476907L;
private int containerWidth = 240;
private int preferredWidth = 240;
private int topToolPaneHeight = 20;
private int leftPaneWidth = 40;
private JComponent leftPane;
private JComponent rightPane;
// private HorizotalToolPane horizontToolPane;
private TopToolPane topToolPane;
private static final int ARROW_MARGIN = 15;
private static final int ARROW_RANGE = 35;
// private boolean isRightPaneVisible = true;
public UIEastResizableContainer() {
this(new JPanel(), new JPanel());
}
/**
* 设置面板宽度
*
* @param width
*/
public void setContainerWidth(int width) {
this.containerWidth = width;
this.preferredWidth = width;
}
public boolean isRightPaneVisible() {
return containerWidth > leftPaneWidth;
}
// public void setRightPaneVisible(boolean isVisible){
// this.isRightPaneVisible = isVisible;
// }
private void setPreferredWidth(int width) {
this.preferredWidth = width;
}
public UIEastResizableContainer(JComponent leftPane, JComponent rightPane) {
setBackground(UIConstants.NORMAL_BACKGROUND);
this.leftPane = leftPane;
this.rightPane = rightPane;
this.topToolPane = new TopToolPane();
setLayout(containerLayout);
add(topToolPane);
add(leftPane);
add(rightPane);
}
public static void main(String... args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
JPanel leftPane = new JPanel();
leftPane.setBackground(Color.yellow);
JPanel rightPane = new JPanel();
rightPane.setBackground(Color.green);
UIButton b1, b2;
b1 = new UIButton("b1");
b2 = new UIButton("b2");
b1.setPreferredSize(new Dimension(40, 40));
b2.setPreferredSize(new Dimension(40, 40));
leftPane.add(b1);
leftPane.add(b2);
UIEastResizableContainer bb = new UIEastResizableContainer(leftPane, rightPane);
JPanel cc = new JPanel();
cc.setBackground(Color.white);
content.add(bb, BorderLayout.EAST);
content.add(cc, BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(500, 500);
jf.setVisible(true);
}
/**
* 将面板设置成最佳的宽度
*/
public void setWindow2PreferWidth() {
if (containerWidth == leftPaneWidth) {
containerWidth = preferredWidth;
refreshContainer();
}
}
/**
* 得到容器的宽度
*
* @return
*/
public int getContainerWidth() {
return this.containerWidth;
}
/**
* 设置关闭设计器前最后一次面板的宽度
*
* @param containerWidth
*/
public void setLastContainerWidth(int containerWidth) {
this.containerWidth = containerWidth;
}
private LayoutManager containerLayout = new LayoutManager() {
@Override
public void removeLayoutComponent(Component comp) {
// TODO Auto-generated method stub
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return parent.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return null;
}
@Override
public void layoutContainer(Container parent) {
if (topToolPane == null || rightPane == null) {
return;
}
topToolPane.setBounds(0, 0, containerWidth, topToolPaneHeight);//0,0,10,462
leftPane.setBounds(0, topToolPaneHeight, leftPaneWidth, getHeight() - topToolPaneHeight);
// parameterPane.setBounds(20, 0, 230, getParameterPaneHeight());//10,0,230,462
rightPane.setBounds(leftPaneWidth, topToolPaneHeight, containerWidth-leftPaneWidth, getHeight() - topToolPaneHeight);//20,0,230,0
}
@Override
public void addLayoutComponent(String name, Component comp) {
}
};
@Override
/**
* 得到最佳大小
*/
public Dimension getPreferredSize() {
return new Dimension(containerWidth, 400);
}
/**
* 替换左子面板
*
* @param pane 面板
*/
public void replaceLeftPane(JComponent pane) {
remove(pane);
remove(this.leftPane);
add(this.leftPane = pane);
refreshContainer();
}
/**
* 替换右子面板
*
* @param pane 面板
*/
public void replaceRightPane(JComponent pane) {
remove(pane);
remove(this.rightPane);
add(this.rightPane = pane);
refreshContainer();
}
/**
* 得到左子面板
*
* @return
*/
public JComponent getLeftPane() {
return this.leftPane;
}
/**
* 得到右子面板
*
* @return
*/
public JComponent getRightPane() {
return this.rightPane;
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
/**
* 伸缩右子面板时触发此方法
*/
public void onResize() {
}
private class TopToolPane extends JPanel {
private int model = UIConstants.MODEL_NORMAL;
public TopToolPane() {
super();
addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
model = UIConstants.MODEL_PRESS;
} else {
setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() <= ARROW_RANGE) {
if (containerWidth == leftPaneWidth) {
containerWidth = preferredWidth;
} else {
setPreferredWidth(containerWidth);
containerWidth = leftPaneWidth;
}
onResize();
refreshContainer();
if (BaseUtils.isAuthorityEditing()) {
DesignerContext.getDesignerFrame().doResize();
}
}
}
});
}
@Override
public void paint(Graphics g) {
Image button;
g.drawImage(UIConstants.DRAG_BAR, 0, 0, containerWidth, topToolPaneHeight, null);
if (containerWidth == leftPaneWidth) {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_LEFT_NORMAL;
} else {
button = UIConstants.DRAG_LEFT_PRESS;
}
} else {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_RIGHT_NORMAL;
} else {
button = UIConstants.DRAG_RIGHT_PRESS;
}
}
// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
g.drawImage(button, 20, 7, 5, 5, null);
}
}
}

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

@ -37,9 +37,9 @@ public class UIResizableContainer extends JPanel {
private static final int MIN_WIDTH = 165;
private static final int ARROW_MARGIN = 15;
private static final int ARROW_MARGIN_VERTICAL = 20;
private static final int ARROW_MARGIN_VERTICAL = 7;
private static final int ARROW_RANGE = 35;
private static final int ARROW_RANGE_VERTICAL = 40;
private static final int ARROW_RANGE_VERTICAL = 25;
private boolean isLeftRightDragEnabled = true;
private boolean isDownPaneVisible = true ;
@ -502,7 +502,7 @@ public class UIResizableContainer extends JPanel {
button = UIConstants.DRAG_LEFT_PRESS;
}
}
g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, 5, null);
} else {
g.drawImage(UIConstants.DRAG_BAR, 0, 0, toolPaneHeight, getHeight(), null);
if (containerWidth == toolPaneHeight) {

24
designer_base/src/com/fr/design/gui/style/BackgroundPane.java

@ -1,9 +1,15 @@
package com.fr.design.gui.style;
import com.fr.base.BaseUtils;
import com.fr.base.Style;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.fun.BackgroundQuickUIProvider;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.*;
import com.fr.general.Background;
import com.fr.general.Inter;
@ -35,7 +41,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
this.setLayout(new BorderLayout(0, 6));
typeComboBox = new UIComboBox();
final CardLayout cardlayout = new CardLayout();
this.add(typeComboBox, BorderLayout.NORTH);
// this.add(typeComboBox, BorderLayout.NORTH);
paneList = supportKindsOfBackgroundUI();
@ -50,7 +56,7 @@ public class BackgroundPane extends AbstractBasicStylePane {
typeComboBox.addItem(pane.title4PopupWindow());
centerPane.add(pane, pane.title4PopupWindow());
}
this.add(centerPane, BorderLayout.CENTER);
// this.add(centerPane, BorderLayout.CENTER);
typeComboBox.addItemListener(new ItemListener() {
@Override
@ -59,6 +65,20 @@ public class BackgroundPane extends AbstractBasicStylePane {
fireStateChanged();
}
});
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Shape_Fill") + " ", SwingConstants.LEFT),typeComboBox},
new Component[]{null, centerPane}
};
double[] rowSize = {p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel, BorderLayout.CENTER);
}
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() {

83
designer_base/src/com/fr/design/gui/style/BorderPane.java

@ -9,8 +9,11 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JPanel;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -21,6 +24,7 @@ import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import com.fr.stable.Constants;
import com.fr.stable.CoreConstants;
@ -45,22 +49,28 @@ public class BorderPane extends AbstractBasicStylePane {
private LineComboBox currentLineCombo;
private NewColorSelectBox currentLineColorPane;
private JPanel panel;
private JPanel borderPanel;
private JPanel backgroundPanel;
private BackgroundPane backgroundPane;
public BorderPane() {
this.initComponents();
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new BorderPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
protected void initComponents() {
initButtonsWithIcon();
this.setLayout(new BorderLayout(0, 6));
double p = TableLayout.PREFERRED, f = TableLayout.FILL;
double[] columnSize1 = {p, f}, rowSize1 = {p, p};
Component[][] components1 = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + ":"), currentLineCombo},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + ":"), currentLineColorPane},
};
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components1, rowSize1, columnSize1);
double[] columnSize2 = {p, f}, rowSize2 = {p, p};
JPanel externalPane = new JPanel(new GridLayout(0, 4));
externalPane.add(topToggleButton);
externalPane.add(leftToggleButton);
@ -69,15 +79,37 @@ public class BorderPane extends AbstractBasicStylePane {
JPanel insidePane = new JPanel(new GridLayout(0, 2));
insidePane.add(horizontalToggleButton);
insidePane.add(verticalToggleButton);
Component[][] components2 = new Component[][]{
new Component[]{outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png")), innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{externalPane, insidePane,}
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Style") + " ", SwingConstants.LEFT), currentLineCombo},
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Color") + " ", SwingConstants.LEFT), currentLineColorPane},
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_outBorder") +" ", SwingConstants.LEFT),outerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/out.png"))},
new Component[]{null,externalPane},
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_inBorder") +" ", SwingConstants.LEFT),innerToggleButton = new UIToggleButton(BaseUtils.readIcon("com/fr/design/images/m_format/in.png"))},
new Component[]{null,insidePane},
new Component[]{null,null}
};
JPanel centerPane = TableLayoutHelper.createTableLayoutPane(components2, rowSize2, columnSize2);
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
outerToggleButton.addChangeListener(new ChangeListener() {
double[] rowSize = {p, p, p, p, p, p, p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
borderPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Border"),280,20,panel);
this.add(borderPanel,BorderLayout.NORTH);
backgroundPane = new BackgroundPane();
backgroundPanel = new UIExpandablePane(Inter.getLocText("FR-Designer_Background"),280,20,backgroundPane);
this.add(backgroundPanel,BorderLayout.CENTER);
outerToggleButton.addChangeListener(outerToggleButtonChangeListener);
innerToggleButton.addChangeListener(innerToggleButtonChangeListener);
}
ChangeListener outerToggleButtonChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = outerToggleButton.isSelected();
@ -86,16 +118,16 @@ public class BorderPane extends AbstractBasicStylePane {
leftToggleButton.setSelected(value);
rightToggleButton.setSelected(value);
}
});
innerToggleButton.addChangeListener(new ChangeListener() {
};
ChangeListener innerToggleButtonChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean value = innerToggleButton.isSelected();
horizontalToggleButton.setSelected(value);
verticalToggleButton.setSelected(value);
}
});
}
};
private void initButtonsWithIcon(){
topToggleButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/base/images/dialog/border/top.png"));
@ -113,7 +145,8 @@ public class BorderPane extends AbstractBasicStylePane {
return Inter.getLocText("FR-Designer_Border");
}
public void populate(Style style) {
@Override
public void populateBean(Style style) {
if (style == null) {
style = Style.DEFAULT_STYLE;
}
@ -127,8 +160,9 @@ public class BorderPane extends AbstractBasicStylePane {
cellBorderStyle.setBottomColor(style.getBorderBottomColor());
cellBorderStyle.setRightStyle(style.getBorderRight());
cellBorderStyle.setRightColor(style.getBorderRightColor());
this.backgroundPane.populateBean(style.getBackground());
this.populateBean(cellBorderStyle, false, style.getBorderTop(), style.getBorderTopColor());
}
public void populateBean(CellBorderStyle cellBorderStyle, boolean insideMode, int currentStyle, Color currentColor) {
@ -151,10 +185,10 @@ public class BorderPane extends AbstractBasicStylePane {
this.innerToggleButton.setEnabled(this.insideMode);
this.horizontalToggleButton.setEnabled(this.insideMode);
this.verticalToggleButton.setEnabled(this.insideMode);
}
public Style update(Style style) {
style = style.deriveBackground(backgroundPane.update());
if (style == null) {
style = Style.DEFAULT_STYLE;
}
@ -163,7 +197,6 @@ public class BorderPane extends AbstractBasicStylePane {
style = style.deriveBorder(cellBorderStyle.getTopStyle(), cellBorderStyle.getTopColor(), cellBorderStyle.getBottomStyle(), cellBorderStyle.getBottomColor(),
cellBorderStyle.getLeftStyle(), cellBorderStyle.getLeftColor(), cellBorderStyle.getRightStyle(), cellBorderStyle.getRightColor());
return style;
}

146
designer_base/src/com/fr/design/gui/style/FRFontPane.java

@ -7,6 +7,7 @@ package com.fr.design.gui.style;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
@ -37,12 +38,15 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Pane to edit Font.
*/
public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObserver {
private static final int MAX_FONT_SIZE = 100;
public static Integer[] FONT_SIZES = {new Integer(6), new Integer(8), new Integer(9), new Integer(10), new Integer(11), new Integer(12), new Integer(14), new Integer(16),
new Integer(18), new Integer(20), new Integer(22), new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72)};
private static final Dimension BUTTON_SIZE = new Dimension(24, 20);
private static final Dimension BUTTON_SIZE = new Dimension(20, 18);
private final String[] fontSizeStyles = {Inter.getLocText("FR-Designer_FRFont_plain"), Inter.getLocText("FR-Designer_FRFont_bold"), Inter.getLocText("FR-Designer_FRFont_italic"), Inter.getLocText("FR-Designer_FRFont_bolditalic")};
private JPanel buttonPane;
private JPanel isSuperOrSubPane;
private UIComboBox fontNameComboBox;
private UIComboBox fontSizeStyleComboBox;
private UIComboBox fontSizeComboBox;
private UIToggleButton bold;
private UIToggleButton italic;
@ -58,14 +62,27 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private UIToggleButton superPane;
private UIToggleButton subPane;
private JPanel linePane;
private int italic_bold;
public FRFontPane() {
this.initComponents();
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FRFontPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("Sytle-FRFont");
return Inter.getLocText("FR-Designer_Sytle-FRFont");
}
/**
@ -73,7 +90,8 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/
public void populateBean(FRFont frFont) {
fontNameComboBox.setSelectedItem(frFont.getFamily());
fontSizeComboBox.setSelectedItem(frFont.getSize());
fontSizeStyleComboBox.setSelectedIndex(frFont.getStyle());
fontSizeComboBox.setSelectedItem(Utils.round5(frFont.getSize2D()));
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
@ -112,31 +130,34 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
*/
public FRFont update(FRFont frFont) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Family"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_Name"))) {
frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Size"))) {
frFont = frFont.applySize((Integer) fontSizeComboBox.getSelectedItem());
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Style"))) {
frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Foreground"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Size"))) {
frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Foreground"))) {
frFont = frFont.applyForeground(this.colorSelectPane.getColor());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Underline"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Underline"))) {
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("Line-Style"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer-FRFont_Line_Style"))) {
frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Strikethrough"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Strikethrough"))) {
frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Shadow"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Shadow"))) {
frFont = frFont.applyShadow(isShadowCheckBox.isSelected());
}
@ -147,7 +168,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateOthers(FRFont frFont) {
frFont = updateItalicBold(frFont);
frFont = updateSubSuperscript(frFont);
return frFont;
}
@ -155,7 +175,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private FRFont updateSubSuperscript(FRFont frFont) {
boolean isSuper = frFont.isSuperscript();
boolean isSub = frFont.isSubscript();
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Superscript"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Superscript"))) {
//如果上标没有选中,点击则选中上标,并且下标一定是不选中状态
//如果上标选中,点击则取消选中上标,字体回复正常
if (superPane.isSelected() && !isSuper) {
@ -165,7 +185,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
frFont = frFont.applySuperscript(false);
}
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-Subscript"))) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FR-Designer_FRFont_Subscript"))) {
if (subPane.isSelected() && !isSub) {
frFont = frFont.applySubscript(true);
frFont = frFont.applySuperscript(false);
@ -176,29 +196,6 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return frFont;
}
private FRFont updateItalicBold(FRFont frFont) {
int italic_bold = frFont.getStyle();
boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC);
boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC);
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-italic"))) {
if (italic.isSelected() && !isItalic) {
italic_bold += Font.ITALIC;
} else if (!italic.isSelected() && isItalic) {
italic_bold -= Font.ITALIC;
}
frFont = frFont.applyStyle(italic_bold);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), Inter.getLocText("FRFont-bold"))) {
if (bold.isSelected() && !isBold) {
italic_bold += Font.BOLD;
} else if (!bold.isSelected() && isBold) {
italic_bold -= Font.BOLD;
}
frFont = frFont.applyStyle(italic_bold);
}
return frFont;
}
@Override
public void populateBean(Style style) {
this.populateBean(style.getFRFont());
@ -212,10 +209,20 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
return style.deriveFRFont(frFont);
}
public static Vector<Integer> getFontSizes(){
Vector<Integer> FONT_SIZES = new Vector<Integer>();
for (int i = 1; i < MAX_FONT_SIZE; i++) {
FONT_SIZES.add(i);
}
return FONT_SIZES;
}
protected void initComponents() {
fontSizeStyleComboBox = new UIComboBox(fontSizeStyles);
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(FONT_SIZES);
fontSizeComboBox = new UIComboBox(getFontSizes());
fontSizeComboBox.setEditable(true);
this.underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY);
colorSelectPane = new UIColorButton();
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
@ -229,48 +236,53 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
isShadowCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/shadow.png"));
isShadowCheckBox.setPreferredSize(BUTTON_SIZE);
superPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sup.png"));
superPane.setPreferredSize(new Dimension(22, 18));
superPane.setPreferredSize(BUTTON_SIZE);
subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png"));
subPane.setPreferredSize(new Dimension(22, 18));
subPane.setPreferredSize(BUTTON_SIZE);
isSuperOrSubPane = new TwoButtonPane(superPane, subPane);
// Component[] components_font = new Component[]{
// colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
// };
Component[] components_font = new Component[]{
colorSelectPane, italic, bold, underline, isStrikethroughCheckBox, isShadowCheckBox
colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox
};
buttonPane = new JPanel(new BorderLayout());
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
// buttonPane.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
linePane = new JPanel(new CardLayout());
initAllNames();
setToolTips();
this.setLayout(new BorderLayout());
this.add(fontNameComboBox, BorderLayout.NORTH);
this.add(createPane(), BorderLayout.CENTER);
DefaultValues defaultValues = FRContext.getDefaultValues();
populateBean(defaultValues.getFRFont());
}
private void initAllNames() {
fontNameComboBox.setGlobalName(Inter.getLocText("FRFont-Family"));
fontSizeComboBox.setGlobalName(Inter.getLocText("FRFont-Size"));
colorSelectPane.setGlobalName(Inter.getLocText("FRFont-Foreground"));
italic.setGlobalName(Inter.getLocText("FRFont-italic"));
bold.setGlobalName(Inter.getLocText("FRFont-bold"));
underline.setGlobalName(Inter.getLocText("FRFont-Underline"));
underlineCombo.setGlobalName(Inter.getLocText("Line-Style"));
isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FRFont-Strikethrough"));
isShadowCheckBox.setGlobalName(Inter.getLocText("FRFont-Shadow"));
superPane.setGlobalName(Inter.getLocText("FRFont-Superscript"));
subPane.setGlobalName(Inter.getLocText("FRFont-Subscript"));
fontSizeStyleComboBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Style"));
fontNameComboBox.setGlobalName(Inter.getLocText("FR-Designer_Name"));
fontSizeComboBox.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Size"));
colorSelectPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Foreground"));
italic.setGlobalName(Inter.getLocText("FR-Designer_FRFont_italic"));
bold.setGlobalName(Inter.getLocText("FR-Designer_FRFont_bold"));
underline.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Underline"));
underlineCombo.setGlobalName(Inter.getLocText("FR-Designer-FRFont_Line_Style"));
isStrikethroughCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
isShadowCheckBox.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Shadow"));
superPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Superscript"));
subPane.setGlobalName(Inter.getLocText("FR-Designer_FRFont_Subscript"));
}
private void setToolTips() {
colorSelectPane.setToolTipText(Inter.getLocText("FRFont-Foreground"));
italic.setToolTipText(Inter.getLocText("FRFont-italic"));
bold.setToolTipText(Inter.getLocText("FRFont-bold"));
underline.setToolTipText(Inter.getLocText("FRFont-Underline"));
isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FRFont-Strikethrough"));
isShadowCheckBox.setToolTipText(Inter.getLocText("FRFont-Shadow"));
superPane.setToolTipText(Inter.getLocText("FRFont-Superscript"));
subPane.setToolTipText(Inter.getLocText("FRFont-Subscript"));
colorSelectPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Foreground"));
italic.setToolTipText(Inter.getLocText("FR-Designer_FRFont_italic"));
bold.setToolTipText(Inter.getLocText("FR-Designer_FRFont_bold"));
underline.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Underline"));
isStrikethroughCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Strikethrough"));
isShadowCheckBox.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Shadow"));
superPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Superscript"));
subPane.setToolTipText(Inter.getLocText("FR-Designer_FRFont_Subscript"));
}
@ -292,10 +304,11 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createLeftPane() {
double p = TableLayout.PREFERRED;
double[] columnSize = {p};
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p, p};
Component[][] components = new Component[][]{
new Component[]{fontNameComboBox},
new Component[]{fontSizeStyleComboBox},
new Component[]{buttonPane},
new Component[]{createLinePane()}
};
@ -317,9 +330,10 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
private JPanel createPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p};
double[] columnSize = {f, f};
double[] rowSize = {p,p};
Component[][] components = new Component[][]{
new Component[]{null, null},
new Component[]{createLeftPane(), createRightPane()},
};
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
@ -349,7 +363,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
public TwoButtonPane(UIToggleButton leftButton, UIToggleButton rightButton) {
this.leftButton = leftButton;
this.rightButton = rightButton;
this.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 0));
this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
initButton(leftButton);
initButton(rightButton);

151
designer_base/src/com/fr/design/gui/style/FormatPane.java

@ -7,27 +7,24 @@ import com.fr.base.TextFormat;
import com.fr.data.core.FormatField;
import com.fr.data.core.FormatField.FormatContents;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.icombobox.UIComboBoxRenderer;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.*;
import java.text.Format;
import java.text.SimpleDateFormat;
@ -54,13 +51,16 @@ public class FormatPane extends AbstractBasicStylePane {
private Format format;
private UIComboBox typeComboBox;
private UIComboBox textField;
private UILabel sampleLabel;
private FormatePaneNumField patternTextField = null;
private JList patternList = null;
private JPanel contentPane;
private JPanel txtCenterPane;
private JPanel centerPane;
private JPanel formatFontPane;
private FRFontPane frFontPane;
private boolean isRightFormate;
private boolean isDate = false;
private boolean isFormat = false;
/**
* Constructor.
*/
@ -68,41 +68,59 @@ public class FormatPane extends AbstractBasicStylePane {
this.initComponents(TYPES);
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new FormatPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
protected void initComponents(Integer[] types) {
this.setLayout(new BorderLayout(0, 4));
iniSampleLable();
JPanel contentPane = new JPanel(new BorderLayout(0, 4)) {
contentPane = new JPanel(new BorderLayout(0, 4)) {
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 185);
return new Dimension(super.getPreferredSize().width, 70);
}
};
typeComboBox = new UIComboBox(types);
UIComboBoxRenderer render = createComBoxRender();
typeComboBox.setRenderer(render);
typeComboBox.addItemListener(itemListener);
contentPane.add(sampleLabel, BorderLayout.NORTH);
this.add(typeComboBox, BorderLayout.NORTH);
centerPane = new JPanel(new CardLayout());
centerPane.add(new JPanel(), "hide");
centerPane.setPreferredSize(new Dimension(0, 0) );
centerPane.add(contentPane, "show");
this.add(centerPane, BorderLayout.CENTER);
// content pane.
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(centerPane, BorderLayout.CENTER);
patternTextField = new FormatePaneNumField();
centerPane.add(patternTextField, BorderLayout.NORTH);
patternTextField.getDocument().addDocumentListener(patternTextDocumentListener);
patternList = new JList(new DefaultListModel());
centerPane.add(new UIScrollPane(patternList), BorderLayout.CENTER);
patternList.addListSelectionListener(patternListSelectionListener);
patternList.setSelectionBackground(UIConstants.LIGHT_BLUE);
patternList.setSelectionForeground(Color.black);
// init values.
formatFontPane = new JPanel(new BorderLayout());
formatFontPane.add(centerPane, BorderLayout.NORTH);
formatFontPane.add(new FRFontPane(), BorderLayout.CENTER);
txtCenterPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
contentPane.add(txtCenterPane, BorderLayout.CENTER);
textField = new UIComboBox(FormatField.getInstance().getFormatArray(getFormatContents()));
textField.addItemListener(textFieldItemListener);
textField.setEditable(true);
txtCenterPane.add(textField, BorderLayout.NORTH);
frFontPane = new FRFontPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{
new Component[]{null,null},
new Component[]{new UILabel(Inter.getLocText("FR-Base_Format")+" ", SwingConstants.LEFT), typeComboBox },
new Component[]{null,centerPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_FRFont"), SwingConstants.LEFT), frFontPane},
new Component[]{null,null}
};
double[] rowSize = {p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1},{1, 1}, {1, 1}, {1, 3}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_MEDIUM);
this.add(panel,BorderLayout.CENTER);
}
protected UIComboBoxRenderer createComBoxRender(){
@ -187,7 +205,6 @@ public class FormatPane extends AbstractBasicStylePane {
} else {
setPatternComboBoxAndList(FormatContents.NUMBER, pattern);
}
patternTextField.setText(pattern);
} else if (format instanceof SimpleDateFormat) { // date and time
String pattern = ((SimpleDateFormat) format).toPattern();
if (!isTimeType(pattern)) {
@ -195,7 +212,6 @@ public class FormatPane extends AbstractBasicStylePane {
} else {
setPatternComboBoxAndList(FormatContents.TIME, pattern);
}
patternTextField.setText(pattern);
} else if (format instanceof TextFormat) { // Text
this.typeComboBox.setSelectedItem(FormatContents.TEXT);
}
@ -224,9 +240,9 @@ public class FormatPane extends AbstractBasicStylePane {
this.typeComboBox.setSelectedItem(formatStyle);
int i = isArrayContainPattern(FormatField.getInstance().getFormatArray(formatStyle), pattern);
if (i == -1) {
this.patternList.setSelectedIndices(ArrayUtils.EMPTY_INT_ARRAY);
this.textField.setSelectedIndex(0);
} else {
this.patternList.setSelectedIndex(i);
this.textField.setSelectedIndex(i);
}
}
@ -238,7 +254,7 @@ public class FormatPane extends AbstractBasicStylePane {
* update
*/
public Format update() {
String patternString = patternTextField.getText();
String patternString = String.valueOf(textField.getSelectedItem());
if (getFormatContents() == FormatContents.TEXT) {
return FormatField.getInstance().getFormat(getFormatContents(), patternString);
}
@ -262,10 +278,10 @@ public class FormatPane extends AbstractBasicStylePane {
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground"));
try {
isRightFormate = true;
if (StringUtils.isEmpty(patternTextField.getText())) {
if (StringUtils.isEmpty(String.valueOf(textField.getSelectedItem()))) {
return;
}
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), patternTextField.getText()));
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(getFormatContents(), String.valueOf(textField.getSelectedItem())));
} catch (Exception e) {
this.sampleLabel.setForeground(Color.red);
this.sampleLabel.setText(e.getMessage());
@ -285,56 +301,35 @@ public class FormatPane extends AbstractBasicStylePane {
@Override
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){
int contents = getFormatContents();
String[] items = FormatField.getInstance().getFormatArray(contents);
CardLayout cardLayout = (CardLayout) centerPane.getLayout();
if (isTextOrNull()) {
centerPane.setPreferredSize(new Dimension(0, 0) );
cardLayout.show(centerPane, "hide");
patternTextField.setText("");
} else {
textField.removeAllItems();
for (int i = 0; i < items.length; i++) {
textField.addItem(items[i]);
}
centerPane.setPreferredSize(new Dimension(270, 70) );
cardLayout.show(centerPane, "show");
}
String[] patternArray = FormatField.getInstance().getFormatArray(contents, false);
//
DefaultListModel patternModel = (DefaultListModel) patternList.getModel();
patternModel.removeAllElements();
for (int i = 0; i < patternArray.length; i++) {
patternModel.addElement(patternArray[i]);
isFormat = true;
}
if (patternModel.size() > 0) {
patternList.setSelectedIndex(0);
}
}
};
/**
* text pattern document listener.
*/
DocumentListener patternTextDocumentListener = new DocumentListener() {
public void insertUpdate(DocumentEvent evt) {
refreshPreviewLabel();
}
public void removeUpdate(DocumentEvent evt) {
refreshPreviewLabel();
}
public void changedUpdate(DocumentEvent evt) {
ItemListener textFieldItemListener = new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if(e.getStateChange() == ItemEvent.SELECTED){
isFormat = true;
refreshPreviewLabel();
}
};
/**
* Pattern list selection listener.
*/
ListSelectionListener patternListSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
if (!evt.getValueIsAdjusting()) {
patternTextField.setText((String) patternList.getSelectedValue());
}
}
};
@ -344,6 +339,8 @@ public class FormatPane extends AbstractBasicStylePane {
*/
public void populateBean(Style style) {
this.populateBean(style.getFormat());
isFormat = false;
this.frFontPane.populateBean(style.getFRFont());
}
@Override
@ -351,7 +348,12 @@ public class FormatPane extends AbstractBasicStylePane {
* update
*/
public Style update(Style style) {
if (isFormat){
isFormat = false;
return style.deriveFormat(this.update());
} else {
return style.deriveFRFont(this.frFontPane.update(style.getFRFont()));
}
}
/**
@ -401,4 +403,5 @@ public class FormatPane extends AbstractBasicStylePane {
}
}
}
}

29
designer_base/src/com/fr/design/locale/designer.properties

@ -2001,8 +2001,35 @@ FR-Designer_AlphaFine_Latest=Latest
FR-Designer_AlphaFine_ShowLess=show less
FR-Designer_AlphaFine=AlphaFine
FR-Designer-Alphafine_No_Remind=
<<<<<<< HEAD
FR-Designer_AlphaFine_NoResult=no results
FR-Designer_ConnectionFailed=connection failed
FR-Designer_NoResult=No results
FR-Designer-AlphaFine_SetShortcuts=
FR-Designer_Cell_Element=Cell Element
FR-Designer_Cell_Attributes=Cell Attributes
FR-Designer_Float_Element=Float Element
FR-Designer_Widget_Library=Widget Library
FR-Designer_No_Settings_Available=No Settings Available!
FR-Designer_Configured_Roles=Configured role
FR-Designer_Scale_EnlargeOrReduce=Scale
FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
FR-Designer_Scale_customButton=custom
FR-Designer_FRFont_Subscript=Subscript
FR-Designer_FRFont_Superscript=Superscript
FR-Designer_FRFont_Shadow=Shadow
FR-Designer_FRFont_Strikethrough=Strikethrough
FR-Designer_FRFont_Underline=Underline
FR-Designer_FRFont_bold=bold
FR-Designer_FRFont_italic=italic
FR-Designer_FRFont_Foreground=Foreground
FR-Designer_FRFont_Style=Style
FR-Designer_FRFont_plain=plain
FR-Designer_FRFont_bolditalic=bolditalic
FR-Designer_outBorder=outBorder
FR-Designer_inBorder=inBorder
FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
FR-Designer_ExpandD_Expand_Direction=Expand_Direction
FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure

29
designer_base/src/com/fr/design/locale/designer_en_US.properties

@ -1998,7 +1998,6 @@ FR-Designer_AlphaFine_ShowAll=Show all
FR-Designer_AlphaFine_Latest=Recent
FR-Designer_AlphaFine_ShowLess=Show less
FR-Designer_AlphaFine=AlphaFine
<<<<<<< HEAD
FR-Designer-Alphafine_No_Remind=don't remind
FR-Designer_AlphaFine_NoResult=No results
FR-Designer_ConnectionFailed=Connection failed
@ -2006,3 +2005,31 @@ FR-Designer_AlphaFine_EnableAlphaFine=Enable AlphaFine
FR-Designer_AlphaFine_EnableInternet=Internet
FR-Designer_NoResult=No results
FR-Designer-AlphaFine_SetShortcuts=please press two key to set shortcut
FR-Designer_Cell_Element=Cell Element
FR-Designer_Cell_Attributes=Cell Attributes
FR-Designer_Float_Element=Float Element
FR-Designer_Widget_Library=Widget Library
FR-Designer_No_Settings_Available=No Settings Available!
FR-Designer_Configured_Roles=Configured role
FR-Designer_Scale_EnlargeOrReduce=Scale
FR-Designer_Scale_selfAdaptButton=Fit the selected area exactly
FR-Designer_Scale_customButton=custom
FR-Designer_FRFont_Subscript=Subscript
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=Shadow
FR-Designer_FRFont_Strikethrough=Strikethrough
FR-Designer_FRFont_Underline=Underline
FR-Designer_FRFont_bold=bold
FR-Designer_FRFont_italic=italic
FR-Designer_FRFont_Foreground=Foreground
FR-Designer_FRFont_Style=Style
FR-Designer_FRFont_plain=plain
FR-Designer_FRFont_bolditalic=bolditalic
FR-Designer_outBorder=outBorder
FR-Designer_inBorder=inBorder
FR-Designer_ExpandD_Up_Father_Cell=Up_Father_Cell
FR-Designer_ExpandD_Expand_Direction=Expand_Direction
FR-Designer_Expand=Expand
FR-Designer_ExpendSort=ExpendSort
FR-Designer_ExpandD_Expandable=Expandable
FR-Designer_Read_failure=Read_failure

28
designer_base/src/com/fr/design/locale/designer_ja_JP.properties

@ -1982,3 +1982,31 @@ FR-Base_UnSignIn=\ \u672A\u30ED\u30B0\u30A4\u30F3
Every=\u6BCF
CellWrite-Preview_Cell_Content=\u30BB\u30EB\u306E\u5185\u5BB9\u3092\u30D7\u30EC\u30D3\u30E5\u30FC\u3059\u308B
FormulaD-Data_Fields=\u30C7\u30FC\u30BF\u30D5\u30A3\u30FC\u30EB\u30C9
FR-Designer_Cell_Element=\u30BB\u30EB\u8981\u7D20
FR-Designer_Cell_Attributes=\u30BB\u30EB\u5C5E\u6027
FR-Designer_Float_Element=\u30D5\u30ED\u30FC\u30C8\u8981\u7D20
FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\u69CB\u6210\u3055\u308C\u305F\u5F79\u5272
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_Scale_customButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

28
designer_base/src/com/fr/design/locale/designer_ko_KR.properties

@ -446,7 +446,6 @@ FR-Designer_WLayout-Absolute-ToolTips=\uC790\uC720\uC2DD\uB808\uC774\uC544\uC6C3
FR-Designer_Add_all=\uBAA8\uB450\uCD94\uAC00
FR-Designer_Reset=
FR-Designer_Language_Change_Successful=
FR-Designer_Template_Web_Attributes=
FR-Designer_Basic=\uAE30\uBCF8
FR-Designer_Printers(Server)=\uD504\uB9B0\uD130(\uC11C\uBC84)
FR-Designer_Pagination_Setting=\uD398\uC774\uC9C0\uB098\uB204\uAE30\uBBF8\uB9AC\uBCF4\uAE30\uC124\uC815
@ -1983,3 +1982,30 @@ FR-Base_UnSignIn=\uC544\uC9C1 \uB4F1\uB85D
Every=\uAC01
CellWrite-Preview_Cell_Content=\uC140\uB0B4\uC6A9\uBBF8\uB9AC\uBCF4\uAE30
FormulaD-Data_Fields=\uB370\uC774\uD130\uD56D\uBAA9
FR-Designer_Cell_Element=\uC140\uC694\uC18C
FR-Designer_Cell_Attributes=\uC140\uC18D\uC131
FR-Designer_Float_Element=\uD638\uBC84\uC694\uC18C
FR-Designer_Widget_Library=
FR-Designer_No_Settings_Available=
FR-Designer_Configured_Roles=\uC5ED\uD560\uC774\uAD6C\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
FR-Designer_Scale_EnlargeOrReduce=
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

28
designer_base/src/com/fr/design/locale/designer_zh_CN.properties

@ -2003,3 +2003,31 @@ FR-Designer_AlphaFine_NoResult=\u6682\u65E0\u76F8\u5173\u5185\u5BB9
FR-Designer_ConnectionFailed=\u94FE\u63A5\u5931\u8D25
FR-Designer_NoResult=\u6682\u4E0D\u652F\u6301\u663E\u793A
FR-Designer-AlphaFine_SetShortcuts=\u8BF7\u76F4\u63A5\u5728\u952E\u76D8\u4E0A\u6309\u4E24\u4E2A\u7EC4\u5408\u952E
FR-Designer_Cell_Element=\u5355\u5143\u683C\u5143\u7D20
FR-Designer_Cell_Attributes=\u5355\u5143\u683C\u5C5E\u6027
FR-Designer_Float_Element=\u60AC\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7EC4\u4EF6\u5E93
FR-Designer_No_Settings_Available=\u65E0\u53EF\u7528\u914D\u7F6E\u9879\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_EnlargeOrReduce=\u7F29\u653E
FR-Designer_Scale_selfAdaptButton=\u6070\u597D\u5BB9\u7EB3\u9009\u5B9A\u533A\u57DF
FR-Designer_Scale_customButton=\u81EA\u5B9A\u4E49
FR-Designer_FRFont_Subscript=\u4E0B\u6807
FR-Designer_FRFont_Superscript=\u4E0A\u6807
FR-Designer_FRFont_Shadow=\u9634\u5F71
FR-Designer_FRFont_Strikethrough=\u5220\u9664\u7EBF
FR-Designer_FRFont_Underline=\u4E0B\u5212\u7EBF
FR-Designer_FRFont_bold=\u52A0\u7C97
FR-Designer_FRFont_italic=\u659C\u4F53
FR-Designer_FRFont_Foreground=\u989C\u8272
FR-Designer_FRFont_Style=\u5B57\u5F62
FR-Designer_FRFont_plain=\u5E38\u89C4
FR-Designer_FRFont_bolditalic=\u52A0\u7C97\u503E\u659C
FR-Designer_outBorder=\u5916\u8FB9\u6846
FR-Designer_inBorder=\u5185\u8FB9\u6846
FR-Designer_ExpandD_Up_Father_Cell=\u4E0A\u7236\u683C
FR-Designer_ExpandD_Expand_Direction=\u6269\u5C55\u65B9\u5411
FR-Designer_Expand=\u6269\u5C55
FR-Designer_ExpendSort=\u6269\u5C55\u540E\u6392\u5E8F
FR-Designer_ExpandD_Expandable=\u53EF\u4F38\u5C55\u6027
FR-Designer_Read_failure=\u8BFB\u53D6\u5931\u8D25\uFF0C\u53EF\u80FD\u6E90\u6587\u4EF6\u5DF2\u635F\u574F

27
designer_base/src/com/fr/design/locale/designer_zh_TW.properties

@ -2004,3 +2004,30 @@ FR-Designer_AlphaFine_NoResult=\u66AB\u7121\u76F8\u95DC\u5167\u5BB9
FR-Designer_ConnectionFailed=\u93C8\u63A5\u5931\u6557
FR-Designer_NoResult=\u66AB\u4E0D\u652F\u6301\u986F\u793A
FR-Designer-AlphaFine_SetShortcuts=\u8ACB\u76F4\u63A5\u5728\u9375\u76E4\u4E0A\u6309\u5169\u500B\u7D44\u5408\u9375
FR-Designer_Cell_Element=\u5132\u5B58\u683C\u5143\u7D20
FR-Designer_Cell_Attributes=\u5132\u5B58\u683C\u5C6C\u6027
FR-Designer_Float_Element=\u61F8\u6D6E\u5143\u7D20
FR-Designer_Widget_Library=\u7D44\u4EF6\u5EAB
FR-Designer_No_Settings_Available=\u7121\u53EF\u7528\u914D\u5BD8\u9805\uFF01
FR-Designer_Configured_Roles=\u5DF2\u914D\u7F6E\u89D2\u8272
FR-Designer_Scale_selfAdaptButton=\
FR-Designer_Scale_customButton=\
FR-Designer_FRFont_Subscript=\
FR-Designer_FRFont_Superscript=\
FR-Designer_FRFont_Shadow=\
FR-Designer_FRFont_Strikethrough=\
FR-Designer_FRFont_Underline=\
FR-Designer_FRFont_bold=\
FR-Designer_FRFont_italic=\
FR-Designer_FRFont_Foreground=\
FR-Designer_FRFont_Style=\
FR-Designer_FRFont_plain=\
FR-Designer_FRFont_bolditalic=\
FR-Designer_outBorder=\
FR-Designer_inBorder=\
FR-Designer_ExpandD_Up_Father_Cell=\
FR-Designer_ExpandD_Expand_Direction=\
FR-Designer_Expand=\
FR-Designer_ExpendSort=\
FR-Designer_ExpandD_Expandable=\
FR-Designer_Read_failure=\

10
designer_base/src/com/fr/design/mainframe/DesignerFrame.java

@ -255,6 +255,11 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
basePane.add(centerPane, BorderLayout.CENTER);
laoyoutWestPane();
// JPanel eastRegionPane = new JPanel(new BorderLayout());
// eastRegionPane.add(EastRegionContainerPane.getInstance(), BorderLayout.CENTER);
// eastRegionPane.add(JSliderPane.getInstance(), BorderLayout.SOUTH);
// basePane.add(eastRegionPane, BorderLayout.EAST);
basePane.add(EastRegionContainerPane.getInstance(), BorderLayout.EAST);
basePane.setBounds(0, 0, contentWidth, contentHeight);
@ -421,10 +426,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane(
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
EastRegionContainerPane.getInstance().replaceUpPane(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastUpPane());
EastRegionContainerPane.getInstance().replaceDownPane(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getEastDownPane());
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane();
DesignerContext.getDesignerFrame().resetToolkitByPlus(
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getToolBarMenuDockPlus());
needToAddAuhtorityPaint();

854
designer_base/src/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1,11 +1,61 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.gui.icontainer.UIResizableContainer;
import com.fr.stable.Constants;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIEastResizableContainer;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.FRFont;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import com.fr.third.fr.pdf.kernel.utils.CompareTool;
public class EastRegionContainerPane extends UIResizableContainer {
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
public class EastRegionContainerPane extends UIEastResizableContainer {
private static EastRegionContainerPane THIS;
private Map<String, PropertyItem> propertyItemMap;
private CardLayout propertyCard;
private JPanel leftPane;
private JPanel rightPane;
private static final int CONTAINER_WIDTH = 260;
private static final int TAB_WIDTH = 40;
private static final int CONTENT_WIDTH = CONTAINER_WIDTH - TAB_WIDTH;
private static final int POPUP_TOOLPANE_HEIGHT = 25;
private static final int ARROW_RANGE_START = CONTENT_WIDTH - 30;
private static final String KEY_CELL_ELEMENT = "cellElement";
private static final String KEY_CELL_ATTR = "cellAttr";
private static final String KEY_FLOAT_ELEMENT = "floatElement";
private static final String KEY_WIDGET_SETTINGS = "widgetSettings";
private static final String KEY_CONDITION_ATTR = "conditionAttr";
private static final String KEY_HYPERLINK = "hyperlink";
private static final String KEY_WIDGET_LIB = "widgetLib";
private static final String KEY_AUTHORITY_EDITION = "authorityEdition";
private static final String KEY_CONFIGURED_ROLES = "editedRoles";
private static final String DEFAULT_PANE = "defaultPane"; // "无可用配置项"面板
public enum PropertyMode {
REPORT, // 报表
REPORT_PARA, // 报表参数面板
REPORT_FLOAT, // 报表悬浮元素
FORM, // 表单
FORM_REPORT, // 表单报表块
POLY, // 聚合报表
POLY_REPORT, // 聚合报表-报表块
POLY_CHART, // 聚合报表-图表块
AUTHORITY_EDITION // 权限编辑
}
private PropertyMode currentMode; // 当前模式(根据不同模式,显示不同的可用面板)
/**
* 得到实例
@ -15,24 +65,808 @@ public class EastRegionContainerPane extends UIResizableContainer {
public static final EastRegionContainerPane getInstance() {
if (THIS == null) {
THIS = new EastRegionContainerPane();
THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY());
// THIS.setLastToolPaneY(DesignerEnvManager.getEnvManager().getLastEastRegionToolPaneY());
THIS.setLastContainerWidth(DesignerEnvManager.getEnvManager().getLastEastRegionContainerWidth());
}
return THIS;
}
public EastRegionContainerPane() {
super(Constants.LEFT);
setVerticalDragEnabled(false);
setContainerWidth(260);
super();
// setVerticalDragEnabled(false);
initPropertyItemList();
switchMode(PropertyMode.REPORT);
// initContentPane();
// super(leftPane, rightPane);
setContainerWidth(CONTAINER_WIDTH);
}
private void initPropertyItemList() {
propertyItemMap = new LinkedHashMap<>(); // 有序map
// 单元格元素
PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, Inter.getLocText("FR-Designer_Cell_Element"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 单元格属性
PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, Inter.getLocText("FR-Designer_Cell_Attributes"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 悬浮元素
PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, Inter.getLocText("FR-Designer_Float_Element"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT});
// 控件设置
PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, Inter.getLocText("FR-Designer-Widget_Settings"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART});
// 条件属性
PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, Inter.getLocText("FR-Designer_Condition_Attributes"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 超级链接
PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, Inter.getLocText("FR-Designer_Hyperlink"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART},
new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT});
// 组件库
PropertyItem widgetLib = new PropertyItem(KEY_WIDGET_LIB, Inter.getLocText("FR-Designer_Widget_Library"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.FORM},
new PropertyMode[]{PropertyMode.FORM});
// 权限编辑
PropertyItem authorityEdition = new PropertyItem(KEY_AUTHORITY_EDITION, Inter.getLocText("FR-Designer_Permissions_Edition"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
// 已配置角色
PropertyItem configuredRoles = new PropertyItem(KEY_CONFIGURED_ROLES, Inter.getLocText("FR-Designer_Configured_Roles"),
"/com/fr/design/images/buttonicon/add.png", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
propertyItemMap.put(KEY_CELL_ELEMENT, cellElement);
propertyItemMap.put(KEY_CELL_ATTR, cellAttr);
propertyItemMap.put(KEY_FLOAT_ELEMENT, floatElement);
propertyItemMap.put(KEY_WIDGET_SETTINGS, widgetSettings);
propertyItemMap.put(KEY_CONDITION_ATTR, conditionAttr);
propertyItemMap.put(KEY_HYPERLINK, hyperlink);
propertyItemMap.put(KEY_WIDGET_LIB, widgetLib);
propertyItemMap.put(KEY_AUTHORITY_EDITION, authorityEdition);
propertyItemMap.put(KEY_CONFIGURED_ROLES, configuredRoles);
}
// "无可用配置项"面板
private JPanel getDefaultPane() {
JPanel defaultPane = new JPanel();
UILabel label = new UILabel(Inter.getLocText("FR-Designer_No_Settings_Available"));
defaultPane.setLayout(new BorderLayout());
defaultPane.add(label, BorderLayout.CENTER);
return defaultPane;
}
private void initContentPane() {
initRightPane();
initLeftPane();
}
// 右侧属性面板
private void initRightPane() {
rightPane = new JPanel();
propertyCard = new CardLayout();
rightPane.setBackground(Color.green);
rightPane.setLayout(propertyCard);
for (PropertyItem item : propertyItemMap.values()) {
if (item.isPoppedOut() || !item.isVisible()) {
continue;
}
rightPane.add(item.getName(), item.getPropertyPanel());
}
rightPane.add(DEFAULT_PANE, getDefaultPane());
replaceRightPane(rightPane);
refreshRightPane();
}
// 左侧按钮面板
private void initLeftPane() {
leftPane = new JPanel();
leftPane.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0));
for (PropertyItem item : propertyItemMap.values()) {
if (item.isPoppedOut() || !item.isVisible()) {
continue;
}
leftPane.add(item.getButton());
}
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
leftPane.setBackground(Color.yellow);
replaceLeftPane(leftPane);
}
public void switchMode(PropertyMode mode) {
if (currentMode != null && currentMode.equals(mode)) {
return;
}
currentMode = mode;
updateAllPropertyPane();
}
public void updateAllPropertyPane() {
updatePropertyItemMap();
initContentPane();
}
private void updatePropertyItemMap() {
for (PropertyItem item : propertyItemMap.values()) {
item.updateStatus();
}
}
// 弹出面板时,更新框架内容
private void removeItem(PropertyItem propertyItem) {
leftPane.remove(propertyItem.getButton());
rightPane.remove(propertyItem.getPropertyPanel());
refreshRightPane();
refreshContainer();
}
@Override
public void onResize() {
for (PropertyItem item : propertyItemMap.values()) {
item.onResize();
}
}
public EastRegionContainerPane(JPanel leftPane, JPanel rightPane) {
super(leftPane, rightPane);
// setVerticalDragEnabled(false);
// setContainerWidth(260);
}
public void replaceUpPane(JComponent pane) {
replaceCellElementPane(pane);
}
public void replaceDownPane(JComponent pane) {
replaceCellAttrPane(pane);
}
public JComponent getUpPane() {
return getCellElementPane();
}
public JComponent getDownPane() {
return getCellAttrPane();
}
public void replaceCellElementPane(JComponent pane) {
propertyItemMap.get(KEY_CELL_ELEMENT).replaceContentPane(pane);
}
public JComponent getCellElementPane() {
return propertyItemMap.get(KEY_CELL_ELEMENT).getContentPane();
}
public void replaceCellAttrPane(JComponent pane) {
propertyItemMap.get(KEY_CELL_ATTR).replaceContentPane(pane);
}
public JComponent getCellAttrPane() {
return propertyItemMap.get(KEY_CELL_ATTR).getContentPane();
}
public void replaceFloatElementPane(JComponent pane) {
propertyItemMap.get(KEY_FLOAT_ELEMENT).replaceContentPane(pane);
}
public JComponent getFloatElementPane() {
return propertyItemMap.get(KEY_FLOAT_ELEMENT).getContentPane();
}
public void replaceWidgetSettingsPane(JComponent pane) {
propertyItemMap.get(KEY_WIDGET_SETTINGS).replaceContentPane(pane);
}
public JComponent getWidgetSettingsPane() {
return propertyItemMap.get(KEY_WIDGET_SETTINGS).getContentPane();
}
public void replaceWidgetLibPane(JComponent pane) {
propertyItemMap.get(KEY_WIDGET_LIB).replaceContentPane(pane);
}
public JComponent getWidgetLibPane() {
return propertyItemMap.get(KEY_WIDGET_LIB).getContentPane();
}
public void replaceAuthorityEditionPane(JComponent pane) {
propertyItemMap.get(KEY_AUTHORITY_EDITION).replaceContentPane(pane);
}
public JComponent getAuthorityEditionPane() {
return propertyItemMap.get(KEY_AUTHORITY_EDITION).getContentPane();
}
public void replaceConfiguredRolesPane(JComponent pane) {
propertyItemMap.get(KEY_CONFIGURED_ROLES).replaceContentPane(pane);
}
public JComponent getConfiguredRolesPane() {
return propertyItemMap.get(KEY_CONFIGURED_ROLES).getContentPane();
}
public void addParameterPane(JComponent paraPane) {
// propertyItemMap.get(KEY_HYPERLINK).replaceContentPane(paraPane);
}
public void setParameterHeight(int height) {
// stub
}
public static void main(String[] args){
JFrame jf = new JFrame("test");
// jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel cc = new JPanel();
cc.setBackground(Color.white);
// JPanel leftPane = new JPanel();
// leftPane.setBackground(Color.yellow);
// JPanel rightPane = new JPanel();
// rightPane.setBackground(Color.green);
//
// JButton b1, b2;
// b1 = new JButton("b1");
// b2 = new JButton("b2");
// b1.setPreferredSize(new Dimension(40, 40));
// b2.setPreferredSize(new Dimension(40, 40));
// leftPane.add(b1);
// leftPane.add(b2);
// leftPane.setLayout(new BoxLayout(leftPane, BoxLayout.Y_AXIS));
JPanel content = (JPanel)jf.getContentPane();
// content.setLayout(null);
content.add(cc, BorderLayout.CENTER);
content.add(new EastRegionContainerPane(), BorderLayout.EAST);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
public void removeParameterPane() {
}
/**
* 刷新下面板
* 刷新面板
*/
public void refreshRightPane() {
boolean hasAvailableTab = false;
for (String name : propertyItemMap.keySet()) {
PropertyItem propertyItem = propertyItemMap.get(name);
if (propertyItem.isVisible() && !propertyItem.isPoppedOut() && propertyItem.isEnabled()) {
propertyCard.show(rightPane, name); // 显示第一个可用tab
hasAvailableTab = true;
break;
}
}
if (!hasAvailableTab) {
propertyCard.show(rightPane, DEFAULT_PANE);
}
// if (this.getRightPane() instanceof DockingView) {
// ((DockingView) this.getRightPane()).refreshDockingView();
// }
}
public void refreshDownPane() {
if (this.getDownPane() instanceof DockingView) {
((DockingView) this.getDownPane()).refreshDockingView();
// JComponent pane = propertyItemList.get(1).getContentPane();
// if (pane instanceof DockingView) {
// ((DockingView) pane).refreshDockingView();
// }
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
public int getToolPaneY() {
return 0;
}
class PropertyItem {
private UIButton button;
private String name; // 用于 card 切换
private String title; // 用于显示
private JComponent propertyPanel;
private JComponent contentPane;
private FixedPopupPane popupPane; // 左侧固定弹出框
private PopupToolPane popupToolPane; // 弹出工具条
private PopupDialog popupDialog; // 弹出框
private boolean isPoppedOut = false; // 是否弹出
private boolean isVisible = true; // 是否可见
private boolean isEnabled = true; // 是否可用
private Set<PropertyMode> visibleModes;
private Set<PropertyMode> enableModes;
public PropertyItem(String name, String title, String btnUrl, PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.name = name;
this.title = title;
initButton(btnUrl);
initPropertyPanel();
// this.visibleModes = new ArrayList<PropertyMode>(visibleModes);
initModes(visibleModes, enableModes);
}
private void initModes(PropertyMode[] visibleModes, PropertyMode[] enableModes) {
this.enableModes = new HashSet<>();
this.visibleModes = new HashSet<>();
for (PropertyMode enableMode : enableModes) {
this.enableModes.add(enableMode);
}
for (PropertyMode visibleMode : visibleModes) {
this.visibleModes.add(visibleMode);
}
this.visibleModes.addAll(this.enableModes); // 可用必可见
}
public void updateStatus() {
setEnabled(enableModes.contains(currentMode));
setVisible(visibleModes.contains(currentMode));
}
public boolean isVisible() {
return isVisible;
}
public void setVisible(boolean isVisible) {
this.isVisible = isVisible;
}
public boolean isEnabled() {
return isEnabled;
}
// 选项不可用
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
button.setEnabled(isEnabled);
}
private void initPropertyPanel() {
propertyPanel = new JPanel();
propertyPanel.setBackground(Color.pink);
contentPane = generateContentPane();
popupToolPane = new PopupToolPane(this, PopupToolPane.DOWN_BUTTON);
propertyPanel.setLayout(new BorderLayout());
propertyPanel.add(popupToolPane, BorderLayout.NORTH);
propertyPanel.add(contentPane, BorderLayout.CENTER);
}
public boolean isPoppedOut() {
return isPoppedOut;
}
public JComponent generateContentPane() {
JComponent contentPane = new JPanel();
UIButton testBtn = new UIButton(name);
testBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setEnabled(!button.isEnabled());
}
});
contentPane.add(testBtn);
return contentPane;
}
public void replaceContentPane(JComponent pane) {
propertyPanel.remove(this.contentPane);
propertyPanel.add(this.contentPane = pane);
if (popupDialog != null && isPoppedOut) {
popupDialog.replaceContentPane(contentPane);
}
if (popupPane != null && !isRightPaneVisible()) {
popupPane.replaceContentPane(contentPane);
}
refreshContainer();
}
public JComponent getContentPane() {
return contentPane;
}
public void onResize() {
if (isRightPaneVisible()) {
replaceContentPane(contentPane);
} else if(popupPane != null) {
popupPane.replaceContentPane(contentPane);
}
}
// private void refreshContainer() {
// propertyPanel.validate();
// propertyPanel.repaint();
// propertyPanel.revalidate();
// }
private void initButton(String btnUrl) {
button = new UIButton(BaseUtils.readIcon(btnUrl)) {
public Dimension getPreferredSize() {
return new Dimension(TAB_WIDTH, TAB_WIDTH);
}
};
button.set4LargeToolbarButton();
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (isRightPaneVisible()) {
propertyCard.show(rightPane, name);
} else {
popupFixedPane();
}
}
});
}
public UIButton getButton() {
return button;
}
public String getName() {
return name;
}
public String getTitle() {
return title;
}
public JComponent getPropertyPanel() {
return propertyPanel;
}
// 固定弹窗
public void popupFixedPane() {
if (popupPane == null) {
popupPane = new FixedPopupPane(this);
}
GUICoreUtils.showPopupMenu(popupPane, button, -popupPane.getPreferredSize().width, 0);
}
// 弹出对话框
public void popupDialog() {
// setIsPoppedOut(true);
if (isPoppedOut) {
return;
}
isPoppedOut = true;
if (popupDialog == null) {
popupDialog = new PopupDialog(this);
} else {
popupDialog.replaceContentPane(contentPane);
popupDialog.setVisible(true);
}
// initContentPane();
// refreshContainer();
removeItem(this);
}
public void popToFrame() {
if (isPoppedOut) {
isPoppedOut = false;
// popupDialog.dispose();
popupDialog.setVisible(false);
initContentPane();
onResize();
refreshContainer();
}
}
}
private class FixedPopupPane extends JPopupMenu {
private JComponent contentPane;
// private PopupToolPane popupToolPane;
private int fixedHeight;
FixedPopupPane(PropertyItem propertyItem) {
contentPane = propertyItem.getContentPane();
this.setLayout(new BorderLayout());
// popupToolPane = ;
this.add(new PopupToolPane(propertyItem), BorderLayout.NORTH);
this.add(contentPane, BorderLayout.CENTER);
this.setOpaque(false);
fixedHeight = getPreferredSize().height - contentPane.getPreferredSize().height;
updateSize();
}
private void updateSize() {
int newHeight = fixedHeight + contentPane.getPreferredSize().height;
this.setPreferredSize(new Dimension(CONTAINER_WIDTH - TAB_WIDTH, newHeight));
}
public JComponent getContentPane() {
return contentPane;
}
public void replaceContentPane(JComponent pane) {
// remove(pane);
this.remove(this.contentPane);
this.add(this.contentPane = pane);
updateSize();
refreshContainer();
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
}
// 弹出属性面板的工具条
private class PopupToolPane extends JPanel {
private int model = UIConstants.MODEL_NORMAL;
private String title;
private JComponent contentPane;
private PropertyItem propertyItem;
private String buttonType;
private JDialog parentDialog; // 如果不在对话框中,值为null
private Color originColor; // 初始背景
private boolean isMovable = false;
private Point mouseDownCompCoords; // 存储按下左键的位置,移动对话框时会用到
private static final int MIN_X = -150;
private static final int MAX_X_SHIFT = 50;
private static final int MAX_Y_SHIFT = 50;
private static final String NO_BUTTON = "NoButton";
private static final String UP_BUTTON = "UpButton";
private static final String DOWN_BUTTON = "DownButton";
private MouseListener mouseListener = new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) {
setCursor(Cursor.getDefaultCursor());
if (mouseDownCompCoords == null) {
setBackground(originColor);
}
model = UIConstants.MODEL_NORMAL;
repaint();
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
onPop();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
if (!getBounds().contains(e.getPoint())) {
setBackground(originColor);
}
}
@Override
public void mousePressed(MouseEvent e) {
if (e.getX() < ARROW_RANGE_START) {
mouseDownCompCoords = e.getPoint();
}
}
};
private MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent e) {
if (e.getX() >= ARROW_RANGE_START) {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
model = UIConstants.MODEL_PRESS;
} else if (isMovable) {
setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
setBackground(Color.pink);
} else {
setCursor(Cursor.getDefaultCursor());
model = UIConstants.MODEL_NORMAL;
}
repaint();
}
@Override
public void mouseDragged(MouseEvent e) {
if (isMovable && mouseDownCompCoords != null) {
Point currCoords = e.getLocationOnScreen();
int x = currCoords.x - mouseDownCompCoords.x;
int y = currCoords.y - mouseDownCompCoords.y;
//屏幕可用区域
Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
int minY = screen.y;
int maxX = Toolkit.getDefaultToolkit().getScreenSize().width - MAX_X_SHIFT;
int maxY = Toolkit.getDefaultToolkit().getScreenSize().height - MAX_Y_SHIFT;
if (x < MIN_X) {
x = MIN_X;
} else if (x > maxX) {
x = maxX;
}
if (y < minY) {
y = minY;
} else if (y > maxY) {
y = maxY;
}
// 移动到屏幕边缘时,需要校正位置
parentDialog.setLocation(x, y);
}
}
};
public PopupToolPane(PropertyItem propertyItem) {
this(propertyItem, NO_BUTTON);
}
public PopupToolPane(PropertyItem propertyItem, String buttonType) {
super();
this.propertyItem = propertyItem;
this.title = propertyItem.getTitle();
this.contentPane = propertyItem.getContentPane();
originColor = getBackground();
setLayout(new BorderLayout());
UILabel label = new UILabel(title);
label.setForeground(new Color(69, 135, 255));
add(label, BorderLayout.WEST);
setBorder(new EmptyBorder(5, 10, 0, 0));
initToolButton(buttonType);
}
public void setParentDialog(JDialog parentDialog) {
this.parentDialog = parentDialog;
isMovable = true;
}
private void initToolButton(final String buttonType) {
this.buttonType = buttonType;
if (StringUtils.isEmpty(buttonType) || buttonType.equals(NO_BUTTON)) {
return;
}
// validate
if (!buttonType.equals(UP_BUTTON) && !buttonType.equals(DOWN_BUTTON)) {
throw new IllegalArgumentException("unknown button type: " + buttonType);
}
addMouseMotionListener(mouseMotionListener);
addMouseListener(mouseListener);
}
// 触发弹入、弹出
private void onPop() {
if (buttonType.equals(DOWN_BUTTON)) {
propertyItem.popupDialog();
} else if (buttonType.equals(UP_BUTTON)) {
propertyItem.popToFrame();
}
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, POPUP_TOOLPANE_HEIGHT);
}
@Override
public void paint(Graphics g) {
super.paint(g);
Image button;
g.setColor(new Color(69, 135, 255));
g.setFont(FRFont.getInstance().applySize(14));
// g.drawString(title, 5, 20);
// g.drawImage(UIConstants.DRAG_BAR, 0, 0, CONTENT_WIDTH, POPUP_TOOLPANE_HEIGHT, null);
if (buttonType.equals(NO_BUTTON)) {
return;
}
if (buttonType.equals(DOWN_BUTTON)) {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_LEFT_NORMAL;
} else {
button = UIConstants.DRAG_LEFT_PRESS;
}
} else {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_RIGHT_NORMAL;
} else {
button = UIConstants.DRAG_RIGHT_PRESS;
}
}
// g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
g.drawImage(button, ARROW_RANGE_START + 12, 7, 5, 5, null);
}
}
private class PopupDialog extends JDialog {
private Container container;
private static final int RESIZE_RANGE = 4;
private Cursor originCursor;
private Cursor southResizeCursor = Cursor.getPredefinedCursor(Cursor.S_RESIZE_CURSOR);
private Point mouseDownCompCoords;
private int minHeight; // 对话框最小高度
private JComponent contentPane;
public PopupDialog(PropertyItem propertyItem) {
super(DesignerContext.getDesignerFrame());
container = getContentPane();
setUndecorated(true);
PopupToolPane popupToolPane = new PopupToolPane(propertyItem, PopupToolPane.UP_BUTTON);
popupToolPane.setParentDialog(this);
contentPane = propertyItem.getContentPane();
container.add(popupToolPane, BorderLayout.NORTH);
container.add(contentPane, BorderLayout.CENTER);
minHeight = container.getPreferredSize().height;
setSize(CONTENT_WIDTH, minHeight);
// validate();
Point btnCoords = propertyItem.getButton().getLocationOnScreen();
this.setLocation(btnCoords.x - CONTENT_WIDTH, btnCoords.y);
initListener();
this.setVisible(true);
}
public void replaceContentPane(JComponent contentPane) {
container.remove(this.contentPane);
container.add(this.contentPane = contentPane);
// pack();
if (getSize().height < container.getPreferredSize().height) {
setSize(CONTENT_WIDTH, container.getPreferredSize().height);
}
refreshContainer();
}
private void refreshContainer() {
validate();
repaint();
revalidate();
}
private void initListener() {
addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
if (mouseDownCompCoords != null) {
Rectangle bounds = getBounds();
Point currCoords = e.getLocationOnScreen();
bounds.height = currCoords.y - mouseDownCompCoords.y + bounds.height;
// 校正位置
if (bounds.height < minHeight) {
bounds.height = minHeight;
}
mouseDownCompCoords.y = currCoords.y;
setBounds(bounds);
}
}
@Override
public void mouseMoved(MouseEvent e) {
if (originCursor == null) { // 记录最初的光标
originCursor = getCursor();
}
if (e.getY() > getHeight() - RESIZE_RANGE) {
setCursor(southResizeCursor);
} else {
// 还原
if (mouseDownCompCoords == null && getCursor().equals(southResizeCursor)) {
setCursor(originCursor);
}
}
repaint();
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (getCursor().equals(southResizeCursor)) {
mouseDownCompCoords = e.getLocationOnScreen();
}
}
@Override
public void mouseReleased(MouseEvent e) {
mouseDownCompCoords = null;
}
});
}
}
}

417
designer_base/src/com/fr/design/mainframe/JSliderPane.java

@ -0,0 +1,417 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*;
import java.awt.event.*;
import java.math.BigDecimal;
/**
* Created by MoMeak on 2017/7/13.
*/
public class JSliderPane extends JPanel {
private static final double ONEPOINTEIGHT = 1.8;
private static final int SIX = 6;
private static final int TEN = 10;
private static final int ONEEIGHT = 18;
private static final int FOURTEN = 40;
private static final int HALFHUNDRED = 50;
private static final int HUNDRED = 100;
private static final int TWOHUNDRED = 200;
private static final int THREEHUNDRED = 300;
private static final int FOURHUNDRED = 400;
private static final int DIALOGWIDTH = 150;
private static final int DIALOGHEIGHT = 200;
public int showValue = 100;
public double resolutionTimes = 1.0;
private static JSliderPane THIS;
private UITextField showVal;
private UISlider slider;
private int times;
private int sliderValue;
private UIButton downButton;
private UIButton upButton;
private UIButton showValButton;
private UIRadioButton twoHundredButton;
private UIRadioButton oneHundredButton;
private UIRadioButton SevenFiveButton;
private UIRadioButton fiveTenButton;
private UIRadioButton twoFiveButton;
private UIRadioButton selfAdaptButton;
private UIRadioButton customButton;
//拖动条处理和button、直接输入不一样
private boolean isButtonOrIsTxt = true;
private PopupPane dialog;
private int upButtonX;
public JSliderPane() {
this.setLayout(new BorderLayout());
slider = new UISlider(0,HUNDRED,HALFHUNDRED);
slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener);
showVal = new UITextField();
showVal.setText("100%");
showVal.setPreferredSize(new Dimension(FOURTEN,ONEEIGHT));
showVal.getDocument().addDocumentListener(showValDocumentListener);
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png"));
upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
downButton.setActionCommand("less");
upButton.setActionCommand("more");
downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener);
JPanel panel = new JPanel(new FlowLayout(1,1,0));
showValButton = new UIButton(showVal.getText());
showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(HALFHUNDRED,ONEEIGHT));
showValButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
});
panel.add(downButton);
panel.add(slider);
panel.add(upButton);
panel.add(showValButton);
this.add(panel,BorderLayout.NORTH);
this.setBounds(0,0,THREEHUNDRED,ONEEIGHT);
}
public static final JSliderPane getInstance() {
// if (THIS == null) {
// THIS = new JSliderPane();
// }
THIS = new JSliderPane();
return THIS;
}
private void initUIRadioButton(){
twoHundredButton = new UIRadioButton("200%");
oneHundredButton = new UIRadioButton("100%");
SevenFiveButton = new UIRadioButton("75%");
fiveTenButton = new UIRadioButton("50%");
twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
ButtonGroup bg=new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组
bg.add(oneHundredButton);
bg.add(SevenFiveButton);
bg.add(fiveTenButton);
bg.add(twoFiveButton);
bg.add(selfAdaptButton);
bg.add(customButton);
}
//定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener()
{
public void stateChanged( ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt){
JSlider source = (JSlider) event.getSource();
EventQueue.invokeLater(new Runnable() {
public void run() {
sliderValue = slider.getValue();
getTimes(sliderValue);
showValue = times;
showVal.setText(times + "%");
}
});
}else {
isButtonOrIsTxt = false;
}
}
};
DocumentListener showValDocumentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue,100,2);
refreshSlider();
refreshBottun();
}
@Override
public void removeUpdate(DocumentEvent e) {
// refreshSlider();
}
@Override
public void changedUpdate(DocumentEvent e) {
// refreshSlider();
}
};
private void refreshSlider(){
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%")));
if (showValue >HUNDRED){
slider.setValue((int)(showValue+TWOHUNDRED)/SIX);
}else if (showValue <HUNDRED){
slider.setValue((int)((showValue-TEN)/ONEPOINTEIGHT));
}else if (showValue == HUNDRED){
slider.setValue(HALFHUNDRED);
}
}
private void refreshBottun(){
showValButton.setText(showVal.getText());
}
public double getResolutionTimes(){
return this.resolutionTimes;
}
public int getshowValue(){
return this.showValue;
}
public static double divide(double v1, double v2,int scale) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.divide(b2,scale).doubleValue();
}
ActionListener buttonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%")));
isButtonOrIsTxt = true;
if(e.getActionCommand().equals("less")){
int newDownVal = showValue - TEN;
if (newDownVal >= TEN ){
showValue = newDownVal;
showVal.setText(newDownVal + "%");
}else {
showValue = newDownVal;
showVal.setText(TEN + "%");
}
}
if(e.getActionCommand().equals("more")){
int newUpVal = showValue + TEN;
if (newUpVal <= FOURHUNDRED ){
showValue = newUpVal;
showVal.setText(newUpVal + "%");
}else {
showValue = newUpVal;
showVal.setText(FOURHUNDRED + "%");
}
}
isButtonOrIsTxt = true;
}
};
private void getTimes(int value){
if (value == HALFHUNDRED){
times=HUNDRED;
}else if (value < HALFHUNDRED){
times = (int) Math.round(ONEPOINTEIGHT*value + TEN);
}else {
times = (int) (SIX*value - TWOHUNDRED);
}
}
public UITextField getShowVal(){
return this.showVal;
}
private void popupDialog(){
Point btnCoords = upButton.getLocationOnScreen();
if (dialog == null){
dialog = new PopupPane(upButton,showVal);
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT);
}
}else {
if (upButtonX == 0) {
upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT);
} else {
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT);
}
}
}
public static void main(String[] args)
{
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel)jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(JSliderPane.getInstance(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 80);
jf.setVisible(true);
}
}
class JSliderPaneUI extends BasicSliderUI {
private static final int VERTICAL_WIDTH = 11;
private static final int VERTICAL_HEIGHT = 16;
private static final int FOUR = 4;
private static final int FIVE = 5;
private static final int SIX = 6;
public JSliderPaneUI(UISlider b) {
super(b);
}
/** */
/**
* 绘制指示物
*/
public Dimension getThumbSize() {
Dimension size = new Dimension();
if ( slider.getOrientation() == JSlider.VERTICAL ) {
size.width = VERTICAL_WIDTH;
size.height = VERTICAL_HEIGHT;
}
else {
size.width = VERTICAL_WIDTH;
size.height = VERTICAL_HEIGHT;
}
return size;
}
public void paintThumb(Graphics g) {
Rectangle knobBounds = thumbRect;
int w = knobBounds.width;
int h = knobBounds.height;
g.translate(knobBounds.x, knobBounds.y);
if ( slider.isEnabled() ) {
g.setColor(slider.getBackground());
}
else {
g.setColor(slider.getBackground().darker());
}
g.setColor(Color.darkGray);
g.fillRect(0, 1, w-SIX, h+1);
}
/** */
/**
* 绘制刻度轨迹
*/
public void paintTrack(Graphics g) {
int cy, cw;
Rectangle trackBounds = trackRect;
if (slider.getOrientation() == UISlider.HORIZONTAL) {
Graphics2D g2 = (Graphics2D) g;
cy = (trackBounds.height / 2);
cw = trackBounds.width;
g.setColor(Color.lightGray);
g.drawLine(0, cy, cw+FIVE, cy);
g.drawLine(FIVE+cw/2, cy-FOUR, FIVE+cw/2, cy+FOUR);
} else {
super.paintTrack(g);
}
}
}
class Dialog extends JDialog {
// private Container container;
// private static final int UPLABELHEIGHT = 25;
// private static final int HALFHUNDRED = 50;
// private static final int DIALOGWIDTH = 150;
// private static final int DIALOGHEIGHT = 200;
// private static final int UPLABELWIDTH = 300;
// private int minHeight; // 对话框最小高度
// private JComponent contentPane;
// private JComponent centerPane;
// private UILabel upLabel;
// public Dialog(UIButton b,UITextField j) {
// super(DesignerContext.getDesignerFrame());
// container = getContentPane();
// setUndecorated(true);
// contentPane = new JPanel(new BorderLayout());
// centerPane = new JPanel(new BorderLayout());
// upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
// upLabel.setOpaque(true);
// upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT));
// upLabel.setBackground(Color.LIGHT_GRAY);
// upLabel.setBorder(BorderFactory.createLineBorder(Color.gray,1));
// upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
// centerPane.add(j,BorderLayout.NORTH);
// contentPane.add(upLabel,BorderLayout.NORTH);
// contentPane.add(centerPane,BorderLayout.CENTER);
//// contentPane.setBorder(BorderFactory.createLineBorder(Color.gray,1));
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
//// contentPane.add(new JPanel())
// container.add(contentPane, BorderLayout.CENTER);
// minHeight = container.getPreferredSize().height;
// setSize(DIALOGWIDTH, DIALOGHEIGHT);
//// validate();
// Point btnCoords = b.getLocationOnScreen();
//
// this.setLocation(btnCoords.x - DIALOGWIDTH + b.getWidth() +HALFHUNDRED, btnCoords.y -DIALOGHEIGHT);
//// initListener();
//
// this.setVisible(true);
// }
}
class PopupPane extends JPopupMenu {
private JComponent contentPane;
private static final int UPLABELHEIGHT = 25;
private static final int HALFHUNDRED = 50;
private static final int DIALOGWIDTH = 150;
private static final int DIALOGHEIGHT = 200;
private static final int UPLABELWIDTH = 300;
private JComponent centerPane;
private UILabel upLabel;
PopupPane(UIButton b,UITextField j) {
contentPane = new JPanel(new BorderLayout());
centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
centerPane.add(j,BorderLayout.NORTH);
contentPane.add(upLabel,BorderLayout.NORTH);
contentPane.add(centerPane,BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));
this.add(contentPane, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(DIALOGWIDTH, DIALOGHEIGHT));
this.setOpaque(false);
}
}

7
designer_base/src/com/fr/design/mainframe/JTemplate.java

@ -109,6 +109,9 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
}
}
// 刷新右侧属性面板
public abstract void refreshEastPropertiesPane();
// 为收集模版信息作准备
private void initForCollect() {
template.initTemplateID(); // 为新模板设置 templateID 属性
@ -210,6 +213,10 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
*/
public abstract void removeParameterPaneSelection();
public abstract void setScale(int resolution);
public abstract int getScale();
protected abstract DesignModelAdapter<T, ?> createDesignModel();
/**

2
designer_base/src/com/fr/design/roleAuthority/RoleTree.java

File diff suppressed because one or more lines are too long

5
designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java

@ -109,12 +109,13 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/
public void initBeforeUpEdit() {
WidgetToolBarPane.getInstance(this);
EastRegionContainerPane.getInstance().replaceDownPane(
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_PARA);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(
FormWidgetDetailPane.getInstance(this));
if (!BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(this));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(this).getPreferredSize().height);
EastRegionContainerPane.getInstance().replaceUpPane(
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
WidgetPropertyPane.getInstance(this));
} else {
EastRegionContainerPane.getInstance().removeParameterPane();

52
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -20,6 +20,8 @@ import javax.swing.JPanel;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
@ -45,10 +47,12 @@ import com.fr.general.Inter;
public class FormArea extends JComponent implements ScrollRulerComponent {
private static final double SLIDER_FLOAT = 120.0;
private static final double SLIDER_MIN = 60.0;
private static final double SLIDER_FLOAT = 400.0;
private static final double SLIDER_MIN = 10.0;
public static final double DEFAULT_SLIDER = 100.0;
private static final int ROTATIONS = 50;
private static final int SHOWVALMAX = 400;
private static final int SHOWVALMIN = 10;
private FormDesigner designer;
private int horizontalValue = 0;
private int verticalValue = 0;
@ -59,11 +63,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
//显示和设置表单界面大小的控件
private UINumberField widthPane;
private UINumberField heightPane;
private UINumberSlidePane slidePane;
private JSliderPane slidePane;
private boolean isValid = true;
// 初始时滑块值为100,托动后的值设为START_VALUE;
private double START_VALUE = DEFAULT_SLIDER;
private double screenValue;
private JSliderPane sliderPane;
public FormScrollBar getHorScrollBar() {
return horScrollBar;
@ -114,8 +119,13 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
widthPane.setPreferredSize(new Dimension(60, 0));
heightPane = new UINumberField();
heightPane.setPreferredSize(new Dimension(60, 0));
slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
slidePane.setPreferredSize(new Dimension(200,0));
// slidePane = new UINumberSlidePane(SLIDER_MIN, SLIDER_FLOAT);
// slidePane.setPreferredSize(new Dimension(260,20));
slidePane = JSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(300,20));
JPanel resizePane =TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"),
heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}},
@ -124,8 +134,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
setWidgetsConfig();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
slidePane.setEnabled(false);
slidePane.setVisible(false);
// initTransparent();
slidePane.setVisible(true);
initTransparent();
initCalculateSize();
}
@ -143,16 +153,38 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private void initTransparent() {
initCalculateSize();
slidePane.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
double value = ((UINumberSlidePane) e.getSource()).getValue();
slidePane.getShowVal().getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
// slidePane.getShowVal().getDocument()
double value = Integer.parseInt(slidePane.getShowVal().getText().substring(0, slidePane.getShowVal().getText().indexOf("%")));
value = value>SHOWVALMAX ? SHOWVALMAX : value;
value = value<SHOWVALMIN ? SHOWVALMIN : value;
reCalculateRoot(value, true);
JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if(form != null){
form.fireTargetModified();
}
}
@Override
public void removeUpdate(DocumentEvent e) {
}
@Override
public void changedUpdate(DocumentEvent e) {
}
});
// slidePane.addChangeListener(new ChangeListener() {
// public void stateChanged(ChangeEvent e) {
// double value = ((UINumberSlidePane) e.getSource()).getValue();
// reCalculateRoot(value, true);
// JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
// if(form != null){
// form.fireTargetModified();
// }
// }
// });
}
/**

35
designer_form/src/com/fr/design/mainframe/JForm.java

@ -88,6 +88,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
super(form, file);
}
@Override
public void refreshEastPropertiesPane() {
}
public int getMenuState() {
return DesignState.JFORM;
@ -240,6 +244,16 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return;
}
@Override
public void setScale(int resolution) {
}
@Override
public int getScale() {
return 0;
}
/**
* 创建权限细粒度编辑面板
*
@ -257,12 +271,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return;
}
editingComponent = comp.createToolPane(this, formDesign);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
if (BaseUtils.isAuthorityEditing()) {
EastRegionContainerPane.getInstance().replaceUpPane(
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(
ComparatorUtils.equals(editingComponent.getClass(), NoSupportAuthorityEdit.class) ? editingComponent : createAuthorityEditPane());
} else {
EastRegionContainerPane.getInstance().replaceUpPane(editingComponent);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(editingComponent);
}
}
@ -617,17 +631,19 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
if (formDesign.isReportBlockEditing()) {
if (elementCaseDesign != null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceDownPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceUpPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
return;
}
}
EastRegionContainerPane.getInstance().replaceUpPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().addParameterPane(ParameterPropertyPane.getInstance(formDesign));
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance(formDesign).getPreferredSize().height);
if (EastRegionContainerPane.getInstance().getDownPane() == null) {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() {
public void run() {
try {
@ -638,15 +654,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane);
}
}.start();
} else {
JPanel pane = new JPanel();
pane.setLayout(new BorderLayout());
pane.add(FormWidgetDetailPane.getInstance(formDesign), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceDownPane(pane);
EastRegionContainerPane.getInstance().replaceWidgetLibPane(pane);
}
}

Loading…
Cancel
Save