plough 8 years ago
parent
commit
72081223ee
  1. 6
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  2. 6
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  3. 9
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java
  4. 80
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveAction.java
  5. 23
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java
  6. 48
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java
  7. 45
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java
  8. 46
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java
  9. 46
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java
  10. 10
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  11. 20
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  12. 5
      designer_form/src/com/fr/design/mainframe/EditingMouseListener.java

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

@ -525,9 +525,9 @@ FR-Designer_Background_Gradient_Color=Gradient Color
FR-Designer_Background_Image=Image FR-Designer_Background_Image=Image
FR-Designer_Background_Clear=Clear FR-Designer_Background_Clear=Clear
FR-Designer_Background_Image_Select=Select Picture FR-Designer_Background_Image_Select=Select Picture
FR-Designer_Tab_carousel= FR-Designer_Tab_carousel=tab carousel
FR-Designer_setCarousel= FR-Designer_setCarousel=set carousel
FR-Designer_carouselInterval= FR-Designer_carouselInterval=interval
FR-Designer_Initial_Background_Tips=Initial background of the button FR-Designer_Initial_Background_Tips=Initial background of the button
FR-Designer_Mouse_Move_Tips=Move the mouse to the button on the background, in the absence of not changing the background FR-Designer_Mouse_Move_Tips=Move the mouse to the button on the background, in the absence of not changing the background
FR-Designer_Mouse_Click_Tips=The background of the mouse to click the button, in the absence of not changing the background FR-Designer_Mouse_Click_Tips=The background of the mouse to click the button, in the absence of not changing the background

6
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -277,6 +277,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
super.clearCompsList(); super.clearCompsList();
} }
protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout){
return mainLayout.getBounds();
}
private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) { private Rectangle adjustBackupBound(Rectangle backupBound, XWCardMainBorderLayout mainLayout) {
// 参数界面高度对纵坐标产生的影响 // 参数界面高度对纵坐标产生的影响
JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()); JForm jform = (JForm) (HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
@ -284,7 +288,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
backupBound.y -= jform.getFormDesign().getParaHeight(); backupBound.y -= jform.getFormDesign().getParaHeight();
} }
Rectangle rec = mainLayout.getBounds(); Rectangle rec = getLayoutBound(mainLayout);
// XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响 // XWTabLayout里面的横纵坐标收到外层XWCardMainBorderLayout的横纵坐标影响
// 减掉之后可以按照它原来的逻辑执行 // 减掉之后可以按照它原来的逻辑执行
backupBound.x -= rec.x; backupBound.x -= rec.x;

9
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRTabFitLayoutAdapter.java

@ -4,13 +4,12 @@
package com.fr.design.designer.beans.adapters.layout; package com.fr.design.designer.beans.adapters.layout;
import java.awt.Rectangle;
import com.fr.design.beans.GroupModel; import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; 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.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel; import com.fr.design.designer.properties.FRTabFitLayoutPropertiesGroupModel;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
@ -18,6 +17,8 @@ import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import java.awt.*;
/** /**
* tab布局tabFit适配器 * tab布局tabFit适配器
* *
@ -91,4 +92,8 @@ public class FRTabFitLayoutAdapter extends FRFitLayoutAdapter {
} }
return y; return y;
} }
protected Rectangle getLayoutBound(XWCardMainBorderLayout mainLayout){
return ComponentUtils.getRelativeBounds(mainLayout);
}
} }

80
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveAction.java

@ -0,0 +1,80 @@
package com.fr.design.designer.creator.cardlayout;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.FRLogger;
/**
* Created by zhouping on 2017/2/17.
*/
public class TabMoveAction extends FormUndoableAction {
private XCardSwitchButton xCardSwitchButton;
public TabMoveAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t);
this.xCardSwitchButton = xCardSwitchButton;
}
@Override
public boolean executeActionReturnUndoRecordNeeded() {
XCardSwitchButton xCardSwitchButton = getxCardSwitchButton();
XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout();
XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout();
CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData();
try {
int currentIndex = currentButton.getIndex();
int maxIndex = xwCardTagLayout.getComponentCount();
XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex);
WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData();
xwCardTagLayout.setSwitchingTab(true);
changeTabIndex(xwCardTagLayout, xwCardLayout, currentIndex, maxIndex);
moveTabAction(xwCardTagLayout, currentButton, xCurrentTab, currentTab);
xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){
xwCardTagLayout.setSwitchingTab(false);
FRLogger.getLogger().error(e.getMessage());
return false;
}
return true;
}
private void moveTabAction(XWCardTagLayout xwCardTagLayout, CardSwitchButton currentButton, XWTabFitLayout xCurrentTab, WTabFitLayout currentTab) {
int move2Index = getTabMoveIndex(currentButton);
XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout();
xwCardTagLayout.remove(xCardSwitchButton);
xwCardTagLayout.add(xCardSwitchButton, move2Index);
xwCardLayout.remove(xCurrentTab);
xwCardLayout.add(xCurrentTab, move2Index);
currentButton.setIndex(move2Index);
currentTab.setIndex(move2Index);
currentTab.setTabNameIndex(move2Index);
xwCardLayout.toData().setShowIndex(move2Index);
xwCardLayout.showCard();
}
//改变Tab的索引号
protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) {
}
/**
* 获取tab移动的目的索引首位末尾下一个上一个
* @param currentButton 当前按钮
* @return 索引
*/
protected int getTabMoveIndex(CardSwitchButton currentButton) {
return currentButton.getIndex();
}
public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton;
}
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
}
}

23
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveCustomAction.java

@ -1,32 +1,17 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.general.IOUtils;
/** /**
* Created by zhouping on 2017/2/9. * Created by zhouping on 2017/2/9.
*/ */
public class TabMoveCustomAction extends FormUndoableAction { public class TabMoveCustomAction extends TabMoveAction {
private XCardSwitchButton xCardSwitchButton;
public TabMoveCustomAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { public TabMoveCustomAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t); super(t, xCardSwitchButton);
this.setName(""); this.setName("");
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/refresh.png")); this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/control/refresh.png"));
this.xCardSwitchButton = xCardSwitchButton;
} }
@Override
public boolean executeActionReturnUndoRecordNeeded() {
return false;
}
public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton;
}
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
}
} }

48
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java

@ -1,37 +1,24 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.FRLogger; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
* Created by zhouping on 2017/2/9. * Created by zhouping on 2017/2/9.
*/ */
public class TabMoveEndAction extends FormUndoableAction { public class TabMoveEndAction extends TabMoveAction {
private XCardSwitchButton xCardSwitchButton;
public TabMoveEndAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { public TabMoveEndAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t); super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_End")); this.setName(Inter.getLocText("FR-Designer-Move_Tab_End"));
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/rightright.png")); this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/rightright.png"));
this.xCardSwitchButton = xCardSwitchButton;
} }
@Override //改变Tab的索引号
public boolean executeActionReturnUndoRecordNeeded() { protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) {
XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout();
XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout();
CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData();
try {
int currentIndex = currentButton.getIndex();
int maxIndex = xwCardTagLayout.getComponentCount();
XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex);
WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData();
xwCardTagLayout.setSwitchingTab(true);
//修改当前tab往后所有tab的索引号 //修改当前tab往后所有tab的索引号
for (int i = currentIndex + 1; i < maxIndex; i++) { for (int i = currentIndex + 1; i < maxIndex; i++) {
CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData();
@ -40,27 +27,10 @@ public class TabMoveEndAction extends FormUndoableAction {
tempTab.setIndex(i - 1); tempTab.setIndex(i - 1);
tempTab.setTabNameIndex(i - 1); tempTab.setTabNameIndex(i - 1);
} }
xwCardTagLayout.remove(xCardSwitchButton);
xwCardTagLayout.add(xCardSwitchButton);
xwCardLayout.remove(xCurrentTab);
xwCardLayout.add(xCurrentTab);
currentButton.setIndex(maxIndex - 1);
currentTab.setIndex(maxIndex - 1);
currentTab.setTabNameIndex(maxIndex - 1);
xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){
xwCardTagLayout.setSwitchingTab(false);
FRLogger.getLogger().error(e.getMessage());
return false;
}
return true;
} }
public XCardSwitchButton getxCardSwitchButton() { @Override
return xCardSwitchButton; protected int getTabMoveIndex(CardSwitchButton btn) {
} return getxCardSwitchButton().getTagLayout().getComponentCount() - 1;
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
} }
} }

45
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java

@ -1,36 +1,24 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.FRLogger; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
* Created by zhouping on 2017/2/9. * Created by zhouping on 2017/2/9.
*/ */
public class TabMoveFirstAction extends FormUndoableAction { public class TabMoveFirstAction extends TabMoveAction {
private XCardSwitchButton xCardSwitchButton;
public TabMoveFirstAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { public TabMoveFirstAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t); super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_First")); this.setName(Inter.getLocText("FR-Designer-Move_Tab_First"));
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/leftleft.png")); this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/leftleft.png"));
this.xCardSwitchButton = xCardSwitchButton;
} }
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) {
XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout();
XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout();
CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData();
try {
int currentIndex = currentButton.getIndex();
XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex);
WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData();
xwCardTagLayout.setSwitchingTab(true);
//修改当前tab往前所有tab的索引号 //修改当前tab往前所有tab的索引号
for (int i = currentIndex - 1; i >= 0; i--) { for (int i = currentIndex - 1; i >= 0; i--) {
CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData();
@ -39,27 +27,10 @@ public class TabMoveFirstAction extends FormUndoableAction {
tempTab.setIndex(i + 1); tempTab.setIndex(i + 1);
tempTab.setTabNameIndex(i + 1); tempTab.setTabNameIndex(i + 1);
} }
xwCardTagLayout.remove(xCardSwitchButton);
xwCardTagLayout.add(xCardSwitchButton, 0);
xwCardLayout.remove(xCurrentTab);
xwCardLayout.add(xCurrentTab, 0);
currentButton.setIndex(0);
currentTab.setIndex(0);
currentTab.setTabNameIndex(0);
xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){
xwCardTagLayout.setSwitchingTab(false);
FRLogger.getLogger().error(e.getMessage());
return false;
}
return true;
}
public XCardSwitchButton getxCardSwitchButton() {
return xCardSwitchButton;
} }
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { @Override
this.xCardSwitchButton = xCardSwitchButton; protected int getTabMoveIndex(CardSwitchButton btn) {
return 0;
} }
} }

46
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java

@ -1,64 +1,34 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.FRLogger; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
* Created by zhouping on 2017/2/9. * Created by zhouping on 2017/2/9.
*/ */
public class TabMoveNextAction extends FormUndoableAction { public class TabMoveNextAction extends TabMoveAction {
private XCardSwitchButton xCardSwitchButton;
public TabMoveNextAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { public TabMoveNextAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t); super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_Next")); this.setName(Inter.getLocText("FR-Designer-Move_Tab_Next"));
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/right.png")); this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/right.png"));
this.xCardSwitchButton = xCardSwitchButton;
} }
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) {
XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout();
XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout();
CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData();
try {
int currentIndex = currentButton.getIndex();
XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex);
WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData();
xwCardTagLayout.setSwitchingTab(true);
//修改下一个tab的索引号 //修改下一个tab的索引号
CardSwitchButton nextBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex + 1).toData(); CardSwitchButton nextBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex + 1).toData();
nextBtn.setIndex(currentIndex); nextBtn.setIndex(currentIndex);
WTabFitLayout nextTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex + 1).toData(); WTabFitLayout nextTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex + 1).toData();
nextTab.setIndex(currentIndex); nextTab.setIndex(currentIndex);
nextTab.setTabNameIndex(currentIndex); nextTab.setTabNameIndex(currentIndex);
xwCardTagLayout.remove(xCardSwitchButton);
xwCardTagLayout.add(xCardSwitchButton, currentIndex + 1);
xwCardLayout.remove(xCurrentTab);
xwCardLayout.add(xCurrentTab, currentIndex + 1);
currentButton.setIndex(currentIndex + 1);
currentTab.setIndex(currentIndex + 1);
currentTab.setTabNameIndex(currentIndex + 1);
xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){
xwCardTagLayout.setSwitchingTab(false);
FRLogger.getLogger().error(e.getMessage());
return false;
}
return true;
} }
public XCardSwitchButton getxCardSwitchButton() { @Override
return xCardSwitchButton; protected int getTabMoveIndex(CardSwitchButton currentButton) {
} return currentButton.getIndex() + 1;
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
} }
} }

46
designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java

@ -1,64 +1,34 @@
package com.fr.design.designer.creator.cardlayout; package com.fr.design.designer.creator.cardlayout;
import com.fr.base.BaseUtils;
import com.fr.design.designer.beans.actions.FormUndoableAction;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.CardSwitchButton;
import com.fr.form.ui.container.cardlayout.WTabFitLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout;
import com.fr.general.FRLogger; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
/** /**
* Created by zhouping on 2017/2/9. * Created by zhouping on 2017/2/9.
*/ */
public class TabMovePrevAction extends FormUndoableAction { public class TabMovePrevAction extends TabMoveAction {
private XCardSwitchButton xCardSwitchButton;
public TabMovePrevAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { public TabMovePrevAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) {
super(t); super(t, xCardSwitchButton);
this.setName(Inter.getLocText("FR-Designer-Move_Tab_Prev")); this.setName(Inter.getLocText("FR-Designer-Move_Tab_Prev"));
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/left.png")); this.setSmallIcon(IOUtils.readIcon("com/fr/design/images/control/left.png"));
this.xCardSwitchButton = xCardSwitchButton;
} }
@Override @Override
public boolean executeActionReturnUndoRecordNeeded() { protected void changeTabIndex(XWCardTagLayout xwCardTagLayout, XWCardLayout xwCardLayout, int currentIndex, int maxIndex) {
XWCardTagLayout xwCardTagLayout = xCardSwitchButton.getTagLayout();
XWCardLayout xwCardLayout = xCardSwitchButton.getCardLayout();
CardSwitchButton currentButton = (CardSwitchButton) xCardSwitchButton.toData();
try {
int currentIndex = currentButton.getIndex();
XWTabFitLayout xCurrentTab = (XWTabFitLayout) xwCardLayout.getXCreator(currentIndex);
WTabFitLayout currentTab = (WTabFitLayout) xCurrentTab.toData();
xwCardTagLayout.setSwitchingTab(true);
//修改上一个tab的索引号 //修改上一个tab的索引号
CardSwitchButton prevBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex - 1).toData(); CardSwitchButton prevBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex - 1).toData();
prevBtn.setIndex(currentIndex); prevBtn.setIndex(currentIndex);
WTabFitLayout prevTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex - 1).toData(); WTabFitLayout prevTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex - 1).toData();
prevTab.setIndex(currentIndex); prevTab.setIndex(currentIndex);
prevTab.setTabNameIndex(currentIndex); prevTab.setTabNameIndex(currentIndex);
xwCardTagLayout.remove(xCardSwitchButton);
xwCardTagLayout.add(xCardSwitchButton, currentIndex - 1);
xwCardLayout.remove(xCurrentTab);
xwCardLayout.add(xCurrentTab, currentIndex - 1);
currentButton.setIndex(currentIndex - 1);
currentTab.setIndex(currentIndex - 1);
currentTab.setTabNameIndex(currentIndex - 1);
xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){
xwCardTagLayout.setSwitchingTab(false);
FRLogger.getLogger().error(e.getMessage());
return false;
}
return true;
} }
public XCardSwitchButton getxCardSwitchButton() { @Override
return xCardSwitchButton; protected int getTabMoveIndex(CardSwitchButton currentButton) {
} return currentButton.getIndex() - 1;
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) {
this.xCardSwitchButton = xCardSwitchButton;
} }
} }

10
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -296,8 +296,14 @@ public class XWCardLayout extends XLayoutContainer {
* @return 嵌套与否 * @return 嵌套与否
*/ */
private boolean isNested() { private boolean isNested() {
XLayoutContainer xLayoutContainer = this.getBackupParent().getBackupParent(); XCreator xCreator = (XCreator)this.getBackupParent().getParent();
return xLayoutContainer != null && xLayoutContainer.acceptType(XWTabFitLayout.class); while (xCreator != null) {
if (xCreator.acceptType(XWCardMainBorderLayout.class)) {
return true;
}
xCreator = (XCreator) xCreator.getParent();
}
return false;
} }
public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException { public CRPropertyDescriptor[] getisCarousel() throws IntrospectionException {

20
designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -26,8 +26,11 @@ import java.util.Comparator;
public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPropertiesGroupModel { public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPropertiesGroupModel {
private LayoutTypeEditor layoutTypeEditor; private LayoutTypeEditor layoutTypeEditor;
private LayoutTypeRenderer layoutTypeRenderer; private LayoutTypeRenderer layoutTypeRenderer;
//默认body是0,自适应布局;1,绝对布局. //默认body是0,自适应布局;1,绝对布局.
private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE; private WBodyLayoutType layoutType = WBodyLayoutType.ABSOLUTE;
private static final int EACH_ROW_COUNT = 4;
public FRAbsoluteBodyLayoutPropertiesGroupModel(XWAbsoluteBodyLayout xwAbsoluteBodyLayout) { public FRAbsoluteBodyLayoutPropertiesGroupModel(XWAbsoluteBodyLayout xwAbsoluteBodyLayout) {
super(xwAbsoluteBodyLayout); super(xwAbsoluteBodyLayout);
} }
@ -180,9 +183,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
// 把绝对布局中的元素按规则移动到自适应布局中 // 把绝对布局中的元素按规则移动到自适应布局中
// 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度 // 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) { private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
int eachRowCount = 4;
Component[] components = xwFitLayout.getComponents(); Component[] components = xwFitLayout.getComponents();
if (components.length <= 1){ if (components.length == 0){
xwFitLayout.updateBoundsWidget(); xwFitLayout.updateBoundsWidget();
return; return;
} }
@ -191,17 +193,17 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
int leftMargin = xwFitLayout.toData().getMargin().getLeft(); int leftMargin = xwFitLayout.toData().getMargin().getLeft();
int topMargin = xwFitLayout.toData().getMargin().getTop(); int topMargin = xwFitLayout.toData().getMargin().getTop();
xwFitLayout.toData().setCompInterval(0); xwFitLayout.toData().setCompInterval(0);
int row = (components.length / eachRowCount) + (components.length % eachRowCount == 0 ? 0 : 1); int row = (components.length / EACH_ROW_COUNT) + (components.length % EACH_ROW_COUNT == 0 ? 0 : 1);
//最后一行的列数不定 //最后一行的列数不定
int column = components.length % eachRowCount == 0 ? eachRowCount : components.length % eachRowCount; int column = components.length % EACH_ROW_COUNT == 0 ? EACH_ROW_COUNT : components.length % EACH_ROW_COUNT;
int componentWidth = layoutWidth / eachRowCount; int componentWidth = layoutWidth / EACH_ROW_COUNT;
int componentHeight = layoutHeight / row; int componentHeight = layoutHeight / row;
for(int i = 0;i < row - 1;i++){ for(int i = 0;i < row - 1;i++){
for(int j = 0;j < eachRowCount;j++){ for(int j = 0;j < EACH_ROW_COUNT;j++){
components[eachRowCount * i + j].setBounds( components[EACH_ROW_COUNT * i + j].setBounds(
leftMargin + componentWidth * j, leftMargin + componentWidth * j,
topMargin + componentHeight * i, topMargin + componentHeight * i,
j == eachRowCount - 1 ? layoutWidth - componentWidth * (eachRowCount - 1) : componentWidth, j == EACH_ROW_COUNT - 1 ? layoutWidth - componentWidth * (EACH_ROW_COUNT - 1) : componentWidth,
componentHeight componentHeight
); );
} }
@ -210,7 +212,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
int lastRowWidth = layoutWidth / column; int lastRowWidth = layoutWidth / column;
int lastRowHeight = layoutHeight - componentHeight * (row - 1); int lastRowHeight = layoutHeight - componentHeight * (row - 1);
for (int i = 0;i < column;i++) { for (int i = 0;i < column;i++) {
components[eachRowCount * (row - 1) + i].setBounds( components[EACH_ROW_COUNT * (row - 1) + i].setBounds(
leftMargin + lastRowWidth * i, leftMargin + lastRowWidth * i,
topMargin + componentHeight * (row - 1), topMargin + componentHeight * (row - 1),
i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth, i == column - 1 ? layoutWidth - lastRowWidth * (column - 1) : lastRowWidth,

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

@ -11,6 +11,7 @@ import com.fr.design.designer.beans.location.Location;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel; import com.fr.design.designer.beans.models.StateModel;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.xpane.ToolTipEditor; import com.fr.design.gui.xpane.ToolTipEditor;
@ -519,6 +520,10 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
XCreator creator = designer.getComponentAt(e); XCreator creator = designer.getComponentAt(e);
if (e.getButton() != MouseEvent.BUTTON1 && !creator.acceptType(XCardSwitchButton.class)) {
return;
}
creator = processTopLayoutMouseClick(creator); creator = processTopLayoutMouseClick(creator);
if(creator != null){ if(creator != null){

Loading…
Cancel
Save