From 1c5efe79e4a69033838489a651d1360fa898ae31 Mon Sep 17 00:00:00 2001 From: plough Date: Mon, 31 Jul 2017 14:35:24 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=3D=E3=80=8B=E5=AE=9E=E6=97=B6=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=EF=BC=8C=E5=8F=AF=E6=92=A4=E9=94=80=E3=80=81=E9=87=8D?= =?UTF-8?q?=E5=81=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../present/ConditionAttributesGroupPane.java | 10 ++++- .../gui/controlpane/UIListControlPane.java | 39 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java b/designer/src/com/fr/design/present/ConditionAttributesGroupPane.java index fb08c1828..59e8dae7e 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 5d48980a9..1968dc635 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);