1 24 package org.riotfamily.riot.list.ui; 25 26 import java.util.Iterator ; 27 import java.util.List ; 28 29 import org.riotfamily.riot.list.command.CommandState; 30 31 35 public class ListItem { 36 37 private int rowIndex; 38 39 private String objectId; 40 41 private String cssClass; 42 43 private List columns; 44 45 private List commands; 46 47 private String defaultCommandId; 48 49 private boolean lastOnPage; 50 51 public ListItem() { 52 } 53 54 public ListItem(String objectId) { 55 this.objectId = objectId; 56 } 57 58 public List getColumns() { 59 return this.columns; 60 } 61 62 public void setColumns(List columns) { 63 this.columns = columns; 64 } 65 66 public String getCssClass() { 67 return this.cssClass; 68 } 69 70 public void setCssClass(String cssClass) { 71 this.cssClass = cssClass; 72 } 73 74 public List getCommands() { 75 return this.commands; 76 } 77 78 public void setCommands(List commands) { 79 this.commands = commands; 80 } 81 82 public String getObjectId() { 83 return this.objectId; 84 } 85 86 public void setObjectId(String objectId) { 87 this.objectId = objectId; 88 } 89 90 public int getRowIndex() { 91 return this.rowIndex; 92 } 93 94 public void setRowIndex(int rowIndex) { 95 this.rowIndex = rowIndex; 96 } 97 98 public boolean isLastOnPage() { 99 return this.lastOnPage; 100 } 101 102 public void setLastOnPage(boolean lastOnPage) { 103 this.lastOnPage = lastOnPage; 104 } 105 106 void setDefaultCommandIds(String [] defaultCommandIds) { 107 if (defaultCommandIds != null) { 108 for (int i = 0; i < defaultCommandIds.length; i++) { 109 CommandState state = getCommandState(defaultCommandIds[i]); 110 if (state != null && state.isEnabled()) { 111 defaultCommandId = state.getId(); 112 break; 113 } 114 } 115 } 116 } 117 118 private CommandState getCommandState(String id) { 119 Iterator it = commands.iterator(); 120 while (it.hasNext()) { 121 CommandState state = (CommandState) it.next(); 122 if (state.getId().equals(id)) { 123 return state; 124 } 125 } 126 return null; 127 } 128 129 public void setDefaultCommandId(String defaultCommandId) { 130 this.defaultCommandId = defaultCommandId; 131 } 132 133 public String getDefaultCommandId() { 134 return defaultCommandId; 135 } 136 137 } 138 | Popular Tags |