@ -0,0 +1,36 @@ |
|||||||
|
package com.fr.design.fun; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.JTemplate; |
||||||
|
import com.fr.design.menu.ShortCut; |
||||||
|
import com.fr.stable.fun.mark.Immutable; |
||||||
|
|
||||||
|
import javax.swing.JComponent; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.awt.image.BufferedImage; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
* 临时接口,后续自适应内置后删除 |
||||||
|
*/ |
||||||
|
public interface FormAdaptiveConfigUIProcessor extends Immutable { |
||||||
|
|
||||||
|
String MARK_STRING = "FormAdaptiveConfigUIProcessor"; |
||||||
|
int CURRENT_LEVEL = 1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取表单自适应配置菜单 |
||||||
|
* @return 表单自适应配置菜单 |
||||||
|
*/ |
||||||
|
ShortCut getConfigShortCut(JTemplate jTemplate); |
||||||
|
|
||||||
|
/** |
||||||
|
* 绘制自适应下报表块在表单界面中显示图片 |
||||||
|
* @param size 绘制尺寸 |
||||||
|
* @param elementCasePane 报表块内容对象 |
||||||
|
* @return 自适应下报表块在表单界面中显示的图片 |
||||||
|
*/ |
||||||
|
BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane); |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,39 @@ |
|||||||
|
package com.fr.design.fun; |
||||||
|
|
||||||
|
import com.fr.stable.fun.mark.Mutable; |
||||||
|
import com.fr.stable.unit.UNIT; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
public interface ReportLengthUNITProvider extends Mutable { |
||||||
|
String MARK_STRING = "ReportLengthUNITProvider"; |
||||||
|
|
||||||
|
int CURRENT_LEVEL = 1; |
||||||
|
|
||||||
|
/** |
||||||
|
* 标尺单位显示字符 |
||||||
|
* @return 标尺单位字符 |
||||||
|
*/ |
||||||
|
String unitText(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 标尺单位类型(之前是将int类型的值直接保存在数据库里面的) |
||||||
|
* @return 返回标尺单位类型 |
||||||
|
*/ |
||||||
|
int unitType(); |
||||||
|
|
||||||
|
/** |
||||||
|
* UNIT转标尺单位值 |
||||||
|
* @param value UNIT |
||||||
|
* @return 标尺单位值 |
||||||
|
*/ |
||||||
|
float unit2Value4Scale(UNIT value); |
||||||
|
|
||||||
|
/** |
||||||
|
* 标尺单位值转UNIT |
||||||
|
* @param value 标尺单位值 |
||||||
|
* @return UNIT |
||||||
|
*/ |
||||||
|
UNIT float2UNIT(float value); |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.design.fun.impl; |
||||||
|
|
||||||
|
|
||||||
|
import com.fr.design.fun.FormAdaptiveConfigUIProcessor; |
||||||
|
import com.fr.stable.fun.mark.API; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL) |
||||||
|
public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor { |
||||||
|
|
||||||
|
@Override |
||||||
|
public int currentAPILevel() { |
||||||
|
return CURRENT_LEVEL; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int layerIndex() { |
||||||
|
return DEFAULT_LAYER_INDEX; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.fr.design.fun.impl; |
||||||
|
|
||||||
|
|
||||||
|
import com.fr.design.fun.ReportLengthUNITProvider; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.stable.fun.impl.AbstractProvider; |
||||||
|
import com.fr.stable.fun.mark.API; |
||||||
|
import com.fr.stable.unit.UNIT; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
@API(level = ReportLengthUNITProvider.CURRENT_LEVEL) |
||||||
|
public abstract class AbstractReportLengthUNITProvider extends AbstractProvider implements ReportLengthUNITProvider { |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public int currentAPILevel() { |
||||||
|
return CURRENT_LEVEL; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String unitText() { |
||||||
|
return StringUtils.EMPTY; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int unitType() { |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public float unit2Value4Scale(UNIT value) { |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public UNIT float2UNIT(float value) { |
||||||
|
return UNIT.ZERO; |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,52 @@ |
|||||||
|
package com.fr.design.unit; |
||||||
|
|
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.fun.ReportLengthUNITProvider; |
||||||
|
import com.fr.design.unit.impl.CMReportLengthUNIT; |
||||||
|
import com.fr.design.unit.impl.INCHReportLengthUNIT; |
||||||
|
import com.fr.design.unit.impl.MMReportLengthUNIT; |
||||||
|
import com.fr.design.unit.impl.PTReportLengthUNIT; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
public class UnitConvertUtil { |
||||||
|
private static List<ReportLengthUNITProvider> lengthUNITList = new ArrayList<ReportLengthUNITProvider>(); |
||||||
|
|
||||||
|
static { |
||||||
|
lengthUNITList.add(new MMReportLengthUNIT()); |
||||||
|
lengthUNITList.add(new CMReportLengthUNIT()); |
||||||
|
lengthUNITList.add(new INCHReportLengthUNIT()); |
||||||
|
lengthUNITList.add(new PTReportLengthUNIT()); |
||||||
|
Set<ReportLengthUNITProvider> providers = ExtraDesignClassManager.getInstance().getArray(ReportLengthUNITProvider.MARK_STRING); |
||||||
|
for (ReportLengthUNITProvider provider : providers) { |
||||||
|
lengthUNITList.add(provider); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private UnitConvertUtil() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static ReportLengthUNITProvider parseLengthUNIT(int unitType) { |
||||||
|
for (ReportLengthUNITProvider lengthUNIT : lengthUNITList) { |
||||||
|
if (unitType == lengthUNIT.unitType()) { |
||||||
|
return lengthUNIT; |
||||||
|
} |
||||||
|
} |
||||||
|
return new MMReportLengthUNIT(); |
||||||
|
} |
||||||
|
|
||||||
|
public static String[] getUnitItems() { |
||||||
|
String[] unitItems = new String[lengthUNITList.size()]; |
||||||
|
for (int i = 0; i < lengthUNITList.size(); i++) { |
||||||
|
unitItems[i] = lengthUNITList.get(i).unitText(); |
||||||
|
} |
||||||
|
return unitItems; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.fr.design.unit.impl; |
||||||
|
|
||||||
|
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.unit.CM; |
||||||
|
import com.fr.stable.unit.UNIT; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
public class CMReportLengthUNIT extends AbstractReportLengthUNITProvider { |
||||||
|
@Override |
||||||
|
public String unitText() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_CM"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int unitType() { |
||||||
|
return Constants.UNIT_CM; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public float unit2Value4Scale(UNIT value) { |
||||||
|
return value.toCMValue4Scale2(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public UNIT float2UNIT(float value) { |
||||||
|
return new CM(value); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.fr.design.unit.impl; |
||||||
|
|
||||||
|
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.unit.INCH; |
||||||
|
import com.fr.stable.unit.UNIT; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
public class INCHReportLengthUNIT extends AbstractReportLengthUNITProvider { |
||||||
|
@Override |
||||||
|
public String unitText() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_INCH"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int unitType() { |
||||||
|
return Constants.UNIT_INCH; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public float unit2Value4Scale(UNIT value) { |
||||||
|
return value.toINCHValue4Scale3(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public UNIT float2UNIT(float value) { |
||||||
|
return new INCH(value); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.fr.design.unit.impl; |
||||||
|
|
||||||
|
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.unit.MM; |
||||||
|
import com.fr.stable.unit.UNIT; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
public class MMReportLengthUNIT extends AbstractReportLengthUNITProvider { |
||||||
|
@Override |
||||||
|
public String unitText() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_MM"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int unitType() { |
||||||
|
return Constants.UNIT_MM; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public float unit2Value4Scale(UNIT value) { |
||||||
|
return value.toMMValue4Scale2(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public UNIT float2UNIT(float value) { |
||||||
|
return new MM(value); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.fr.design.unit.impl; |
||||||
|
|
||||||
|
import com.fr.design.fun.impl.AbstractReportLengthUNITProvider; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.unit.PT; |
||||||
|
import com.fr.stable.unit.UNIT; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2020-04-09 |
||||||
|
*/ |
||||||
|
public class PTReportLengthUNIT extends AbstractReportLengthUNITProvider { |
||||||
|
@Override |
||||||
|
public String unitText() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Unit_PT_Duplicate"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int unitType() { |
||||||
|
return Constants.UNIT_PT; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public float unit2Value4Scale(UNIT value) { |
||||||
|
return value.toPTValue4Scale2(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public UNIT float2UNIT(float value) { |
||||||
|
return new PT(value); |
||||||
|
} |
||||||
|
} |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,36 @@ |
|||||||
|
package com.fr.design.designer.properties.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||||
|
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.MobileBookMarkCombinePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2020/4/18 |
||||||
|
*/ |
||||||
|
public class MobileBookMarkCombinePropertyUI extends AbstractWidgetPropertyUIProvider { |
||||||
|
|
||||||
|
private XCreator xCreator; |
||||||
|
|
||||||
|
public MobileBookMarkCombinePropertyUI(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractPropertyTable createWidgetAttrTable() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BasicPane createWidgetAttrPane() { |
||||||
|
return new MobileBookMarkCombinePane(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String tableTitle() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileAdvanceInnerPane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2020/4/18 |
||||||
|
*/ |
||||||
|
public class MobileBookMarkCombinePane extends MobileWidgetDefinePane { |
||||||
|
|
||||||
|
private MobileBookMarkUsePane mobileBookMarkUsePane; |
||||||
|
private MobileAdvanceInnerPane mobileAdvanceInnerPane; |
||||||
|
private XCreator xCreator; |
||||||
|
|
||||||
|
|
||||||
|
public MobileBookMarkCombinePane(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void initPropertyGroups(Object source) { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
this.mobileAdvanceInnerPane = new MobileAdvanceInnerPane(xCreator); |
||||||
|
this.mobileBookMarkUsePane = new MobileBookMarkUsePane(); |
||||||
|
panel.add(this.mobileBookMarkUsePane, BorderLayout.NORTH); |
||||||
|
panel.add(this.mobileAdvanceInnerPane, BorderLayout.CENTER); |
||||||
|
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, panel); |
||||||
|
this.add(uiExpandablePane, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
private void bindListeners2Widgets() { |
||||||
|
reInitAllListeners(); |
||||||
|
AttributeChangeListener changeListener = new AttributeChangeListener() { |
||||||
|
@Override |
||||||
|
public void attributeChange() { |
||||||
|
update(); |
||||||
|
} |
||||||
|
}; |
||||||
|
this.addAttributeChangeListener(changeListener); |
||||||
|
} |
||||||
|
|
||||||
|
private void reInitAllListeners() { |
||||||
|
initListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(FormDesigner designer) { |
||||||
|
this.mobileBookMarkUsePane.populate(xCreator); |
||||||
|
this.mobileAdvanceInnerPane.populate(); |
||||||
|
this.bindListeners2Widgets(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
this.mobileBookMarkUsePane.update(xCreator); |
||||||
|
this.mobileAdvanceInnerPane.update(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,169 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile.component; |
||||||
|
|
||||||
|
import com.fr.design.constants.LayoutConstants; |
||||||
|
import com.fr.design.designer.IntervalConstants; |
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.dialog.FineJOptionPane; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itextfield.UITextField; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.design.mainframe.WidgetPropertyPane; |
||||||
|
import com.fr.form.main.Form; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
import com.fr.form.ui.container.WLayout; |
||||||
|
import com.fr.form.ui.container.WSortLayout; |
||||||
|
import com.fr.form.ui.mobile.MobileBookMark; |
||||||
|
import com.fr.form.ui.widget.CRBoundsWidget; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.event.ChangeEvent; |
||||||
|
import javax.swing.event.ChangeListener; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.FocusAdapter; |
||||||
|
import java.awt.event.FocusEvent; |
||||||
|
import java.awt.event.KeyAdapter; |
||||||
|
import java.awt.event.KeyEvent; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2020/4/17 |
||||||
|
*/ |
||||||
|
public class MobileAdvanceInnerPane extends BasicPane { |
||||||
|
|
||||||
|
private XCreator xCreator; |
||||||
|
private UICheckBox useBookMarkCheck; |
||||||
|
private UITextField bookMarkNameField; |
||||||
|
|
||||||
|
|
||||||
|
public MobileAdvanceInnerPane(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
initComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initComponent() { |
||||||
|
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
|
this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false); |
||||||
|
this.bookMarkNameField = new UITextField() { |
||||||
|
@Override |
||||||
|
protected void initListener() { |
||||||
|
if (shouldResponseChangeListener()) { |
||||||
|
addFocusListener(new FocusAdapter() { |
||||||
|
@Override |
||||||
|
public void focusLost(FocusEvent e) { |
||||||
|
attributeChange(); |
||||||
|
} |
||||||
|
}); |
||||||
|
addKeyListener(new KeyAdapter() { |
||||||
|
@Override |
||||||
|
public void keyTyped(KeyEvent e) { |
||||||
|
if (e.getKeyCode() == KeyEvent.VK_ENTER) { |
||||||
|
attributeChange(); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
JPanel useBookMarkPane = TableLayoutHelper.createGapTableLayoutPane( |
||||||
|
new Component[][]{new Component[]{useBookMarkCheck}}, |
||||||
|
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); |
||||||
|
final JPanel bookMarkNamePane = TableLayoutHelper.createGapTableLayoutPane( |
||||||
|
new Component[][]{new Component[]{new UILabel( |
||||||
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Name")), bookMarkNameField}}, |
||||||
|
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE); |
||||||
|
this.useBookMarkCheck.addChangeListener(new ChangeListener() { |
||||||
|
@Override |
||||||
|
public void stateChanged(ChangeEvent e) { |
||||||
|
boolean selected = MobileAdvanceInnerPane.this.useBookMarkCheck.isSelected(); |
||||||
|
Widget widget = MobileAdvanceInnerPane.this.xCreator.toData(); |
||||||
|
MobileBookMark bookMark = widget.getMobileBookMark(); |
||||||
|
bookMarkNamePane.setVisible(selected); |
||||||
|
if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) { |
||||||
|
String name = widget.getWidgetName(); |
||||||
|
MobileAdvanceInnerPane.this.bookMarkNameField.setText(name); |
||||||
|
bookMark.setBookMarkName(name); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark()); |
||||||
|
contentPane.add(useBookMarkPane, BorderLayout.NORTH); |
||||||
|
contentPane.add(bookMarkNamePane, BorderLayout.CENTER); |
||||||
|
this.add(contentPane); |
||||||
|
initData(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initData() { |
||||||
|
MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); |
||||||
|
String bookMarkName = bookMark.getBookMarkName(); |
||||||
|
if (StringUtils.isEmpty(bookMarkName)) { |
||||||
|
String widgetName = xCreator.toData().getWidgetName(); |
||||||
|
this.bookMarkNameField.setText(widgetName); |
||||||
|
bookMark.setBookMarkName(widgetName); |
||||||
|
} else { |
||||||
|
this.bookMarkNameField.setText(bookMarkName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void populate() { |
||||||
|
MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); |
||||||
|
this.bookMarkNameField.setText(bookMark.getBookMarkName()); |
||||||
|
if (bookMark.isFrozen()) { |
||||||
|
this.useBookMarkCheck.setSelected(false); |
||||||
|
this.useBookMarkCheck.setEnabled(false); |
||||||
|
} else { |
||||||
|
this.useBookMarkCheck.setSelected(bookMark.isUseBookMark()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void update() { |
||||||
|
MobileBookMark bookMark = xCreator.toData().getMobileBookMark(); |
||||||
|
bookMark.setUseBookMark(this.useBookMarkCheck.isSelected()); |
||||||
|
String newBookMarkName = this.bookMarkNameField.getText(); |
||||||
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
|
if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (!isExist(newBookMarkName)) { |
||||||
|
bookMark.setBookMarkName(newBookMarkName); |
||||||
|
} else { |
||||||
|
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
||||||
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"), |
||||||
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), |
||||||
|
JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); |
||||||
|
this.bookMarkNameField.setText(bookMark.getBookMarkName()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private boolean isExist(String name) { |
||||||
|
Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget(); |
||||||
|
WLayout container = form.getContainer(); |
||||||
|
WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1); |
||||||
|
List<String> list = wSortLayout.getOrderedMobileWidgetList(); |
||||||
|
for (String value : list) { |
||||||
|
Widget widget = form.getWidgetByName(value); |
||||||
|
if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value); |
||||||
|
if (boundsWidget != null && ComparatorUtils.equals(boundsWidget.getWidget().getMobileBookMark().getBookMarkName(), name)) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return "MobileAdvanceInnerPane"; |
||||||
|
} |
||||||
|
} |