From 41a577353064bb08beb470b2bcf00a0dcd0932b6 Mon Sep 17 00:00:00 2001 From: "jihye424.kim" Date: Thu, 20 Aug 2015 14:09:16 +0900 Subject: [PATCH] TableViewer: add VM list table viewer Change-Id: If11ae8128baa5e1ce5a08451abcc5179795fadba Signed-off-by: jihye424.kim --- .../emulator/manager/ui/renewal/MainDialog.java | 139 ++++++ .../renewal/tableviewer/AbstractTableViewer.java | 221 ++++++++++ .../ui/renewal/tableviewer/MenuHandling.java | 335 ++++++++++++++ .../manager/ui/renewal/tableviewer/MessageBox.java | 306 +++++++++++++ .../ui/renewal/tableviewer/ProfileButtonList.java | 197 +++++++++ .../ui/renewal/tableviewer/VMListTable.java | 484 +++++++++++++++++++++ .../ui/renewal/tableviewer/VMListTableViewer.java | 115 +++++ 7 files changed, 1797 insertions(+) create mode 100644 src/org/tizen/emulator/manager/ui/renewal/MainDialog.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/tableviewer/MenuHandling.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/tableviewer/MessageBox.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButtonList.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTable.java create mode 100644 src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java diff --git a/src/org/tizen/emulator/manager/ui/renewal/MainDialog.java b/src/org/tizen/emulator/manager/ui/renewal/MainDialog.java new file mode 100644 index 0000000..67cbaa6 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/MainDialog.java @@ -0,0 +1,139 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * JiHye Kim + * Minkee Lee + * SeokYeon Hwang + * Sangho Park + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.ui.renewal; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StackLayout; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.tizen.emulator.manager.Messages; +import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.renewal.resources.ImageResources; +import org.tizen.emulator.manager.ui.renewal.tableviewer.AbstractTableViewer; +import org.tizen.emulator.manager.ui.renewal.tableviewer.VMListTableViewer; + +public class MainDialog { + private static final String ICON_FILE_NAME = "res/em.ico"; //$NON-NLS-1$ + + public static final int DEFALUT_WIDTH = 842; + public static final int DEFAULT_HEIGHT = 580; + public static int WIDTH = DEFALUT_WIDTH; + public static int HEIGHT = DEFAULT_HEIGHT; + + static Shell shell = null; + Image icon; + + private int frameX = 0; + private int frameY = 0; + + private final StackLayout stackLayout = new StackLayout(); + private List viewerList = new ArrayList(); + + public MainDialog() { + Display.setAppName(Messages.getString("MainDialog.AppName.0")); + + shell = new Shell(Display.getCurrent(), SWT.CLOSE | SWT.TITLE | SWT.BORDER); + shell.setLayout(stackLayout); + shell.setBackgroundMode(SWT.INHERIT_FORCE); + + frameX = shell.getSize().x - shell.getClientArea().width; + frameY = shell.getSize().y - shell.getClientArea().height; + + shell.setSize(WIDTH + frameX, HEIGHT + frameY); + + shell.setText(StringResources.MAIN_TITLE); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream(ICON_FILE_NAME); + if(is != null) { + icon = new Image(Display.getCurrent(), is); + shell.setImage(icon); + try { + is.close(); + } catch (IOException e) { + EMLogger.getLogger().info(e.getMessage()); + } + } + } + + public void draw() { + VMListTableViewer vmListViewer = new VMListTableViewer(shell, "vmlist"); + viewerList.add(vmListViewer); + this.setStackTop(findViewer("vmlist")); + } + + public AbstractTableViewer findViewer (String key) { + for (AbstractTableViewer viewer : viewerList) { + if (viewer.getKey().equals(key)) { + return viewer; + } + } + return null; + } + + public void open() { + // TODO + //CheckingRunningEmulator.startCheckingThread(); + + shell.open(); + while(!shell.isDisposed()) { + if(!Display.getCurrent().readAndDispatch()) { + Display.getCurrent().sleep(); + } + } + } + + public void dispose() { + ImageResources.dispose(); + //ColorResources.dispose(); + if(icon != null) { + icon.dispose(); + } + } + + public static Shell getShell() { + return shell; + } + + public void setStackTop(AbstractTableViewer viewer) { + stackLayout.topControl = viewer.getMainComposite(); + // TODO + viewer.initTableViewer(); + viewer.showTableViewer(); + } + +} diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java new file mode 100644 index 0000000..7d97041 --- /dev/null +++ b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java @@ -0,0 +1,221 @@ +/* + * Emulator Manager + * + * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * JiHye Kim + * Minkee Lee + * SeokYeon Hwang + * Sangho Park + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.ui.renewal.tableviewer; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.tizen.emulator.manager.resources.ColorResources; +import org.tizen.emulator.manager.ui.dialog.AboutDialog; +import org.tizen.emulator.manager.renewal.resources.ImageResources; +import org.tizen.emulator.manager.ui.table.FontResources; +import org.tizen.emulator.manager.ui.widgets.ImageButton; + +public abstract class AbstractTableViewer { + private static final int BUTTON_MENU_WIDTH = 20; + private static final int BUTTON_MENU_HEIGHT = 20; + private String key; + private Composite mainComp; + + private Composite topComp; + private Composite tableComp; + + private boolean isInitialize = false; + + private static ImageButton infoButton; + private List buttonMenuList = new ArrayList(); + + private List