use of us.mn.state.dot.sonar.Privilege in project iris by mnit-rtmc.
the class PrivilegeModel method createColumns.
/**
* Create the columns in the model
*/
@Override
protected ArrayList<ProxyColumn<Privilege>> createColumns() {
ArrayList<ProxyColumn<Privilege>> cols = new ArrayList<ProxyColumn<Privilege>>(5);
cols.add(new ProxyColumn<Privilege>("privilege.type", 140) {
public Object getValueAt(Privilege p) {
return p.getTypeN();
}
public boolean isEditable(Privilege p) {
return canWrite(p);
}
public void setValueAt(Privilege p, Object value) {
p.setTypeN(value.toString().trim());
}
protected TableCellEditor createCellEditor() {
return new DefaultCellEditor(new JComboBox<String>(ALL_TYPES));
}
});
cols.add(new ProxyColumn<Privilege>("privilege.obj", 140) {
public Object getValueAt(Privilege p) {
return p.getObjN();
}
public boolean isEditable(Privilege p) {
return canWrite(p);
}
public void setValueAt(Privilege p, Object value) {
String v = value.toString().trim();
p.setObjN(v);
}
});
cols.add(new ProxyColumn<Privilege>("privilege.group", 140) {
public Object getValueAt(Privilege p) {
return p.getGroupN();
}
public boolean isEditable(Privilege p) {
return canWrite(p);
}
public void setValueAt(Privilege p, Object value) {
String v = value.toString().trim();
p.setGroupN(v);
}
});
cols.add(new ProxyColumn<Privilege>("privilege.attr", 120) {
public Object getValueAt(Privilege p) {
return p.getAttrN();
}
public boolean isEditable(Privilege p) {
return canWrite(p);
}
public void setValueAt(Privilege p, Object value) {
String v = value.toString().trim();
p.setAttrN(v);
}
});
cols.add(new ProxyColumn<Privilege>("privilege.write", 60, Boolean.class) {
public Object getValueAt(Privilege p) {
return p.getWrite();
}
public boolean isEditable(Privilege p) {
return canWrite(p);
}
public void setValueAt(Privilege p, Object value) {
if (value instanceof Boolean)
p.setWrite((Boolean) value);
}
});
return cols;
}
Aggregations