01: package org.drools.brms.client.ruleeditor;
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.common.DirtyableComposite;
20: import org.drools.brms.client.common.FormStylePopup;
21:
22: import com.google.gwt.user.client.Command;
23: import com.google.gwt.user.client.ui.Button;
24: import com.google.gwt.user.client.ui.ClickListener;
25: import com.google.gwt.user.client.ui.TextArea;
26: import com.google.gwt.user.client.ui.Widget;
27:
28: /**
29: *
30: * A popup and confirmation dialog for committing an asset.
31: *
32: * @author Michael Neale
33: *
34: */
35: public class CheckinPopup {
36:
37: private TextArea comment;
38: private Button save;
39: private FormStylePopup pop;
40:
41: public CheckinPopup(int left, int top, String message) {
42: pop = new FormStylePopup("images/checkin.gif", message);
43: comment = new TextArea();
44: comment.setWidth("100%");
45: save = new Button("Save");
46: pop.addAttribute("Comment", comment);
47: pop.addAttribute("", save);
48:
49: pop.setStyleName("ks-popups-Popup");
50: pop.setPopupPosition(left, top);
51:
52: }
53:
54: public void setCommand(final Command checkin) {
55: save.addClickListener(new ClickListener() {
56: public void onClick(Widget w) {
57: checkin.execute();
58: pop.hide();
59: }
60: });
61: }
62:
63: public void show() {
64: pop.setPopupPosition((DirtyableComposite.getWidth() - pop
65: .getOffsetWidth()) / 2, 100);
66: pop.show();
67: }
68:
69: public String getCheckinComment() {
70: return comment.getText();
71: }
72:
73: }
|