|
|
|
@ -4,6 +4,7 @@ import com.fr.base.mobile.MobileFitAttrState;
|
|
|
|
|
import com.fr.design.constants.LayoutConstants; |
|
|
|
|
import com.fr.design.designer.creator.XCreator; |
|
|
|
|
import com.fr.design.foldablepane.UIExpandablePane; |
|
|
|
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
@ -11,19 +12,14 @@ import com.fr.design.gui.ispinner.UISpinner;
|
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.mainframe.FormDesigner; |
|
|
|
|
import com.fr.design.mainframe.WidgetPropertyPane; |
|
|
|
|
import com.fr.form.ui.ElementCaseEditor; |
|
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
|
import java.awt.*; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.awt.event.ItemEvent; |
|
|
|
|
import java.awt.event.ItemListener; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 报表块-移动端属性面板 |
|
|
|
@ -45,13 +41,27 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
|
|
|
|
|
private UICheckBox heightRestrictCheckBox; // 手机显示限制高度复选框
|
|
|
|
|
private UILabel maxHeightLabel; |
|
|
|
|
private UISpinner maxHeightSpinner; // 最大高度Spinner
|
|
|
|
|
private AttributeChangeListener changeListener; |
|
|
|
|
|
|
|
|
|
public ElementCaseDefinePane (XCreator xCreator) { |
|
|
|
|
this.xCreator = xCreator; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
protected void initContentPane() {} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected JPanel createContentPane() { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String getIconPath() { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String title4PopupWindow() { |
|
|
|
|
return "ElementCase"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -86,39 +96,68 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane{
|
|
|
|
|
UIExpandablePane folderPane = new UIExpandablePane(Inter.getLocText("FR-Designer_Fit"), 280, 20, panelWrapper); |
|
|
|
|
this.add(folderPane, BorderLayout.NORTH); |
|
|
|
|
this.bingListeners2Widgets(); |
|
|
|
|
this.setGlobalNames(); |
|
|
|
|
this.repaint(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void bingListeners2Widgets() { |
|
|
|
|
this.hComboBox.addActionListener(new ActionListener() { |
|
|
|
|
private void bingListeners2Widgets() { |
|
|
|
|
reInitAllListeners(); |
|
|
|
|
this.changeListener = new AttributeChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1)); |
|
|
|
|
public void attributeChange() { |
|
|
|
|
update(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 后台初始化所有事件. |
|
|
|
|
*/ |
|
|
|
|
private void reInitAllListeners() { |
|
|
|
|
initListener(this); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.vComboBox.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1)); |
|
|
|
|
public void populate(FormDesigner designer) { |
|
|
|
|
this.designer = designer; |
|
|
|
|
this.addAttributeChangeListener(changeListener); |
|
|
|
|
ElementCaseEditor elementCaseEditor = (ElementCaseEditor)xCreator.toData(); |
|
|
|
|
this.hComboBox.setSelectedIndex(elementCaseEditor.getHorziontalAttr().getState() - 1); |
|
|
|
|
this.vComboBox.setSelectedIndex(elementCaseEditor.getVerticalAttr().getState() - 1); |
|
|
|
|
this.heightRestrictCheckBox.setSelected(elementCaseEditor.isHeightRestrict()); |
|
|
|
|
this.maxHeightLabel.setVisible(elementCaseEditor.isHeightRestrict()); |
|
|
|
|
this.maxHeightSpinner.setVisible(elementCaseEditor.isHeightRestrict()); |
|
|
|
|
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.heightRestrictCheckBox.addItemListener(new ItemListener() { |
|
|
|
|
@Override |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
public void update() { |
|
|
|
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
|
|
|
|
|
String globalName = this.getGlobalName(); |
|
|
|
|
switch (globalName) { |
|
|
|
|
case "hComboBox": |
|
|
|
|
((ElementCaseEditor)xCreator.toData()).setHorziontalAttr(MobileFitAttrState.parse(hComboBox.getSelectedIndex() + 1)); |
|
|
|
|
break; |
|
|
|
|
case "vComboBox": |
|
|
|
|
((ElementCaseEditor)xCreator.toData()).setVerticalAttr(MobileFitAttrState.parse(vComboBox.getSelectedIndex() + 1)); |
|
|
|
|
break; |
|
|
|
|
case "heightRestrictCheckBox": |
|
|
|
|
boolean isHeightRestrict = heightRestrictCheckBox.isSelected(); |
|
|
|
|
((ElementCaseEditor)xCreator.toData()).setHeightRestrict(isHeightRestrict); |
|
|
|
|
maxHeightSpinner.setVisible(isHeightRestrict); |
|
|
|
|
maxHeightLabel.setVisible(isHeightRestrict); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.maxHeightSpinner.addChangeListener(new ChangeListener() { |
|
|
|
|
@Override |
|
|
|
|
public void stateChanged(ChangeEvent e) { |
|
|
|
|
break; |
|
|
|
|
case "maxHeightSpinner": |
|
|
|
|
((ElementCaseEditor)xCreator.toData()).setHeightPercent(maxHeightSpinner.getValue()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setGlobalNames() { |
|
|
|
|
this.hComboBox.setGlobalName("hComboBox"); |
|
|
|
|
this.vComboBox.setGlobalName("vComboBox"); |
|
|
|
|
this.heightRestrictCheckBox.setGlobalName("heightRestrictCheckBox"); |
|
|
|
|
this.maxHeightSpinner.setGlobalName("maxHeightSpinner"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|