Browse Source

Merge pull request #1324 in BA/design from ~PLOUGH/design:release/9.0 to release/9.0

* commit '8a9a1d7e7316f2987c0bbcc31e7e973b5e793202':
  REPORT-4883 代码规范
  REPORT-4883 模板参数控件问题=>添加参数,再撤销时,刷新右上角的面板
  REPORT-4883 模板参数控件问题=>删除参数面板内的控件后,选中参数面板
  REPORT-4883 模板参数控件问题=>选中参数面板内部组件时,可继续添加参数
  REPORT-4883 模板参数控件问题
  REPORT-4983 切换tab再切回,添加参数面板消失
master
superman 7 years ago
parent
commit
a731639cf3
  1. 25
      designer/src/com/fr/design/parameter/ParameterDefinitePane.java
  2. 3
      designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java
  3. 157
      designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java
  4. 40
      designer_form/src/com/fr/design/form/parameter/FormParaDesigner.java
  5. 17
      designer_form/src/com/fr/design/mainframe/FormDesigner.java
  6. 17
      designer_form/src/com/fr/design/mainframe/JForm.java
  7. 16
      designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java
  8. 16
      designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

25
designer/src/com/fr/design/parameter/ParameterDefinitePane.java

@ -75,12 +75,23 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
this.setBorder(null);
this.setLayout(FRGUIPaneFactory.createBorderLayout());
setComponentBg(this);
// formParaDesignEditor = new FormParaDesigner(new FormParameterUI());
paraDesignEditor = DesignModuleFactory.getFormParaDesigner();
if (paraDesignEditor == null) {
return;
}
paraDesignEditor.initWidgetToolbarPane();
this.add(paraDesignEditor.createWrapper(), BorderLayout.CENTER);
setButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/parametersetting.png"));
setButton.set4ToolbarButton();
isshowWindowItem = new JCheckBoxMenuItem(Inter.getLocText("ParameterD-Show_Parameter_Window"));
isdelayItem = new JCheckBoxMenuItem(Inter.getLocText("ParameterD-Delay_Playing"));
initListeners();
}
private void initListeners() {
((TargetComponent) paraDesignEditor).addTargetModifiedListener(new TargetModifiedListener() {
@Override
public void targetModified(TargetModifiedEvent e) {
@ -93,7 +104,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
paraDesignEditor.addListener(this);
propertyChangeListener = new PropertyChangeAdapter() {
@Override
public void propertyChange() {
if (isEditing) {
@ -102,12 +112,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
}
}
};
this.add(paraDesignEditor.createWrapper(), BorderLayout.CENTER);
// WidgetToolBarPane.getRecentSearchManger(formParaDesignEditor);
setButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/parametersetting.png"));
setButton.set4ToolbarButton();
isshowWindowItem = new JCheckBoxMenuItem(Inter.getLocText("ParameterD-Show_Parameter_Window"));
isshowWindowItem.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
@ -116,9 +121,8 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
}
}
});
isdelayItem = new JCheckBoxMenuItem(Inter.getLocText("ParameterD-Delay_Playing"));
isdelayItem.addItemListener(new ItemListener() {
isdelayItem.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (propertyChangeListener != null) {
@ -128,7 +132,6 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
}
});
setButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -298,7 +301,7 @@ public class ParameterDefinitePane extends JPanel implements ToolBarMenuDockPlus
*/
public void refreshParameter() {
if (paraDesignEditor != null) {
paraDesignEditor.refreshParameter(this);
paraDesignEditor.refreshParameter(this, this.workBook);
}
}

3
designer_base/src/com/fr/design/parameter/ParameterDesignerProvider.java

@ -3,6 +3,7 @@ package com.fr.design.parameter;
import com.fr.base.Parameter;
import com.fr.base.parameter.ParameterUI;
import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.JTemplate;
import javax.swing.*;
import java.awt.*;
@ -31,6 +32,8 @@ public interface ParameterDesignerProvider {
void refreshParameter(ParaDefinitePane paraDefinitePane);
void refreshParameter(ParaDefinitePane paraDefinitePane, JTemplate jt);
boolean isWithQueryButton();
java.util.List<String> getAllXCreatorNameList();

157
designer_form/src/com/fr/design/designer/beans/models/SelectionModel.java

@ -136,37 +136,7 @@ public class SelectionModel {
private void unselectedPaste() {
if (designer.getClass().equals(FormDesigner.class)) {
if (selection.getSelectedCreator() instanceof XWFitLayout) {
if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) {
XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator();
//tab布局编辑器内部左上角第一个坐标点
int leftUpX = container.toData().getMargin().getLeft() + 1;
int leftUpY = container.toData().getMargin().getTop() + 1;
//选中第一个坐标点坐在的组件
selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY));
Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, container, clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
} else {
//自适应布局编辑器内部左上角第一个坐标点
int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1;
int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1;
//选中第一个坐标点坐在的组件
selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY));
Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
}
pasteXWFitLayout();
} else {
//绝对布局
//编辑器外面还有两层容器,使用designer.getRootComponent()获取到的是编辑器中层的容器,不是编辑器表层
@ -186,6 +156,40 @@ public class SelectionModel {
}
}
private void pasteXWFitLayout() {
if (selection.getSelectedCreator().getClass().equals(XWTabFitLayout.class)) {
XLayoutContainer container = (XLayoutContainer) selection.getSelectedCreator();
//tab布局编辑器内部左上角第一个坐标点
int leftUpX = container.toData().getMargin().getLeft() + 1;
int leftUpY = container.toData().getMargin().getTop() + 1;
//选中第一个坐标点坐在的组件
selection.setSelectedCreator((XCreator) container.getComponentAt(leftUpX, leftUpY));
Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, container, clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
} else {
//自适应布局编辑器内部左上角第一个坐标点
int leftUpX = designer.getRootComponent().toData().getMargin().getLeft() + 1;
int leftUpY = designer.getRootComponent().toData().getMargin().getTop() + 1;
//选中第一个坐标点坐在的组件
selection.setSelectedCreator((XCreator) designer.getRootComponent().getComponentAt(leftUpX, leftUpY));
Rectangle rectangle = selection.getRelativeBounds();
if (hasSelectedPasteSource()) {
selectedPaste();
} else {
FormSelectionUtils.paste2Container(designer, designer.getRootComponent(),
clipboard,
rectangle.x + rectangle.width / 2,
rectangle.y + DELTA_X_Y);
}
}
}
/**
* 粘贴时选择组件
*/
@ -227,7 +231,11 @@ public class SelectionModel {
XCreator[] roots = selection.getSelectedCreators();
if (roots.length > 0) {
boolean isInPara = true; // 在参数面板内删除控件
for (XCreator creator : roots) {
if (isInPara && !(creator.getParent() instanceof XWParameterLayout)) {
isInPara = false;
}
if (creator.acceptType(XWParameterLayout.class)) {
designer.removeParaComponent();
}
@ -236,8 +244,7 @@ public class SelectionModel {
// 清除被选中的组件
selection.reset();
}
setSelectedCreator(designer.getRootComponent());
FormSelectionUtils.rebuildSelection(designer);
setSelectedCreator(isInPara ? designer.getParaComponent() : designer.getRootComponent());
// 触发事件
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_DELETED);
designer.repaint();
@ -401,45 +408,57 @@ public class SelectionModel {
if (x < (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((x >= (bounds.x - XCreatorConstants.RESIZE_BOX_SIZ)) && (x <= bounds.x)) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.left_top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.left;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.left_bottom;
} else {
return Location.outer;
}
return getDirectionLeft(bounds, y);
} else if ((x > bounds.x) && (x < (bounds.x + bounds.width))) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.inner;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.bottom;
} else {
return Location.outer;
}
return getDirectionCenter(bounds, y);
} else if ((x >= (bounds.x + bounds.width))
&& (x <= (bounds.x + bounds.width + XCreatorConstants.RESIZE_BOX_SIZ))) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.right_top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.right;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.right_bottom;
} else {
return Location.outer;
}
return getDirectionRight(bounds, y);
} else {
return Location.outer;
}
}
private Direction getDirectionRight(Rectangle bounds, int y) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.right_top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.right;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.right_bottom;
} else {
return Location.outer;
}
}
private Direction getDirectionCenter(Rectangle bounds, int y) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.inner;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.bottom;
} else {
return Location.outer;
}
}
private Direction getDirectionLeft(Rectangle bounds, int y) {
if (y < (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) {
return Location.outer;
} else if ((y >= (bounds.y - XCreatorConstants.RESIZE_BOX_SIZ)) && (y <= bounds.y)) {
return Location.left_top;
} else if ((y > bounds.y) && (y < (bounds.y + bounds.height))) {
return Location.left;
} else if ((y >= (bounds.y + bounds.height))
&& (y <= (bounds.y + bounds.height + XCreatorConstants.RESIZE_BOX_SIZ))) {
return Location.left_bottom;
} else {
return Location.outer;
}

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

@ -37,16 +37,7 @@ import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.mainframe.AuthorityEditPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.FormArea;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormDesignerModeForSpecial;
import com.fr.design.mainframe.FormParaPane;
import com.fr.design.mainframe.FormWidgetDetailPane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.WidgetToolBarPane;
import com.fr.design.mainframe.*;
import com.fr.design.parameter.ParaDefinitePane;
import com.fr.design.parameter.ParameterDesignerProvider;
import com.fr.design.parameter.ParameterPropertyPane;
@ -79,6 +70,9 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
private static final int SECOND_H_LOCATION = 170;
private static final int ADD_HEIGHT = 20;
private static final int H_GAP = 105;
private static final int SUBMIT_BUTTON_H_LOCATION = 270;
private static final int PARA_IMAGE_SHIFT_X = -4;
private static final int FORM_AREA_PADDING_LEFT = 13;
private static Image paraImage = BaseUtils.readImage("/com/fr/design/images/form/parameter.png");
@ -175,12 +169,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
@Override
public void fireCreatorModified(DesignerEvent evt) {
if (evt.getCreatorEventID() == DesignerEvent.CREATOR_ADDED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_CUTED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_PASTED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_DELETED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_EDITED
|| evt.getCreatorEventID() == DesignerEvent.CREATOR_RENAMED) {
if (evt.getCreatorEventID() != DesignerEvent.CREATOR_SELECTED) {
paraDefinitePane.setParameterArray(
paraDefinitePane.getNoRepeatParas(DesignModelAdapter.getCurrentModelAdapter().getParameters()));
paraDefinitePane.refreshParameter();
@ -196,7 +185,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
*/
public Component createWrapper() {
FormArea area = new FormArea(this, false);
area.setBorder(BorderFactory.createEmptyBorder(0, 13, 0, 0));
area.setBorder(BorderFactory.createEmptyBorder(0, FORM_AREA_PADDING_LEFT, 0, 0));
return area;
}
@ -224,6 +213,16 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
* @param p 参数面板
*/
public void refreshParameter(ParaDefinitePane p) {
refreshParameter(p, DesignerContext.getDesignerFrame().getSelectedJTemplate());
}
/**
* 刷新参数
*
* @param p 参数面板
* @param jt 当前模版
*/
public void refreshParameter(ParaDefinitePane p, JTemplate jt) {
XLayoutContainer rootContainer = this.getRootComponent();
java.util.List<String> namelist = getAllXCreatorNameList(rootContainer);
// parameterArray是报表的所有参数, nameList是已经在参数面板添加过控件的参数名
@ -240,8 +239,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
}
ParameterPropertyPane.getInstance().getParameterToolbarPane().populateBean(
p.getParameterArray() == null ? new Parameter[0] : p.getParameterArray());
EastRegionContainerPane.getInstance().setParameterHeight(ParameterPropertyPane.getInstance().getPreferredSize().height);
ParameterPropertyPane.getInstance().refreshState(jt);
}
/**
@ -439,7 +437,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
}
for (Parameter p : paras) {
if (p.getName().equalsIgnoreCase(creator.toData().getWidgetName())) {
g.drawImage(paraImage, creator.getX() - 4, creator.getY() + 2, null);
g.drawImage(paraImage, creator.getX() + PARA_IMAGE_SHIFT_X, creator.getY() + 2, null);
break;
}
}
@ -617,7 +615,7 @@ public class FormParaDesigner extends FormDesigner implements ParameterDesignerP
formSubmitButton.setWidgetName("Search");
formSubmitButton.setText(Inter.getLocText("FR-Designer_Query"));
xCreator = XCreatorUtils.createXCreator(formSubmitButton);
if (!(this.autoAddComponent(xCreator, 270, FIRST_V_LOCATION + V_COMPONENT_GAP
if (!(this.autoAddComponent(xCreator, SUBMIT_BUTTON_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP
* (currentIndex / NUM_IN_A_LINE)))) {
return false;
}

17
designer_form/src/com/fr/design/mainframe/FormDesigner.java

@ -123,6 +123,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
private static final int SECOND_H_LOCATION = 170;
private static final int ADD_HEIGHT = 20;
private static final int H_GAP = 105;
private static final int SUBMIT_BUTTON_H_LOCATION = 270;
public FormDesigner(Form form) {
this(form, null);
@ -257,7 +258,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
currentIndex++;
parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter);
refreshParameter();
EastRegionContainerPane.getInstance().refreshDownPane();
fireTargetModified();
}
/**
@ -294,14 +295,14 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
formSubmitButton.setWidgetName("Search");
formSubmitButton.setText(Inter.getLocText("FR-Designer_Query"));
xCreator = XCreatorUtils.createXCreator(formSubmitButton);
if (!(this.autoAddComponent(xCreator, 270, FIRST_V_LOCATION + V_COMPONENT_GAP
if (!(this.autoAddComponent(xCreator, SUBMIT_BUTTON_H_LOCATION, FIRST_V_LOCATION + V_COMPONENT_GAP
* (currentIndex / NUM_IN_A_LINE)))) {
return;
}
currentIndex = currentIndex + NUM_IN_A_LINE - currentIndex % NUM_IN_A_LINE;
parameterArray = (Parameter[]) ArrayUtils.removeElement(parameterArray, parameter);
refreshParameter();
EastRegionContainerPane.getInstance().refreshDownPane();
fireTargetModified();
}
/**
@ -667,9 +668,8 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
// 只有选择组件时不触发模版更新,其他都要触发
if (evt.getCreatorEventID() != DesignerEvent.CREATOR_SELECTED) {
FormDesigner.this.fireTargetModified();
//bug59192
//setParameterArray(getNoRepeatParas(getTarget().getParameters()));
//refreshParameter();
setParameterArray(getNoRepeatParas(getTarget().getParameters()));
refreshParameter();
}
}
@ -1147,7 +1147,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
* 同步
*/
public void populateRootSize() {
// do nothing
}
/**
@ -1233,6 +1233,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
*/
@Override
public void stopEditing() {
// do nothing
}
/**
@ -1412,7 +1413,7 @@ public class FormDesigner extends TargetComponent<Form> implements TreeSelection
parent = parent.getParent();
}
Object[] components = path.toArray();
Object[] components = (Object[]) path.toArray();
if (components.length == 0) {
return null;
}

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

@ -328,10 +328,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
private void setPropertyPaneChange(XComponent comp) {
if (comp == null) {
ParameterPropertyPane.getInstance().setAddParaPaneVisible(false);
ParameterPropertyPane.getInstance().setAddParaPaneVisible(false, this);
return;
}
ParameterPropertyPane.getInstance().setAddParaPaneVisible(comp instanceof XWParameterLayout);
ParameterPropertyPane.getInstance().setAddParaPaneVisible(isAddParaPaneVisible(comp), this);
editingComponent = comp.createToolPane(this, formDesign);
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
if (BaseUtils.isAuthorityEditing()) {
@ -342,6 +342,16 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}
}
private boolean isAddParaPaneVisible(XComponent comp) {
boolean isVisible = false;
try {
isVisible = comp instanceof XWParameterLayout || ((XCreator) comp).getParent() instanceof XWParameterLayout;
} catch (Throwable throwable) {
// 发生异常则返回 false
}
return isVisible;
}
public JComponent getEditingPane() {
return editingComponent;
}
@ -546,6 +556,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
//撤销的时候要重新选择的body布局
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
refreshToolArea();
} else {
String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样
@ -718,7 +729,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(WidgetPropertyPane.getInstance(formDesign));
ParameterPropertyPane parameterPropertyPane = ParameterPropertyPane.getInstance(formDesign);
parameterPropertyPane.setAddParaPaneVisible(false);
parameterPropertyPane.setAddParaPaneVisible(false, this);
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);

16
designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java

@ -4,10 +4,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.*;
import javax.swing.*;
import java.awt.*;
@ -87,18 +84,23 @@ public class ParameterPropertyPane extends JPanel{
}
// 显示或隐藏添加参数面板
public void refreshState(JTemplate jt) {
setAddParaPaneVisible(toolbarPane.hasSelectedLabelItem(), jt);
}
// 显示或隐藏添加参数面板
public void refreshState() {
setAddParaPaneVisible(toolbarPane.hasSelectedLabelItem());
refreshState(DesignerContext.getDesignerFrame().getSelectedJTemplate());
}
public void setAddParaPaneVisible(boolean isVisible) {
public void setAddParaPaneVisible(boolean isVisible, JTemplate jt) {
if (isVisible == addParaPane.isVisible() || formHierarchyTreePaneWrapper == null) {
return;
}
// 表单中,只有添加并选中参数面板时,才显示
boolean hideInJForm;
try {
hideInJForm = DesignerContext.getDesignerFrame().getSelectedJTemplate() instanceof JForm &&
hideInJForm = jt instanceof JForm &&
!(FormHierarchyTreePane.getInstance().getComponentTree().getSelectionPath().getLastPathComponent() instanceof XWParameterLayout);
} catch (NullPointerException ex) {
hideInJForm = true;

16
designer_form/src/com/fr/design/parameter/ParameterToolBarPane.java

@ -35,6 +35,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
private static final int BUTTON_HEIGHT = 20;
private static final int WIDTH = 225;
private static final int L_H = 18;
private static final int LABEL_PADDING_LEFT = 4;
public ParameterToolBarPane() {
this.setLayout(new FlowParameterPaneLayout());
@ -47,9 +48,9 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
return new Dimension(super.getPreferredSize().width, 18);
}
};
label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated")+":");
label.setText(Inter.getLocText("FR-Following_parameters_are_not_generated") + ":");
label.setHorizontalAlignment(SwingConstants.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
label.setBorder(BorderFactory.createEmptyBorder(0, LABEL_PADDING_LEFT, 0, 0));
this.add(label);
addAll = new UIButton(Inter.getLocText("FR-Designer_Add_all"));
@ -68,7 +69,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
public Parameter getTargetParameter(UIButton button) {
int index = parameterSelectedLabellist.indexOf(button);
if(index < 0 || index > parameterList.length - 1) {
if (index < 0 || index > parameterList.length - 1) {
return null;
}
return parameterList[index];
@ -82,7 +83,6 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
this.add(label);
if (parameterArray.length == 0) {
ParameterPropertyPane.getInstance().refreshState();
this.setVisible(false);
this.repaint();
return;
@ -103,7 +103,6 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
this.add(addAll);
this.doLayout();
ParameterPropertyPane.getInstance().refreshState();
this.repaint();
}
@ -124,12 +123,15 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
private class FlowParameterPaneLayout implements LayoutManager {
public FlowParameterPaneLayout() {
// do nothing
}
public void addLayoutComponent(String name, Component comp) {
// do nothing
}
public void removeLayoutComponent(Component comp) {
// do nothing
}
public Dimension preferredLayoutSize(Container parent) {
@ -137,7 +139,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
layoutContainer(parent);
int h= ((parameterSelectedLabellist.size() == 0) ? 0 : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height);
int h= (parameterSelectedLabellist.isEmpty() ? 0 : breakid * (BUTTON_HEIGHT + GAP_V) + GAP_BV + L_H + GAP_H + addAll.getPreferredSize().height);
return new Dimension(w, h);
}
@ -155,7 +157,7 @@ public class ParameterToolBarPane extends BasicBeanPane<Parameter[]> {
breakid = 1;
for (UIButton tab : parameterSelectedLabellist) {
Dimension dim = tab.getPreferredSize();
if(x + dim.width > width) {
if (x + dim.width > width) {
breakid++;
x = 0;
y += (dim.height + GAP_V);

Loading…
Cancel
Save