NSCREEN : Create new NScreen view. 35/20035/8
authoryonghwan82.jeon <yonghwan82.jeon@samsung.com>
Fri, 25 Apr 2014 07:14:11 +0000 (16:14 +0900)
committeryonghwan82.jeon <yonghwan82.jeon@samsung.com>
Mon, 28 Apr 2014 06:38:21 +0000 (15:38 +0900)
Create new Screen view and Add New NScreen Dialog.

Change-Id: I7bd87d9016ac852c3909e9355be8a342cc864e3a
Signed-off-by: yonghwan82.jeon <yonghwan82.jeon@samsung.com>
org.tizen.webuibuilder/plugin.xml
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenInputWizardPage.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenModel.java [moved from org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/nscreen2/NScreenModel.java with 98% similarity]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenView.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewMessages.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewMessages.properties [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewPage.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NscreenInputWizard.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/nscreen/NScreenView.java

index 54005db..27165c8 100644 (file)
@@ -40,7 +40,7 @@
                relative="org.eclipse.ui.views.ContentOutline">
          </view>
          <view
-               id="org.tizen.webuibuilder.ui.views.NScreenView"
+               id="org.tizen.webuibuilder.ui.views.NScreenView3"
                minimized="false"
                relationship="stack"
                relative="org.eclipse.ui.views.ContentOutline">
          <newWizardShortcut
                id="org.tizen.web.project.wizard.webapp">
          </newWizardShortcut>
+         <view
+               id="org.tizen.webuibuilder.ui.views.NScreenView"
+               minimized="false"
+               relationship="stack"
+               relative="org.eclipse.ui.views.ContentOutline">
+         </view>
       </perspectiveExtension>
    </extension>
    <extension
       <view
             category="org.tizen.nativeapp.viewCategory"
             class="org.tizen.webuibuilder.ui.views.nscreen.NScreenView"
-            id="org.tizen.webuibuilder.ui.views.NScreenView"
-            name="%nscreenViewName"
+            id="org.tizen.webuibuilder.ui.views.NScreenView3"
+            name="NScreen3"
             restorable="true">
       </view>
       <view
             name="%timeline"
             restorable="true">
       </view>
+      <view
+            category="org.tizen.nativeapp.viewCategory"
+            class="org.tizen.webuibuilder.ui.views.newnscreen.NScreenView"
+            icon="res/icons/checkboxitem_16.png"
+            id="org.tizen.webuibuilder.ui.views.NScreenView"
+            name="%nscreenViewName"
+            restorable="true">
+      </view>
    </extension>
    <extension
          point="org.eclipse.ui.newWizards">
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenInputWizardPage.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenInputWizardPage.java
new file mode 100644 (file)
index 0000000..e9173ee
--- /dev/null
@@ -0,0 +1,294 @@
+
+
+package org.tizen.webuibuilder.ui.views.newnscreen;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+public class NScreenInputWizardPage extends WizardPage {
+    // private static Logger logger = LoggerFactory.getLogger(NScreenInputWizardPage.class);
+    public static final String NAME = NScreenInputWizardPage.class.getName();
+    public final String NAME_PATTERN = "^[a-zA-Z]+[a-zA-Z0-9]*$";
+    public final String SIZE_PATTERN = "^[0-9]*$";
+
+    // Parent part
+    private Composite parentComposite;
+
+    // Widget
+    private Text nscreenNameText;
+    private Text maxDeviceWidthText;
+    private Text maxDeviceHeightText;
+    private Button orientationButton;
+    private Button maxDeviceWidthCheckBox;
+    private Button maxDeviceHeightCheckBox;
+    private Button orientationCheckBox;
+
+    // preview
+    private Text previewText;
+
+    protected NScreenInputWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+        super(pageName, title, titleImage);
+        setDescription(NScreenViewMessages.NSCREEN_INPUTWIZARD_PAGE_DESCRIPTION);
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+        // Parent part
+        parentComposite = new Composite(parent, SWT.NONE);
+        parentComposite.setLayout(new GridLayout(1, true));
+        parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+        setControl(parentComposite);
+
+        // Children part
+        createNscreenNameComposite(parentComposite);
+        createDeviceListComposite(parentComposite);
+        createUserInputComposite(parentComposite);
+        createDetailInputComposite(parentComposite);
+        createPreviewComposite(parentComposite);
+
+        setPageComplete(false);
+    }
+
+    private void createNscreenNameComposite(Composite parent) {
+        Composite nscreenItemNameComposite = new Composite(parent, SWT.NONE);
+        nscreenItemNameComposite.setLayout(new GridLayout(8, true));
+        nscreenItemNameComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        GridData gd = null;
+
+        Label label = new Label(nscreenItemNameComposite, SWT.NULL);
+        label.setText("NScreen Name : ");
+        gd = new GridData(GridData.FILL_BOTH);
+        gd.horizontalSpan = 2;
+        label.setLayoutData(gd);
+
+        nscreenNameText = new Text(nscreenItemNameComposite, SWT.BORDER | SWT.SINGLE);
+        gd = new GridData(GridData.FILL_BOTH);
+        gd.horizontalSpan = 6;
+        nscreenNameText.setLayoutData(gd);
+        nscreenNameText.addModifyListener(new ModifyListener() {
+            @Override
+            public void modifyText(ModifyEvent e) {
+                changeDialogText();
+            }
+        });
+    }
+
+    private void createDeviceListComposite(Composite parent) {
+        Composite deviceListComposite = new Composite(parent, SWT.NONE);
+        deviceListComposite.setLayout(new GridLayout(8, true));
+        deviceListComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        for (int i = 1; i < 17; i++) {
+            Button button = new Button(deviceListComposite, SWT.NONE);
+            button.setText("device : " + i);
+        }
+
+    }
+
+    private void createUserInputComposite(Composite parent) {
+        Composite userInputComposite = new Composite(parent, SWT.NONE);
+        userInputComposite.setLayout(new GridLayout(8, true));
+        userInputComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        GridData gd = null;
+
+        // Device width
+        maxDeviceWidthCheckBox = new Button(userInputComposite, SWT.CHECK);
+        maxDeviceWidthCheckBox.setText("Max-Device-Width : ");
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 2;
+        maxDeviceWidthCheckBox.setLayoutData(gd);
+        maxDeviceWidthCheckBox.setSelection(true);
+
+        maxDeviceWidthText = new Text(userInputComposite, SWT.BORDER);
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 6;
+        maxDeviceWidthText.setLayoutData(gd);
+
+        maxDeviceWidthCheckBox.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (maxDeviceWidthCheckBox.getSelection()) {
+                    maxDeviceWidthText.setEnabled(true);
+                } else {
+                    maxDeviceWidthText.setEnabled(false);
+                }
+            }
+        });
+
+        maxDeviceWidthText.addModifyListener(new ModifyListener() {
+            @Override
+            public void modifyText(ModifyEvent e) {
+                changeDialogText();
+            }
+        });
+
+        // Device Height
+        maxDeviceHeightCheckBox = new Button(userInputComposite, SWT.CHECK);
+        maxDeviceHeightCheckBox.setText("Max-Device-Height : ");
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 2;
+        maxDeviceHeightCheckBox.setLayoutData(gd);
+        maxDeviceHeightCheckBox.setSelection(true);
+
+        maxDeviceHeightText = new Text(userInputComposite, SWT.BORDER);
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 6;
+        maxDeviceHeightText.setLayoutData(gd);
+
+        maxDeviceHeightCheckBox.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (maxDeviceHeightCheckBox.getSelection()) {
+                    maxDeviceHeightText.setEnabled(true);
+                } else {
+                    maxDeviceHeightText.setEnabled(false);
+                }
+            }
+        });
+
+        maxDeviceHeightText.addModifyListener(new ModifyListener() {
+            @Override
+            public void modifyText(ModifyEvent e) {
+                changeDialogText();
+            }
+        });
+
+        // Orientation
+        orientationCheckBox = new Button(userInputComposite, SWT.CHECK);
+        orientationCheckBox.setText("Orientation : ");
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 2;
+        orientationCheckBox.setLayoutData(gd);
+        orientationCheckBox.setSelection(true);
+
+        orientationButton = new Button(userInputComposite, SWT.TOGGLE);
+        orientationButton.setText("Portrait");
+        gd = new GridData(GridData.FILL_HORIZONTAL);
+        gd.horizontalSpan = 6;
+        orientationButton.setLayoutData(gd);
+        orientationCheckBox.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (orientationCheckBox.getSelection()) {
+                    orientationButton.setEnabled(true);
+                } else {
+                    orientationButton.setEnabled(false);
+                }
+            }
+        });
+
+        orientationButton.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                if (orientationButton.getSelection()) {
+                    orientationButton.setText("Landscape");
+                } else {
+                    orientationButton.setText("Portrait");
+
+                }
+            }
+        });
+    }
+
+    private void createDetailInputComposite(Composite parent) {
+        Composite detailInputComposite = new Composite(parent, SWT.NONE);
+        detailInputComposite.setLayout(new GridLayout(8, true));
+        detailInputComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        for (int i = 1; i < 17; i++) {
+            Button button = new Button(detailInputComposite, SWT.NONE);
+            button.setText("detail : " + i);
+        }
+    }
+
+    private void createPreviewComposite(Composite parent) {
+        Composite previewComposite = new Composite(parent, SWT.NONE);
+        previewComposite.setLayout(new GridLayout(8, true));
+        previewComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+        GridData gd = null;
+
+        Label label = new Label(previewComposite, SWT.NULL);
+        label.setText("MediaQueries : ");
+        gd = new GridData(GridData.FILL_BOTH);
+        gd.horizontalSpan = 2;
+        label.setLayoutData(gd);
+
+        previewText = new Text(previewComposite, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI);
+        gd = new GridData(GridData.FILL_BOTH);
+        gd.horizontalSpan = 6;
+        previewText.setLayoutData(gd);
+        previewText.setEnabled(false);
+    }
+
+    private void makeMediaQueries() {
+        // logger.info("Make mediaqueries");
+    }
+
+    private void changeDialogText() {
+        // logger.info("change Text");
+        // check Validation.
+        if (nscreenNameText.getText().isEmpty()) {
+            setErrorMessage("Name is Empty.");
+            setPageComplete(false);
+            return;
+        }
+
+        if (!nscreenNameText.getText().matches(this.NAME_PATTERN)) {
+            setErrorMessage("Name is started width the first letter of the character.");
+            setPageComplete(false);
+            return;
+        }
+
+        if (maxDeviceWidthCheckBox.getSelection()) {
+            if (maxDeviceWidthText.getText().isEmpty()) {
+                setErrorMessage("Max-Device-Width is Empty.");
+                setPageComplete(false);
+                return;
+            }
+
+            if (!maxDeviceWidthText.getText().matches(this.SIZE_PATTERN)) {
+                setErrorMessage("Max-Device-Width use only numbers.");
+                setPageComplete(false);
+                return;
+            }
+        }
+
+        if (maxDeviceHeightCheckBox.getSelection()) {
+            if (maxDeviceHeightText.getText().isEmpty()) {
+                setErrorMessage("Max-Device-Height is Empty.");
+                setPageComplete(false);
+                return;
+            }
+
+            if (!maxDeviceHeightText.getText().matches(this.SIZE_PATTERN)) {
+                setErrorMessage("Max-Device-Height use only numbers.");
+                setPageComplete(false);
+                return;
+            }
+        }
+
+        makeMediaQueries();
+
+        {
+            setErrorMessage(null);
+            setMessage(NScreenViewMessages.NSCREEN_INPUTWIZARD_PAGE_DESCRIPTION);
+            setPageComplete(true);
+        }
+        return;
+    }
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenView.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenView.java
new file mode 100644 (file)
index 0000000..e19d2a8
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.webuibuilder.ui.views.newnscreen;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.part.MessagePage;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.PageBookView;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.tizen.webuibuilder.ui.editor.PageDesignerForHTML;
+import org.tizen.webuibuilder.ui.views.nscreen.NScreenViewMessages;
+
+
+/**
+ * This sample class demonstrates how to plug-in a new workbench view. The view shows data obtained
+ * from the model. The sample creates a dummy model on the fly, but a real implementation would
+ * connect to the model available either in this or another plug-in (e.g. the workspace). The view
+ * is connected to the model using a content provider.
+ * <p>
+ * The view uses a label provider to define how model objects should be presented in the view. Each
+ * view can present the same model objects using different labels and icons, if needed.
+ * Alternatively, a single label provider can be shared between views in order to ensure that
+ * objects of the same type are presented in the same way everywhere.
+ * <p>
+ */
+
+public class NScreenView extends PageBookView {
+    private static Logger logger = LoggerFactory.getLogger(NScreenView.class);
+
+    /**
+     * The constructor.
+     */
+    public NScreenView() {
+    }
+
+    @Override
+    /*
+     * (non-Javadoc) Passing the focus request to the viewer's control.
+     * 
+     * @see org.eclipse.ui.part.PageBookView#setFocus()
+     */
+    public void setFocus() {
+    }
+
+    @Override
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
+     */
+    protected IPage createDefaultPage(PageBook book) {
+        MessagePage messagePage = new MessagePage();
+        initPage(messagePage);
+        messagePage.setMessage(NScreenViewMessages.MESSAGE_DEFAULT);
+        messagePage.createControl(book);
+        return messagePage;
+    }
+
+    @Override
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
+     */
+    protected PageRec doCreatePage(IWorkbenchPart part) {
+        PageRec rec = null;
+        if (part instanceof PageDesignerForHTML) {
+            NScreenViewPage page = new NScreenViewPage();
+            initPage(page);
+            page.createControl(getPageBook());
+            rec = new PageRec(part, page);
+        } else {
+            logger.info("Call default Page.");
+        }
+        return rec;
+    }
+
+    @Override
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart,
+     * org.eclipse.ui.part.PageBookView.PageRec)
+     */
+    protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
+        pageRecord.page.dispose();
+    }
+
+    @Override
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
+     */
+    protected IWorkbenchPart getBootstrapPart() {
+        IWorkbench workbench = PlatformUI.getWorkbench();
+        if (workbench == null) {
+            return null;
+        }
+
+        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+        if (window == null) {
+            return null;
+        }
+
+        IWorkbenchPage page = window.getActivePage();
+        if (page == null) {
+            return null;
+        }
+
+        IEditorPart editor = page.getActiveEditor();
+        if (editor == null) {
+            return null;
+        }
+
+        return editor;
+    }
+
+    @Override
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
+     */
+    protected boolean isImportant(IWorkbenchPart part) {
+        if (!(part instanceof PageDesignerForHTML)) {
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewMessages.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewMessages.java
new file mode 100644 (file)
index 0000000..2f8e014
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.webuibuilder.ui.views.newnscreen;
+
+import org.eclipse.osgi.util.NLS;
+
+
+/**
+ * The NScreenViewMessages class is a set of characters that are displayed on the screen .
+ */
+public class NScreenViewMessages {
+    private static final String BUNDLE_NAME = NScreenViewMessages.class.getName();
+
+    // Messages
+    public static String MESSAGE_DEFAULT;
+
+    // Dialog
+    public static String NSCREEN_INPUTWIZARD_TITLE;
+    public static String NSCREEN_INPUTWIZARD_PAGE_TITLE;
+    public static String NSCREEN_INPUTWIZARD_PAGE_DESCRIPTION;
+
+    static {
+        NLS.initializeMessages(BUNDLE_NAME, NScreenViewMessages.class);
+    }
+
+    private NScreenViewMessages() {
+    }
+
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewMessages.properties b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewMessages.properties
new file mode 100644 (file)
index 0000000..17bef98
--- /dev/null
@@ -0,0 +1,7 @@
+# Messages
+MESSAGE_DEFAULT=N-Screen are not available.
+
+# InputWizard Dialog
+NSCREEN_INPUTWIZARD_TITLE=New NScreen
+NSCREEN_INPUTWIZARD_PAGE_TITLE=NScreen Item
+NSCREEN_INPUTWIZARD_PAGE_DESCRIPTION=Add & Edit NScreen in App
\ No newline at end of file
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewPage.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NScreenViewPage.java
new file mode 100644 (file)
index 0000000..7266863
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * UI Builder
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+
+package org.tizen.webuibuilder.ui.views.newnscreen;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.Page;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class NScreenViewPage extends Page {
+    private static Logger logger = LoggerFactory.getLogger(NScreenViewPage.class);
+
+    private Composite parentComposite;
+    private Button button1;
+    private Button button2;
+
+    /**
+     * Creates a new page.
+     */
+
+    public NScreenViewPage() {
+        // nothing.
+    }
+
+    @Override
+    public void createControl(Composite parent) {
+        this.parentComposite = new Composite(parent, SWT.NULL);
+        layout();
+    }
+
+    @Override
+    public Control getControl() {
+        return this.parentComposite;
+    }
+
+    /**
+     * Sets focus to a part in the page.
+     */
+
+    @Override
+    public void setFocus() {
+        this.parentComposite.setFocus();
+    }
+
+    private void layout() {
+        this.parentComposite.setLayout(new FillLayout());
+
+        button1 = new Button(this.parentComposite, SWT.PUSH);
+        button1.setText("Add/Edit");
+        button1.pack();
+
+        button2 = new Button(this.parentComposite, SWT.PUSH);
+        button2.setText("Custom Device Manger");
+        button2.pack();
+
+        button1.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                logger.info("Button1 push and Pop Up New Nscreen Input Dialog.");
+
+                NscreenInputWizard wizard = new NscreenInputWizard();
+                WizardDialog dialog = openWizardDialog(wizard);
+                if (dialog == null) {
+                    logger.info("NscreenInputWizard Dialog is null");
+                    return;
+                }
+                dialog.open();
+            }
+        });
+
+        button2.addSelectionListener(new SelectionAdapter() {
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                logger.info("Button2 push.");
+            }
+        });
+
+    }
+
+    private WizardDialog openWizardDialog(IWizard newWizard) {
+        IWorkbench workbench = PlatformUI.getWorkbench();
+        IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+        if (window == null) {
+            logger.info("IWorkbenchWindow is null");
+            return null;
+        }
+        Shell shell = window.getShell();
+        if (shell == null) {
+            logger.info("Shell is null");
+            return null;
+        }
+
+        WizardDialog dialog = new WizardDialog(shell, newWizard);
+        return dialog;
+    }
+
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NscreenInputWizard.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/newnscreen/NscreenInputWizard.java
new file mode 100644 (file)
index 0000000..28a394a
--- /dev/null
@@ -0,0 +1,46 @@
+
+
+package org.tizen.webuibuilder.ui.views.newnscreen;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.tizen.webuibuilder.pagetemplate.ui.wizards.CreateWizardMessages;
+import org.tizen.webuibuilder.utility.ResourceManager;
+
+
+public class NscreenInputWizard extends Wizard implements INewWizard {
+    private NScreenInputWizardPage page;
+
+    public NscreenInputWizard() {
+        super();
+        setWindowTitle(NScreenViewMessages.NSCREEN_INPUTWIZARD_TITLE);
+    }
+
+    @Override
+    public void init(IWorkbench workbench, IStructuredSelection selection) {
+    }
+
+    @Override
+    public boolean performFinish() {
+        return false;
+    }
+
+    @Override
+    public boolean performCancel() {
+        return true;
+    }
+
+    @Override
+    public void addPages() {
+        super.addPages();
+        page =
+                new NScreenInputWizardPage(
+                                           NScreenInputWizardPage.NAME,
+                                           NScreenViewMessages.NSCREEN_INPUTWIZARD_PAGE_TITLE,
+                                           ResourceManager
+                                                   .getIconDescriptor(CreateWizardMessages.WIZARD_TITLE_IMAGE));
+        addPage(page);
+    }
+}
index da91ae0..e56b0a3 100644 (file)
@@ -76,11 +76,11 @@ public class NScreenView extends PageBookView {
      * @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
      */
     protected IPage createDefaultPage(PageBook book) {
-        MessagePage page = new MessagePage();
-        initPage(page);
-        page.createControl(book);
-        page.setMessage(NScreenViewMessages.MESSAGE_DEFAULT);
-        return page;
+        MessagePage messagePage = new MessagePage();
+        initPage(messagePage);
+        messagePage.setMessage(NScreenViewMessages.MESSAGE_DEFAULT);
+        messagePage.createControl(book);
+        return messagePage;
     }
 
     @Override