Browse Source

REPORT-2897 9.0设计器修改

缩放条部分
master
MoMeak 8 years ago
parent
commit
6ad1e6adcf
  1. 6
      designer/src/com/fr/design/cell/bar/DynamicScrollBar.java
  2. 2
      designer/src/com/fr/design/mainframe/ElementCasePane.java
  3. 66
      designer/src/com/fr/design/mainframe/JWorkBook.java
  4. 4
      designer/src/com/fr/design/mainframe/ReportComponent.java
  5. 2
      designer/src/com/fr/design/mainframe/ReportComponentCardPane.java
  6. 26
      designer/src/com/fr/design/mainframe/ReportComponentComposite.java
  7. 11
      designer/src/com/fr/design/present/BarCodePane.java
  8. 35
      designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java
  9. 4
      designer/src/com/fr/grid/Grid.java
  10. 20
      designer/src/com/fr/grid/GridColumn.java
  11. 9
      designer/src/com/fr/grid/GridColumnMouseHandler.java
  12. 12
      designer/src/com/fr/grid/GridHeader.java
  13. 14
      designer/src/com/fr/grid/GridRow.java
  14. 229
      designer_base/src/com/fr/design/mainframe/JSliderPane.java
  15. 2
      designer_base/src/com/fr/design/mainframe/JTemplate.java
  16. 36
      designer_form/src/com/fr/design/mainframe/FormArea.java
  17. 5
      designer_form/src/com/fr/design/mainframe/JForm.java

6
designer/src/com/fr/design/cell/bar/DynamicScrollBar.java

@ -59,6 +59,10 @@ public class DynamicScrollBar extends JScrollBar {
}); });
} }
public void setDpi(int dpi){
this.dpi = dpi;
}
public ElementCasePane getReportPane() { public ElementCasePane getReportPane() {
return reportPane; return reportPane;
} }
@ -112,6 +116,8 @@ public class DynamicScrollBar extends JScrollBar {
} }
} }
private abstract class DynamicScrollBarHelper extends BarHelper { private abstract class DynamicScrollBarHelper extends BarHelper {
protected abstract DynamicUnitList getSizeList(); protected abstract DynamicUnitList getSizeList();

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

@ -12,8 +12,6 @@ import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.event.*; import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.util.Set; import java.util.Set;

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

@ -1,9 +1,6 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.*;
import com.fr.base.DynamicUnitList;
import com.fr.base.FRContext;
import com.fr.base.Parameter;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.AllowAuthorityEditAction; import com.fr.design.actions.AllowAuthorityEditAction;
@ -14,6 +11,7 @@ import com.fr.design.actions.report.ReportExportAttrAction;
import com.fr.design.actions.report.ReportMobileAttrAction; import com.fr.design.actions.report.ReportMobileAttrAction;
import com.fr.design.actions.report.ReportParameterAction; import com.fr.design.actions.report.ReportParameterAction;
import com.fr.design.actions.report.ReportWebAttrAction; import com.fr.design.actions.report.ReportWebAttrAction;
import com.fr.design.cell.bar.DynamicScrollBar;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
@ -70,6 +68,7 @@ import com.fr.stable.module.Module;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
import javax.swing.*; import javax.swing.*;
import javax.swing.Icon;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -334,20 +333,51 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public void setScale(int resolution) { public void setScale(int resolution) {
//更新resolution //更新resolution
this.resolution = resolution; this.resolution = resolution;
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution); if (reportComposite.centerCardPane.editingComponet.elementCasePane != null){
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setResolution(resolution); reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getGridMouseAdapter().setResolution(resolution);
//更新Grid reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setResolution(resolution);
Grid grid = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid(); //更新Grid
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); Grid grid = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid();
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase()); DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase());
grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution)); DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(reportComposite.centerCardPane.editingComponet.elementCasePane.getEditingElementCase());
grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution)); grid.setVerticalExtent(GridUtils.getExtentValue(0, rowHeightList, grid.getHeight(), resolution));
reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().updateUI(); grid.setHorizontalExtent(GridUtils.getExtentValue(0, columnWidthList, grid.getWidth(), resolution));
//更新Column和Row reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().updateUI();
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().setResolution(resolution); //更新Column和Row
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridColumn().updateUI(); ((DynamicScrollBar)reportComposite.centerCardPane.editingComponet.elementCasePane.getVerticalScrollBar()).setDpi(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().setResolution(resolution); ((DynamicScrollBar)reportComposite.centerCardPane.editingComponet.elementCasePane.getHorizontalScrollBar()).setDpi(resolution);
reportComposite.centerCardPane.editingComponet.elementCasePane.getGridRow().updateUI(); 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();
}
if (reportComposite.centerCardPane.polyDezi != null){
reportComposite.centerCardPane.polyDezi.setResolution(resolution);
reportComposite.centerCardPane.polyDezi.updateUI();
}
// reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().setVerticalValue(10);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
@Override
public int selfAdaptUpdate(){
ElementCasePane reportPane = reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getElementCasePane();
int column = reportPane.getSelection().getSelectedColumns()[0];
double columnLength = reportPane.getSelection().getSelectedColumns().length;
double columnExtent = reportPane.getGrid().getHorizontalExtent();
int row = reportPane.getSelection().getSelectedRows()[0];
double rowLength = reportPane.getSelection().getSelectedRows().length;
double rowExtent = reportPane.getGrid().getVerticalExtent();
if (columnLength == 0||rowLength == 0){
return resolution;
}
double time =(columnExtent/columnLength)<(rowExtent/rowLength) ? (columnExtent/columnLength) : (rowExtent/rowLength);
if (reportPane.isHorizontalScrollBarVisible()) {
reportPane.getVerticalScrollBar().setValue(row);
reportPane.getHorizontalScrollBar().setValue(column);
}
return (int) (time * reportComposite.centerCardPane.editingComponet.elementCasePane.getGrid().getResolution());
} }
@Override @Override

4
designer/src/com/fr/design/mainframe/ReportComponent.java

@ -27,9 +27,13 @@ import com.fr.design.selection.Selectedable;
*/ */
public abstract class ReportComponent<T extends TemplateReport, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S> { public abstract class ReportComponent<T extends TemplateReport, E extends ElementCasePane, S extends SelectableElement> extends TargetComponent<T> implements Selectedable<S> {
protected E elementCasePane; protected E elementCasePane;
// protected P polyElementCasePane;
public E getEditingElementCasePane() { public E getEditingElementCasePane() {
return elementCasePane; return elementCasePane;
} }
// public P getEditingPolyElementCasePane() {
// return polyElementCasePane;
// }
public ReportComponent(T t) { public ReportComponent(T t) {
super(t); super(t);
} }

2
designer/src/com/fr/design/mainframe/ReportComponentCardPane.java

@ -25,7 +25,7 @@ public class ReportComponentCardPane extends JComponent implements TargetModifie
private CardLayout cl; private CardLayout cl;
private WorkSheetDesigner sheetDezi; private WorkSheetDesigner sheetDezi;
private PolyDesigner polyDezi; protected PolyDesigner polyDezi;
public ReportComponentCardPane() { public ReportComponentCardPane() {
this.setLayout(cl = new CardLayout()); this.setLayout(cl = new CardLayout());

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

@ -1,11 +1,15 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JSplitPane; import javax.swing.JSplitPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
@ -15,6 +19,7 @@ import com.fr.design.designer.EditingState;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.icontainer.UIModeControlContainer; import com.fr.design.gui.icontainer.UIModeControlContainer;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.grid.Grid; import com.fr.grid.Grid;
@ -60,25 +65,28 @@ public class ReportComponentComposite extends JComponent {
CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane(); CellElementRegion = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.add(CellElementRegion, BorderLayout.NORTH); this.add(CellElementRegion, BorderLayout.NORTH);
this.add(createSouthControlPane(), BorderLayout.SOUTH); this.add(createSouthControlPane(), BorderLayout.SOUTH);
jSliderContainer.getShowVal().getDocument().addDocumentListener(jSliderContainerListener); jSliderContainer.getShowVal().addChangeListener(showValSpinnerChangeListener);
jSliderContainer.getSelfAdaptButton().addItemListener(selfAdaptButtonItemListener);
} }
DocumentListener jSliderContainerListener = new DocumentListener() { ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void stateChanged(ChangeEvent e) {
double value = Integer.parseInt(jSliderContainer.getShowVal().getText().substring(0, jSliderContainer.getShowVal().getText().indexOf("%"))); double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
value = value>MAX ? MAX : value; value = value>MAX ? MAX : value;
value = value<MIN ? MIN : value; value = value<MIN ? MIN : value;
int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND); int resolution = (int) (ScreenResolution.getScreenResolution()*value/HUND);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(resolution);
} }
};
ItemListener selfAdaptButtonItemListener = new ItemListener() {
@Override @Override
public void removeUpdate(DocumentEvent e) { public void itemStateChanged(ItemEvent e) {
} if (jSliderContainer.getSelfAdaptButton().isSelected()){
int resolution = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().selfAdaptUpdate();
@Override jSliderContainer.getShowVal().setValue(resolution);
public void changedUpdate(DocumentEvent e) { }
} }
}; };

11
designer/src/com/fr/design/present/BarCodePane.java

@ -69,6 +69,17 @@ public class BarCodePane extends FurtherBasicBeanPane<BarcodePresent> {
addlistener(); addlistener();
} }
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 BarCodePane(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(270, 400);
jf.setVisible(true);
}
private void initComponents() { private void initComponents() {
barCodePreviewPane = new BarCodePreviewPane(); barCodePreviewPane = new BarCodePreviewPane();
this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, 100, 0.1)); this.barWidthSpinner = new UIBasicSpinner(new SpinnerNumberModel(1, 1, 100, 0.1));

35
designer/src/com/fr/grid/AbstractGridHeaderMouseHandler.java

@ -41,7 +41,6 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
protected static final int SEPARATOR_GAP = 5; protected static final int SEPARATOR_GAP = 5;
private GridHeader gHeader; private GridHeader gHeader;
private int dragType = GridUtils.DRAG_NONE; private int dragType = GridUtils.DRAG_NONE;
//james 是否为选定多行的drag //james 是否为选定多行的drag
private boolean isMultiSelectDragPermited = false; private boolean isMultiSelectDragPermited = false;
@ -53,10 +52,16 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private int dragIndex = 0; private int dragIndex = 0;
private JToolTip tip = null; private JToolTip tip = null;
private JWindow tipWindow = null; private JWindow tipWindow = null;
protected int resolution = ScreenResolution.getScreenResolution();
public AbstractGridHeaderMouseHandler(GridHeader gHeader) { public AbstractGridHeaderMouseHandler(GridHeader gHeader) {
this.gHeader = gHeader; this.gHeader = gHeader;
} if (gHeader instanceof GridColumn){
this.resolution = ((GridColumn)gHeader).getResolution();
}else {
this.resolution = ((GridRow)gHeader).getResolution();
}
}
public void setStartMultiSelectIndex(int index) { public void setStartMultiSelectIndex(int index) {
this.startMultiSelectIndex = index; this.startMultiSelectIndex = index;
@ -98,7 +103,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
@Override @Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) { public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
// richer:这边这么做的原因是调整了行高列宽后需要通知聚合块改变边界 // richer:这边这么做的原因是调整了行高列宽后需要通知聚合块改变边界
Method method = null; Method method = null;
try { try {
@ -142,7 +147,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private ScrollAction PRESS_ACTION = new ScrollAction() { private ScrollAction PRESS_ACTION = new ScrollAction() {
@Override @Override
public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) { public boolean run(MouseEvent evt, int index, double tmpSize1, double tmpSize2, int tmpIncreaseSize, int oldEndValueSize, ElementCase report, DynamicUnitList sizeList) {
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) { if (isOnSeparatorLineIncludeZero(evt, tmpSize2, tmpIncreaseSize) || isOnNormalSeparatorLine(evt, tmpSize2)) {
dragType = GridUtils.DRAG_CELL_SIZE; dragType = GridUtils.DRAG_CELL_SIZE;
@ -177,7 +182,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
double tmpIncreaseSize = 0; double tmpIncreaseSize = 0;
double oldEndValueSize = 0; double oldEndValueSize = 0;
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
for (int index = beginValue; index < endValue; index++) { // denny: for (int index = beginValue; index < endValue; index++) { // denny:
// beginValue // beginValue
@ -215,7 +220,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
ePane.getGrid().stopEditing();// james 停止当前的所有编辑 ePane.getGrid().stopEditing();// james 停止当前的所有编辑
// peter:选中格子位置. // peter:选中格子位置.
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evt.getX(), evt.getY()); ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(),resolution);
iterateScrollBar(ePane, evt, PRESS_ACTION); iterateScrollBar(ePane, evt, PRESS_ACTION);
@ -255,7 +260,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
* @param evtY * @param evtY
*/ */
private void doShiftSelectHeader(ElementCasePane ePane, double evtX, double evtY) { private void doShiftSelectHeader(ElementCasePane ePane, double evtX, double evtY) {
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evtX, evtY); ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evtX, evtY, resolution);
int selectedCellPointX = selectedCellPoint.getColumn();// column. int selectedCellPointX = selectedCellPoint.getColumn();// column.
int selectedCellPointY = selectedCellPoint.getRow();// row. int selectedCellPointY = selectedCellPoint.getRow();// row.
CellSelection cs = ((CellSelection) ePane.getSelection()).clone(); CellSelection cs = ((CellSelection) ePane.getSelection()).clone();
@ -294,7 +299,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
private String createToolTipString(double doubleValue, double totalDoubleValue) { private String createToolTipString(double doubleValue, double totalDoubleValue) {
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit();
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
FU ulen = FU.valueOfPix((int) doubleValue, resolution); FU ulen = FU.valueOfPix((int) doubleValue, resolution);
FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution); FU tulen = FU.valueOfPix((int) totalDoubleValue, resolution);
String unit; String unit;
@ -317,11 +322,11 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
unit = Inter.getLocText("Unit_MM"); unit = Inter.getLocText("Unit_MM");
} }
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(Utils.convertNumberStringToString(new Float(len))) sb.append(String.format("%.2f", new Double(len)))
.append('/').append(Utils.convertNumberStringToString(new Float(tlen))) .append('/').append(String.format("%.2f", new Double(tlen)))
.append(unit).append('(') .append(unit).append('(')
.append(Utils.doubleToString(doubleValue)).append('/') .append((int)(doubleValue)).append('/')
.append(Utils.doubleToString(totalDoubleValue)) .append((int)(totalDoubleValue))
.append(Inter.getLocText("px")) .append(Inter.getLocText("px"))
.append(')'); .append(')');
return sb.toString(); return sb.toString();
@ -401,7 +406,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
if (!this.isMultiSelectDragPermited) { if (!this.isMultiSelectDragPermited) {
return; return;
} }
ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow(ePane, evt.getX(), evt.getY()); ColumnRow selectedCellPoint = GridUtils.getAdjustEventColumnRow_withresolution(ePane, evt.getX(), evt.getY(), resolution);
endMultiSelectIndex = getColumnOrRowByGridHeader(selectedCellPoint); endMultiSelectIndex = getColumnOrRowByGridHeader(selectedCellPoint);
resetGridSelectionByDrag(cs, ePane, startMultiSelectIndex, endMultiSelectIndex); resetGridSelectionByDrag(cs, ePane, startMultiSelectIndex, endMultiSelectIndex);
cs.setSelectedType(doChooseFrom()); cs.setSelectedType(doChooseFrom());
@ -421,7 +426,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
iterateScrollBar(ePane, evt, DRAG_ACTION); iterateScrollBar(ePane, evt, DRAG_ACTION);
DynamicUnitList sizeList = getSizeList(report); DynamicUnitList sizeList = getSizeList(report);
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution))); this.setToolTipText2(this.createToolTipString(sizeList.get(dragIndex).toPixD(resolution), sizeList.getRangeValue(0, dragIndex + 1).toPixD(resolution)));
} }
@ -472,7 +477,7 @@ public abstract class AbstractGridHeaderMouseHandler extends MouseInputAdapter {
double tmpSize1 = 0; double tmpSize1 = 0;
double tmpSize2; double tmpSize2;
double tmpIncreaseSize = 0; double tmpIncreaseSize = 0;
int resolution = ScreenResolution.getScreenResolution(); // int resolution = ScreenResolution.getScreenResolution();
for (int i = beginValue; i < endValue; i++) { for (int i = beginValue; i < endValue; i++) {
if (i == 0) { if (i == 0) {

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

@ -141,6 +141,10 @@ public class Grid extends BaseGridComponent {
this.resolution = resolution; this.resolution = resolution;
} }
public int getResolution() {
return this.resolution;
}
/** /**
* 应用界面设置 * 应用界面设置
* *

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

@ -10,6 +10,7 @@ import com.fr.base.ScreenResolution;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.GridUIProcessor; import com.fr.design.fun.GridUIProcessor;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JSliderPane;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
@ -22,11 +23,15 @@ import javax.swing.plaf.ComponentUI;
*/ */
public class GridColumn extends GridHeader<String> { public class GridColumn extends GridHeader<String> {
private int resolution = ScreenResolution.getScreenResolution(); public int resolution = ScreenResolution.getScreenResolution();
private GridColumnMouseHandler gridColumnMouseHandler;
@Override @Override
protected void initByConstructor() { protected void initByConstructor() {
GridColumnMouseHandler gridColumnMouseHandler = new GridColumnMouseHandler(this); resolution = ScreenResolution.getScreenResolution();
this.setResolution(resolution);
gridColumnMouseHandler = new GridColumnMouseHandler(this);
this.addMouseListener(gridColumnMouseHandler); this.addMouseListener(gridColumnMouseHandler);
this.addMouseMotionListener(gridColumnMouseHandler); this.addMouseMotionListener(gridColumnMouseHandler);
this.updateUI(); this.updateUI();
@ -39,6 +44,12 @@ public class GridColumn extends GridHeader<String> {
@Override @Override
public void updateUI() { public void updateUI() {
this.removeMouseListener(gridColumnMouseHandler);
this.removeMouseMotionListener(gridColumnMouseHandler);
gridColumnMouseHandler = new GridColumnMouseHandler(this);
this.addMouseListener(gridColumnMouseHandler);
this.addMouseMotionListener(gridColumnMouseHandler);
// gridColumnMouseHandler.setResolution(resolution);
this.setUI(new GridColumnUI(resolution)); this.setUI(new GridColumnUI(resolution));
} }
@ -46,6 +57,11 @@ public class GridColumn extends GridHeader<String> {
this.resolution = resolution; this.resolution = resolution;
} }
@Override
public int getResolution() {
return this.resolution;
}
/** /**
* Gets the preferred size. * Gets the preferred size.
*/ */

9
designer/src/com/fr/grid/GridColumnMouseHandler.java

@ -9,6 +9,7 @@ import java.awt.event.MouseEvent;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.base.ScreenResolution;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -22,8 +23,15 @@ import com.fr.stable.ColumnRow;
*/ */
public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler { public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler {
private int resolution;
public GridColumnMouseHandler(GridColumn gridColumn) { public GridColumnMouseHandler(GridColumn gridColumn) {
super(gridColumn); super(gridColumn);
this.resolution = gridColumn.resolution;
}
public void setResolution(int resolution){
this.resolution = resolution;
} }
@Override @Override
@ -86,7 +94,6 @@ public class GridColumnMouseHandler extends AbstractGridHeaderMouseHandler {
/** /**
* Checks whether is on zero separator line. * Checks whether is on zero separator line.
* *
* @param evtX event x
*/ */
@Override @Override
protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpWidth2, double tmpIncreaseWidth) { protected boolean isOnSeparatorLineIncludeZero(MouseEvent evt, double tmpWidth2, double tmpIncreaseWidth) {

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

@ -1,5 +1,7 @@
package com.fr.grid; package com.fr.grid;
import com.fr.base.ScreenResolution;
import java.awt.Color; import java.awt.Color;
@ -12,6 +14,8 @@ public abstract class GridHeader<T> extends BaseGridComponent {
private Color selectedForeground = Color.black; private Color selectedForeground = Color.black;
private Color selectedBackground = new Color(253, 216, 153); private Color selectedBackground = new Color(253, 216, 153);
protected int resolution;
public GridHeader() { public GridHeader() {
//清除所有的Key Action. //清除所有的Key Action.
this.getInputMap().clear(); this.getInputMap().clear();
@ -23,6 +27,14 @@ public abstract class GridHeader<T> extends BaseGridComponent {
initByConstructor(); initByConstructor();
} }
public void setResolution(int resolution){
this.resolution = resolution;
}
public int getResolution(){
return this.resolution;
}
protected abstract void initByConstructor(); protected abstract void initByConstructor();
protected abstract T getDisplay(int index) ; protected abstract T getDisplay(int index) ;

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

@ -23,10 +23,13 @@ public class GridRow extends GridHeader<Integer> {
private static final int MAX = 5; private static final int MAX = 5;
private int resolution = ScreenResolution.getScreenResolution(); private int resolution = ScreenResolution.getScreenResolution();
private GridRowMouseHandler gridRowMouseHandler;
@Override @Override
protected void initByConstructor() { protected void initByConstructor() {
GridRowMouseHandler gridRowMouseHandler = new GridRowMouseHandler(this); resolution = ScreenResolution.getScreenResolution();
this.setResolution(resolution);
gridRowMouseHandler = new GridRowMouseHandler(this);
this.addMouseListener(gridRowMouseHandler); this.addMouseListener(gridRowMouseHandler);
this.addMouseMotionListener(gridRowMouseHandler); this.addMouseMotionListener(gridRowMouseHandler);
this.updateUI(); this.updateUI();
@ -39,6 +42,11 @@ public class GridRow extends GridHeader<Integer> {
@Override @Override
public void updateUI() { public void updateUI() {
this.removeMouseListener(gridRowMouseHandler);
this.removeMouseMotionListener(gridRowMouseHandler);
gridRowMouseHandler = new GridRowMouseHandler(this);
this.addMouseListener(gridRowMouseHandler);
this.addMouseMotionListener(gridRowMouseHandler);
this.setUI(new GridRowUI(resolution)); this.setUI(new GridRowUI(resolution));
} }
@ -46,6 +54,10 @@ public class GridRow extends GridHeader<Integer> {
this.resolution = resolution; this.resolution = resolution;
} }
public int getResolution() {
return this.resolution;
}
/** /**
* Gets the preferred size. * Gets the preferred size.

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

@ -1,11 +1,15 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.islider.UISlider; import com.fr.design.gui.islider.UISlider;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -13,8 +17,6 @@ import javax.swing.*;
import javax.swing.border.MatteBorder; import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.basic.BasicSliderUI; import javax.swing.plaf.basic.BasicSliderUI;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
@ -29,6 +31,9 @@ public class JSliderPane extends JPanel {
private static final int SIX = 6; private static final int SIX = 6;
private static final int TEN = 10; private static final int TEN = 10;
private static final int ONEEIGHT = 18; private static final int ONEEIGHT = 18;
private static final int FONTSIZE = 14;
private static final int SPINNERWIDTH= 45;
private static final int SPINNERHEIGHT = 20;
private static final int TWOFIVE = 25; private static final int TWOFIVE = 25;
private static final int FOURTEN = 40; private static final int FOURTEN = 40;
private static final int HALFHUNDRED = 50; private static final int HALFHUNDRED = 50;
@ -37,11 +42,14 @@ public class JSliderPane extends JPanel {
private static final int THREEHUNDRED = 300; private static final int THREEHUNDRED = 300;
private static final int FOURHUNDRED = 400; private static final int FOURHUNDRED = 400;
private static final int DIALOGWIDTH = 150; private static final int DIALOGWIDTH = 150;
private static final int DIALOGHEIGHT = 200; private static final int DIALOGHEIGHT = 240;
private static final int SHOWVALBUTTONWIDTH = 70;
private static final int SHOWVALBUTTONHEIGHTH = 25;
public int showValue = 100; public int showValue = 100;
public double resolutionTimes = 1.0; public double resolutionTimes = 1.0;
private static JSliderPane THIS; private static JSliderPane THIS;
private UITextField showVal; private UITextField showVal;
private JSpinner showValSpinner;
private UISlider slider; private UISlider slider;
private int times; private int times;
private int sliderValue; private int sliderValue;
@ -59,6 +67,7 @@ public class JSliderPane extends JPanel {
private boolean isButtonOrIsTxt = true; private boolean isButtonOrIsTxt = true;
private PopupPane dialog; private PopupPane dialog;
private int upButtonX; private int upButtonX;
private JPanel dialogContentPanel;
public JSliderPane() { public JSliderPane() {
@ -67,11 +76,18 @@ public class JSliderPane extends JPanel {
slider.setUI(new JSliderPaneUI(slider)); slider.setUI(new JSliderPaneUI(slider));
slider.addChangeListener(listener); slider.addChangeListener(listener);
showVal = new UITextField(); showValSpinner = new UIBasicSpinner(new SpinnerNumberModel(HUNDRED, TEN, FOURHUNDRED, 1));
showVal.setText("100%"); showValSpinner.setEnabled(true);
showVal.setPreferredSize(new Dimension(FOURTEN,ONEEIGHT)); showValSpinner.addChangeListener(showValSpinnerChangeListener);
showVal.getDocument().addDocumentListener(showValDocumentListener); showValSpinner.setPreferredSize(new Dimension(SPINNERWIDTH, SPINNERHEIGHT));
//MoMeak:控制只能输入10-400,但是用起来感觉不舒服,先注释掉吧
// JSpinner.NumberEditor editor = new JSpinner.NumberEditor(showValSpinner, "0");
// showValSpinner.setEditor(editor);
// JFormattedTextField textField = ((JSpinner.NumberEditor) showValSpinner.getEditor()).getTextField();
// textField.setEditable(true);
// DefaultFormatterFactory factory = (DefaultFormatterFactory) textField .getFormatterFactory();
// NumberFormatter formatter = (NumberFormatter) factory.getDefaultFormatter();
// formatter.setAllowsInvalid(false);
downButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveDown.png")); 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")); upButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/data/source/moveUp.png"));
downButton.setActionCommand("less"); downButton.setActionCommand("less");
@ -79,25 +95,20 @@ public class JSliderPane extends JPanel {
downButton.addActionListener(buttonActionListener); downButton.addActionListener(buttonActionListener);
upButton.addActionListener(buttonActionListener); upButton.addActionListener(buttonActionListener);
JPanel panel = new JPanel(new FlowLayout(1,1,0)); showValButton = new UIButton(showValSpinner.getValue()+"%");
showValButton = new UIButton(showVal.getText());
showValButton.setBorderPainted(false); showValButton.setBorderPainted(false);
showValButton.setPreferredSize(new Dimension(HALFHUNDRED,TWOFIVE)); showValButton.setPreferredSize(new Dimension(SHOWVALBUTTONWIDTH,SHOWVALBUTTONHEIGHTH));
showValButton.addActionListener(showValButtonActionListener);
showValButton.addActionListener(new ActionListener() { initUIRadioButton();
@Override initPane();
public void actionPerformed(ActionEvent e) { JPanel panel = new JPanel(new FlowLayout(1,1,0));
popupDialog();
}
});
panel.add(downButton); panel.add(downButton);
panel.add(slider); panel.add(slider);
panel.add(upButton); panel.add(upButton);
panel.add(showValButton); panel.add(showValButton);
this.add(panel,BorderLayout.NORTH); this.add(panel,BorderLayout.NORTH);
this.setBounds(0,0,THREEHUNDRED,ONEEIGHT); this.setBounds(0,0,THREEHUNDRED,ONEEIGHT);
} }
public static final JSliderPane getInstance() { public static final JSliderPane getInstance() {
@ -116,6 +127,13 @@ public class JSliderPane extends JPanel {
twoFiveButton = new UIRadioButton("25%"); twoFiveButton = new UIRadioButton("25%");
selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton")); selfAdaptButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_selfAdaptButton"));
customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton")); customButton = new UIRadioButton(Inter.getLocText("FR-Designer_Scale_customButton"));
twoHundredButton.addItemListener(radioButtonItemListener);
oneHundredButton.addItemListener(radioButtonItemListener);
SevenFiveButton.addItemListener(radioButtonItemListener);
fiveTenButton.addItemListener(radioButtonItemListener);
twoFiveButton.addItemListener(radioButtonItemListener);
//TODO
// selfAdaptButton.addItemListener();
ButtonGroup bg=new ButtonGroup();// 初始化按钮组 ButtonGroup bg=new ButtonGroup();// 初始化按钮组
bg.add(twoHundredButton);// 加入按钮组 bg.add(twoHundredButton);// 加入按钮组
@ -125,8 +143,53 @@ public class JSliderPane extends JPanel {
bg.add(twoFiveButton); bg.add(twoFiveButton);
bg.add(selfAdaptButton); bg.add(selfAdaptButton);
bg.add(customButton); bg.add(customButton);
customButton.setSelected(true);
}
private void initPane(){
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = { p, f };
double[] rowSize = { p,p,p,p,p,p,p};
Component[][] components = new Component[][]{
new Component[]{twoHundredButton,null},
new Component[]{oneHundredButton,null},
new Component[]{SevenFiveButton,null},
new Component[]{fiveTenButton,null},
new Component[]{twoFiveButton,null},
new Component[]{selfAdaptButton,null},
new Component[]{customButton,createSpinnerPanel()}
};
dialogContentPanel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize);
}
private JPanel createSpinnerPanel(){
JPanel spinnerPanel = new JPanel(new FlowLayout());
spinnerPanel.add(showValSpinner);
UILabel percent = new UILabel("%");
percent.setFont(new Font("Dialog", Font.PLAIN, FONTSIZE));
spinnerPanel.add(percent);
return spinnerPanel;
} }
ActionListener showValButtonActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
popupDialog();
}
};
ChangeListener showValSpinnerChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int val = (int) ((UIBasicSpinner)e.getSource()).getValue();
isButtonOrIsTxt = true;
resolutionTimes = divide(showValue,100,2);
refreshSlider(val);
refreshBottun(val);
}
};
//定义一个监听器,用于监听所有滑动条 //定义一个监听器,用于监听所有滑动条
ChangeListener listener = new ChangeListener() ChangeListener listener = new ChangeListener()
@ -134,13 +197,13 @@ public class JSliderPane extends JPanel {
public void stateChanged( ChangeEvent event) { public void stateChanged( ChangeEvent event) {
//取出滑动条的值,并在文本中显示出来 //取出滑动条的值,并在文本中显示出来
if (!isButtonOrIsTxt){ if (!isButtonOrIsTxt){
JSlider source = (JSlider) event.getSource(); customButton.setSelected(true);
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
sliderValue = slider.getValue(); sliderValue = slider.getValue();
getTimes(sliderValue); getTimes(sliderValue);
showValue = times; showValue = times;
showVal.setText(times + "%"); showValSpinner.setValue(times);
} }
}); });
}else { }else {
@ -149,28 +212,18 @@ public class JSliderPane extends JPanel {
} }
}; };
DocumentListener showValDocumentListener = new DocumentListener() { ItemListener radioButtonItemListener = new ItemListener() {
@Override @Override
public void insertUpdate(DocumentEvent e) { public void itemStateChanged(ItemEvent e) {
isButtonOrIsTxt = true; JRadioButton temp=(JRadioButton)e.getSource();
resolutionTimes = divide(showValue,100,2); if(temp.isSelected()){
refreshSlider(); showValSpinner.setValue(Integer.valueOf(temp.getText().substring(0, temp.getText().indexOf("%"))));
refreshBottun(); }
}
@Override
public void removeUpdate(DocumentEvent e) {
// refreshSlider();
}
@Override
public void changedUpdate(DocumentEvent e) {
// refreshSlider();
} }
}; };
private void refreshSlider(){ private void refreshSlider(int val){
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); showValue = val;
if (showValue >HUNDRED){ if (showValue >HUNDRED){
slider.setValue((int)(showValue+TWOHUNDRED)/SIX); slider.setValue((int)(showValue+TWOHUNDRED)/SIX);
}else if (showValue <HUNDRED){ }else if (showValue <HUNDRED){
@ -181,8 +234,8 @@ public class JSliderPane extends JPanel {
} }
private void refreshBottun(){ private void refreshBottun(int val){
showValButton.setText(showVal.getText()); showValButton.setText(val+"%");
} }
public double getResolutionTimes(){ public double getResolutionTimes(){
@ -202,29 +255,30 @@ public class JSliderPane extends JPanel {
ActionListener buttonActionListener = new ActionListener() { ActionListener buttonActionListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
showValue = Integer.parseInt(showVal.getText().substring(0, showVal.getText().indexOf("%"))); showValue = (int) showValSpinner.getValue();
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
if(e.getActionCommand().equals("less")){ if(e.getActionCommand().equals("less")){
int newDownVal = showValue - TEN; int newDownVal = showValue - TEN;
if (newDownVal >= TEN ){ if (newDownVal >= TEN ){
showValue = newDownVal; showValue = newDownVal;
showVal.setText(newDownVal + "%"); showValSpinner.setValue(newDownVal);
}else { }else {
showValue = newDownVal; showValue = newDownVal;
showVal.setText(TEN + "%"); showValSpinner.setValue(TEN);
} }
} }
if(e.getActionCommand().equals("more")){ if(e.getActionCommand().equals("more")){
int newUpVal = showValue + TEN; int newUpVal = showValue + TEN;
if (newUpVal <= FOURHUNDRED ){ if (newUpVal <= FOURHUNDRED ){
showValue = newUpVal; showValue = newUpVal;
showVal.setText(newUpVal + "%"); showValSpinner.setValue(newUpVal);
}else { }else {
showValue = newUpVal; showValue = newUpVal;
showVal.setText(FOURHUNDRED + "%"); showValSpinner.setValue(FOURHUNDRED);
} }
} }
isButtonOrIsTxt = true; isButtonOrIsTxt = true;
customButton.setSelected(true);
} }
}; };
@ -241,38 +295,42 @@ public class JSliderPane extends JPanel {
} }
public UITextField getShowVal(){ public JSpinner getShowVal(){
return this.showVal; return this.showValSpinner;
}
public UIRadioButton getSelfAdaptButton(){
return this.selfAdaptButton;
} }
private void popupDialog(){ private void popupDialog(){
Point btnCoords = upButton.getLocationOnScreen(); Point btnCoords = upButton.getLocationOnScreen();
if (dialog == null){ if (dialog == null){
dialog = new PopupPane(upButton,showVal); dialog = new PopupPane(upButton,dialogContentPanel);
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() + SHOWVALBUTTONWIDTH , -DIALOGHEIGHT);
} }
}else { }else {
if (upButtonX == 0) { if (upButtonX == 0) {
upButtonX = btnCoords.x; upButtonX = btnCoords.x;
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT);
} else { } else {
GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +HALFHUNDRED, -DIALOGHEIGHT); GUICoreUtils.showPopupMenu(dialog, upButton, - DIALOGWIDTH + upButton.getWidth() +SHOWVALBUTTONWIDTH, -DIALOGHEIGHT);
} }
} }
} }
public static void main(String[] args) public static void main(String[] args)
{ {
JFrame jf = new JFrame("test"); // JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel)jf.getContentPane(); // JPanel content = (JPanel)jf.getContentPane();
content.setLayout(new BorderLayout()); // content.setLayout(new BorderLayout());
content.add(JSliderPane.getInstance(),BorderLayout.CENTER); // content.add(JSliderPane.getInstance(),BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf); // GUICoreUtils.centerWindow(jf);
jf.setSize(400, 80); // jf.setSize(400, 80);
jf.setVisible(true); // jf.setVisible(true);
} }
} }
@ -345,66 +403,25 @@ class JSliderPaneUI extends BasicSliderUI {
} }
} }
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 { class PopupPane extends JPopupMenu {
private JComponent contentPane; private JComponent contentPane;
private static final int UPLABELHEIGHT = 25; private static final int UPLABELHEIGHT = 25;
private static final int HALFHUNDRED = 50; private static final int HALFHUNDRED = 50;
private static final int DIALOGWIDTH = 150; private static final int DIALOGWIDTH = 150;
private static final int DIALOGHEIGHT = 200; private static final int DIALOGHEIGHT = 240;
private static final int UPLABELWIDTH = 300; private static final int UPLABELWIDTH = 300;
private JComponent centerPane; private JComponent centerPane;
private UILabel upLabel; private UILabel upLabel;
PopupPane(UIButton b,UITextField j) { PopupPane(UIButton b,JPanel dialogContentPanel) {
contentPane = new JPanel(new BorderLayout()); contentPane = new JPanel(new BorderLayout());
centerPane = new JPanel(new BorderLayout()); centerPane = new JPanel(new BorderLayout());
upLabel = new UILabel(Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce")); upLabel = new UILabel(" " + Inter.getLocText("FR-Designer_Scale_EnlargeOrReduce"));
upLabel.setOpaque(true); upLabel.setOpaque(true);
upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT)); upLabel.setPreferredSize(new Dimension(UPLABELWIDTH,UPLABELHEIGHT));
upLabel.setBackground(Color.LIGHT_GRAY); upLabel.setBackground(Color.LIGHT_GRAY);
upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray)); upLabel.setBorder(new MatteBorder(0,0,1,0,Color.gray));
centerPane.add(j,BorderLayout.NORTH); centerPane.add(dialogContentPanel,BorderLayout.NORTH);
contentPane.add(upLabel,BorderLayout.NORTH); contentPane.add(upLabel,BorderLayout.NORTH);
contentPane.add(centerPane,BorderLayout.CENTER); contentPane.add(centerPane,BorderLayout.CENTER);
// contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray)); // contentPane.setBorder(new MatteBorder(1,1,1,1,Color.darkGray));

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

@ -217,6 +217,8 @@ public abstract class JTemplate<T extends IOFile, U extends BaseUndoState<?>> ex
public abstract int getScale(); public abstract int getScale();
public abstract int selfAdaptUpdate();
protected abstract DesignModelAdapter<T, ?> createDesignModel(); protected abstract DesignModelAdapter<T, ?> createDesignModel();
/** /**

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

@ -31,6 +31,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.UINumberSlidePane; import com.fr.design.gui.frpane.UINumberSlidePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.gui.itextfield.UINumberField; import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
@ -153,11 +154,13 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private void initTransparent() { private void initTransparent() {
initCalculateSize(); initCalculateSize();
slidePane.getShowVal().getDocument().addDocumentListener(new DocumentListener() { slidePane.getShowVal().addChangeListener(showValSpinnerChangeListener);
@Override }
public void insertUpdate(DocumentEvent e) {
// slidePane.getShowVal().getDocument() ChangeListener showValSpinnerChangeListener = new ChangeListener() {
double value = Integer.parseInt(slidePane.getShowVal().getText().substring(0, slidePane.getShowVal().getText().indexOf("%"))); @Override
public void stateChanged(ChangeEvent e) {
double value = (int) ((UIBasicSpinner)e.getSource()).getValue();
value = value>SHOWVALMAX ? SHOWVALMAX : value; value = value>SHOWVALMAX ? SHOWVALMAX : value;
value = value<SHOWVALMIN ? SHOWVALMIN : value; value = value<SHOWVALMIN ? SHOWVALMIN : value;
reCalculateRoot(value, true); reCalculateRoot(value, true);
@ -165,27 +168,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
if(form != null){ if(form != null){
form.fireTargetModified(); 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();
// }
// }
// });
}
/** /**
* 返回当前的屏幕分辨率对应的百分比值 * 返回当前的屏幕分辨率对应的百分比值

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

@ -254,6 +254,11 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return 0; return 0;
} }
@Override
public int selfAdaptUpdate() {
return 0;
}
/** /**
* 创建权限细粒度编辑面板 * 创建权限细粒度编辑面板
* *

Loading…
Cancel
Save