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.NonEmpty; 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 NonEmptyUI extends TableComponentExtensionSupport implements ModelChangeListener { 28 29 public static final String ID = "nonEmpty"; 30 public String getId() { 31 return ID; 32 } 33 34 NonEmpty extension; 35 36 public void initialize(RequestContext context, TableComponent table) throws Exception { 37 super.initialize(context, table); 38 table.getOlapModel().addModelChangeListener(this); 39 extension = getNonEmpty(); 40 } 41 42 public boolean isButtonPressed() { 43 if (extension != null) 44 return extension.isNonEmpty(); 45 return false; 46 } 47 48 public void setButtonPressed(boolean value) { 49 if (extension != null) 50 extension.setNonEmpty(value); 51 } 52 53 public boolean isAvailable() { 54 return getNonEmpty() != null; 55 } 56 57 NonEmpty getNonEmpty() { 58 return (NonEmpty) table.getOlapModel().getExtension(NonEmpty.ID); 59 } 60 61 public void modelChanged(ModelChangeEvent e) { 62 } 63 64 public void structureChanged(ModelChangeEvent e) { 65 extension = getNonEmpty(); 66 } 67 68 } 69 | Popular Tags |