diff --git a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java index fb08c18284..59e8dae7eb 100644 --- a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java +++ b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java @@ -5,7 +5,9 @@ import java.util.List; import com.fr.base.FRContext; import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.ElementCasePane; +import com.fr.design.mainframe.JTemplate; import com.fr.general.NameObject; import com.fr.design.condition.HighLightConditionAttributesPane; import com.fr.design.gui.controlpane.JListControlPane; @@ -24,6 +26,7 @@ import com.fr.stable.Nameable; public class ConditionAttributesGroupPane extends UIListControlPane { private static ConditionAttributesGroupPane singleton; + private TemplateCellElement editCellElement; // 当前单元格对象 private ConditionAttributesGroupPane() { super(); @@ -43,6 +46,11 @@ public class ConditionAttributesGroupPane extends UIListControlPane { @Override public void saveSettings() { + if (isPopulating) { + return; + } + editCellElement.setHighlightGroup(updateHighlightGroup()); + DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); } @Override @@ -53,7 +61,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane { public void populate(ElementCasePane ePane) { CellSelection cs = (CellSelection) ePane.getSelection(); final TemplateElementCase tplEC = ePane.getEditingElementCase(); - TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); + editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); if (editCellElement == null) { editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); tplEC.addCellElement(editCellElement); diff --git a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java index 5d48980a9a..1968dc6356 100644 --- a/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer_base/src/com/fr/design/gui/controlpane/UIListControlPane.java @@ -3,6 +3,7 @@ package com.fr.design.gui.controlpane; import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; +import com.fr.design.actions.core.ActionFactory; import com.fr.design.beans.BasicBeanPane; import com.fr.design.data.tabledata.tabledatapane.GlobalMultiTDTableDataPane; import com.fr.design.data.tabledata.tabledatapane.GlobalTreeTableDataPane; @@ -26,6 +27,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.Inter; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; +import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import javax.swing.*; @@ -436,6 +438,43 @@ public abstract class UIListControlPane extends UIControlPane { this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png")); } + /** + * Gets component on toolbar. + * + * @return the created components on toolbar. + */ + @Override + public JComponent createToolBarComponent() { + Object object = this.getValue(UIButton.class.getName()); + if (!(object instanceof AbstractButton)) { + // 直接使用默认UI + UIButton button = new UIButton(); + // 添加一个名字作为自动化测试用 + button.setName(getName()); + + //设置属性. + Integer mnemonicInteger = (Integer) this.getValue(Action.MNEMONIC_KEY); + if (mnemonicInteger != null) { + button.setMnemonic((char) mnemonicInteger.intValue()); + } + + button.setIcon((Icon) this.getValue(Action.SMALL_ICON)); + button.addActionListener(this); + + button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW); + + this.putValue(UIButton.class.getName(), button); + button.setText(StringUtils.EMPTY); + button.setEnabled(this.isEnabled()); + + //peter:产生tooltip + button.setToolTipText(ActionFactory.createButtonToolTipText(this)); + object = button; + } + + return (JComponent) object; + } + @Override public void actionPerformed(ActionEvent e) { Nameable nameable = creator.createNameable(UIListControlPane.this);