19 package org.turro.erp.task;
21 import org.turro.command.Command;
22 import org.turro.command.Context;
23 import org.turro.elephant.context.Application;
24 import org.turro.elephant.util.ZkossUtils;
25 import org.turro.erp.entity.Predecessor;
26 import org.turro.erp.entity.PredecessorType;
27 import org.turro.erp.entity.Task;
28 import org.turro.jpa.entity.EntityCollectionUtil;
29 import org.turro.zkoss.dialog.InputDialog;
30 import org.turro.zkoss.dialog.InputField;
31 import org.turro.zkoss.grid.GroupExtended;
32 import org.turro.zkoss.grid.PagingGrid;
33 import org.turro.zul.frame.Framework;
34 import org.zkoss.zk.ui.HtmlBasedComponent;
35 import org.zkoss.zk.ui.event.Event;
36 import org.zkoss.zk.ui.event.EventListener;
37 import org.zkoss.zk.ui.event.Events;
38 import org.zkoss.zul.*;
63 editRelation(p,
new Command() {
65 public Object execute(Context context) {
73 private void editRelation(
final Predecessor p,
final Command command) {
78 new InputField(
"lType", null, null, 0) {
80 protected HtmlBasedComponent createEditor() {
81 PredecessorTypeListbox ptl = new PredecessorTypeListbox();
82 ptl.setMold(
"select");
83 ptl.setObjectValue(p.getType());
89 protected HtmlBasedComponent createEditor() {
98 new InputField(
"lLag",
new Double(p.
getLag()),
null, 2)
101 public Object execute(Context context) {
102 InputField[] fields = (InputField[]) context.get(
"fields");
103 if(fields.length > 0) {
104 for(InputField f : fields) {
105 if(
"lType".equals(f.getLabel())) {
106 p.
setType((PredecessorType) f.getValue());
107 }
else if(
"lTask".equals(f.getLabel())) {
109 }
else if(
"lLag".equals(f.getLabel())) {
110 p.
setLag((Double) f.getValue());
114 if(command !=
null) command.execute(context);
122 private void addColumns() {
123 Columns cols = getColumns(
true);
124 cols.getChildren().clear();
126 Column col =
new Column(
null,
null,
"100px");
127 cols.appendChild(col);
129 col =
new Column(Application.getString(
"lTask"));
130 cols.appendChild(col);
132 col =
new Column(
null,
null,
"40px");
133 cols.appendChild(col);
136 private void addRows() {
137 Rows rows = getRows(
true);
138 rows.getChildren().clear();
141 if(lastType ==
null || !p.
getType().equals(lastType)) {
142 GroupExtended g =
new GroupExtended(Application.getString(p.
getType().toString()));
146 final Row row =
new Row();
147 row.setValign(
"top");
148 rows.appendChild(row);
149 Button edit =
new Button(Application.getString(
"lEdit"));
150 edit.addEventListener(Events.ON_CLICK,
new EventListener() {
152 public void onEvent(Event event)
throws Exception {
153 editRelation(p,
new Command() {
155 public Object execute(Context context) {
162 row.appendChild(edit);
164 Toolbarbutton del =
new Toolbarbutton(
null,
"/_zul/images/edit-delete.png");
165 del.addEventListener(Events.ON_CLICK,
new EventListener() {
167 public void onEvent(Event event)
throws Exception {
168 ZkossUtils.confirmDeletion(
null,
new Command() {
170 public Object execute(Context context) {
178 row.appendChild(del);
static String getString(String key)
PredecessorType getType()
void setType(PredecessorType type)
void setPredecessor(Task predecessor)
OrderReference getOrderReference()
Set< Predecessor > getPredecessors()
String getFullDescription()
void setWorkOrder(WorkOrder workOrder)
void setReference(Task reference)
static Framework getCurrent()