Browse Source
# Conflicts: # designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.javafinal/10.0
jeo
5 years ago
28 changed files with 745 additions and 132 deletions
@ -0,0 +1,72 @@
|
||||
package com.fr.design.mainframe.mobile.ui; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.gui.itextfield.UIIntNumberField; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.widget.UITitleSplitLine; |
||||
import com.fr.form.ui.mobile.MobileCollapsedStyle; |
||||
import com.fr.form.ui.mobile.MobileFormCollapsedStyle; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/2/13 |
||||
*/ |
||||
public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane { |
||||
|
||||
private static final Dimension DEFAULT_SPINNER_SIZE = new Dimension(60, 24); |
||||
|
||||
private UISpinner rowSpinner; |
||||
|
||||
public MobileCollapsedStyleExpandPane() { |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createLinePane() { |
||||
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520); |
||||
splitLine.setPreferredSize(new Dimension(520, 20)); |
||||
this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1) { |
||||
@Override |
||||
protected UINumberField initNumberField(){ |
||||
return new UIIntNumberField(); |
||||
} |
||||
}; |
||||
rowSpinner.setPreferredSize(DEFAULT_SPINNER_SIZE); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); |
||||
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From"))); |
||||
panel.add(rowSpinner); |
||||
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Row_To_Fold"))); |
||||
JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
linePane.add(splitLine, BorderLayout.NORTH); |
||||
linePane.add(panel, BorderLayout.CENTER); |
||||
return linePane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileCollapsedStyle ob) { |
||||
super.populateBean(ob); |
||||
rowSpinner.setValue(((MobileFormCollapsedStyle) ob).getLineAttr().getNumber()); |
||||
} |
||||
|
||||
@Override |
||||
public MobileCollapsedStyle updateBean() { |
||||
MobileCollapsedStyle style = super.updateBean(); |
||||
((MobileFormCollapsedStyle) style).getLineAttr().setNumber((int) rowSpinner.getValue()); |
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
protected MobileCollapsedStyle updateDiffBean() { |
||||
return new MobileFormCollapsedStyle(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,125 @@
|
||||
package com.fr.design.mainframe.mobile.ui; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.ibutton.ModeButtonGroup; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
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.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.layout.VerticalFlowLayout; |
||||
import com.fr.design.mainframe.widget.UITitleSplitLine; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.form.ui.mobile.CollapseState; |
||||
import com.fr.form.ui.mobile.MobileChartCollapsedStyle; |
||||
import com.fr.form.ui.mobile.MobileCollapsedStyle; |
||||
|
||||
import javax.swing.JPanel; |
||||
import javax.swing.border.TitledBorder; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/2/13 |
||||
*/ |
||||
public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle> { |
||||
|
||||
private UICheckBox showButtonCheck; |
||||
private NewColorSelectBox buttonColorBox; |
||||
private UITextField foldedTextFiled; |
||||
private UITextField unfoldedTextFiled; |
||||
private ModeButtonGroup<CollapseState> buttonGroup; |
||||
|
||||
|
||||
public MobileCollapsedStylePane() { |
||||
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null); |
||||
VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10); |
||||
layout.setAlignLeft(true); |
||||
this.setBorder(titledBorder); |
||||
this.setLayout(layout); |
||||
this.add(createLinePane()); |
||||
this.add(createSettingPane()); |
||||
} |
||||
|
||||
private JPanel createSettingPane() { |
||||
JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"), 520); |
||||
splitLine.setPreferredSize(new Dimension(520, 20)); |
||||
UILabel showButtonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button")); |
||||
showButtonCheck = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right")); |
||||
UILabel buttonColorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color")); |
||||
buttonColorBox = new NewColorSelectBox(137); |
||||
UILabel foldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint")); |
||||
foldedTextFiled = new UITextField(); |
||||
UILabel unfoldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint")); |
||||
unfoldedTextFiled = new UITextField(); |
||||
UILabel defaultStateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State")); |
||||
buttonGroup = new ModeButtonGroup<>(); |
||||
UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold")); |
||||
foldedButton.setSelected(true); |
||||
UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold")); |
||||
buttonGroup.put(CollapseState.FOLDED, foldedButton); |
||||
buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton); |
||||
JPanel flowLeftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
flowLeftPane.add(foldedButton); |
||||
flowLeftPane.add(unfoldedButton); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p, p}; |
||||
double[] colSize = {p, f}; |
||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||
Component[][] components = new Component[][] { |
||||
new Component[] {showButtonLabel, showButtonCheck}, |
||||
new Component[] {buttonColorLabel, buttonColorBox}, |
||||
new Component[] {foldedLabel, foldedTextFiled}, |
||||
new Component[] {unfoldedLabel, unfoldedTextFiled}, |
||||
new Component[] {defaultStateLabel, flowLeftPane}, |
||||
}; |
||||
JPanel buttonPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); |
||||
settingPane.add(splitLine, BorderLayout.NORTH); |
||||
settingPane.add(buttonPane, BorderLayout.CENTER); |
||||
return settingPane; |
||||
} |
||||
|
||||
protected JPanel createLinePane() { |
||||
return FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileCollapsedStyle ob) { |
||||
showButtonCheck.setSelected(ob.getCollapseButton().isShowButton()); |
||||
buttonColorBox.setSelectObject(ob.getCollapseButton().getButtonColor()); |
||||
foldedTextFiled.setText(ob.getCollapseButton().getFoldedHint()); |
||||
unfoldedTextFiled.setText(ob.getCollapseButton().getUnfoldedHint()); |
||||
buttonGroup.setSelectButton(ob.getCollapseButton().getDefaultState()); |
||||
} |
||||
|
||||
@Override |
||||
public MobileCollapsedStyle updateBean() { |
||||
MobileCollapsedStyle style = updateDiffBean(); |
||||
style.getCollapseButton().setShowButton(showButtonCheck.isSelected()); |
||||
style.getCollapseButton().setButtonColor(buttonColorBox.getSelectObject()); |
||||
style.getCollapseButton().setFoldedHint(foldedTextFiled.getText()); |
||||
style.getCollapseButton().setUnfoldedHint(unfoldedTextFiled.getText()); |
||||
style.getCollapseButton().setDefaultState(buttonGroup.getCurrentSelected()); |
||||
return style; |
||||
} |
||||
|
||||
protected MobileCollapsedStyle updateDiffBean() { |
||||
return new MobileChartCollapsedStyle(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand"); |
||||
} |
||||
} |
@ -0,0 +1,100 @@
|
||||
package com.fr.design.mainframe.mobile.ui; |
||||
|
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.form.ui.mobile.MobileCollapsedStyle; |
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/2/13 |
||||
*/ |
||||
public class MobileComboBoxDialogEditor extends BasicPane { |
||||
|
||||
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400); |
||||
private static final Dimension COMBOX_DIMENSION = new Dimension(135,20); |
||||
private static final String NONE = Toolkit.i18nText("Fine-Design_Mobile_Collapse_None"); |
||||
private static final String CUSTOM = Toolkit.i18nText("Fine-Design_Mobile_Collapse_Custom"); |
||||
|
||||
|
||||
private MobileCollapsedStyle style; |
||||
private MobileCollapsedStylePane stylePane; |
||||
private UIComboBox comboBox; |
||||
private ActionListener listener; |
||||
|
||||
public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) { |
||||
this.stylePane = stylePane; |
||||
this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM}); |
||||
this.comboBox.setPreferredSize(COMBOX_DIMENSION); |
||||
this.comboBox.setSelectedItem(NONE); |
||||
listener = new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (ComparatorUtils.equals(MobileComboBoxDialogEditor.this.comboBox.getSelectedItem(), CUSTOM)) { |
||||
showEditorPane(); |
||||
} |
||||
} |
||||
}; |
||||
this.comboBox.addActionListener(listener); |
||||
this.add(comboBox); |
||||
|
||||
} |
||||
|
||||
public boolean isSelectedCustom() { |
||||
return ComparatorUtils.equals(CUSTOM, this.comboBox.getSelectedItem()); |
||||
} |
||||
|
||||
public void setSelected(boolean selectedCustom) { |
||||
this.comboBox.removeActionListener(listener); |
||||
this.comboBox.setSelectedItem(selectedCustom ? CUSTOM : NONE); |
||||
this.comboBox.addActionListener(listener); |
||||
} |
||||
|
||||
private void showEditorPane() { |
||||
stylePane.setPreferredSize(DEFAULT_DIMENSION); |
||||
BasicDialog dialog = stylePane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||
dialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
MobileCollapsedStyle style = stylePane.updateBean(); |
||||
style.setCollapsedWork(true); |
||||
setStyle(style); |
||||
MobileComboBoxDialogEditor.this.firePropertyChanged(); |
||||
} |
||||
}); |
||||
stylePane.populateBean(getStyle()); |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
|
||||
protected void firePropertyChanged() { |
||||
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified(); |
||||
} |
||||
|
||||
public MobileCollapsedStyle getStyle() { |
||||
return style; |
||||
} |
||||
|
||||
public void setStyle(MobileCollapsedStyle style) { |
||||
this.style = style; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.os.impl; |
||||
|
||||
import com.fr.general.GeneralContext; |
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
import org.junit.Test; |
||||
|
||||
import java.util.Locale; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/1/16 |
||||
*/ |
||||
public class SupportOSImplTest extends TestCase { |
||||
|
||||
@Test |
||||
public void testAutoPush() { |
||||
Assert.assertTrue(SupportOSImpl.AUTOPUSHUPDATE.support()); |
||||
GeneralContext.setLocale(Locale.TAIWAN); |
||||
Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support()); |
||||
} |
||||
|
||||
} |
@ -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.MobileBookMarkDefinePane; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/2/12 |
||||
*/ |
||||
public class MobileBooKMarkUsePropertyUI extends AbstractWidgetPropertyUIProvider { |
||||
|
||||
private XCreator xCreator; |
||||
|
||||
public MobileBooKMarkUsePropertyUI(XCreator xCreator) { |
||||
this.xCreator = xCreator; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractPropertyTable createWidgetAttrTable() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BasicPane createWidgetAttrPane() { |
||||
return new MobileBookMarkDefinePane(xCreator); |
||||
} |
||||
|
||||
@Override |
||||
public String tableTitle() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
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.MobileBookMarkUsePane; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/2/12 |
||||
*/ |
||||
public class MobileBookMarkDefinePane extends MobileWidgetDefinePane { |
||||
|
||||
private XCreator xCreator; |
||||
private MobileBookMarkUsePane mobileBookMarkUsePane; |
||||
|
||||
public MobileBookMarkDefinePane(XCreator xCreator) { |
||||
this.xCreator = xCreator; |
||||
} |
||||
|
||||
@Override |
||||
public void initPropertyGroups(Object source) { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
this.mobileBookMarkUsePane = new MobileBookMarkUsePane(); |
||||
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, mobileBookMarkUsePane); |
||||
panel.add(uiExpandablePane); |
||||
this.add(panel, 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.bindListeners2Widgets(); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
this.mobileBookMarkUsePane.update(xCreator); |
||||
} |
||||
} |
@ -0,0 +1,86 @@
|
||||
package com.fr.design.widget.ui.designer.mobile.component; |
||||
|
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.designer.creator.XCreator; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.container.WLayout; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/2/12 |
||||
*/ |
||||
public class MobileBookMarkUsePane extends BasicPane { |
||||
|
||||
private UICheckBox showHierarchicalBookmarksCheck; |
||||
|
||||
public MobileBookMarkUsePane() { |
||||
initComponent(); |
||||
} |
||||
|
||||
|
||||
private void initComponent() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.showHierarchicalBookmarksCheck = new UICheckBox( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true) { |
||||
@Override |
||||
protected void initListener() { |
||||
this.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
attributeChange(); |
||||
} |
||||
}); |
||||
} |
||||
}; |
||||
UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint")); |
||||
hintLabel.setForeground(Color.GRAY); |
||||
double f = TableLayout.FILL; |
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {f}; |
||||
int[][] rowCount = {{1}, {1}}; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{this.showHierarchicalBookmarksCheck}, |
||||
new Component[]{hintLabel} |
||||
}; |
||||
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, |
||||
IntervalConstants.INTERVAL_L1, |
||||
IntervalConstants.INTERVAL_L1); |
||||
showBookMarkPane.setBorder( |
||||
BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0)); |
||||
wrapPane.add(showBookMarkPane, BorderLayout.CENTER); |
||||
this.add(showBookMarkPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(XCreator xCreator) { |
||||
WLayout wLayout = ((WLayout) xCreator.toData()); |
||||
this.showHierarchicalBookmarksCheck.setSelected(wLayout.isShowBookmarks()); |
||||
} |
||||
|
||||
public void update(XCreator xCreator) { |
||||
WLayout wLayout = ((WLayout) xCreator.toData()); |
||||
wLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected()); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "MobileBookMarkUsePane"; |
||||
} |
||||
} |
Loading…
Reference in new issue