1 13 package com.tonbeller.jpivot.table.navi; 14 15 import com.tonbeller.jpivot.core.ModelChangeEvent; 16 import com.tonbeller.jpivot.core.ModelChangeListener; 17 import com.tonbeller.jpivot.olap.navi.SwapAxes; 18 import com.tonbeller.jpivot.table.TableComponent; 19 import com.tonbeller.jpivot.table.TableComponentExtensionSupport; 20 import com.tonbeller.wcf.controller.RequestContext; 21 22 27 public class SwapAxesUI extends TableComponentExtensionSupport implements ModelChangeListener { 28 SwapAxes extension; 29 30 public static final String ID = "swapAxes"; 31 public String getId() { 32 return ID; 33 } 34 35 public void initialize(RequestContext context, TableComponent table) throws Exception { 36 super.initialize(context, table); 37 table.getOlapModel().addModelChangeListener(this); 38 extension = getExtension(); 39 } 40 41 public boolean isButtonPressed() { 42 return extension != null && extension.isSwapAxes(); 43 } 44 45 public void setButtonPressed(boolean value) { 46 if (extension != null && extension.canSwapAxes()) { 47 extension.setSwapAxes(value); 48 } 49 } 50 51 public boolean isAvailable() { 52 return getExtension() != null; 53 } 54 55 public void startBuild(RequestContext context) { 56 super.startBuild(context); 57 } 58 59 private SwapAxes getExtension() { 60 return (SwapAxes) table.getOlapModel().getExtension(SwapAxes.ID); 61 } 62 63 public void modelChanged(ModelChangeEvent e) { 64 } 65 66 public void structureChanged(ModelChangeEvent e) { 67 extension = getExtension(); 68 } 69 70 } 71 | Popular Tags |