You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.6 KiB
128 lines
4.6 KiB
package com.fr.design.report.fit; |
|
|
|
|
|
import com.fr.design.designer.properties.items.Item; |
|
import com.fr.form.fit.common.LightTool; |
|
import com.fr.form.main.BodyScaleAttrTransformer; |
|
import com.fr.form.main.Form; |
|
import com.fr.form.ui.container.WAbsoluteLayout; |
|
import com.fr.form.ui.container.WBodyLayoutType; |
|
import com.fr.form.ui.container.WFitLayout; |
|
|
|
public enum FormFitAttrModelType { |
|
PLAIN_FORM_FIT_ATTR_MODEL { |
|
@Override |
|
public FitAttrModel getFitAttrModel() { |
|
return new FrmFitAttrModel(); |
|
} |
|
|
|
@Override |
|
public Item[] getFitLayoutScaleAttr() { |
|
return new Item[]{ |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN)}; |
|
|
|
} |
|
|
|
@Override |
|
public Item[] getAbsoluteLayoutSaleAttr() { |
|
return new Item[]{ |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WAbsoluteLayout.STATE_FIT), |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), WAbsoluteLayout.STATE_FIXED) |
|
}; |
|
} |
|
|
|
|
|
@Override |
|
public int getScaleAttrShowIndex(WFitLayout wFitLayout) { |
|
int scale = wFitLayout.getScaleAttr(); |
|
if (wFitLayout.getBodyLayoutType() == WBodyLayoutType.FIT) { |
|
return BodyScaleAttrTransformer.getFitBodyCompStateFromScaleAttr(scale); |
|
} else { |
|
return BodyScaleAttrTransformer.getAbsoluteBodyCompStateFromScaleAttr(scale); |
|
} |
|
} |
|
|
|
@Override |
|
public int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType) { |
|
if (wBodyLayoutType == WBodyLayoutType.FIT) { |
|
if (showIndex == 0) { |
|
return WFitLayout.SCALE_FULL; |
|
} else { |
|
return WFitLayout.SCALE_HOR; |
|
} |
|
} else { |
|
if (showIndex == 0) { |
|
return WFitLayout.SCALE_FULL; |
|
} else { |
|
return WFitLayout.SCALE_NO; |
|
} |
|
} |
|
} |
|
|
|
|
|
}, |
|
NEW_FORM_FIT_ATTR_MODEL { |
|
@Override |
|
public FitAttrModel getFitAttrModel() { |
|
return new AdaptiveFrmFitAttrModel(); |
|
} |
|
|
|
@Override |
|
public Item[] getFitLayoutScaleAttr() { |
|
return new Item[]{ |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN), |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), 2)}; |
|
} |
|
|
|
@Override |
|
public Item[] getAbsoluteLayoutSaleAttr() { |
|
return new Item[]{ |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Bidirectional_Adaptive"), WFitLayout.STATE_FULL), |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Horizontal_Adaptive"), WFitLayout.STATE_ORIGIN), |
|
new Item(com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Fit-No"), 2)}; |
|
} |
|
|
|
|
|
@Override |
|
public int getScaleAttrShowIndex(WFitLayout wFitLayout) { |
|
int scale = wFitLayout.getScaleAttr(); |
|
if (scale == WFitLayout.SCALE_NO) { |
|
return 2; |
|
} else if (scale == WFitLayout.SCALE_HOR) { |
|
return 1; |
|
} else { |
|
return 0; |
|
} |
|
} |
|
|
|
@Override |
|
public int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType) { |
|
if (showIndex == 0) { |
|
return WFitLayout.SCALE_FULL; |
|
} else if (showIndex == 1) { |
|
return WFitLayout.SCALE_HOR; |
|
} else { |
|
return WFitLayout.SCALE_NO; |
|
} |
|
} |
|
|
|
|
|
}; |
|
|
|
public abstract FitAttrModel getFitAttrModel(); |
|
|
|
public abstract Item[] getFitLayoutScaleAttr(); |
|
|
|
public abstract Item[] getAbsoluteLayoutSaleAttr(); |
|
|
|
public abstract int getScaleAttrShowIndex(WFitLayout wFitLayout); |
|
|
|
public abstract int parseScaleAttrFromShowIndex(int showIndex, WBodyLayoutType wBodyLayoutType); |
|
|
|
|
|
public static FormFitAttrModelType parse(Form form) { |
|
return LightTool.containNewFormFlag(form) ? NEW_FORM_FIT_ATTR_MODEL : PLAIN_FORM_FIT_ATTR_MODEL; |
|
} |
|
}
|
|
|