Browse Source

Merge pull request #1275 in BA/design from ~KERRY/design:release/9.0 to release/9.0

* commit 'b42d22e10d10d34c94c70eea3f31a4c739590113':
  修改import
  REPORT-4713 表单报表块工具栏状态切换后,没法撤销操作
  REPORT-4694 tab组件,切换tab时组件内容没有改变和控件边界可编辑
master
superman 7 years ago
parent
commit
9fb616d31c
  1. 12
      designer/src/com/fr/design/widget/ui/AbstractDataModify.java
  2. 8
      designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java
  3. 18
      designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java
  4. 8
      designer_base/src/com/fr/design/widget/DataModify.java
  5. 32
      designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java
  6. 20
      designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java
  7. 10
      designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java
  8. 19
      designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  9. 16
      designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java
  10. 31
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java
  11. 115
      designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java
  12. 12
      designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java
  13. 46
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java
  14. 17
      designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

12
designer/src/com/fr/design/widget/ui/AbstractDataModify.java

@ -4,12 +4,14 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.widget.DataModify;
import javax.swing.*;
import javax.swing.JComponent;
/**
* Created by richie on 15/11/16.
*/
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected String globalName;
@Override
public DataCreatorUI dataUI() {
@ -20,4 +22,12 @@ public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements
public JComponent toSwingComponent() {
return this;
}
public void setGlobalName(String globalName){
this.globalName = globalName;
}
public String getGlobalName(){
return globalName;
}
}

8
designer_base/src/com/fr/design/mainframe/widget/BasicPropertyPane.java

@ -8,8 +8,10 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by plough on 2017/8/7.
@ -25,7 +27,7 @@ public class BasicPropertyPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
widgetName = new UITextField();
widgetName.setGlobalName(Inter.getLocText("FR-Designer_Widget_Name"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};

18
designer_base/src/com/fr/design/mainframe/widget/accessibles/BaseAccessibleEditor.java

@ -1,12 +1,17 @@
package com.fr.design.mainframe.widget.accessibles;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton;
import javax.swing.JComponent;
@ -77,7 +82,14 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
setOpaque(false);
if (showButton) {
btPopup = new UIButton();
btPopup = new UIButton(){
public void registerChangeListener(UIObserverListener listener) {
return;
}
public boolean shouldResponseChangeListener() {
return false;
}
};
initPopupButton();
btPopup.addActionListener(new ActionListener() {
@ -189,4 +201,6 @@ public class BaseAccessibleEditor extends BasicPane implements AccessibleEditor
public static void showMessage(String message, Component editorComponent) {
JOptionPane.showMessageDialog(editorComponent, message, "Validation Error", JOptionPane.ERROR_MESSAGE);
}
}

8
designer_base/src/com/fr/design/widget/DataModify.java

@ -2,7 +2,8 @@ package com.fr.design.widget;
import com.fr.design.data.DataCreatorUI;
import javax.swing.*;
import javax.swing.JComponent;
public interface DataModify<T> {
@ -15,4 +16,9 @@ public interface DataModify<T> {
DataCreatorUI dataUI();
JComponent toSwingComponent();
String getGlobalName();
void setGlobalName(String globalName);
}

32
designer_form/src/com/fr/design/mainframe/widget/accessibles/AccessibleElementCaseToolBarEditor.java

@ -5,11 +5,16 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.FormWebWidgetConstants;
import com.fr.design.mainframe.widget.editors.ElementCaseToolBarPane;
import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.editors.TextField;
import com.fr.design.mainframe.widget.wrappers.ElementCaseToolBarWrapper;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import javax.swing.*;
import javax.swing.SwingUtilities;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -54,4 +59,29 @@ public class AccessibleElementCaseToolBarEditor extends UneditableAccessibleEdit
options.addAll(defaultOptions);
return options.toArray(new WidgetOption[options.size()]);
}
protected ITextComponent createTextField() {
TextField textField = new TextField(){
protected void initListener() {
if (shouldResponseChangeListener()) {
getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
}
@Override
public void removeUpdate(DocumentEvent e) {
attributeChange();
}
@Override
public void changedUpdate(DocumentEvent e) {
}
});
}
}
};
textField.setGlobalName(Inter.getLocText("Form-EC_toolbar"));
return textField;
}
}

20
designer_form/src/com/fr/design/mainframe/widget/ui/FormWidgetCardPane.java

@ -18,11 +18,15 @@ import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WScaleLayout;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by ibm on 2017/7/25.
@ -199,13 +203,19 @@ public class FormWidgetCardPane extends AbstractAttrNoScrollPane {
public void updateCreator() {
currentEditorDefinePane.setGlobalName(getGlobalName());
Widget widget = currentEditorDefinePane.updateBean();
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Widget_Name"))){
widgetPropertyPane.update(widget);
if (widgetBoundPane != null) {
widgetBoundPane.update();
}
xCreator.resetCreatorName(widget.getWidgetName());
designer.getEditListenerTable().fireCreatorModified(xCreator, DesignerEvent.CREATOR_RENAMED);
return;
}
if (widgetBoundPane != null && ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Coords_And_Size"))) {
widgetBoundPane.update();
}
fireValueChanged();
}

10
designer_form/src/com/fr/design/widget/ui/designer/AbstractDataModify.java

@ -5,13 +5,15 @@ import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.widget.DataModify;
import javax.swing.*;
import javax.swing.JComponent;
/**
* Created by kerry on 17/07/28.
*/
public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements DataModify<T> {
protected XCreator creator;
protected String globalName;
public AbstractDataModify(XCreator xCreator){
@ -28,5 +30,11 @@ public abstract class AbstractDataModify<T> extends BasicBeanPane<T> implements
return this;
}
public void setGlobalName(String globalName){
this.globalName = globalName;
}
public String getGlobalName(){
return globalName;
}
}

19
designer_form/src/com/fr/design/widget/ui/designer/DateEditorDefinePane.java

@ -20,10 +20,15 @@ import com.fr.script.Calculator;
import com.fr.stable.ArrayUtils;
import com.fr.stable.UtilEvalError;
import javax.swing.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
@ -64,12 +69,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Label_Name")), labelNameTextField},
new Component[]{new UILabel(Inter.getLocText("FR-Designer-Estate_Widget_Value")), formWidgetValuePane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format") + ":"), formatHead},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date") + ":"), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date") + ":"), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark") + ":"), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Engine_Format")), formatHead},
new Component[]{new UILabel(Inter.getLocText("FS_Start_Date")), startDv},
new Component[]{new UILabel(Inter.getLocText("FS_End_Date")), endDv},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_WaterMark")), waterMarkDictPane},
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Font-Size")), fontSizePane},
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type") + ":"), returnTypeComboBox}
new Component[]{new UILabel(Inter.getLocText("Widget-Date_Selector_Return_Type")), returnTypeComboBox}
};
double[] rowSize = {p, p, p, p, p, p, p, p, p, p};

16
designer_form/src/com/fr/design/widget/ui/designer/component/PaddingBoundPane.java

@ -11,13 +11,16 @@ import com.fr.form.ui.AbstractMarginWidget;
import com.fr.form.ui.PaddingMargin;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
/**
* Created by ibm on 2017/8/3.
*/
public class PaddingBoundPane extends BasicPane {
public class PaddingBoundPane extends BasicPane{
protected UISpinner top;
protected UISpinner bottom;
protected UISpinner left;
@ -33,6 +36,10 @@ public class PaddingBoundPane extends BasicPane {
bottom = new UISpinner(0, 1000, 1, 0);
left = new UISpinner(0, 1000, 1, 0);
right = new UISpinner(0, 1000, 1, 0);
top.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
bottom.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
left.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
right.setGlobalName(Inter.getLocText("FR-Designer_Layout-Padding"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p};
@ -47,9 +54,9 @@ public class PaddingBoundPane extends BasicPane {
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(panel);
}
public void update(AbstractMarginWidget marginWidget) {
marginWidget.setMargin(new PaddingMargin((int)top.getValue(), (int)left.getValue(), (int)bottom.getValue(), (int)right.getValue() ));
}
@ -66,4 +73,5 @@ public class PaddingBoundPane extends BasicPane {
right.setValue(paddingMargin.getRight());
}
}

31
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetAbsoluteBoundPane.java

@ -1,26 +1,23 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.Inter;
import java.awt.Rectangle;
import java.awt.*;
/**
* Created by ibm on 2017/8/3.
*/
public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
protected XWAbsoluteLayout parent;
private UISpinner x;
private UISpinner y;
public WidgetAbsoluteBoundPane(XCreator source){
super(source);
XLayoutContainer xLayoutContainer = getParent(source);
this.parent = (XWAbsoluteLayout) xLayoutContainer;
}
public void initBoundPane() {
@ -28,6 +25,10 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
y = new UISpinner(0, 1200, 1);
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
x.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
y.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
this.add(WidgetBoundsPaneFactory.createAbsoluteBoundsPane(x, y, width, height));
}
@ -40,13 +41,25 @@ public class WidgetAbsoluteBoundPane extends WidgetBoundPane {
if (parent == null) {
return;
}
WAbsoluteLayout wabs = parent.toData();
WLayout wabs = parent.toData();
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
}
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec){
bounds.width = w;
}
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec){
bounds.height = h;
}
protected String title4PopupWindow() {
return "";
return "absoluteBound";
}
public void populate() {

115
designer_form/src/com/fr/design/widget/ui/designer/component/WidgetBoundPane.java

@ -1,18 +1,33 @@
package com.fr.design.widget.ui.designer.component;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.ComponentUtils;
import com.fr.design.widget.WidgetBoundsPaneFactory;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.Inter;
import javax.swing.JOptionPane;
import java.awt.Rectangle;
import java.awt.*;
/**
* Created by ibm on 2017/7/30.
*/
public class WidgetBoundPane extends BasicPane {
private static final int MINHEIGHT = WLayout.MIN_HEIGHT;
private static final int MINWIDTH = WLayout.MIN_WIDTH;
protected XLayoutContainer parent;
protected XCreator creator;
protected UISpinner width;
protected UISpinner height;
@ -20,6 +35,7 @@ public class WidgetBoundPane extends BasicPane {
public WidgetBoundPane(XCreator source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.creator = source;
this.parent = getParent(source);
initBoundPane();
}
@ -34,19 +50,22 @@ public class WidgetBoundPane extends BasicPane {
public void initBoundPane() {
width = new UISpinner(0, 1200, 1);
height = new UISpinner(0, 1200, 1);
width.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
height.setGlobalName(Inter.getLocText("FR-Designer_Coords_And_Size"));
if (creator.acceptType(XWCardLayout.class)) {
width.setEnabled(false);
height.setEnabled(false);
}
this.add(WidgetBoundsPaneFactory.createBoundsPane(width, height));
}
public void update() {
Rectangle bounds = new Rectangle(creator.getBounds());
bounds.width = (int) width.getValue();
bounds.height = (int) height.getValue();
creator.setBounds(bounds);
fix();
}
protected String title4PopupWindow() {
return "";
return "widgetBound";
}
public void populate() {
@ -54,4 +73,88 @@ public class WidgetBoundPane extends BasicPane {
width.setValue(bounds.width);
height.setValue(bounds.height);
}
public void fix() {
Rectangle bounds = new Rectangle(creator.getBounds());
int w = (int) width.getValue();
int h = (int) height.getValue();
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
WLayout wabs = parent.toData();
if (bounds.width != w) {
limitWidth(wabs, w, bounds, rec);
}
if (bounds.height != h) {
limitHeight(wabs, h, bounds, rec);
}
creator.setBounds(bounds);
}
public void adjustComponents(Rectangle bounds, int difference, int row) {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle backupBounds = getBound();
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, creator);
if (layoutAdapter != null) {
layoutAdapter.setEdit(true);
layoutAdapter.calculateBounds(backupBounds, bounds, creator, row, difference);
}
}
public void limitWidth(WLayout wabs, int w, Rectangle bounds, Rectangle rec) {
int difference = 0;
int minWidth = (int) (MINWIDTH * ((WFitLayout) wabs).getResolutionScaling());
PaddingMargin margin = wabs.getMargin();
if (bounds.width != w) {
if (bounds.width == rec.width - margin.getLeft() - margin.getRight()) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds"));
width.setValue(bounds.width);
return;
} else if (w < minWidth) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Width") + Integer.toString(minWidth));
width.setValue(bounds.width);
return;
}
difference = bounds.width - w;
bounds.width = w;
}
width.setValue(bounds.width);
wabs.setBounds(creator.toData(), bounds);
adjustComponents(bounds, difference, 0);
}
public void limitHeight(WLayout wabs, int h, Rectangle bounds, Rectangle rec) {
int difference = 0;
PaddingMargin margin = wabs.getMargin();
int minHeight = (int) (MINHEIGHT * ((WFitLayout) wabs).getResolutionScaling());
if (bounds.height != h) {
if (bounds.height == rec.height - margin.getTop() - margin.getBottom()) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds"));
height.setValue(bounds.height);
return;
} else if (h < minHeight) {
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Height") + Integer.toString(minHeight));
height.setValue(bounds.height);
return;
}
difference = bounds.height - h;
bounds.height = h;
}
wabs.setBounds(creator.toData(), bounds);
creator.setBounds(bounds);
adjustComponents(bounds, difference, 1);
}
public Rectangle getBound() {
Rectangle bounds = new Rectangle(creator.getBounds());
if (parent == null) {
return bounds;
}
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
bounds.x += rec.x;
bounds.y += rec.y;
return bounds;
}
}

12
designer_form/src/com/fr/design/widget/ui/designer/layout/ElementEditorDefinePane.java

@ -8,10 +8,13 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleElementCaseToolBarEd
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.web.FormToolBarManager;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by ibm on 2017/8/7.
@ -45,8 +48,13 @@ public class ElementEditorDefinePane extends WTitleLayoutDefinePane<ElementCaseE
protected ElementCaseEditor updateSubBean() {
ElementCaseEditor elementCaseEditor = (ElementCaseEditor) creator.toData();
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("FR-Designer_Layout-Padding"))){
paddingBoundPane.update(elementCaseEditor);
}
if(ComparatorUtils.equals(getGlobalName(), Inter.getLocText("Form-EC_toolbar"))){
elementCaseEditor.setToolBars((FormToolBarManager[]) elementCaseToolBarEditor.getValue());
}
return elementCaseEditor;
}

46
designer_form/src/com/fr/design/widget/ui/designer/layout/WTabFitLayoutDefinePane.java

@ -2,6 +2,9 @@ package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
@ -11,11 +14,17 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.design.widget.ui.designer.component.TabFitLayoutBackgroundPane;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.form.ui.container.cardlayout.WCardTitleLayout;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by ibm on 2017/8/5.
@ -70,16 +79,47 @@ public class WTabFitLayoutDefinePane extends AbstractDataModify<WTabFitLayout> {
borderStyle.populate(ob);
paddingBoundPane.populate(ob);
componentInterval.setValue(ob.getCompInterval());
if(ob.getCurrentCard() == null){
ob.setCurrentCard(getRelateSwitchButton(ob));
}
titleField.setText(ob.getCurrentCard().getText());
}
private CardSwitchButton getRelateSwitchButton(WTabFitLayout layout){
int index = layout.getIndex();
XWCardLayout cardLayout = (XWCardLayout)creator.getBackupParent();
XWCardMainBorderLayout border = (XWCardMainBorderLayout)cardLayout.getBackupParent();
WCardMainBorderLayout borderLayout = border.toData();
WCardTitleLayout titleLayout = borderLayout.getTitlePart();
if(titleLayout == null){
return null;
}
WCardTagLayout tagLayout = titleLayout.getTagPart();
return tagLayout == null ? null : tagLayout.getSwitchButton(index);
}
private void setLayoutGap(int gap, WTabFitLayout layout, XWTabFitLayout xwTabFitLayout) {
if(xwTabFitLayout.canAddInterval(gap)){
int interval = layout.getCompInterval();
if (gap != interval) {
xwTabFitLayout.moveContainerMargin();
xwTabFitLayout.moveCompInterval(xwTabFitLayout.getAcualInterval());
layout.setCompInterval(gap);
xwTabFitLayout.addCompInterval(xwTabFitLayout.getAcualInterval());
}
}
}
@Override
public WTabFitLayout updateBean() {
WTabFitLayout layout = (WTabFitLayout) creator.toData();
borderStyle.update(layout);
paddingBoundPane.update(layout);
layout.setCompInterval((int)componentInterval.getValue());
int gap = (int)componentInterval.getValue();
setLayoutGap(gap, layout, (XWTabFitLayout)creator);
layout.getCurrentCard().setText(titleField.getText());
return layout;
}

17
designer_form/src/com/fr/design/widget/ui/designer/layout/WTitleLayoutDefinePane.java

@ -2,20 +2,22 @@ package com.fr.design.widget.ui.designer.layout;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleWLayoutBorderStyleEditor;
import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
import com.fr.form.ui.*;
import com.fr.form.ui.container.WTitleLayout;
import com.fr.form.ui.AbstractBorderStyleWidget;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by ibm on 2017/8/3.
@ -32,7 +34,6 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel advancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
borderStyleEditor = new AccessibleWLayoutBorderStyleEditor();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
@ -74,7 +75,9 @@ public abstract class WTitleLayoutDefinePane<T extends AbstractBorderStyleWidget
@Override
public T updateBean() {
T e = updateSubBean();
if(!ComparatorUtils.equals(borderStyleEditor.getValue(), e.getBorderStyle())){
e.setBorderStyle((LayoutBorderStyle) borderStyleEditor.getValue());
}
return e;
}

Loading…
Cancel
Save