Browse Source

REPORT-1814 表单tab块的改良bug

轮播bug以及页签拖动的bug
master
zhouping 8 years ago
parent
commit
9553260916
  1. 6
      designer_base/src/com/fr/design/locale/designer_en_US.properties
  2. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveEndAction.java
  3. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveFirstAction.java
  4. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMoveNextAction.java
  5. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/TabMovePrevAction.java
  6. 4
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  7. 20
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  8. 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

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

@ -47,6 +47,8 @@ public class TabMoveEndAction extends FormUndoableAction {
currentButton.setIndex(maxIndex - 1); currentButton.setIndex(maxIndex - 1);
currentTab.setIndex(maxIndex - 1); currentTab.setIndex(maxIndex - 1);
currentTab.setTabNameIndex(maxIndex - 1); currentTab.setTabNameIndex(maxIndex - 1);
xwCardLayout.toData().setShowIndex(maxIndex - 1);
xwCardLayout.showCard();
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){ }catch (Exception e){
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);

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

@ -46,6 +46,8 @@ public class TabMoveFirstAction extends FormUndoableAction {
currentButton.setIndex(0); currentButton.setIndex(0);
currentTab.setIndex(0); currentTab.setIndex(0);
currentTab.setTabNameIndex(0); currentTab.setTabNameIndex(0);
xwCardLayout.toData().setShowIndex(0);
xwCardLayout.showCard();
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){ }catch (Exception e){
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);

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

@ -45,6 +45,8 @@ public class TabMoveNextAction extends FormUndoableAction {
currentButton.setIndex(currentIndex + 1); currentButton.setIndex(currentIndex + 1);
currentTab.setIndex(currentIndex + 1); currentTab.setIndex(currentIndex + 1);
currentTab.setTabNameIndex(currentIndex + 1); currentTab.setTabNameIndex(currentIndex + 1);
xwCardLayout.toData().setShowIndex(currentIndex + 1);
xwCardLayout.showCard();
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){ }catch (Exception e){
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);

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

@ -45,6 +45,8 @@ public class TabMovePrevAction extends FormUndoableAction {
currentButton.setIndex(currentIndex - 1); currentButton.setIndex(currentIndex - 1);
currentTab.setIndex(currentIndex - 1); currentTab.setIndex(currentIndex - 1);
currentTab.setTabNameIndex(currentIndex - 1); currentTab.setTabNameIndex(currentIndex - 1);
xwCardLayout.toData().setShowIndex(currentIndex - 1);
xwCardLayout.showCard();
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);
}catch (Exception e){ }catch (Exception e){
xwCardTagLayout.setSwitchingTab(false); xwCardTagLayout.setSwitchingTab(false);

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

@ -295,9 +295,9 @@ public class XWCardLayout extends XLayoutContainer {
* 判断当前tab组件是不是嵌套的 * 判断当前tab组件是不是嵌套的
* @return 嵌套与否 * @return 嵌套与否
*/ */
private boolean isNested(){ private boolean isNested() {
XLayoutContainer xLayoutContainer = this.getBackupParent().getBackupParent(); XLayoutContainer xLayoutContainer = this.getBackupParent().getBackupParent();
return xLayoutContainer != null && xLayoutContainer.acceptType(XWTabFitLayout.class); return xLayoutContainer == null || xLayoutContainer.acceptType(XWTabFitLayout.class);
} }
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