Browse Source

代码

master
daniel 8 years ago
parent
commit
9e3fe437e2
  1. 18
      designer/src/com/fr/design/actions/ElementCaseAction.java
  2. 36
      designer/src/com/fr/design/actions/SelectionListenerAction.java
  3. 20
      designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java

18
designer/src/com/fr/design/actions/ElementCaseAction.java

@ -10,24 +10,10 @@ import com.fr.grid.selection.Selection;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
public abstract class ElementCaseAction extends TemplateComponentAction<ElementCasePane> {
public abstract class ElementCaseAction extends SelectionListenerAction {
protected ElementCaseAction(ElementCasePane t) {
super(t);
t.addSelectionChangeListener(new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
update();
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
Selection selection = getEditingComponent().getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
//样式处理
getEditingComponent().setCellNeedTOFormat(cellselection);
}
}
}
});
t.addSelectionChangeListener(createSelectionListener());
}
}

36
designer/src/com/fr/design/actions/SelectionListenerAction.java

@ -0,0 +1,36 @@
package com.fr.design.actions;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.selection.SelectionEvent;
import com.fr.design.selection.SelectionListener;
import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection;
/**
* Created by daniel on 2016/10/10.
*/
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> {
protected SelectionListenerAction(ElementCasePane elementCasePane) {
super(elementCasePane);
}
protected SelectionListener createSelectionListener () {
return new SelectionListener() {
@Override
public void selectionChanged(SelectionEvent e) {
update();
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
Selection selection = getEditingComponent().getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
//样式处理
getEditingComponent().setCellNeedTOFormat(cellselection);
}
}
}
};
}
}

20
designer/src/com/fr/design/actions/cell/GlobalStyleMenuDef.java

@ -8,6 +8,7 @@ import com.fr.base.BaseUtils;
import com.fr.base.ConfigManager;
import com.fr.base.NameStyle;
import com.fr.design.actions.ElementCaseAction;
import com.fr.design.actions.SelectionListenerAction;
import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.actions.UpdateAction;
import com.fr.design.gui.imenu.UIMenu;
@ -151,7 +152,7 @@ public class GlobalStyleMenuDef extends MenuDef {
public static class GlobalStyleSelection extends TemplateComponentAction<ElementCasePane> {
public static class GlobalStyleSelection extends SelectionListenerAction {
private NameStyle nameStyle;
@ -196,22 +197,5 @@ public class GlobalStyleMenuDef extends MenuDef {
return useMenuItem;
}
private SelectionListener createSelectionListener (){
return new SelectionListener (){
@Override
public void selectionChanged(SelectionEvent e) {
update();
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) {
Selection selection = getEditingComponent().getSelection();
if (selection instanceof CellSelection) {
CellSelection cellselection = (CellSelection) selection;
//样式处理
getEditingComponent().setCellNeedTOFormat(cellselection);
}
}
}
};
}
}
}
Loading…
Cancel
Save