String property1 = "name";
PropertySetter propertySetter1 = new IntrospectionPropertySetter(Pipe.class);
ModelModifier modifier1 = new PropertyBasedModelModifier(property1, propertySetter1);
TextEditor editor1 = new TextEditor();
editor1.setSize(50);
FieldInfo fieldInfo1 = new FieldInfo(id1, label1, modifier1, editor1);
pipeListFieldInfo.addColumn(fieldInfo1);
}
{
// -----------------
// Start time
// -----------------
String id3 = "starttime";
String label3 = "starttimelist";
ModelModifier modifier3 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
Date start =((Pipe) model).getStartTime();
if(start==null){
return "";
}
return dateFormat.format(start);
}
public void setModelValue(Object model, Object value) throws Exception {
}
};
UneditingEditor editor3=new UneditingEditor();
FieldInfo linkFieldInfo = new FieldInfo(id3, label3, modifier3, editor3);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
{
// -----------------
// Finish time
// -----------------
String id4 = "endtime";
String label4 = "endtimelist";
ModelModifier modifier4 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
Date end=((Pipe) model).getEndTime();
if(end==null||(pipeSet!=null&&pipeSet.contains((Pipe)model))){
return "";
}
return dateFormat.format(end);
}
public void setModelValue(Object model, Object value) throws Exception {
}
};
UneditingEditor editor4=new UneditingEditor();
FieldInfo linkFieldInfo = new FieldInfo(id4, label4, modifier4, editor4);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
{
// -----------------
// Duration of pipe execution
// -----------------
String id4 = "duration";
String label4 = "duration";
ModelModifier modifier4 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
Long duration=((Pipe)model).getDuration();
if(duration==0)
return "";
else if(pipeSet!=null&&pipeSet.contains((Pipe)model))
return environment.getLabel(PIPE_RUNNING, language );
else
return DurationFormatUtils.formatDuration(duration,DURATION_FORMAT);
}
public void setModelValue(Object model, Object value) throws Exception {
}
};
UneditingEditor editor4=new UneditingEditor();
FieldInfo linkFieldInfo = new FieldInfo(id4, label4, modifier4, editor4);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
{
// -----------------
// Last status
// -----------------
String id4 = "status";
String label4 = "laststatus";
ModelModifier modifier4 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
String status=((Pipe) model).getLastStatus();
if(status!=null && (pipeSet==null||!pipeSet.contains((Pipe)model)))
return status;
return "";
}
public void setModelValue(Object model, Object value) throws Exception {
}
};
UneditingEditor editor4=new UneditingEditor();
FieldInfo linkFieldInfo = new FieldInfo(id4, label4, modifier4, editor4);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
{
// -----------------
// Last user
// -----------------
String id6 = "lastuser";
String label6 = "lastuser";
ModelModifier modifier6 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
String user=((Pipe) model).getUser();
if(user!=null && (pipeSet==null||!pipeSet.contains((Pipe)model)))
return user;
return "";
}
public void setModelValue(Object model, Object value) throws Exception {
}
};
UneditingEditor editor6=new UneditingEditor();
FieldInfo linkFieldInfo = new FieldInfo(id6, label6, modifier6, editor6);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
{
// -----------------
// Edit button field
// -----------------
String id2 = "edit";
String label2 = "edit";
ModelModifier modifier2 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
return ((Pipe) model).getId();
}
public void setModelValue(Object model, Object value) throws Exception {
// We don't want to change it, we just want too see it
}
};
// Just want to show it...
LinkButtonEditor editor2 = new LinkButtonEditor();
editor2.setHref("EditPipe");
editor2.setParameterName(PIPE_ID);
editor2.setTarget("_self");
FieldInfo linkFieldInfo = new FieldInfo(id2, label2, modifier2, editor2);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
{
// -----------------
// Start button field
// -----------------
String id5 = "start";
String label5 = "start";
ModelModifier modifier5 = new DefaultModelModifier() {
public Object getModelValue(Object model) throws Exception {
return ((Pipe) model).getId();
}
public void setModelValue(Object model, Object value) throws Exception {
}
};
LinkButtonEditor editor5 = new LinkButtonEditor();
editor5.setHref("PipeList");
editor5.setParameterName(PIPE_ID);
editor5.setTarget("_self");
FieldInfo linkFieldInfo = new FieldInfo(id5, label5, modifier5, editor5);
pipeListFieldInfo.addColumn(linkFieldInfo);
}
} catch(Exception e) {
environment.log("Problems initializing GUI: \n"+e.getMessage());