2 * $Id: FormElementWizardPage.java,v 1.3 2006-10-21 23:18:43 pombredanne Exp $
3 * Copyright Narushima Hironori. All rights reserved.
5 package net.sourceforge.phpeclipse.wizards.html;
7 import org.eclipse.core.runtime.CoreException;
8 import org.eclipse.swt.SWT;
9 import org.eclipse.swt.widgets.Button;
10 import org.eclipse.swt.widgets.Combo;
11 import org.eclipse.swt.widgets.Composite;
12 import org.eclipse.swt.widgets.Text;
17 public class FormElementWizardPage extends EditElementWizardPage {
21 Button postRadio, getRadio, multipartCheck;
25 public FormElementWizardPage() {
26 super("FormElementWizardPage");
29 protected void createChildControl(Composite parent) throws CoreException {
30 postRadio = new Button(parent, SWT.RADIO);
34 public String getPreviewText() {
35 boolean controlCreated = actionText != null;
37 StringBuffer buff = new StringBuffer("<form action=\"");
39 buff.append(actionText.getText());
41 buff.append("\" method=\"");
42 if (controlCreated && postRadio.getSelection()) {
43 buff.append("POST\"");
44 if (multipartCheck.getSelection()) {
45 buff.append(" enctype=\"multipart/form-data\"");
53 String charset = charsetCombo.getText();
54 if (charset != null) {
55 buff.append(" accept-charset=\"" + charset + "\"");
60 buff.append(getSelectionText());
61 buff.append("\n</form>\n");
63 return buff.toString();