plough
8 years ago
16 changed files with 461 additions and 101 deletions
@ -0,0 +1,32 @@
|
||||
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; |
||||
|
||||
/** |
||||
* Created by zhouping on 2017/2/9. |
||||
*/ |
||||
public class TabMoveCustomAction extends FormUndoableAction { |
||||
private XCardSwitchButton xCardSwitchButton; |
||||
|
||||
public TabMoveCustomAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { |
||||
super(t); |
||||
this.setName(""); |
||||
this.setSmallIcon(BaseUtils.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; |
||||
} |
||||
} |
@ -0,0 +1,66 @@
|
||||
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.form.ui.CardSwitchButton; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by zhouping on 2017/2/9. |
||||
*/ |
||||
public class TabMoveEndAction extends FormUndoableAction { |
||||
private XCardSwitchButton xCardSwitchButton; |
||||
|
||||
public TabMoveEndAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { |
||||
super(t); |
||||
this.setName(Inter.getLocText("FR-Designer-Move_Tab_End")); |
||||
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/rightright.png")); |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
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的索引号
|
||||
for (int i = currentIndex + 1; i < maxIndex; i++) { |
||||
CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); |
||||
tempBtn.setIndex(i - 1); |
||||
WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); |
||||
tempTab.setIndex(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() { |
||||
return xCardSwitchButton; |
||||
} |
||||
|
||||
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
} |
@ -0,0 +1,65 @@
|
||||
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.form.ui.CardSwitchButton; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by zhouping on 2017/2/9. |
||||
*/ |
||||
public class TabMoveFirstAction extends FormUndoableAction { |
||||
private XCardSwitchButton xCardSwitchButton; |
||||
|
||||
public TabMoveFirstAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { |
||||
super(t); |
||||
this.setName(Inter.getLocText("FR-Designer-Move_Tab_First")); |
||||
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/leftleft.png")); |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
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的索引号
|
||||
for (int i = currentIndex - 1; i >= 0; i--) { |
||||
CardSwitchButton tempBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(i).toData(); |
||||
tempBtn.setIndex(i + 1); |
||||
WTabFitLayout tempTab = (WTabFitLayout) xwCardLayout.getXCreator(i).toData(); |
||||
tempTab.setIndex(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) { |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
} |
@ -0,0 +1,64 @@
|
||||
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.form.ui.CardSwitchButton; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by zhouping on 2017/2/9. |
||||
*/ |
||||
public class TabMoveNextAction extends FormUndoableAction { |
||||
private XCardSwitchButton xCardSwitchButton; |
||||
|
||||
public TabMoveNextAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { |
||||
super(t); |
||||
this.setName(Inter.getLocText("FR-Designer-Move_Tab_Next")); |
||||
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/right.png")); |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
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的索引号
|
||||
CardSwitchButton nextBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex + 1).toData(); |
||||
nextBtn.setIndex(currentIndex); |
||||
WTabFitLayout nextTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex + 1).toData(); |
||||
nextTab.setIndex(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() { |
||||
return xCardSwitchButton; |
||||
} |
||||
|
||||
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
} |
@ -0,0 +1,64 @@
|
||||
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.form.ui.CardSwitchButton; |
||||
import com.fr.form.ui.container.cardlayout.WTabFitLayout; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Created by zhouping on 2017/2/9. |
||||
*/ |
||||
public class TabMovePrevAction extends FormUndoableAction { |
||||
private XCardSwitchButton xCardSwitchButton; |
||||
|
||||
public TabMovePrevAction(FormDesigner t, XCardSwitchButton xCardSwitchButton) { |
||||
super(t); |
||||
this.setName(Inter.getLocText("FR-Designer-Move_Tab_Prev")); |
||||
this.setSmallIcon(BaseUtils.readIcon("com/fr/design/images/control/left.png")); |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
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的索引号
|
||||
CardSwitchButton prevBtn = (CardSwitchButton) xwCardTagLayout.getXCreator(currentIndex - 1).toData(); |
||||
prevBtn.setIndex(currentIndex); |
||||
WTabFitLayout prevTab = (WTabFitLayout) xwCardLayout.getXCreator(currentIndex - 1).toData(); |
||||
prevTab.setIndex(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() { |
||||
return xCardSwitchButton; |
||||
} |
||||
|
||||
public void setxCardSwitchButton(XCardSwitchButton xCardSwitchButton) { |
||||
this.xCardSwitchButton = xCardSwitchButton; |
||||
} |
||||
} |
Loading…
Reference in new issue