My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 4 attachment: EditorNew.java (4.1 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package com.mycompany.project.client.view;

import gr.open.client.TinyMCE;

import com.extjs.gxt.ui.client.Style.Orientation;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
import com.extjs.gxt.ui.client.widget.custom.Portal;
import com.extjs.gxt.ui.client.widget.layout.TableLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.ui.Grid;
import com.extjs.gxt.ui.client.widget.Text;
import com.google.gwt.user.client.ui.DockPanel;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.mycompany.resources.client.Resources;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.event.ButtonEvent;

public class EditorNew extends Window implements EntryPoint{

TinyMCE ed;

public EditorNew() {
setHeading("Editor Buku");
setLayout(new TableLayout(2));
setIcon(Resources.ICONS.tabs());
add(new Text());
add(new Text());
add(new Text());

LabelField lblfldTitle = new LabelField("Title :");
add(lblfldTitle);
add(new Text());

TextField t_title = new TextField();
t_title.setName("t_title");
t_title.setWidth(350);
add(t_title);
t_title.setFieldLabel("New TextField");
add(new Text());

LabelField lblfldBab = new LabelField("Bab :");
add(lblfldBab);
add(new Text());

TextField txtfldNewTextfield_1 = new TextField();
add(txtfldNewTextfield_1);
txtfldNewTextfield_1.setWidth(350);
txtfldNewTextfield_1.setFieldLabel("New TextField");
add(new Text());

LabelField lblfldSubBab = new LabelField("Sub Bab :");
add(lblfldSubBab);
add(new Text());

TextField txtfldNewTextfield_2 = new TextField();
add(txtfldNewTextfield_2);
txtfldNewTextfield_2.setWidth(350);
txtfldNewTextfield_2.setFieldLabel("New TextField");
add(new Text());
add(new Text());
add(new Text());

add(ed);
add(new Text());

HorizontalPanel horizontalPanel = new HorizontalPanel();
add(horizontalPanel);
horizontalPanel.setSize("149px", "28px");

Button btnNewButton = new Button("New button");
btnNewButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
String url = "localhost:9000/api/content/save";
StringBuffer postData = new StringBuffer();
// note param pairs are separated by a '&'
// and each key-value pair is separated by a '='
postData.append(URL.encode("judul")).append("=").append(URL.encode("Contohnya ini adalah judul"));
postData.append("&");
postData.append(URL.encode("bab")).append("=").append(URL.encode("1"));
postData.append("&");
postData.append(URL.encode("subBab")).append("=").append(URL.encode("1"));
postData.append("&");
postData.append(URL.encode("isi")).append("=").append(URL.encode("bla bla"));


RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
builder.setHeader("Content-type", "application/x-www-form-urlencoded");
builder.setRequestData(postData.toString());
//builder.setCallback(this /* or other RequestCallback impl*/);
try {
builder.send();
} catch (RequestException e) {
System.out.println("gagal == "+ e.getMessage());
// handle this
}
}
});
btnNewButton.setText("Simpan");
horizontalPanel.add(btnNewButton);

Button btnNewButton_1 = new Button("New button");
btnNewButton_1.setText("Batal");
horizontalPanel.add(btnNewButton_1);
}

@Override
public void onModuleLoad() {
// TODO Auto-generated method stub
this.ed = new TinyMCE();
// this.ed.getConfig().setTheme("simple");
this.ed.getConfig().setTheme("advanced");
this.ed.setText("Tes");
}

}
Powered by Google Project Hosting