|
|
|
@ -2,14 +2,16 @@ package com.fr.design.mainframe;
|
|
|
|
|
|
|
|
|
|
import com.fr.base.ScreenResolution; |
|
|
|
|
import com.fr.common.inputevent.InputEventBaseOnOS; |
|
|
|
|
import com.fr.design.designer.beans.events.DesignerEditListener; |
|
|
|
|
import com.fr.design.ExtraDesignClassManager; |
|
|
|
|
import com.fr.design.designer.beans.events.DesignerEvent; |
|
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
|
import com.fr.design.designer.creator.XLayoutContainer; |
|
|
|
|
import com.fr.design.designer.creator.XWBorderLayout; |
|
|
|
|
import com.fr.design.designer.creator.XWFitLayout; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
|
import com.fr.design.fun.FormAdaptiveConfigUIProcessor; |
|
|
|
|
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.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
@ -26,10 +28,8 @@ import com.fr.general.FRScreen;
|
|
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.AbstractAction; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.KeyStroke; |
|
|
|
|
import javax.swing.border.LineBorder; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
@ -46,17 +46,13 @@ import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.awt.event.FocusAdapter; |
|
|
|
|
import java.awt.event.FocusEvent; |
|
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
|
import java.awt.event.MouseWheelEvent; |
|
|
|
|
import java.awt.event.MouseWheelListener; |
|
|
|
|
|
|
|
|
|
import static com.fr.design.gui.syntax.ui.rtextarea.RTADefaultInputMap.DEFAULT_MODIFIER; |
|
|
|
|
|
|
|
|
|
public class FormArea extends JComponent implements ScrollRulerComponent { |
|
|
|
|
private static final double SLIDER_FLOAT = 400.0; |
|
|
|
|
private static final double SLIDER_MIN = 10.0; |
|
|
|
|
private static final String SCALE_PLUS_COMMAND = "scale_plus"; |
|
|
|
|
private static final String SCALE_MINUS_COMMAND = "scale_minus"; |
|
|
|
|
public static final double DEFAULT_SLIDER = 100.0; |
|
|
|
|
private static final int ROTATIONS = 50; |
|
|
|
|
private static final int SHOWVALMAX = 400; |
|
|
|
@ -76,6 +72,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
private UINumberField heightPane; |
|
|
|
|
private JFormSliderPane slidePane; |
|
|
|
|
private boolean isValid = true; |
|
|
|
|
// 初始时滑块值为100,托动后的值设为START_VALUE;
|
|
|
|
|
private double START_VALUE = DEFAULT_SLIDER; |
|
|
|
|
private int resolution = ScreenResolution.getScreenResolution(); |
|
|
|
|
private double screenValue; |
|
|
|
|
|
|
|
|
@ -114,33 +112,16 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
addFormRuler(); |
|
|
|
|
} |
|
|
|
|
this.setFocusTraversalKeysEnabled(false); |
|
|
|
|
this.addMouseWheelListener(showValSpinnerMouseWheelListener); |
|
|
|
|
registerShortCutKey(); |
|
|
|
|
this.designer.addDesignerEditListener(designerEditListener); |
|
|
|
|
this.designer.addMouseWheelListener(showValSpinnerMouseWheelListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 注册缩放快捷键 |
|
|
|
|
* mac: command + 和 command - |
|
|
|
|
* windows: ctr + 和 ctr - |
|
|
|
|
*/ |
|
|
|
|
private void registerShortCutKey() { |
|
|
|
|
this.registerKeyboardAction(new AbstractAction() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
int old_resolution = slidePane.getShowValue(); |
|
|
|
|
slidePane.setShowValue(old_resolution + SHOWVALMIN); |
|
|
|
|
private boolean openSliderZoom(){ |
|
|
|
|
FormAdaptiveConfigUIProcessor adaptiveConfigUI = ExtraDesignClassManager.getInstance().getSingle(FormAdaptiveConfigUIProcessor.MARK_STRING); |
|
|
|
|
if (adaptiveConfigUI != null) { |
|
|
|
|
return adaptiveConfigUI.openFormSliderZoom(); |
|
|
|
|
} |
|
|
|
|
}, SCALE_PLUS_COMMAND, KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, DEFAULT_MODIFIER), WHEN_IN_FOCUSED_WINDOW); |
|
|
|
|
this.registerKeyboardAction(new AbstractAction() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
int old_resolution = slidePane.getShowValue(); |
|
|
|
|
slidePane.setShowValue(old_resolution - SHOWVALMIN); |
|
|
|
|
} |
|
|
|
|
}, SCALE_MINUS_COMMAND, KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, DEFAULT_MODIFIER), WHEN_IN_FOCUSED_WINDOW); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void onMobileAttrModified() { |
|
|
|
|
FormMobileAttr formMobileAttr = designer.getTarget().getFormMobileAttr(); |
|
|
|
|
if (formMobileAttr.isMobileOnly()) { |
|
|
|
@ -157,14 +138,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
public void mouseWheelMoved(MouseWheelEvent e) { |
|
|
|
|
if (InputEventBaseOnOS.isControlDown(e)) { |
|
|
|
|
int dir = e.getWheelRotation(); |
|
|
|
|
int old_resolution = slidePane.getShowValue(); |
|
|
|
|
slidePane.setShowValue(old_resolution - (dir * SHOWVALMIN)); |
|
|
|
|
int old_resolution = (int) slidePane.getShowVal().getValue(); |
|
|
|
|
slidePane.getShowVal().setValue(old_resolution - (dir * SHOWVALMIN)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 增加表单的页面大小控制界面,包括手动修改和滑块拖动 |
|
|
|
|
*/ |
|
|
|
@ -172,34 +151,35 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
double f = TableLayout.FILL; |
|
|
|
|
double p = TableLayout.PREFERRED; |
|
|
|
|
double[] rowSize = {f}; |
|
|
|
|
double[] columnSize = {p, f, p, p, p, p, p, f, p}; |
|
|
|
|
double[] columnSize = {p, f, p, p, p, p, p, p}; |
|
|
|
|
UILabel tipsPane = new UILabel("form"); |
|
|
|
|
tipsPane.setPreferredSize(new Dimension(265, 0)); |
|
|
|
|
tipsPane.setPreferredSize(new Dimension(200, 0)); |
|
|
|
|
widthPane = new UINumberField(); |
|
|
|
|
widthPane.setPreferredSize(new Dimension(60, 0)); |
|
|
|
|
heightPane = new UINumberField(); |
|
|
|
|
heightPane.setPreferredSize(new Dimension(60, 0)); |
|
|
|
|
|
|
|
|
|
slidePane = JFormSliderPane.getInstance(); |
|
|
|
|
slidePane.setPreferredSize(new Dimension(326, 20)); |
|
|
|
|
slidePane.setPreferredSize(new Dimension(375, 20)); |
|
|
|
|
|
|
|
|
|
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane( |
|
|
|
|
new JComponent[][]{{tipsPane, new UILabel(), widthPane, |
|
|
|
|
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), |
|
|
|
|
new UILabel("x"), heightPane, |
|
|
|
|
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Indent_Pixel")), |
|
|
|
|
new UILabel(), |
|
|
|
|
slidePane}}, rowSize, columnSize, RESIZE_PANE_GAP); |
|
|
|
|
this.add(FormRulerLayout.BOTTOM, resizePane); |
|
|
|
|
setWidgetsConfig(); |
|
|
|
|
boolean needOpenSliderZoom = openSliderZoom(); |
|
|
|
|
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
|
|
|
|
|
slidePane.setEnabled(true); |
|
|
|
|
slidePane.setVisible(true); |
|
|
|
|
slidePane.setEnabled(needOpenSliderZoom); |
|
|
|
|
slidePane.setVisible(needOpenSliderZoom); |
|
|
|
|
if (needOpenSliderZoom) { |
|
|
|
|
initTransparent(); |
|
|
|
|
} |
|
|
|
|
initCalculateSize(); |
|
|
|
|
slidePane.addValueChangeListener(showValSpinnerChangeListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setWidgetsConfig() { |
|
|
|
|
widthPane.setHorizontalAlignment(widthPane.CENTER); |
|
|
|
|
heightPane.setHorizontalAlignment(heightPane.CENTER); |
|
|
|
@ -212,14 +192,21 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
addHeightPaneListener(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void initTransparent() { |
|
|
|
|
initCalculateSize(); |
|
|
|
|
slidePane.getShowVal().addChangeListener(showValSpinnerChangeListener); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ChangeListener showValSpinnerChangeListener = new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
double value = slidePane.getShowValue(); |
|
|
|
|
double value = (int) ((UIBasicSpinner) e.getSource()).getValue(); |
|
|
|
|
value = value > SHOWVALMAX ? SHOWVALMAX : value; |
|
|
|
|
value = value < SHOWVALMIN ? SHOWVALMIN : value; |
|
|
|
|
scale((int) value); |
|
|
|
|
JForm jf = (JForm) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); |
|
|
|
|
jf.getFormDesign().setResolution((int) value); |
|
|
|
|
jf.getFormDesign().getArea().resolution = (int) value; |
|
|
|
|
reCalculateRoot(value, true); |
|
|
|
|
JTemplate form = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); |
|
|
|
|
if (form != null) { |
|
|
|
|
form.fireTargetModified(); |
|
|
|
@ -227,13 +214,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
private void scale(int value){ |
|
|
|
|
this.designer.setScale(value / DEFAULT_SLIDER); |
|
|
|
|
FormArea.this.validate(); |
|
|
|
|
this.designer.repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 返回当前的屏幕分辨率对应的百分比值 |
|
|
|
|
* |
|
|
|
@ -258,6 +238,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
this.screenValue = FRScreen.getDesignScreenByDimension(scrnsize).getValue(); |
|
|
|
|
XLayoutContainer root = FormArea.this.designer.getRootComponent(); |
|
|
|
|
// 7.1.1不放缩放滑块,但表单大小仍按屏幕分辨率调整
|
|
|
|
|
// slidePane.populateBean(screenValue);
|
|
|
|
|
if (root.acceptType(XWFitLayout.class)) { |
|
|
|
|
XWFitLayout layout = (XWFitLayout) root; |
|
|
|
|
if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { |
|
|
|
@ -265,7 +246,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
} else { |
|
|
|
|
// 组件间隔啊
|
|
|
|
|
// REPORT-2585 原有的逻辑导致嵌套的tab中的间隔加不上去,会在后续拖动的过程中出问题
|
|
|
|
|
reCalculateDefaultRoot(); |
|
|
|
|
reCalculateDefaultRoot(screenValue, true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
LayoutUtils.layoutContainer(root); |
|
|
|
@ -385,14 +366,16 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
* 修改大小后,再根据屏幕分辨率调整下 |
|
|
|
|
*/ |
|
|
|
|
private void doReCalculateRoot(int width, int height, XWFitLayout layout) { |
|
|
|
|
// double value = slidePane.updateBean();
|
|
|
|
|
//重置滑块的值为默认值100
|
|
|
|
|
START_VALUE = DEFAULT_SLIDER; |
|
|
|
|
if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { |
|
|
|
|
layout.getParent().setSize(width, height + designer.getParaHeight()); |
|
|
|
|
FormArea.this.validate(); |
|
|
|
|
} else { |
|
|
|
|
layout.setBackupGap(screenValue / DEFAULT_SLIDER); |
|
|
|
|
reCalculateRoot(screenValue, false); |
|
|
|
|
} |
|
|
|
|
reCalculateRoot(slidePane.getShowValue(), true); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -402,69 +385,72 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
* @param value |
|
|
|
|
*/ |
|
|
|
|
private void reCalculateRoot(double value, boolean needCalculateParaHeight) { |
|
|
|
|
double percent = (value - DEFAULT_SLIDER) / DEFAULT_SLIDER; |
|
|
|
|
double scale = value / DEFAULT_SLIDER; |
|
|
|
|
if ( AssistUtils.equals(value, START_VALUE) ) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
double percent = (value - START_VALUE) / START_VALUE; |
|
|
|
|
XLayoutContainer root = FormArea.this.designer.getRootComponent(); |
|
|
|
|
if (root.acceptType(XWFitLayout.class)) { |
|
|
|
|
XWFitLayout layout = (XWFitLayout) root; |
|
|
|
|
layout.setContainerPercent(scale); |
|
|
|
|
layout.adjustCompSize(percent); |
|
|
|
|
layout.setContainerPercent(value / DEFAULT_SLIDER); |
|
|
|
|
traverAndAdjust(layout, percent); |
|
|
|
|
layout.adjustCreatorsWhileSlide(percent); |
|
|
|
|
|
|
|
|
|
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
|
|
|
|
|
|
|
|
|
|
Dimension d = new Dimension(layout.getWidth(), layout.getHeight()); |
|
|
|
|
XWBorderLayout parent = (XWBorderLayout) layout.getParent(); |
|
|
|
|
traverAndAdjust(parent, percent); |
|
|
|
|
// 自适应布局的父层是border
|
|
|
|
|
if (parent != null) { |
|
|
|
|
parent.setScale(scale); |
|
|
|
|
int paraHeight = parent.toData().getNorthSize(); |
|
|
|
|
XLayoutContainer paraComponent = designer.getParaComponent(); |
|
|
|
|
if (needCalculateParaHeight && paraComponent != null) { |
|
|
|
|
paraComponent.setScale(scale); |
|
|
|
|
this.designer.setParaHeight(paraHeight); |
|
|
|
|
paraComponent.setPreferredSize(new Dimension(d.width, this.designer.getParaHeight())); |
|
|
|
|
paraComponent.adjustCompSize( percent); |
|
|
|
|
if (layout.getParent() != null) { |
|
|
|
|
int paraHeight = designer.getParaHeight(); |
|
|
|
|
if (needCalculateParaHeight && paraHeight > 0) { |
|
|
|
|
designer.setParaHeight(paraHeight); |
|
|
|
|
XWBorderLayout parent = (XWBorderLayout) layout.getParent(); |
|
|
|
|
parent.toData().setNorthSize(paraHeight); |
|
|
|
|
parent.removeAll(); |
|
|
|
|
parent.add(paraComponent, WBorderLayout.NORTH); |
|
|
|
|
parent.add(root, WBorderLayout.CENTER); |
|
|
|
|
root.setBounds(0, this.designer.getParaHeight(), d.width, d.height); |
|
|
|
|
parent.add(designer.getParaComponent(), WBorderLayout.NORTH); |
|
|
|
|
parent.add(designer.getRootComponent(), WBorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
parent.setSize(d.width, d.height + this.designer.getParaHeight()); |
|
|
|
|
|
|
|
|
|
layout.getParent().setSize(d.width, d.height + paraHeight); |
|
|
|
|
// 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea
|
|
|
|
|
FormArea.this.validate(); |
|
|
|
|
LayoutUtils.layoutRootContainer(designer.getRootComponent()); |
|
|
|
|
} |
|
|
|
|
START_VALUE = value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 按照界面大小的百分比值调整root大小 |
|
|
|
|
* |
|
|
|
|
* @param needCalculateParaHeight 是否需要调整参数界面高度 |
|
|
|
|
* @param value |
|
|
|
|
*/ |
|
|
|
|
private void reCalculateDefaultRoot() { |
|
|
|
|
Dimension dim = calDesignAreaSize(); |
|
|
|
|
private void reCalculateDefaultRoot(double value, boolean needCalculateParaHeight) { |
|
|
|
|
XLayoutContainer root = FormArea.this.designer.getRootComponent(); |
|
|
|
|
if (root.acceptType(XWFitLayout.class)) { |
|
|
|
|
XWFitLayout layout = (XWFitLayout) root; |
|
|
|
|
Dimension dimension = layout.getSize(); |
|
|
|
|
// double widthScale = dim.width / (double) dimension.width;
|
|
|
|
|
// double heightScale = dim.height / (double) dimension.height;
|
|
|
|
|
// final double scaleValue = Math.min(widthScale, heightScale);
|
|
|
|
|
int value = 100; |
|
|
|
|
slidePane.setShowValue(value); |
|
|
|
|
if (value == 100) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
scale(value); |
|
|
|
|
layout.setContainerPercent(1.0); |
|
|
|
|
traverAndAdjust(layout, 0.0); |
|
|
|
|
layout.adjustCreatorsWhileSlide(0.0); |
|
|
|
|
|
|
|
|
|
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
|
|
|
|
|
|
|
|
|
|
Dimension d = new Dimension(layout.getWidth(), layout.getHeight()); |
|
|
|
|
// 自适应布局的父层是border
|
|
|
|
|
if (layout.getParent() != null) { |
|
|
|
|
int paraHeight = designer.getParaHeight(); |
|
|
|
|
if (needCalculateParaHeight && paraHeight > 0) { |
|
|
|
|
designer.setParaHeight(paraHeight); |
|
|
|
|
XWBorderLayout parent = (XWBorderLayout) layout.getParent(); |
|
|
|
|
parent.toData().setNorthSize(paraHeight); |
|
|
|
|
parent.removeAll(); |
|
|
|
|
parent.add(designer.getParaComponent(), WBorderLayout.NORTH); |
|
|
|
|
parent.add(designer.getRootComponent(), WBorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
layout.getParent().setSize(d.width, d.height + paraHeight); |
|
|
|
|
// 调整自适应布局大小后,同步调整参数界面和border大小,此时刷新下formArea
|
|
|
|
|
FormArea.this.validate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Dimension calDesignAreaSize() { |
|
|
|
|
Dimension cardSize = DesignerContext.getDesignerFrame().getCenterTemplateCardPane().getSize(); |
|
|
|
|
if (cardSize.width == 0 || cardSize.height == 0) { |
|
|
|
|
return new Dimension(960, 540); |
|
|
|
|
} |
|
|
|
|
return new Dimension(cardSize.width, cardSize.height - verScrollBar.getPreferredSize().height - 20); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//循环遍历布局,按百分比调整子组件大小
|
|
|
|
@ -473,7 +459,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
Object object = creator.getComponent(i); |
|
|
|
|
if (object instanceof XCreator) { |
|
|
|
|
XCreator temp = (XCreator) object; |
|
|
|
|
temp.setScale(1 + percent); |
|
|
|
|
temp.adjustCompSize(percent); |
|
|
|
|
traverAndAdjust(temp, percent); |
|
|
|
|
} |
|
|
|
@ -495,17 +480,17 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
* 鼠标滚轮事件 |
|
|
|
|
* 由于表单设计界面要求: 容器大小大于界面时,滚动条才可以拖动,所以不支持滚动无限往下滚 |
|
|
|
|
*/ |
|
|
|
|
// @Override
|
|
|
|
|
// protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) {
|
|
|
|
|
// int id = evt.getID();
|
|
|
|
|
// switch (id) {
|
|
|
|
|
// case MouseEvent.MOUSE_WHEEL: {
|
|
|
|
|
// onMouseWheelScroll(evt);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// default:
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
@Override |
|
|
|
|
protected void processMouseWheelEvent(java.awt.event.MouseWheelEvent evt) { |
|
|
|
|
int id = evt.getID(); |
|
|
|
|
switch (id) { |
|
|
|
|
case MouseEvent.MOUSE_WHEEL: { |
|
|
|
|
onMouseWheelScroll(evt); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
default: |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onMouseWheelScroll(MouseWheelEvent evt) { |
|
|
|
|
int value = this.verScrollBar.getValue() + evt.getWheelRotation() * ROTATIONS; |
|
|
|
@ -570,9 +555,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
layout(); |
|
|
|
|
if (isValid) { |
|
|
|
|
XLayoutContainer root = designer.getRootComponent(); |
|
|
|
|
setScrollBarProperties((int) (root.getWidth()*designer.getScale() - designer.getWidth()), horScrollBar, horizontalValue); |
|
|
|
|
setScrollBarProperties(root.getWidth() - designer.getWidth(), horScrollBar, horizontalValue); |
|
|
|
|
//计算滚动条值的时候应该算上参数面板的高度
|
|
|
|
|
setScrollBarProperties((int) (designer.getParaHeight() + root.getHeight()*designer.getScale() - designer.getHeight()), verScrollBar, verticalValue); |
|
|
|
|
setScrollBarProperties(designer.getParaHeight() + root.getHeight() - designer.getHeight(), verScrollBar, verticalValue); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -738,7 +723,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
* @return 百分比值 |
|
|
|
|
*/ |
|
|
|
|
public double getSlideValue() { |
|
|
|
|
return slidePane.getShowValue(); |
|
|
|
|
// return slidePane.updateBean();
|
|
|
|
|
//7.1.1不加缩放滑块
|
|
|
|
|
return this.screenValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -776,21 +763,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
layout.moveContainerMargin(); |
|
|
|
|
layout.addCompInterval(layout.getAcualInterval()); |
|
|
|
|
} else if (designer.getRootComponent().acceptType(XWFitLayout.class)) { |
|
|
|
|
// reCalculateRoot(slide, true);
|
|
|
|
|
START_VALUE = DEFAULT_SLIDER; |
|
|
|
|
reCalculateRoot(slide, true); |
|
|
|
|
// slidePane.populateBean(slide);
|
|
|
|
|
} |
|
|
|
|
this.slidePane.setShowValue((int) slide); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private DesignerEditListener designerEditListener = new DesignerEditListener() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void fireCreatorModified(DesignerEvent evt) { |
|
|
|
|
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED) { |
|
|
|
|
// FormArea.this.reCalculateRoot(slidePane.getShowValue(), true);
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 计算滚动条的值和max |
|
|
|
|
* |
|
|
|
@ -861,11 +839,8 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
|
|
|
|
|
int maxWidth = right - vbarPreferredSize.width; |
|
|
|
|
DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH; |
|
|
|
|
DESIGNERHEIGHT = DESIGNERHEIGHT > maxHeight ? maxHeight : DESIGNERHEIGHT; |
|
|
|
|
DESIGNERWIDTH = maxWidth; |
|
|
|
|
DESIGNERHEIGHT = maxHeight; |
|
|
|
|
int designerLeft = left + (verScrollBar.getX() - DESIGNERWIDTH) / 2; |
|
|
|
|
int designerTop = top + (horScrollBar.getY() - DESIGNERHEIGHT) / 2; |
|
|
|
|
rec = new Rectangle(designerLeft, designerTop, DESIGNERWIDTH, DESIGNERHEIGHT); |
|
|
|
|
rec = new Rectangle(designerLeft, TOPGAP, DESIGNERWIDTH, DESIGNERHEIGHT); |
|
|
|
|
} |
|
|
|
|
// designer是整个表单设计界面中的面板部分,目前只放自适应布局和参数界面。
|
|
|
|
|
designer.setBounds(rec); |
|
|
|
|