3. Submits1.tml (Классический подход. Как это сделать на Tapestry)
<body>
<h1>Submits (1)</h1>
In this example we use Submit to generate the 2nd and 3rd buttons… bla bla bla
<div class="eg">
<form t:type="form" t:id="search">
<t:errors/>
<table>
<tr>
<td>Name:</td>
<td><input t:type="TextField" t:id="name" maxlength=”10" size="10"/></td>
</tr> <tr> <td></td> <td>
<input t:type="Submit" t:id="suppliers" value="Search Suppliers"/>
<input t:type="Submit" t:id="cancel" value="Cancel" mode="CANCEL"/>
</td>
</tr>
</table>
</form> </div>
4. public class Submits1 {
@Property private String name;
@InjectPage private Submits2 page2;
@Component private Form search;
private SearchType searchType;
void onSelectedFromSuppliers()
{
searchType = SearchType.SUPPLIERS;
}
Object onSuccess()
{
page2.set(searchType, name);
return page2;
}
}
Соглашение об именовании
onSelectedFrom Suppliers ()
<input t:type="Submit" t:id="
suppliers"
(Классический подход. Как это сделать на Tapestry)
5. private void initUI() {
JPanel panel = new JPanel("Simple example");
getContentPane().add(panel);
panel.setLayout(null);
JButton quitButton = new JButton("Quit");
quitButton.setBounds(50, 60, 80, 30);
quitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
System.exit(0);
}
});
panel.add(quitButton);
}
(Десктоп. Как мы это делали на Swing)
6. Vaadin
public void init (String context)
{
VerticalLayout layout = new VerticalLayout();
Button button = new Button("Click Me!");
button.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
getWindow().showNotification("Thank You!");
}
});
layout.addComponent(button);
}