01: package org.drools.brms.client.decisiontable;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
20:
21: import com.google.gwt.user.client.ui.ClickListener;
22: import com.google.gwt.user.client.ui.Composite;
23: import com.google.gwt.user.client.ui.HorizontalPanel;
24: import com.google.gwt.user.client.ui.Image;
25: import com.google.gwt.user.client.ui.Widget;
26:
27: /**
28: * This shows the widget for inserting a row.
29: * @author Steven Williams
30: */
31: public class InsertAction extends Composite {
32:
33: private HorizontalPanel panel = new HorizontalPanel();
34: private Image insert;
35: private int row;
36:
37: /**
38: * Pass in the click listener delegate for when the respective action is clicked
39: * @param clickListener
40: * @param okClickListener
41: */
42: public InsertAction(final int currentRow,
43: final RowClickListener clickListener) {
44: row = currentRow;
45: insert = new Image("images/new_item.gif");
46: insert.setTitle("Insert row after row " + row);
47: insert.addClickListener(new ClickListener() {
48: public void onClick(final Widget w) {
49: clickListener.onClick(w, row);
50: }
51: });
52:
53: panel.add(insert);
54:
55: initWidget(panel);
56: }
57:
58: public void setRow(final int row) {
59: this .row = row;
60: insert.setTitle("Insert row after row " + row);
61:
62: }
63:
64: public int getRow() {
65: return row;
66: }
67:
68: }
|