+* 2.1.8
+- add scroll bar on detail view
+- add tree view on list view
+- delete da button (change to image button)
+== jihye kim <jihye1128.kim@samsung.com> 2013-06-03
+
* 2.1.7
- apply feedback
- change launch button, modify button
Source: emulator-manager
-Version: 2.1.7
+Version: 2.1.8
Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
Package: emulator-manager
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.CustomPlatform;
import org.tizen.emulator.manager.platform.Platform;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.platform.TotalPlatform;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.tool.CheckSDCard;
import org.tizen.emulator.manager.tool.CheckVirtualization;
checkConsoleMode(args);
- randomAccessFile = new RandomAccessFile(new File(FilePath.getInstance().getBinPath()
+ randomAccessFile = new RandomAccessFile(new File(FilePathResouces.getInstance().getBinPath()
+ File.separator + "." +System.getProperty("user.name"))+ ".lock",
"rw");
if (isConsoleMode) {
}
private static CustomPlatform custom = new CustomPlatform();
+ private static TotalPlatform total = new TotalPlatform();
public static CustomPlatform getCustomPlatform() {
return custom;
}
+ public static TotalPlatform getTotalPlatform() {
+ return total;
+ }
+
static void makePlatformList() {
platformList = new ArrayList<Platform>();
- File platforms = new File(FilePath.getInstance().getPlatformsPath());
+ File platforms = new File(FilePathResouces.getInstance().getPlatformsPath());
if (platforms.isDirectory() && platforms.exists()) {
for (File platform : platforms.listFiles()) {
if (platform.isDirectory()) {
}
}
}
+
+ total.settingVMProperty();
}
public enum ManagerModeType {
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.platform.SkinList;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.tool.SelectTemplate;
import org.tizen.emulator.manager.tool.SelectWorkspace;
import org.tizen.emulator.manager.vms.RAM_SIZE;
" Get workspace : workspace -g");
commandList.add(new Command("s", Actions.OP_SET,
- "Set path of workspace.", FilePath.getInstance().getTizenVmsPath(),
+ "Set path of workspace.", FilePathResouces.getInstance().getTizenVmsPath(),
false, true));
commandList.add(new Command("g", Actions.OP_GET,
- "Get current workspace path.", FilePath.getInstance().getTizenVmsPath(),
+ "Get current workspace path.", FilePathResouces.getInstance().getTizenVmsPath(),
false, false));
}
if (isGet) {
System.out.println("Current Workspace : ");
- System.out.println(FilePath.getInstance().getTizenWorkspacePath());
+ System.out.println(FilePathResouces.getInstance().getTizenWorkspacePath());
} else {
File f = null;
try {
commandList.add(new Command("p", Actions.OP_PATH,
"Setting path of emulator program.",
- FilePath.getInstance().getBinPath(), false, true));
+ FilePathResouces.getInstance().getBinPath(), false, true));
commandList.add(new Command("t", Actions.OP_TEST,
"Print parameters of emulator without executing emulator.",
"Name of VM to create base target image.","", true, true));
commandList.add(new Command("p", Actions.OP_PATH,
"Setting Location to generate base target image.",
- FilePath.getInstance().getTizenWorkspacePath(), false, true));
+ FilePathResouces.getInstance().getTizenWorkspacePath(), false, true));
}
@Override
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.button;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.tizen.emulator.manager.resources.ColorResources;
-
-public class DACustomButton extends Canvas {
-
- public static final int MAX_SIZE = 100;
-
- public static final int STATE_NORMAL = 0;
- public static final int STATE_PUSH = 1;
- public static final int STATE_HOVER = 2;
- public static final int STATE_DISABLE = 3;
-
- public static final int TYPE_IMAGE = 0;
- public static final int TYPE_COLOR = 1;
- public static final int TYPE_GRADATION = 2;
-
- protected int state = STATE_NORMAL;
- protected DACustomButtonAttribute attr;
- protected DACustomButtonRenderer buttonRenderer = null;
-
- public void addListeners() {
- this.addListener(SWT.MouseEnter, buttonMouseListener);
- this.addListener(SWT.MouseExit, buttonMouseListener);
- this.addListener(SWT.MouseDown, buttonMouseListener);
- this.addListener(SWT.MouseUp, buttonMouseListener);
- }
-
- public DACustomButton(Composite parent, int style) {
- super(parent, style);
-
- this.setForeground(ColorResources.WHITE.getColor());
- this.addPaintListener(buttonPaintListener);
- addListeners();
- buttonRenderer = new DACustomButtonDefaultRenderer();
- attr = new DACustomButtonAttribute();
- setDefaultColors();
- }
-
- public DACustomButton(Composite parent, int style, String titleText) {
- this(parent, style);
- attr.setText(titleText);
- }
-
- public DACustomButton(Composite parent, Image normal, Image mouseDown,
- Image hover, Image disable) {
- this(parent, SWT.TRANSPARENT);
- setImages(normal, mouseDown, hover, disable);
- attr.setDrawType(TYPE_IMAGE);
- }
-
- public DACustomButton(Composite parent, Color normalStart, Color normalEnd,
- Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd,
- Color disableStart, Color disableEnd) {
- this(parent, SWT.NONE);
- attr.setColor(0, normalStart);
- attr.setColor(1, normalEnd);
- attr.setColor(2, pushStart);
- attr.setColor(3, pushEnd);
- attr.setColor(4, hoverStart);
- attr.setColor(5, hoverEnd);
- attr.setColor(6, disableStart);
- attr.setColor(7, disableEnd);
- attr.setDrawType(TYPE_GRADATION);
- }
-
- protected void changeButtonState(int s) {
- if (s == STATE_DISABLE) {
- super.setEnabled(false);
- } else {
- super.setEnabled(true);
- }
-
- state = s;
- this.redraw();
- }
-
- protected Listener buttonMouseListener = new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- if (state == STATE_DISABLE) {
- return;
- }
-
- if (event.type == SWT.MouseEnter) {
- changeButtonState(STATE_HOVER);
- }
-
- if (event.type == SWT.MouseExit) {
- changeButtonState(STATE_NORMAL);
- }
-
- if (event.type == SWT.MouseDown) {
- changeButtonState(STATE_PUSH);
- }
-
- if (event.type == SWT.MouseUp) { // FIXME
- changeButtonState(STATE_HOVER);
- }
- }
- };
-
- private void setDefaultColors() {
- attr.setColor(STATE_DISABLE,
- new Color(Display.getCurrent(), 48, 48, 48));
- attr.setColor(STATE_PUSH, new Color(Display.getCurrent(), 29, 109, 140));
- attr.setColor(STATE_HOVER, new Color(Display.getCurrent(), 0, 134, 185));
- attr.setColor(STATE_NORMAL, new Color(Display.getCurrent(), 67, 67, 67));
- }
-
- private PaintListener buttonPaintListener = new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- buttonRenderer.draw(e.gc, (Canvas) e.widget, state, attr);
- }
- };
-
- public void setTitle(String newTitle) {
- attr.setText(newTitle);
- }
-
- public void setText(String newTitle) {
- attr.setText(newTitle);
- }
-
- public void setButtonImage(Image img) {
- attr.setButtonImage(img);
- }
-
- public void setRenderer(DACustomButtonRenderer newRenderer) {
- buttonRenderer = newRenderer;
- }
-/*
- public boolean isEnabled() {
- return (state != STATE_DISABLE ? true : false);
- }
-*/
- public void setEnabled(boolean enabled) {
- if (enabled) {
- super.setEnabled(true);
- changeButtonState(STATE_NORMAL);
- } else {
- changeButtonState(STATE_DISABLE);
- }
- }
-
- public void setImage(int state, Image image) {
- attr.setImage(state, image);
- }
-
- public Image getImage(int state) {
- return attr.getImage(state);
- }
-
- public void setColor(int state, Color color) {
- attr.setColor(state, color);
- }
-
- public void setFont(Font font) {
- attr.setFont(font);
- }
-
- public void setFontPoint(Point p) {
- attr.setFontPoint(p);
- }
-
- public void setColors(Color normal, Color push, Color hover, Color disable) {
- attr.setColor(STATE_NORMAL, normal);
- attr.setColor(STATE_PUSH, push);
- attr.setColor(STATE_HOVER, hover);
- attr.setColor(STATE_DISABLE, disable);
- attr.setDrawType(TYPE_COLOR);
- }
-
- public void setImages(Image normal, Image push, Image hover, Image disable) {
- attr.setImage(STATE_NORMAL, normal);
- attr.setImage(STATE_PUSH, push);
- attr.setImage(STATE_HOVER, hover);
- attr.setImage(STATE_DISABLE, disable);
- attr.setDrawType(TYPE_IMAGE);
- }
-
- public void setOutlineColors(Color normal, Color push, Color hover,
- Color disable) {
- attr.setOutlineColor(STATE_NORMAL, normal);
- attr.setOutlineColor(STATE_PUSH, push);
- attr.setOutlineColor(STATE_HOVER, hover);
- attr.setOutlineColor(STATE_DISABLE, disable);
- }
-
- public void setOutlineInColors(Color normal, Color push, Color hover,
- Color disable) {
- attr.setOutlineInColor(STATE_NORMAL, normal);
- attr.setOutlineInColor(STATE_PUSH, push);
- attr.setOutlineInColor(STATE_HOVER, hover);
- attr.setOutlineInColor(STATE_DISABLE, disable);
- }
-
- public void addClickListener(DACustomButtonClickEventListener listener) {
- addListener(SWT.MouseUp, listener);
- }
-
- public int getState() {
- return state;
- }
-
- public void setGradation(Color normalStart, Color normalEnd,
- Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd,
- Color disableStart, Color disableEnd) {
- attr.setColor(0, normalStart);
- attr.setColor(1, normalEnd);
- attr.setColor(2, pushStart);
- attr.setColor(3, pushEnd);
- attr.setColor(4, hoverStart);
- attr.setColor(5, hoverEnd);
- attr.setColor(6, disableStart);
- attr.setColor(7, disableEnd);
- attr.setDrawType(TYPE_GRADATION);
- }
-
- public void setGradationColor(int state, Color start, Color end) {
- attr.setColor(state * 2, start);
- attr.setColor(state * 2 + 1, end);
- }
-
- public void setFontColors(Color normal, Color push, Color hover,
- Color disable) {
- attr.setFontColor(STATE_NORMAL, normal);
- attr.setFontColor(STATE_PUSH, push);
- attr.setFontColor(STATE_HOVER, hover);
- attr.setFontColor(STATE_DISABLE, disable);
- }
-
- public void setFontColor(int state, Color color) {
- attr.setFontColor(state, color);
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.button;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-public class DACustomButtonAttribute {
- private final int MAX_SIZE = 12;
- private String text;
- private Image buttonImage = null;
- private Font font;
- private Point fontPoint;
- private int drawType = DACustomButton.TYPE_COLOR;
-
- private List<Image> images = new ArrayList<Image>();
- private List<Color> colors = new ArrayList<Color>();
- private List<Color> fontColors = new ArrayList<Color>();
- private List<Color> outlineColors = new ArrayList<Color>();
- private List<Color> outlineInColors = new ArrayList<Color>();
- private boolean enabled;
-
- public DACustomButtonAttribute() {
- enabled = true;
-
- // init array list
- for (int i = 0; i < MAX_SIZE; i++) {
- images.add(null);
- colors.add(null);
- fontColors.add(null);
- outlineColors.add(null);
- outlineInColors.add(null);
- }
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public Image getButtonImage() {
- return buttonImage;
- }
-
- public void setButtonImage(Image img) {
- buttonImage = img;
- }
-
- public Font getFont() {
- return font;
- }
-
- public void setFont(Font font) {
- this.font = font;
- }
-
- public Point getFontPoint() {
- return fontPoint;
- }
-
- public void setFontPoint(Point fontPoint) {
- this.fontPoint = fontPoint;
- }
-
- public int getDrawType() {
- return drawType;
- }
-
- public void setDrawType(int type) {
- drawType = type;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public Image getImage(int state) {
- if (!images.isEmpty()) {
- return images.get(state);
- }
- return null;
- }
-
- public void setImage(int state, Image img) {
- images.set(state, img);
- }
-
- public Color getColor(int state) {
- if (!colors.isEmpty()) {
- return colors.get(state);
- }
- return null;
- }
-
- public void setColor(int state, Color color) {
- colors.set(state, color);
- }
-
- public void setFontColor(int state, Color color) {
- fontColors.set(state, color);
- }
-
- public Color getFontColor(int state) {
- return fontColors.get(state);
- }
-
- public void setOutlineColor(int state, Color color) {
- outlineColors.set(state, color);
- }
-
- public Color getOutlineColor(int state) {
- return outlineColors.get(state);
- }
-
- public void setOutlineInColor(int state, Color color) {
- outlineInColors.set(state, color);
- }
-
- public Color getOutlineInColor(int state) {
- return outlineInColors.get(state);
- }
-}
+++ /dev/null
-/*\r
- * Dynamic Analyzer\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- * \r
- */\r
-\r
-package org.tizen.emulator.manager.da.widgets.button;\r
-\r
-import org.eclipse.swt.graphics.Rectangle;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Listener;\r
-\r
-public abstract class DACustomButtonClickEventListener implements Listener {\r
-\r
- @Override\r
- public void handleEvent(Event event) {\r
- DACustomButton button = (DACustomButton) event.widget;\r
- if (null != button && button.getState() != DACustomButton.STATE_DISABLE) {\r
- Rectangle rectangle = button.getBounds();\r
- int x = event.x;\r
- int y = event.y;\r
-\r
- if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
- return;\r
- }\r
- } else {\r
- return;\r
- }\r
-\r
- handleClickEvent(button);\r
- }\r
-\r
- public abstract void handleClickEvent(DACustomButton button);\r
-}\r
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.button;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-import org.tizen.emulator.manager.resources.ColorResources;
-
-public class DACustomButtonDefaultRenderer extends DACustomButtonRenderer {
-
- @Override
- public void draw(GC gc, Canvas canvas, int state,
- DACustomButtonAttribute attr) {
- Rectangle rect = canvas.getClientArea();
-
- if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- Image image = attr.getImage(state);
- if (null == image) {
- return;
- }
-
- gc.drawImage(image, rect.x, rect.y);
- drawButtonText(gc, rect, attr, state);
- } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
- || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
- drawButton(gc, rect, state, attr);
- }
- drawButtonImage(gc, rect, attr);
- }
-
- public int computeFontSize(Rectangle rect) {
- if (rect.height > 20)
- return 10;
- else
- return 8;
- }
-
- public void drawButton(GC gc, Rectangle rect, int state,
- DACustomButtonAttribute attr) {
- if (attr.getDrawType() == DACustomButton.TYPE_COLOR) {
- gc.setBackground(attr.getColor(state));
- gc.fillRectangle(rect);
- } else {
- int index = state * 2;
- gc.setForeground(attr.getColor(index));
- gc.setBackground(attr.getColor(index + 1));
- gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height,
- true);
- }
-
- Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
- if (attr.getButtonImage() == null) {
- drawButtonText(gc, r, attr, state);
- }
- Color c = gc.getForeground();
- if (null != attr.getOutlineColor(state)) {
- gc.setForeground(attr.getOutlineColor(state));
- } else {
- gc.setForeground(ColorResources.BLACK.getColor());
- }
- gc.drawRectangle(r);
- Rectangle ir = new Rectangle(r.x + 1, r.y + 1, r.width - 2,
- r.height - 2);
- if (null != attr.getOutlineInColor(state)) {
- gc.setForeground(attr.getOutlineInColor(state));
- } else {
- gc.setForeground(c);
- return;
- }
- gc.drawRectangle(ir);
- gc.setForeground(c);
- }
-
- protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
- Rectangle imgRect = img.getBounds();
- int width = rect.width - imgRect.width;
- int height = rect.height - imgRect.height;
- int x = 0, y = 0;
- if (width > 0) {
- x = width / 2;
- }
-
- if (height > 0) {
- y = height / 2;
- }
- gc.drawImage(img, x, y);
- }
- }
-
- protected void drawButtonText(GC gc, Rectangle rect,
- DACustomButtonAttribute attr, int state) {
- String text = null;
- Font font = null;
- Point p = null;
- if (null != (text = attr.getText())) {
- if (null == (font = attr.getFont())) {
- font = new Font(Display.getCurrent(), "Arial",
- computeFontSize(rect), SWT.BOLD);
- attr.setFont(font);
- }
- gc.setFont(font);
-
- int x = 0, y = 0;
- int offset = 0;
- if (null == (p = attr.getFontPoint())) {
- p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- x = (rect.width - p.x) / 2;
- y = (rect.height - p.y) / 2;
- x = (x < 0) ? 0 : x;
- // rect size < text length -> insert offset
- // offset = ((x - rect.x) < 4) ? 4 : 0;
- offset = 0;
- } else {
- x = p.x;
- y = p.y;
- }
-
- if (null != attr.getFontColor(state)) {
- gc.setForeground(attr.getFontColor(state));
- } else {
- gc.setForeground(ColorResources.BLACK.getColor());
- }
-
- if (state == DACustomButton.STATE_PUSH) {
- x += 1;
- y += 1;
- }
- gc.drawString(text, x + offset, y, true);
- }
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.button;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widgets.Canvas;
-
-public abstract class DACustomButtonRenderer {
- public abstract void draw(GC gc, Canvas canvas, int state,
- DACustomButtonAttribute attr);
-
-}
+++ /dev/null
-/*\r
- * Dynamic Analyzer\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- * \r
- */\r
-\r
-package org.tizen.emulator.manager.da.widgets.button.toggle;\r
-\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.swt.widgets.Event;\r
-import org.eclipse.swt.widgets.Listener;\r
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;\r
-import org.tizen.emulator.manager.resources.ColorResources;\r
-\r
-public class DACustomToggleButton extends DACustomButton {\r
-\r
- public static final int STATE_TOGGLE = 4;\r
- public static final int STATE_TOGGLE_HOVER = 5;\r
- public static final int STATE_TOGGLE_PUSH = 6;\r
- private boolean toggle = false;\r
- private boolean toggleByButton = false;\r
-\r
- public DACustomToggleButton(Composite parent, Image normal, Image push,\r
- Image hover, Image disable, Image toggle, Image toggleHover) {\r
- super(parent, normal, push, hover, disable);\r
- buttonRenderer = new DACustomToggleButtonRenderer();\r
-\r
- attr.setImage(STATE_TOGGLE, toggle);\r
- attr.setImage(STATE_TOGGLE_HOVER, toggleHover);\r
- addListeners();\r
- }\r
-\r
- public DACustomToggleButton(Composite parent, Image normal, Image push,\r
- Image hover, Image disable, Image toggle, Image toggleHover,\r
- Image togglePush) {\r
- this(parent, normal, push, hover, disable, toggle, toggleHover);\r
- buttonRenderer = new DACustomToggleButtonRenderer();\r
-\r
- attr.setImage(STATE_TOGGLE_PUSH, togglePush);\r
- }\r
-\r
- public DACustomToggleButton(Composite parent, int style) {\r
- super(parent, style);\r
- buttonRenderer = new DACustomToggleButtonRenderer();\r
- attr.setColor(STATE_TOGGLE, ColorResources.BLUE.getColor());\r
- attr.setColor(STATE_TOGGLE_HOVER, ColorResources.WHITE.getColor());\r
- addListeners();\r
- }\r
-\r
- public DACustomToggleButton(Composite parent, Color normalStart,\r
- Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart,\r
- Color hoverEnd, Color disableStart, Color disableEnd,\r
- Color toggleStart, Color toggleEnd, Color toggleHoverStart,\r
- Color toggleHoverEnd) {\r
- this(parent, SWT.NONE);\r
- attr.setColor(0, normalStart);\r
- attr.setColor(1, normalEnd);\r
- attr.setColor(2, pushStart);\r
- attr.setColor(3, pushEnd);\r
- attr.setColor(4, hoverStart);\r
- attr.setColor(5, hoverEnd);\r
- attr.setColor(6, disableStart);\r
- attr.setColor(7, disableEnd);\r
- attr.setColor(8, toggleStart);\r
- attr.setColor(9, toggleEnd);\r
- attr.setColor(10, toggleHoverStart);\r
- attr.setColor(11, toggleHoverEnd);\r
- attr.setDrawType(TYPE_GRADATION);\r
- }\r
-\r
- public void setToggled(boolean toggled) {\r
- toggle = toggled;\r
- if (toggled) {\r
- changeButtonState(STATE_TOGGLE);\r
- } else {\r
- changeButtonState(STATE_NORMAL);\r
- }\r
- }\r
-\r
- public void setToggled2(boolean toggled) {\r
- if (!toggleByButton) {\r
- toggle = toggled;\r
- if (toggled) {\r
- changeButtonState(STATE_TOGGLE);\r
- } else {\r
- changeButtonState(STATE_NORMAL);\r
- }\r
- }\r
- }\r
-\r
- public boolean isToggled() {\r
- return toggle;\r
- }\r
-\r
- @Override\r
- public void addListeners() {\r
- if (null != toggleButtonMouseListener) {\r
- this.addListener(SWT.MouseEnter, toggleButtonMouseListener);\r
- this.addListener(SWT.MouseExit, toggleButtonMouseListener);\r
- this.addListener(SWT.MouseDown, toggleButtonMouseListener);\r
- this.addListener(SWT.MouseUp, toggleButtonMouseListener);\r
- }\r
- }\r
-\r
- private Listener toggleButtonMouseListener = new Listener() {\r
-\r
- @Override\r
- public void handleEvent(Event event) {\r
- if (state == STATE_DISABLE) {\r
- return;\r
- }\r
-\r
- if (event.type == SWT.MouseEnter) {\r
- if (toggle) {\r
- changeButtonState(STATE_TOGGLE_HOVER);\r
- } else {\r
- changeButtonState(STATE_HOVER);\r
- }\r
- }\r
-\r
- if (event.type == SWT.MouseExit) {\r
- if (toggle) {\r
- changeButtonState(STATE_TOGGLE);\r
- } else {\r
- changeButtonState(STATE_NORMAL);\r
- }\r
- }\r
-\r
- if (event.type == SWT.MouseDown) {\r
- if (toggle) {\r
- if (null != attr.getImage(STATE_TOGGLE_PUSH)) {\r
- changeButtonState(STATE_TOGGLE_PUSH);\r
- } else {\r
- changeButtonState(STATE_PUSH);\r
- }\r
- } else {\r
- changeButtonState(STATE_PUSH);\r
- }\r
- }\r
-\r
- if (event.type == SWT.MouseUp) { // FIXME\r
- toggle = !toggle;\r
- toggleByButton = !toggleByButton;\r
- if (toggle) {\r
- changeButtonState(STATE_TOGGLE_HOVER);\r
- } else {\r
- changeButtonState(STATE_HOVER);\r
- }\r
- }\r
- }\r
- };\r
-}\r
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.button.toggle;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer;
-
-public class DACustomToggleButtonRenderer extends DACustomButtonDefaultRenderer {
-
- @Override
- public void draw(GC gc, Canvas canvas, int state,
- DACustomButtonAttribute attr) {
- Rectangle rect = canvas.getClientArea();
- if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- Image image = attr.getImage(state);
- if (null == image) {
- return;
- }
-
- gc.drawImage(image, rect.x, rect.y);
- drawButtonText(gc, rect, attr, state);
- } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
- || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
- drawButton(gc, rect, state, attr);
- }
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonRenderer;
-import org.tizen.emulator.manager.resources.ColorResources;
-
-public class DACustomCombo extends Canvas {
- public static final int MAX_SIZE = 10;
- public static final int STATE_NORMAL = 0;
- public static final int STATE_HOVER = 1;
- public static final int STATE_PUSH = 2;
- public static final int STATE_DISABLE = 3;
-
- private static final int pageSize = 5;
-
- Composite parent;
- protected Canvas combo = null;
- private Canvas popup = null;
- private int itemHeight = 0;
- private DACustomButton upArrowButton = null;
- private DACustomButton downArrowButton = null;
- private int itemIndex = 0;
- private boolean dirty = false;
-
- private List<String> items;
- private List<Rectangle> rects = null;
-
- private List<Image> images = null;
- protected Image buttonUp = null;
- private Image buttonDown = null;
- private boolean enabled = true;
- private Shell childShell = null;
- private int selection = 0;
- private String text = ""; //$NON-NLS-1$
- private boolean imgCombo = false;
- protected int state = STATE_NORMAL; // 0 normal 1 hover 2 push 3 disable
- protected DACustomComboRenderer comboRenderer = new DACustomComboDefaultRenderer();;
- private DACustomComboPopupRenderer popupRenderer = new DACustomComboPopupDefaultRenderer();
- private DACustomButtonRenderer buttonRenderer = null;
-
- private List<Color> arrowColors = null;
- private List<Image> arrowImages = null;
-
- public DACustomCombo(Composite parent, int style) {
- super(parent, style);
- combo = this;
-
- this.parent = parent;
- addPaintListener(comboPaintListener);
- setForeground(ColorResources.WHITE.getColor());
- addListeners();
- initCombo();
- }
-
- public void addListeners() {
- addListener(SWT.MouseEnter, comboMouseListener);
- addListener(SWT.MouseHover, comboMouseListener);
- addListener(SWT.MouseExit, comboMouseListener);
- addListener(SWT.MouseDown, comboMouseListener);
- addListener(SWT.MouseMove, comboMouseListener);
- addListener(SWT.MouseUp, comboMouseListener);
- }
-
- public String getText() {
- if (getItems().size() > 0) {
- return getItems().get(itemIndex + selection);
- }
- return null;
- }
-
- public List<String> getItems() {
- if (null == items) {
- items = new ArrayList<String>();
- }
- return items;
- }
-
- private List<Rectangle> getRects() {
- if (null == rects) {
- rects = new ArrayList<Rectangle>();
- }
- return rects;
- }
-
- private void changeComboState(int s) {
- state = s;
- redraw();
- }
-
- private Listener popupSelectionListener = new DACustomComboSelectionListener() {
-
- @Override
- public void selectionEvent(DACustomCombo combo) {
- //System.out.println("default selection" + combo.getText());
- }
- };
-
- public void addSelectionListener(DACustomComboSelectionListener listener) {
- popupSelectionListener = listener;
- }
-
- private Listener comboMouseListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (enabled) {
- if (event.type == SWT.MouseEnter) {
- changeComboState(STATE_HOVER);
- }
-
- if (event.type == SWT.MouseHover) {
- if (!isOutOfBounds(event.x, event.y)) {
- if (0 != (event.stateMask & SWT.BUTTON1)) {
- changeComboState(STATE_PUSH);
- } else if (0 == (event.stateMask & SWT.BUTTON1)) {
- changeComboState(STATE_HOVER);
- }
- }
- }
-
- if (event.type == SWT.MouseDown) {
- changeComboState(STATE_PUSH);
- }
-
- if (event.type == SWT.MouseUp) {
- changeComboState(STATE_HOVER);
- if (childShell == null || childShell.isDisposed()) {
- openChildShell();
- } else {
- childShell.close();
- childShell = null;
- }
- }
-
- if (event.type == SWT.MouseMove) {
- if (isOutOfBounds(event.x, event.y)) {
- changeComboState(STATE_NORMAL);
- } else if (isOutOfBounds(event.x, event.y)) {
- if (0 != (event.stateMask & SWT.BUTTON1)) {
- changeComboState(STATE_PUSH);
- } else if (0 == (event.stateMask & SWT.BUTTON1)) {
- changeComboState(STATE_HOVER);
- }
- }
- }
-
- if (event.type == SWT.MouseExit) {
- changeComboState(STATE_NORMAL);
- }
- }
- }
- };
-
- protected boolean isOutOfBounds(int x, int y) {
- Rectangle rectangle = combo.getBounds();
-
- if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
- return true;
- }
-
- return false;
- }
-
- private int getShellWidth() {
- if (getItems().isEmpty()) {
- return 0;
- }
- int max = 0;
- int size = items.size();
- GC gc = new GC(parent.getDisplay(), SWT.NONE);
- for (int i = 0; i < size; i++) {
- Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC);
- if (p.x > max) {
- max = p.x;
- }
- }
- max += 10;
- gc.dispose();
- return max;
- }
-
- public int getItemHeight() {
- return itemHeight;
- }
-
- public void setItemHeight(int height) {
- itemHeight = height;
- }
-
- private void openChildShell() {
- childShell = new Shell(parent.getShell(), SWT.ON_TOP);
- childShell.setLayout(new FormLayout());
-
- Point p = combo.toDisplay(0, 0);
- Rectangle rect = combo.getBounds();
- int size = getItems().size();
-
- int boundSize = (size > MAX_SIZE) ? MAX_SIZE : (size > 0) ? size : 1;
-
- int textSize = getShellWidth() + 4;
- int shellWidth = (textSize > rect.width) ? textSize : rect.width;
- int height = 0;
-
- if (getItemHeight() == 0) {
- height = rect.height;
- } else {
- height = getItemHeight();
- }
- int shellHeight = height * boundSize + 5;
-
- childShell.setSize(shellWidth, shellHeight);
- childShell.setLocation(p.x, p.y + rect.height);
- // childShell.setBackground(ColorResources.BLUE);
- setSelect(text);
-
- popup = new Canvas(childShell, SWT.DOUBLE_BUFFERED);
- popup.setData(this);
- popup.setBackground(ColorResources.WHITE.getColor());
- popup.addPaintListener(popupPaintListener);
- popup.addListener(SWT.MouseUp, popupMouseEventListener);
- popup.addListener(SWT.MouseMove, popupMouseEventListener);
- popup.addListener(SWT.FocusOut, popupMouseEventListener);
- popup.addListener(SWT.MouseUp, popupSelectionListener);
- popup.addListener(SWT.MouseWheel, popupMouseEventListener);
-
- if (size > MAX_SIZE) {
- upArrowButton = makeButton();
- if (buttonUp == null) {
- upArrowButton.setText("UP");
- } else {
- upArrowButton.setButtonImage(buttonUp);
- }
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.height = height;
- upArrowButton.setLayoutData(data);
- upArrowButton.addMouseListener(upArrowListener);
- upArrowButton.addListener(SWT.MouseExit, upButtonMouseExitListener);
- shellHeight += height;
- if (itemIndex > 0) {
- upArrowButton.setEnabled(true);
- } else {
- upArrowButton.setEnabled(false);
- }
-
- data = new FormData();
- data.top = new FormAttachment(upArrowButton, 0);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.height = height * boundSize + 5 - 2;
- popup.setLayoutData(data);
-
- // downArrowButton = new DACustomButton(childShell, SWT.NONE);
- downArrowButton = makeButton();
- // downArrowButton.setText("down"); //$NON-NLS-1$
- if (null == buttonDown) {
- downArrowButton.setText("DOWN");
- } else {
- downArrowButton.setButtonImage(buttonDown);
- }
- data = new FormData();
- data.top = new FormAttachment(popup, 0);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.height = height;
- downArrowButton.setLayoutData(data);
- downArrowButton.addMouseListener(downArrowListener);
- downArrowButton.addListener(SWT.MouseExit,
- downButtonMouseExitListener);
- shellHeight += height;
- if (itemIndex + MAX_SIZE < size - 1) {
- downArrowButton.setEnabled(true);
- } else {
- downArrowButton.setEnabled(false);
- }
-
- childShell.setSize(shellWidth, shellHeight);
- } else {
- FormData data = new FormData();
- data.top = new FormAttachment(0, 0);
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.height = shellHeight - 2;
- popup.setLayoutData(data);
- }
-
- size = (size > MAX_SIZE) ? MAX_SIZE : size;
- getRects().clear();
- for (int i = 0; i < size; i++) {
- Rectangle r = new Rectangle(2, 2 + i * height, shellWidth - 2,
- height);
- getRects().add(r);
- }
- childShell.open();
- }
-
- private MouseListener upArrowListener = new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent event) {
- if (!upArrowButton.isEnabled()) {
- return;
- }
-
- if (null != upArrowButton) {
- Rectangle rectangle = upArrowButton.getBounds();
- int x = event.x;
- int y = event.y;
-
- if (x < 0 || x > rectangle.width || y < 0
- || y > rectangle.height) {
- return;
- }
- }
-
- int size = getItems().size();
- if (itemIndex - pageSize < 0) {
- itemIndex = 0;
- upArrowButton.setEnabled(false);
- } else {
- itemIndex -= pageSize;
- }
-
- if (itemIndex + pageSize < size - 1) {
- downArrowButton.setEnabled(true);
- }
- popup.redraw();
- }
-
- @Override
- public void mouseDown(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
- };
-
- private MouseListener downArrowListener = new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent event) {
-
- if (!downArrowButton.isEnabled()) {
- return;
- }
-
- if (null != downArrowButton) {
- Rectangle rectangle = downArrowButton.getBounds();
- int x = event.x;
- int y = event.y;
-
- if (x < 0 || x > rectangle.width || y < 0
- || y > rectangle.height) {
- return;
- }
- }
-
- int size = getItems().size();
- if (itemIndex + pageSize + MAX_SIZE >= size - 1) {
- itemIndex = size - MAX_SIZE;
- downArrowButton.setEnabled(false);
- } else {
- itemIndex += pageSize;
- }
-
- // if (itemIndex - pageSize > 0) {
- if (itemIndex > 0) {
- upArrowButton.setEnabled(true);
- }
- popup.redraw();
- }
-
- @Override
- public void mouseDown(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
- };
-
- private PaintListener popupPaintListener = new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- List<String> items = getItems();
- List<String> input = new ArrayList<String>();
- int size = (items.size() > MAX_SIZE) ? MAX_SIZE : items.size();
- for (int i = 0; i < size; i++) {
- input.add(items.get(itemIndex + i));
- }
- popupRenderer
- .draw(e.gc, popup, state, getRects(), selection, input);
- }
- };
-
- public void setText(String text) {
- if (!setSelect(text)) {
- this.text = text;
- redraw();
- }
- }
-
- private boolean setSelect(String text) {
- if (getItems().isEmpty()) {
- return false;
- }
-
- int index = items.indexOf(text);
- if (index < 0) {
- return false;
- }
- int size = items.size();
- if (size < MAX_SIZE) {
- selection = index;
- select(selection);
- } else if (index + MAX_SIZE >= size) {
- int lower = size - index;
- selection = MAX_SIZE - lower;
- itemIndex = size - MAX_SIZE;
- select(selection);
- } else {
- selection = index - itemIndex;
- select(selection);
- }
- return true;
- }
-
- public void upEvent() {
- if (getItems().size() > 0) {
- setText(getItems().get(itemIndex + selection));
- } else {
- setText(""); //$NON-NLS-1$
- }
- if (childShell != null) {
- childShell.close();
- }
- childShell = null;
- }
-
- private Listener popupMouseEventListener = new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- if (event.type == SWT.MouseMove) {
- List<Rectangle> rs = getRects();
- int size = rs.size();
- for (int i = 0; i < size; i++) {
- if (rs.get(i).contains(event.x, event.y)) {
- selection = i;
- popup.redraw();
- break;
- }
- }
- }
-
- if (event.type == SWT.FocusOut) {
- childShell.close();
- childShell = null;
- }
-
- if (event.type == SWT.MouseWheel) {
- int size = getItems().size();
- if (null != downArrowButton && null != upArrowButton) {
- if (event.count < 0) {
- if (itemIndex - event.count + MAX_SIZE >= size - 1) {
- itemIndex = size - MAX_SIZE;
- downArrowButton.setEnabled(false);
- } else {
- itemIndex -= event.count;
- }
-
- // if (itemIndex - pageSize > 0) {
- if (itemIndex > 0) {
- upArrowButton.setEnabled(true);
- }
- } else {
-
- if (itemIndex - event.count < 0) {
- itemIndex = 0;
- upArrowButton.setEnabled(false);
- } else {
- itemIndex -= event.count;
- }
-
- if (itemIndex + event.count < size - 1) {
- downArrowButton.setEnabled(true);
- }
- }
- popup.redraw();
- }
- }
- }
- };
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- if (enabled) {
- changeComboState(STATE_NORMAL);
- if (isImageCombo()) {
- setBackgroundImage(images.get(STATE_NORMAL));
- }
- } else {
- changeComboState(STATE_DISABLE);
- if (isImageCombo()) {
- setBackgroundImage(images.get(STATE_DISABLE));
- }
- }
- }
-
- private PaintListener comboPaintListener = new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- if (!isImageCombo()) {
- comboRenderer.draw(e.gc, combo, text, state);
- } else {
- comboRenderer.drawImage(e.gc, combo, images.get(state), text,
- state);
- }
- }
- };
-
- public void setComboRender(DACustomComboRenderer newRenderer) {
- comboRenderer = newRenderer;
- }
-
- public void setComboPopupRender(DACustomComboPopupRenderer newRenderer) {
- popupRenderer = newRenderer;
- }
-
- // public void removeAll() {
- // getItems().clear();
- // }
-
- public void add(String item) {
- if (dirty) {
- getItems().add(item);
- } else {
- getItems().set(0, item);
- dirty = true;
- }
- }
-
- public void add(String item, int index) {
- getItems().add(index, item);
- }
-
- public void select(int index) {
- selection = index;
- this.text = items.get(itemIndex + selection);
- redraw();
- }
-
- public String getItem(int index) {
- if (getItems().size() > 0) {
- return getItems().get(index);
- }
- return ""; //$NON-NLS-1$
- }
-
- public void setImages(Image normal, Image hover, Image push, Image disable) {
- if (null == normal || null == hover || null == push || null == disable) {
- return;
- }
- List<Image> imgs = getImages();
-
- imgs.add(normal);
- imgs.add(hover);
- imgs.add(push);
- imgs.add(disable);
- setImageCombo(true);
- }
-
- protected List<Image> getImages() {
- if (null == images) {
- images = new ArrayList<Image>();
- }
- return images;
- }
-
- private void setImageCombo(boolean b) {
- this.imgCombo = b;
- }
-
- public boolean isImageCombo() {
- return imgCombo;
- }
-
- private Listener upButtonMouseExitListener = new Listener() {
-
- @Override
- public void handleEvent(Event event) {
- }
- };
-
- private Listener downButtonMouseExitListener = new Listener() {
-
- @Override
- public void handleEvent(Event event) {
-
- }
- };
-
- public boolean isDirty() {
- return dirty;
- }
-
- public void initCombo() {
- getItems().clear();
- itemIndex = 0;
- selection = 0;
- items.add("");
- dirty = false;
- }
-
- public void setComboButtonColor(Color normal, Color push, Color hover,
- Color disable) {
- arrowColors = new ArrayList<Color>();
- arrowColors.add(normal);
- arrowColors.add(push);
- arrowColors.add(hover);
- arrowColors.add(disable);
- }
-
- public void setComboButtonImage(Image normal, Image push, Image hover,
- Image disable) {
- arrowImages = new ArrayList<Image>();
- arrowImages.add(normal);
- arrowImages.add(push);
- arrowImages.add(hover);
- arrowImages.add(disable);
- }
-
- public void setComboButtonGradation(Color normalStart, Color normalEnd,
- Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd,
- Color disableStart, Color disableEnd) {
- arrowColors = new ArrayList<Color>();
- arrowColors.add(normalStart);
- arrowColors.add(normalEnd);
- arrowColors.add(pushStart);
- arrowColors.add(pushEnd);
- arrowColors.add(hoverStart);
- arrowColors.add(hoverEnd);
- arrowColors.add(disableStart);
- arrowColors.add(disableEnd);
- }
-
- private DACustomButton makeButton() {
- DACustomButton button = null;
- if (arrowImages != null) {
- button = new DACustomButton(childShell,
- arrowImages.get(STATE_NORMAL), arrowImages.get(STATE_PUSH),
- arrowImages.get(STATE_HOVER),
- arrowImages.get(STATE_DISABLE));
- } else if (arrowColors != null) {
- if (arrowColors.size() > 4) {
- // gradation
- button = new DACustomButton(childShell,
- arrowColors.get(STATE_NORMAL),
- arrowColors.get(STATE_NORMAL + 1),
- arrowColors.get(STATE_PUSH * 2),
- arrowColors.get(STATE_PUSH * 2 + 1),
- arrowColors.get(STATE_HOVER * 2),
- arrowColors.get(STATE_HOVER * 2 + 1),
- arrowColors.get(STATE_DISABLE * 2),
- arrowColors.get(STATE_DISABLE * 2 + 1));
- } else {
- button = new DACustomButton(childShell, SWT.NONE);
- button.setColors(arrowColors.get(STATE_NORMAL),
- arrowColors.get(STATE_PUSH),
- arrowColors.get(STATE_HOVER),
- arrowColors.get(STATE_DISABLE));
- }
- } else {
- button = new DACustomButton(childShell, SWT.NONE);
- }
- if (null != buttonRenderer) {
- button.setRenderer(buttonRenderer);
- }
- return button;
- }
-
- public void setButtonRenderer(DACustomButtonRenderer renderer) {
- buttonRenderer = renderer;
- }
-
- public void setButtonImages(Image up, Image down) {
- buttonUp = up;
- buttonDown = down;
- }
-
- public int getItemIndex(String text) {
- return getItems().indexOf(text);
- }
-
- public int getImageIndex() {
- return selection;
- }
-
- public boolean isChildShellOpened() {
- if (childShell == null || childShell.isDisposed()) {
- return false;
- }
- return true;
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.resources.ColorResources;
-
-
-public class DACustomComboDefaultRenderer extends DACustomComboRenderer {
-
- @Override
- public void draw(GC gc, Canvas canvas, String text, int state) {
- Rectangle rect = canvas.getClientArea();
- if (state == DACustomCombo.STATE_NORMAL) {
- gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor());
- } else if (state == DACustomCombo.STATE_HOVER) {
- gc.setBackground(ColorResources.ITEM_BLUE_DARK.getColor());
- } else if (state == DACustomCombo.STATE_PUSH) {
- gc.setBackground(ColorResources.BLUE.getColor());
- } else if (state == DACustomCombo.STATE_DISABLE) {
- gc.setBackground(ColorResources.GRAY1.getColor());
- }
- gc.fillRectangle(rect);
- gc.drawRectangle(rect.x, rect.y, rect.width - 20, rect.height - 1);
-
- if (null == text) {
- text = ""; //$NON-NLS-1$
- }
- Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.drawString(text, 5, (rect.height - p.y)/2, true);
- gc.fillRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
- gc.drawRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
- }
-
- @Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state) {
-
- }
-
- @Override
- public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
-
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.resources.ColorResources;
-
-
-public class DACustomComboPopupDefaultRenderer extends DACustomComboPopupRenderer {
-
- @Override
- public void draw(GC gc, Canvas canvas, int state, List<Rectangle> rects,
- int selection, List<String> items) {
- int size = rects.size();
- for (int i = 0; i < size; i++) {
- Rectangle r = rects.get(i);
- gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor());
- if (selection == i) {
- gc.setBackground(ColorResources.RED.getColor());
- gc.fillRectangle(r);
- gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor());
- }
- gc.setForeground(ColorResources.WHITE.getColor());
- gc.drawRectangle(r.x, r.y, r.width - 1, r.height - 1);
- Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC);
- gc.drawString(items.get(i), 5, (r.height - p.y) / 2 + i * r.height,
- true);
- }
- }
-
- @Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- int state, List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void drawImage(GC gc, Canvas canvas, Image image, int state,
- List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
-
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import java.util.List;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-
-public abstract class DACustomComboPopupRenderer {
- public abstract void draw(GC gc, Canvas canvas, int state,
- List<Rectangle> rects, int selection, List<String> items);
-
- public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage,
- int state, List<Rectangle> rects, int selection, List<String> items);
-
- public abstract void drawImage(GC gc, Canvas canvas, Image image,
- int state, List<Rectangle> rects, int selection, List<String> items);
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Canvas;
-
-public abstract class DACustomComboRenderer {
- public abstract void draw(GC gc, Canvas canvas, String text, int state);
- public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage, String text, int state);
- public abstract void drawImage(GC gc, Canvas canvas, Image image, String text, int state);
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-public abstract class DACustomComboSelectionListener implements Listener {
-
- @Override
- public void handleEvent(Event event) {
- Canvas popup = (Canvas) event.widget;
- DACustomCombo combo = (DACustomCombo) popup.getData();
- if (null != combo) {
- selectionEvent(combo);
- combo.upEvent();
- }
- }
-
- public abstract void selectionEvent(DACustomCombo combo);
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import java.util.List;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-
-
-public class TitleComboPopupRenderer extends DACustomComboPopupRenderer {
-
- @Override
- public void draw(GC gc, Canvas canvas, int state, List<Rectangle> rects,
- int selection, List<String> items) {
- int size = rects.size();
- for (int i = 0; i < size; i++) {
- Rectangle r = rects.get(i);
- if (selection == i) {
- gc.setBackground(ColorResources.DEVICE_APPLICATION_ITEM_SELECT_INNER.getColor());
- gc.fillRectangle(r);
-
- gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_SELECT_TOP.getColor());
- gc.drawLine(r.x, r.y, r.x + r.width, r.y);
- gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_SELECT_BOTTOM.getColor());
- gc.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y
- + r.height - 1);
- } else {
- gc.setBackground(ColorResources.DEVICE_APPLICATION_ITEM_NORMAL_INNER.getColor());
- gc.fillRectangle(r);
- gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_NORMAL_TOP.getColor());
- gc.drawLine(r.x, r.y, r.x + r.width, r.y);
- gc.setForeground(ColorResources.DEVICE_APPLICATION_ITEM_NORMAL_BOTTOM.getColor());
- gc.drawLine(r.x, r.y + r.height - 1, r.x + r.width, r.y
- + r.height - 1);
- }
- gc.setForeground(ColorResources.DEVICE_APPLICATION_DROPDOWN_TEXT.getColor());
- gc.setFont(FontResources.DROPDOWN.getFont());
- // Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC);
- // gc.drawString(items.get(i), 5, (r.height - p.y) / 2 + i *
- // r.height,
- // true);
- gc.drawString(items.get(i), 5, 6 + i * r.height, true);
-
- Rectangle rect = canvas.getClientArea();
- gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_1.getColor());
- gc.drawRectangle(rect);
- gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_2.getColor());
- gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2,
- rect.height - 2);
- }
- }
-
- @Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- int state, List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void drawImage(GC gc, Canvas canvas, Image image, int state,
- List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
-
- }
-
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.da.widgets.combo;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-
-public class TitleComboRenderer extends DACustomComboRenderer {
-
- @Override
- public void draw(GC gc, Canvas canvas, String text, int state) {
- Rectangle rect = canvas.getClientArea();
- setColors(state, gc);
- gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
- gc.setForeground(ColorResources.BLACK.getColor());
- gc.drawRectangle(rect.x, rect.y, rect.width - 20, rect.height - 1);
-
- if (null == text) {
- text = "";
- }
- gc.setFont(FontResources.COMBO.getFont());
- Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE.getColor());
- gc.drawString(text, 5, (rect.height - p.y) / 2, true);
-
- setColors(state, gc);
- gc.fillGradientRectangle(rect.x + rect.width - 20, rect.y, 19,
- rect.height - 1, true);
- gc.setForeground(ColorResources.BLACK.getColor());
- gc.drawRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
- }
-
- @Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state) {
-
- }
-
- @Override
- public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
- Rectangle rect = canvas.getClientArea();
- gc.drawImage(image, rect.x, rect.y);
- Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.setFont(FontResources.COMBO.getFont());
- gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE.getColor());
- gc.drawString(text, 5, (rect.height - p.y) / 2, true);
- Rectangle clipping = new Rectangle(rect.x + rect.width - 19, rect.y,
- 19, rect.height);
- gc.setClipping(clipping);
- gc.drawImage(image, rect.x, rect.y);
- }
-
- private void setColors(int state, GC gc) {
- if (state == DACustomCombo.STATE_NORMAL) {
- gc.setForeground(ColorResources.GRAY2.getColor());
- gc.setBackground(ColorResources.WINDOW_BG_COLOR.getColor());
- } else if (state == DACustomCombo.STATE_HOVER) {
- gc.setForeground(ColorResources.GRAY2.getColor());
- gc.setBackground(ColorResources.ITEM_BLUE_DARK.getColor());
- } else if (state == DACustomCombo.STATE_PUSH) {
- gc.setForeground(ColorResources.GRAY2.getColor());
- gc.setBackground(ColorResources.BLUE.getColor());
- } else if (state == DACustomCombo.STATE_DISABLE) {
- gc.setForeground(ColorResources.GRAY2.getColor());
- gc.setBackground(ColorResources.GRAY1.getColor());
- }
- }
-
-}
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
public class EMLogger {
private static EMLogger instance;
File logFolder;
Handler logFileHandler;
try {
- logFolder = new File(FilePath.getInstance().getTizenVmsPath());
+ logFolder = new File(FilePathResouces.getInstance().getTizenVmsPath());
if (!logFolder.exists()) {
logFolder.mkdirs();
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.platform;
import java.io.IOException;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.platform;
import java.io.IOException;
import java.util.ArrayList;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
public class Platform {
protected String platformName = null;
//private ArrayList<VMsProperty> templateList = new ArrayList<VMsProperty>();
protected ArrayList<BaseImage> imageList = new ArrayList<BaseImage>();
-
protected Platform() {
}
public Platform(String name) {
this.platformName = name;
- this.platformPath = FilePath.getInstance().getPlatformsPath()
+ this.platformPath = FilePathResouces.getInstance().getPlatformsPath()
+ File.separator + platformName;
//this.version = name;
return;
}
- File defaultImages = new File(platformPath + FilePath.getInstance().getDefaultImagePath());
- File addonsImages = new File(platformPath + FilePath.getInstance().getAddonsImagePath());
+ File defaultImages = new File(platformPath + FilePathResouces.getInstance().getDefaultImagePath());
+ File addonsImages = new File(platformPath + FilePathResouces.getInstance().getAddonsImagePath());
//boolean isDuplicate = false;
if(defaultImages.exists() && defaultImages.isDirectory()) {
import java.util.ArrayList;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.SKIN_TYPE;
private SkinList() {
try {
- makeSkinList(new File(FilePath.getInstance().getSkinPath()));
+ makeSkinList(new File(FilePathResouces.getInstance().getSkinPath()));
//defaultSkin = skinsList.get(0);
} catch (IOException e) {
EMLogger.getLogger().warning(e.getMessage());
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.platform;
+
+import java.io.IOException;
+
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class TotalPlatform extends Platform {
+ private CustomBaseImage image = null;
+ public TotalPlatform() {
+ this.platformName = "all";
+ this.platformPath = "";
+ try {
+ image = new CustomBaseImage(this, "allImage", "x86");
+ } catch (IOException e) {
+ //TODO
+ }
+ }
+
+ public void settingVMProperty() {
+ if (image == null) {
+ return;
+ }
+ image.getVmsList().clear();
+ for (Platform p : EmulatorManager.getPlatformList()) {
+ for (BaseImage base : p.getImageList()) {
+ for (VMProperty prop : base.getVmsList()) {
+ image.addVMsProperty(prop);
+ }
+ }
+ }
+
+ for (BaseImage base : EmulatorManager.getCustomPlatform().getImageList()) {
+ for (VMProperty prop : base.getVmsList()) {
+ image.addVMsProperty(prop);
+ }
+ }
+ this.getImageList().add(image);
+ }
+}
/*\r
- * Dynamic Analyzer\r
+ * Emulator Manager\r
*\r
- * Copyright(c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
*\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
+ * Contact:\r
+ * JiHye Kim <jihye1128.kim@samsung.com>\r
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>\r
+ * SeokYeon Hwang <syeon.hwang@samsung.com>\r
*\r
- * Licensed under the Apache License, Version 2.0(the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
*\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\r
*\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
* Contributors:\r
* - S-Core Co., Ltd\r
- * \r
+ *\r
*/\r
\r
package org.tizen.emulator.manager.resources;\r
\r
import org.eclipse.swt.graphics.Color;\r
import org.eclipse.swt.graphics.RGB;\r
+import org.eclipse.swt.widgets.Display;\r
\r
public enum ColorResources {\r
- WHITE("white", null),\r
- BLACK("black", null),\r
- BLUE("blue", null),\r
- RED("red", null),\r
- YELLOW("yellow", null),\r
- PURPLE("purple", null),\r
-\r
- GREEN("green", null),\r
- BROWN("brown", null),\r
- NAVY("navy", null),\r
- DARKVIOLET("darkviolet", null),\r
- MAROON("maroon", null),\r
- TEAL("teal", null),\r
- INDIGO("indigo", null),\r
- DARKGOLDENROD("darkgoldenrod", null),\r
- CHOCOLATE("chocolate", null),\r
- MAGNETA("magneta", null),\r
-\r
- GOLDENROD("goldenrod", null),\r
- TURQUOISE("turquoise", null),\r
- VIOLET("violet", null),\r
- SLATEBLUE("slateblue", null),\r
- ORANGE("orange", null),\r
- YELLOWGREEN("yellowgreen", null),\r
- SKYBLUE("skyblue", null),\r
- ORCHID("orchid", null),\r
- SANDYBROWN("sandybrown", null),\r
- MEDIUMPURPLE("mediumpurple", null),\r
- GRAY1("gray1", null),\r
- GRAY2("gray2", null),\r
- GRAY3("gray3", null),\r
-\r
- // shell window background color\r
- WINDOW_BG_COLOR("window_bg_color", null),\r
-\r
- DIALOG_BG_UPPER("dialg_bg_upper", null),\r
- DIALOG_BG_LOWER("dialg_bg_lower", null),\r
- DIALOG_SUNKEN_1("dialg_sunken_1", null),\r
- DIALOG_SUNKEN_2("dialg_sunken_2", null),\r
-\r
- EDIT_CHART_DIALOG_UPPER("edit_chart_dialog_upper", null),\r
- EDIT_CHART_DIALOG_LOWER("edit_chart_dialog_lower", null),\r
-\r
- VIEW_BORDER("view_border", null),\r
- VIEW_BG_COLOR("view_bg_color", null),\r
- VIEW_TITLE_FONT_COLOR("view_title_font_color", null),\r
-\r
- /** title bar colors **/\r
- TITLEBAR_TEXT_COLOR("titlebar_text_color", null),\r
- TITLEBAR_BG_COLOR("titlebar_bg", null),\r
- TITLEBAR_START_COLOR("titlebar_start_color", null),\r
- TITLEBAR_END_COLOR("titlebar_end_color", null),\r
- TITLEBAR_BOTTOM_STROKE_1("titlebar_bottom_stroke_1", null),\r
- TITLEBAR_BOTTOM_STROKE_2("titlebar_bottom_stroke_2", null),\r
-\r
- /** Coolbar bg color **/\r
- COOLBAR_BG_COLOR("coolbar_bg_color", null),\r
- DEFAULT_FONT_COLOR("default_font_color", null),\r
-\r
- /** device and application combo specific colors start **/\r
- DEVICE_APPLICATION_ENABLE("device_application_enable_font", null),\r
- DEVICE_APPLICATION_DISABLE("device_application_disable", null),\r
- DEVICE_APPLICATION_POPUP_OUTER_1("device_application_popup_outer_1", null),\r
- DEVICE_APPLICATION_POPUP_OUTER_2("device_application_popup_outer_2", null),\r
- DEVICE_APPLICATION_DROPDOWN_TEXT("device_application_enable_font", null),\r
- DEVICE_APPLICATION_ITEM_NORMAL_TOP("device_application_item_normal_top", null),\r
- DEVICE_APPLICATION_ITEM_NORMAL_INNER("device_application_item_normal_inner", null),\r
- DEVICE_APPLICATION_ITEM_NORMAL_BOTTOM("device_application_item_normal_bottom", null),\r
- DEVICE_APPLICATION_ITEM_SELECT_TOP("device_application_item_select_top", new RGB(76, 76, 77)),\r
- DEVICE_APPLICATION_ITEM_SELECT_INNER("device_application_item_select_inner", null),\r
- DEVICE_APPLICATION_ITEM_SELECT_BOTTOM("device_application_item_select_bottom", null),\r
-\r
- /*** combo button color ***/\r
- DEVICE_APPLICATION_BUTTON_NORMAL_START("device_application_button_normal_start", null),\r
- DEVICE_APPLICATION_BUTTON_NORMAL_END("device_application_button_normal_end", null),\r
- DEVICE_APPLICATION_BUTTON_PUSH_START("device_application_button_push_start", null),\r
- DEVICE_APPLICATION_BUTTON_PUSH_END("device_application_button_push_end", null),\r
- DEVICE_APPLICATION_BUTTON_HOVER_START("device_application_button_hover_start", null),\r
- DEVICE_APPLICATION_BUTTON_HOVER_END("device_application_button_hover_end", null),\r
- DEVICE_APPLICATION_BUTTON_DISABLE_START("device_application_button_disable_start", null),\r
- DEVICE_APPLICATION_BUTTON_DISABLE_END("device_application_button_disable_end", null),\r
- DEVICE_APPLICATION_BUTTON_OUTLINE("device_application_button_outline", null),\r
-\r
- /*** common button colors ***/\r
- BUTTON_NORMAL_FONT_COLOR("button_normal_font_color", null),\r
- BUTTON_PUSH_FONT_COLOR("button_push_font_color", null),\r
- BUTTON_HOVER_FONT_COLOR("button_hover_font_color", null),\r
- BUTTON_DISABLE_FONT_COLOR("button_disable_font_color", null),\r
-\r
- /** normal view layout colors start **/\r
- NORMAL_VIEW_LAYOUT_OUTER("normal_view_layout_outer", null),\r
- NORMAL_VIEW_LAYOUT_MIDDLE("normal_view_layout_middle", null),\r
- NORMAL_VIEW_LAYOUT_INNER("normal_view_layout_inner", null),\r
- /** normal view layout colors end **/\r
-\r
- /** tab widget colors start **/\r
- TAB_SELECTED_FONT_COLOR("tab_selected_font_color", null),\r
- TAB_NORMAL_FONT_COLOR("tab_normal_font_color", null),\r
- TAB_HOVER_FONT_COLOR("tab_hover_font_color", null),\r
- TAB_PUSH_FONT_COLOR("tab_push_font_color", null),\r
-\r
- TAB_BG_COLOR("tab_bg_color", null),\r
- TAB_CONTENTS_BG_COLOR("tab_contents_bg_color", null),\r
- /** tab widget colors end **/\r
-\r
- /** list view colors start **/\r
- LIST_BG_COLOR("list_bg_color", null),\r
- VM_BUTTON_FONT_COLOR("vm_button_font_color", null),\r
- /** list view colors end **/\r
-\r
- /** detail view colors start **/\r
- DETAIL_VIEW_PAGE_COLOR("detail_view_page_color", null),\r
- DETAIL_TOP_FONT_COLOR("detail_top_font_color", null),\r
- DETAIL_TITILE_FONT_COLOR("detail_title_font_color", null),\r
- DETAIL_ENABLE_FONT_COLOR("detail_enable_font_color", null),\r
- DETAIL_DISABLE_FONT_COLOR("detail_disable_font_color", null),\r
- DETAIL_CATEGORY_FONT_COLOR("detail_category_font_color", null),\r
- DETAIL_TOP_COLOR("detail_top_color", null),\r
- DETAIL_MIDDLE_COLOR("detail_middle_color", null),\r
- DETAIL_INPUT_BOX_COLOR("detail_input_box_color", null),\r
- /** detail view colors end **/\r
-\r
- TOOLTIP("tooltip", null),\r
+ WHITE("white", new RGB(255, 255, 255)),\r
+ BLACK("black", new RGB(0, 0, 0)),\r
+ BLUE("blue", new RGB(0, 102, 134)),\r
+ RED("red", new RGB(255, 0, 0)),\r
+ YELLOW("yellow", new RGB(255, 210, 10)),\r
+ PURPLE("purple", new RGB(139, 42, 118)),\r
+\r
+ GREEN("green", new RGB(68, 98, 12)),\r
+ BROWN("brown", new RGB(138, 83, 0)),\r
+ NAVY("navy", new RGB(57, 66, 161)),\r
+ DARKVIOLET("darkviolet", new RGB(105, 2, 126)),\r
+ MAROON("maroon", new RGB(126, 41, 2)),\r
+ TEAL("teal", new RGB(27, 110, 92)),\r
+ INDIGO("indigo", new RGB(80, 26, 146)),\r
+ DARKGOLDENROD("darkgoldenrod", new RGB(212, 150, 57)),\r
+ CHOCOLATE("chocolate", new RGB(151, 124, 39)),\r
+ MAGNETA("magneta", new RGB(155, 20, 184)),\r
+\r
+ GOLDENROD("goldenrod", new RGB(212, 150, 57)),\r
+ TURQUOISE("turquoise", new RGB(72, 194, 168)),\r
+ ORANGE("orange", new RGB(236, 107, 47)),\r
+ YELLOWGREEN("yellowgreen", new RGB(129, 172, 50)),\r
+ SKYBLUE("skyblue", new RGB(72, 185, 221)),\r
+ ORCHID("orchid", new RGB(175, 49, 200)),\r
+ SANDYBROWN("sandybrown", new RGB(201, 168, 58)),\r
+ MEDIUMPURPLE("mediumpurple", new RGB(160, 108, 224)),\r
+\r
+ WINDOW_BG_COLOR("window_bg_color", new RGB(160, 160, 160)),\r
+\r
+ /** tab widget colors **/\r
+ TAB_SELECTED_FONT_COLOR("tab_selected_font_color", new RGB(48, 48, 48)),\r
+ TAB_NORMAL_FONT_COLOR("tab_normal_font_color", new RGB(205, 205, 205)),\r
+ TAB_HOVER_FONT_COLOR("tab_hover_font_color", new RGB(205, 205, 205)),\r
+ TAB_PUSH_FONT_COLOR("tab_push_font_color", new RGB(205, 205, 205)),\r
+ TAB_BG_COLOR("tab_bg_color", new RGB(55, 55, 55)),\r
+ TAB_CONTENTS_BG_COLOR("tab_contents_bg_color", new RGB(209, 209, 209)),\r
+\r
+ /** list view colors **/\r
+ LIST_BG_COLOR("list_bg_color", new RGB(226, 226, 226)),\r
+ VM_BUTTON_FONT_COLOR("vm_button_font_color", new RGB(240, 240, 240)),\r
+\r
+ /** detail view colors **/\r
+ DETAIL_VIEW_PAGE_COLOR("detail_view_page_color", new RGB(209, 209, 209)),\r
+ DETAIL_TOP_FONT_COLOR("detail_top_font_color", new RGB(255, 255, 255)),\r
+ DETAIL_TITILE_FONT_COLOR("detail_title_font_color", new RGB(0, 0, 0)),\r
+ DETAIL_ENABLE_FONT_COLOR("detail_enable_font_color", new RGB(38, 38, 38)),\r
+ DETAIL_DISABLE_FONT_COLOR("detail_disable_font_color", new RGB(153, 153, 153)),\r
+ DETAIL_CATEGORY_FONT_COLOR("detail_category_font_color", new RGB(255, 255, 255)),\r
+ DETAIL_TOP_COLOR("detail_top_color", new RGB(0x7F, 0x7F, 0x7F)),\r
+ DETAIL_MIDDLE_COLOR("detail_middle_color", new RGB(0xB6, 0xB6, 0xB6)),\r
+ DETAIL_INPUT_BOX_COLOR("detail_input_box_color", new RGB(229, 229, 229)),\r
+\r
+ /** image button **/\r
+ BUTTON_BG_COLOR("button_bg_color", new RGB(226, 226, 226)),\r
+ BUTTON_ENABLE_FONT_COLOR("button_enable_font_color", new RGB(20, 20, 20)),\r
+ BUTTON_DISABLE_FONT_COLOR("button_disable_font_color", new RGB(155, 155, 155)),\r
+\r
+ /** combo widget colors **/\r
+ COMBO_BG_COLOR("combo_bg_color", new RGB(226, 226, 226)),\r
+ COMOB_ENABLE_FONT_COLOR("combo_enable_font_color", new RGB(30, 30, 30)),\r
+ COMBO_DISABLE_FONT_COLOR("combo_disable_font_color", new RGB(155, 155, 155)),\r
+ COMBO_ITEM_SELECT_COLOR("combo_item_select", new RGB(50, 185, 231)),\r
+ COMBO_ITEM_NORMAL_COLOR("combo_item_normal", new RGB(230, 230, 230)),\r
+ COMBO_ITEM_SEPERATE_TOP_COLOR("combo_item_seperate_top", new RGB(255, 255, 255)),\r
+ COMBO_ITEM_SEPERATE_BOTTOM_COLOR("combo_item_seperate_bottom", new RGB(189, 189, 189)),\r
+ COMBO_ITEM_FONT_COLOR("combo_item_font", new RGB(30, 30, 30)),\r
+ COMBO_POPUP_OUTER_1_COLOR("combo_popup_outer1", new RGB(120, 120, 120)),\r
+ COMBO_POPUP_OUTER_2_COLOR("combo_popup_outer2", new RGB(50, 185, 231)),\r
+\r
+ TOOLTIP("tooltip", new RGB(255, 255, 225)),\r
\r
/** status bar **/\r
- STATUS_BAR_COLOR("status_bar_color", null),\r
- STATUS_BAR_FONT_COLOR("status_bar_font_color", null),\r
-\r
- ITEM_BLUE_RIGHT("item_blue_right", null),\r
- ITEM_BLUE_DARK("item_blue_dark", null);\r
+ STATUS_BAR_COLOR("status_bar_color", new RGB(174, 174, 174)),\r
+ STATUS_BAR_FONT_COLOR("status_bar_font_color", new RGB(0, 0, 0));\r
\r
String name;\r
Color color;\r
public Color getColor() {\r
if (this.color == null) {\r
if (rgb != null) {\r
- this.color = DAThemeWhite.getInstance().getColor(name, rgb);\r
+ this.color = createColor(rgb);\r
} else {\r
- this.color = DAThemeWhite.getInstance().getColor(name);\r
+ this.color = createColor(new RGB(255, 255, 255));\r
}\r
}\r
return color;\r
}\r
\r
+ private Color createColor(RGB rgb) {\r
+ Display display = Display.getCurrent();\r
+ if (display == null) {\r
+ throw new IllegalStateException();\r
+ }\r
+ return new Color(display, rgb);\r
+ }\r
+\r
@Override\r
public String toString() {\r
return name;\r
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.resources;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-class ColorRegistry {
- private Map<String,Color> stringToColor = new HashMap<String, Color>(7);
- private Map<String, RGB> stringToRGB = new HashMap<String, RGB>(7);
- private Display display = null;
- private final boolean cleanOnDisplayDisposal = true;
-
- public ColorRegistry() {
- this.display = Display.getCurrent();
- }
-
- private Color createColor(RGB rgb) {
- if (this.display == null) {
- Display display = Display.getCurrent();
- if (display == null) {
- throw new IllegalStateException();
- }
- this.display = display;
- if (cleanOnDisplayDisposal) {
- hookDisplayDispose();
- }
- }
- return new Color(display, rgb);
- }
-
- private void disposeColors(Iterator<Color> iterator) {
- while (iterator.hasNext()) {
- Color next = iterator.next();
- next.dispose();
- }
- }
-
- public Color get(String symbolicName) {
-
- assert symbolicName == null;
-
- Color result = stringToColor.get(symbolicName);
- if (result != null) {
- return (Color) result;
- }
-
- Color color = null;
-
- RGB rgb = stringToRGB.get(symbolicName);
- if (rgb == null) {
- return null;
- }
-
- color = createColor(rgb);
-
- stringToColor.put(symbolicName, color);
-
- return color;
- }
-
- public boolean hasValueFor(String colorKey) {
- return stringToRGB.containsKey(colorKey);
- }
-
- private void hookDisplayDispose() {
- display.disposeExec(displayRunnable);
- }
-
- public void put(String symbolicName, RGB colorData) {
-
- assert symbolicName == null;
- assert colorData == null;
-
- RGB existing = (RGB) stringToRGB.get(symbolicName);
- if (colorData.equals(existing)) {
- return;
- }
-
- stringToRGB.put(symbolicName, colorData);
- }
-
- protected Runnable displayRunnable = new Runnable() {
- public void run() {
- clearCaches();
- }
- };
-
- protected void clearCaches() {
- disposeColors(stringToColor.values().iterator());
- stringToColor.clear();
- display = null;
- }
-}
-
-public abstract class DATheme {
- protected String name = "black";//$NON-NLS-1$
- protected static ColorRegistry colorRegistry = new ColorRegistry();
-
- public DATheme() {
- setColor("white", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("black", new RGB(0, 0, 0)); //$NON-NLS-1$
- setColor("blue", new RGB(0, 0, 255)); //$NON-NLS-1$
- setColor("red", new RGB(255, 0, 0)); //$NON-NLS-1$
- setColor("purple", new RGB(226, 101, 225)); //$NON-NLS-1$
- }
-
- public abstract Color getColor(String colorName, RGB rgb);
-
- public abstract Color getColor(String colorName);
-
- public abstract void setColor(String colorName, RGB rgb);
-
- public String getThemePath() {
- return "theme" + File.separator + name + File.separator;//$NON-NLS-1$
- }
-
- public String getImagePath() {
- String path = getThemePath() + "img" + File.separator;//$NON-NLS-1$
- return path;
- }
-}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jooyoul Lee <jy.exe.lee@samsung.com>
- * Juyoung Kim <j0.kim@samsung.com>
- *
- * 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.emulator.manager.resources;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-
-public class DAThemeWhite extends DATheme {
- private static DAThemeWhite instance;
-
- public static DAThemeWhite getInstance() {
- if (instance == null) {
- instance = new DAThemeWhite();
- }
- return instance;
- }
-
- DAThemeWhite() {
- super();
- name = "white";
-
- // defaule
- setColor("blue", new RGB(0, 102, 134));
- setColor("green", new RGB(68, 98, 12));
- setColor("yellow", new RGB(255, 210, 10));
- setColor("purple", new RGB(139, 42, 118));
- setColor("brown", new RGB(138, 83, 0));
- setColor("navy", new RGB(57, 66, 161));
- setColor("darkviolet", new RGB(105, 2, 126));
- setColor("maroon", new RGB(126, 41, 2));
- setColor("teal", new RGB(27, 110, 92));
- setColor("indigo", new RGB(80, 26, 146));
- setColor("goldenrod", new RGB(212, 150, 57));
- setColor("turquoise", new RGB(72, 194, 168));
- setColor("violet", new RGB(226, 109, 201));
- setColor("slateblue", new RGB(122, 132, 238));
- setColor("orange", new RGB(236, 107, 47));
- setColor("yellowgreen", new RGB(129, 172, 50));
- setColor("skyblue", new RGB(72, 185, 221));
- setColor("orchid", new RGB(175, 49, 200));
- setColor("sandybrown", new RGB(201, 168, 58));
- setColor("mediumpurple", new RGB(160, 108, 224));
- setColor("chocolate", new RGB(151, 124, 39));
- setColor("magneta", new RGB(155, 20, 184));
- setColor("GRAY1", new RGB(177, 177, 177)); //$NON-NLS-1$
- setColor("GRAY2", new RGB(153, 153, 153)); //$NON-NLS-1$
- setColor("GRAY3", new RGB(216, 216, 216)); //$NON-NLS-1$
-
- // shell window background color
- setColor("window_bg_color", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("dialg_bg_upper", new RGB(206, 206, 206));
- setColor("dialg_bg_lower", new RGB(240, 240, 240));
- setColor("dialg_sunken_1", new RGB(160, 160, 160));
- setColor("dialg_sunken_2", new RGB(255, 255, 255));
- setColor("edit_chart_dialog_upper", new RGB(255, 255, 255));
- setColor("edit_chart_dialog_lower", new RGB(240, 240, 240));
-
- setColor("view_border", new RGB(206, 206, 206)); //$NON-NLS-1$
- setColor("view_bg_color", new RGB(230, 230, 230)); //$NON-NLS-1$
- getColor("view_title_font_color", new RGB(0, 0, 0));
-
- setColor("coolbar_bg_color", new RGB(228, 228, 228)); //$NON-NLS-1$
- setColor("default_font_color", new RGB(0, 0, 0));//$NON-NLS-1$
-
- /** title bar colors **/
- setColor("titlebar_text_color", new RGB(64, 208, 255)); //$NON-NLS-1$
- setColor("titlebar_bg", new RGB(78, 79, 81)); //$NON-NLS-1$
- setColor("titlebar_start_color", new RGB(240, 240, 240)); //$NON-NLS-1$
- setColor("titlebar_end_color", new RGB(165, 165, 165)); //$NON-NLS-1$
- setColor("titlebar_bottom_stroke_1", new RGB(115, 115, 115));
- setColor("titlebar_bottom_stroke_2", new RGB(160, 160, 160));
-
- /** device and application combo specific colors start **/
- setColor("device_application_enable_font", new RGB(0, 0, 0)); //$NON-NLS-1$
- setColor("device_application_disable_font", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("device_application_popup_outer_1", new RGB(120, 120, 120)); //$NON-NLS-1$
- setColor("device_application_popup_outer_2", new RGB(50, 185, 231)); //$NON-NLS-1$
- setColor("device_application_item_normal_top", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("device_application_item_normal_inner", new RGB(230, 230, 230)); //$NON-NLS-1$
- setColor(
- "device_application_item_normal_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
- setColor("device_application_item_select_top", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("device_application_item_select_inner", new RGB(50, 185, 231)); //$NON-NLS-1$
- setColor(
- "device_application_item_select_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
- /** device and application combo specific colors end **/
-
- /*** combo button gradation ***/
- setColor("device_application_button_normal_start", new RGB(221, 221, 221)); //$NON-NLS-1$
- setColor("device_application_button_normal_end", new RGB(157, 157, 157)); //$NON-NLS-1$
- setColor("device_application_button_push_start", new RGB(24, 147, 189)); //$NON-NLS-1$
- setColor("device_application_button_push_end", new RGB(24, 147, 189)); //$NON-NLS-1$
- setColor("device_application_button_hover_start", new RGB(50, 185, 231)); //$NON-NLS-1$
- setColor("device_application_button_hover_end", new RGB(50, 185, 231)); //$NON-NLS-1$
- setColor("device_application_button_disable_start", new RGB(157, 157, 157)); //$NON-NLS-1$
- setColor("device_application_button_disable_end", new RGB(78, 79, 81)); //$NON-NLS-1$
- setColor("device_application_button_outline", new RGB(31, 31, 31));
-
- /*** common button colors ***/
- setColor("button_normal_font_color", new RGB(0, 0, 0));
- setColor("button_push_font_color", new RGB(91, 91, 91));
- setColor("button_hover_font_color", new RGB(91, 91, 91));
- setColor("button_disable_font_color", new RGB(140, 140, 140));
-
- /** normal view layout colors start **/
- setColor("normal_view_layout_outer", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("normal_view_layout_middle", new RGB(74, 74, 74)); //$NON-NLS-1$
- setColor("normal_view_layout_inner", new RGB(66, 66, 68)); //$NON-NLS-1$
- /** normal view layout colors end **/
-
- /** tab widget colors **/
- setColor("tab_selected_font_color", new RGB(48, 48, 48));
- setColor("tab_normal_font_color", new RGB(205, 205, 205));
- setColor("tab_hover_font_color", new RGB(205, 205, 205));
- setColor("tab_push_font_color", new RGB(205, 205, 205));
-
- setColor("tab_bg_color", new RGB(55, 55, 55));
- setColor("tab_contents_bg_color", new RGB(209, 209, 209));
-
- /** list view colors **/
- setColor("list_bg_color", new RGB(226, 226, 226));
- setColor("vm_button_font_color", new RGB(240, 240, 240));
- /**********************/
-
- /** detail view colors **/
- setColor("detail_view_page_color", new RGB(209, 209, 209)); //tab_contents_bg_color
- setColor("detail_top_font_color", new RGB(255, 255, 255));
- setColor("detail_title_font_color", new RGB(0, 0, 0));
- setColor("detail_enable_font_color", new RGB(38, 38, 38));
- setColor("detail_disable_font_color", new RGB(153, 153, 153));
- setColor("detail_category_font_color", new RGB(255, 255, 255));
- setColor("detail_top_color", new RGB(0x7F, 0x7F, 0x7F));
- setColor("detail_middle_color", new RGB(0xB6, 0xB6, 0xB6));
- setColor("detail_input_box_color", new RGB(229, 229, 229));
- /************************/
- setColor("tooltip", new RGB(255, 255, 225)); //$NON-NLS-1$
-
- /** status bar **/
- setColor("status_bar_color", new RGB(174, 174, 174));
- setColor("status_bar_font_color", new RGB(0, 0, 0));
-
- setColor("item_blue_right", new RGB(131, 196, 218));
- setColor("item_blue_dark", new RGB(38, 104, 138));
- }
-
- public Color getColor(String colorName, RGB rgb) {
- if (!colorRegistry.hasValueFor(colorName)) {
- colorRegistry.put(colorName, rgb);
- }
- return colorRegistry.get(colorName);
- }
-
- public void setColor(String colorName, RGB rgb) {
- colorRegistry.put(colorName, rgb);
- }
-
- @Override
- public Color getColor(String colorName) {
- return colorRegistry.get(colorName);
- }
-
-}
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.vms.EmulatorVMList;
-public class FilePath {
+public class FilePathResouces {
private final static String bin_suffix = File.separator + "tools" + File.separator + "emulator" + File.separator + "bin";
private final static String platform_suffix = File.separator + "platforms";
}
- static FilePath instance = null;
+ static FilePathResouces instance = null;
static {
- synchronized(FilePath.class) {
- instance = new FilePath();
+ synchronized(FilePathResouces.class) {
+ instance = new FilePathResouces();
}
}
- private FilePath() {
+ private FilePathResouces() {
}
- public static FilePath getInstance() {
+ public static FilePathResouces getInstance() {
return instance;
}
* - S-Core Co., Ltd\r
* \r
*/\r
-package org.tizen.emulator.manager.resources;\r
\r
-import java.util.HashMap;\r
-import java.util.Map;\r
+package org.tizen.emulator.manager.resources;\r
\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.graphics.Font;\r
// * Status bar\r
STATUS_BAR_FONT("status_bar_font", resizeDefaultFont(9)),\r
\r
+ // * Radio button\r
+ RADIO_BUTTON_FONT("radio_button_font", resizeDefaultFont(8)),\r
+\r
+ // * Tree view\r
+ TREE_CREATE_FONT("tree_creaet_font", setDefaultFontStyleAndSize(SWT.BOLD, 9)),\r
+ TREE_HEADER_FONT("tree_header_font", resizeDefaultFont(9)),\r
+ TREE_ITEM_FONT("tree_item_font", resizeDefaultFont(8)),\r
+\r
// * not support\r
TOOLTIP("tooltip", resizeDefaultFont(9));\r
\r
\r
public Font getFont(String fontName, FontData[] fontData) {\r
if (this.font == null) {\r
- this.font = FontRegistry.getFont(name, data);\r
+ this.font = new Font(Display.getCurrent(), fontData);\r
}\r
return font;\r
}\r
} else {\r
return Display.getCurrent().getSystemFont();\r
}\r
- return FontRegistry.getFont(\r
- "ex_font", new FontData[] { new FontData(fontName, 9, SWT.NORMAL) });\r
- }\r
-}\r
-\r
-class FontRegistry {\r
- private static Map<String, FontData[]> stringToFontData = null;\r
- static {\r
- if (stringToFontData == null) {\r
- stringToFontData = new HashMap<String, FontData[]>(7);\r
- }\r
- }\r
-\r
- public static Font getFont(String fontName, FontData[] fontData) {\r
- if (stringToFontData == null) {\r
- stringToFontData = new HashMap<String, FontData[]>(7);\r
- }\r
- if (!stringToFontData.containsKey(fontName)) {\r
- stringToFontData.put(fontName, fontData);\r
+ if (defaultFont == null) {\r
+ defaultFont = new Font(Display.getCurrent(), new FontData[] { new FontData(fontName, 9, SWT.NORMAL) });\r
}\r
-\r
- return new Font(Display.getCurrent(), fontData);\r
+ return defaultFont;\r
}\r
-\r
-}\r
+}
\ No newline at end of file
BUTTON_HOVER_LEFT("button_hover_left"),
BUTTON_HOVER_MIDDLE("button_hover_middle"),
- BUTTON_HOVEr_RIGHT("button_hover_right");
+ BUTTON_HOVER_RIGHT("button_hover_right");
String name;
Image image;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.resources;
import org.eclipse.swt.graphics.GC;
public static Image getHoverButton(int width) {
Image left = ImageResources.BUTTON_HOVER_LEFT.getImage();
Image middle = ImageResources.BUTTON_HOVER_MIDDLE.getImage();
- Image right = ImageResources.BUTTON_HOVEr_RIGHT.getImage();
+ Image right = ImageResources.BUTTON_HOVER_RIGHT.getImage();
int height = left.getImageData().height;
Image image = new Image(Display.getCurrent(), width, height);
import java.util.logging.Level;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.vms.EmulatorVMList;
// getting version
BufferedReader about = null;
try {
- about = new BufferedReader(new FileReader(new File(FilePath.getInstance().getEtcPath()
+ about = new BufferedReader(new FileReader(new File(FilePathResouces.getInstance().getEtcPath()
+ File.separator + "version")));
if (about != null) {
ver = about.readLine();
import java.util.logging.Level;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
public class CheckSDCard {
}
public static void CheckSwapDir() {
- File dir = new File(FilePath.getInstance().getSwapPath());
+ File dir = new File(FilePathResouces.getInstance().getSwapPath());
if (!dir.exists()) {
dir.mkdir();
File dest = null;
File src = null;
- dest = new File(FilePath.getInstance().getSwapPath()
+ dest = new File(FilePathResouces.getInstance().getSwapPath()
+ File.separator + StringResources.SWAP_IMAGE);
if (!dest.exists()) {
- src = new File(FilePath.getInstance().getbaseSwapPath()
+ src = new File(FilePathResouces.getInstance().getbaseSwapPath()
+ File.separator + StringResources.SWAP_IMAGE);
if (!src.exists()) {
EMLogger.getLogger().log(Level.WARNING,
}
public static void CheckSDCardDir() {
- File dir = new File(FilePath.getInstance().getTizenWorkspacePath()
+ File dir = new File(FilePathResouces.getInstance().getTizenWorkspacePath()
+ File.separator + StringResources.SD_CARD_DIR);
if (!dir.exists()) {
File dest = null;
File src = null;
for (String s : StringResources.SD_CARD) {
- dest = new File(FilePath.getInstance().getTizenWorkspacePath()
+ dest = new File(FilePathResouces.getInstance().getTizenWorkspacePath()
+ File.separator + StringResources.SD_CARD_DIR
+ File.separator + s);
if (!dest.exists()) {
- src = new File(FilePath.getInstance().getSDCardPath()
+ src = new File(FilePathResouces.getInstance().getSDCardPath()
+ File.separator +s);
if (!src.exists()) {
EMLogger.getLogger().log(Level.WARNING,
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
public class CheckVirtualization {
int exitValue = 1;
List<String> cmd = new ArrayList<String>();
- cmd.add(FilePath.getInstance().getBinPath() + File.separator +
+ cmd.add(FilePathResouces.getInstance().getBinPath() + File.separator +
(System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-hax.exe" : "check-hax"));
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePath.getInstance().getBinPath()));
+ pb.directory(new File(FilePathResouces.getInstance().getBinPath()));
try {
Process process = null;
int exitValue = 1;
List<String> cmd = new ArrayList<String>();
- cmd.add(FilePath.getInstance().getBinPath() + File.separator +
+ cmd.add(FilePathResouces.getInstance().getBinPath() + File.separator +
(System.getProperty("os.name").toLowerCase().indexOf("windows") > -1 ? "check-gl.exe" : "check-gl"));
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePath.getInstance().getBinPath()));
+ pb.directory(new File(FilePathResouces.getInstance().getBinPath()));
try {
Process process = null;
import javax.xml.transform.stream.StreamSource;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
private SelectTemplate() {
// Common Template Path
- File dir = new File(FilePath.getInstance().getTemplatePath());
+ File dir = new File(FilePathResouces.getInstance().getTemplatePath());
if (dir.exists()) {
templateList = new ArrayList<VMProperty>();
for (File config : dir.listFiles(new FileFilter() {
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
import org.tizen.emulator.manager.platform.Platform;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.ui.dialog.AboutDialog;
import org.tizen.emulator.manager.ui.tabfolder.PlatformTabFolder;
import org.tizen.emulator.manager.ui.tabfolder.PlatformTabItem;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
public class MainDialog {
private static final String ICON_FILE_NAME = "res/em.ico";
public static final int DEFALUT_WIDTH = 840;
public static final int DEFAULT_HEIGHT = 482;
- public static final int MIN_HEIGHT = 480;
- public static final int MIN_WIDTH = 500;
+ public static final int MIN_HEIGHT = 380;
+ public static final int MIN_WIDTH = 620;
public static int WIDTH = DEFALUT_WIDTH;
public static int HEIGHT = DEFAULT_HEIGHT;
private ArrayList<PlatformTabItem> platformItems = new ArrayList<PlatformTabItem>(10);
private static PlatformTabFolder tabFolder = null;
- private DACustomButton resetButton = null;
- private DACustomButton infoButton = null;
+ private ImageButton resetButton = null;
+ private ImageButton infoButton = null;
private static StatusBar statusBar = null;
private static int STATUS_BAR_HEIGHT = 20;
private static int OFFSET = 2;
// add custom tab
platformItems.add(new PlatformTabItem(EmulatorManager.getCustomPlatform(),
tabFolder, SWT.CENTER));
+ // add all tab (tree view)
+ platformItems.add(new PlatformTabItem(EmulatorManager.getTotalPlatform(),
+ tabFolder, SWT.CENTER));
- resetButton = new DACustomButton(tabFolder.getTabComposite(),
- ImageResources.RESET_ICON_NOMAL.getImage(),
- ImageResources.RESET_ICON_PUSH.getImage(),
+ resetButton = new ImageButton(tabFolder.getTabComposite(), SWT.PUSH);
+ resetButton.setImages(ImageResources.RESET_ICON_NOMAL.getImage(),
ImageResources.RESET_ICON_HOVER.getImage(),
+ ImageResources.RESET_ICON_PUSH.getImage(),
+ null, null,
ImageResources.RESET_ICON_NOMAL.getImage());
- infoButton = new DACustomButton(tabFolder.getTabComposite(),
- ImageResources.INFO_ICON_NOMAL.getImage(),
- ImageResources.INFO_ICON_PUSH.getImage(),
+ infoButton = new ImageButton(tabFolder.getTabComposite(), SWT.PUSH);
+ infoButton.setImages(ImageResources.INFO_ICON_NOMAL.getImage(),
ImageResources.INFO_ICON_HOVER.getImage(),
+ ImageResources.INFO_ICON_PUSH.getImage(),
+ null, null,
ImageResources.INFO_ICON_NOMAL.getImage());
tabFolder.addTabRightButton(resetButton);
private void decorateRightSideToolItems() {
infoButton.setToolTipText("About Emulator Manager");
- infoButton.addClickListener(new DACustomButtonClickEventListener() {
+ infoButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
AboutDialog.open();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
resetButton.setToolTipText("Refresh list of VM");
- resetButton.addClickListener(new DACustomButtonClickEventListener() {
+ resetButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
// reload vm list
refreshVMPropertyList(false);
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.dialog.CloneDialog;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
}
if(property.getWorker().isRunningNow()) {
- msg.openInfoDialog("Not allowed to delete active VMs."
+ msg.openWarningDialog("Not allowed to delete active VMs."
+ StringResources.NEW_LINE
+ "[" + property.getName() + "] is running now...");
return false;
try {
property.getWorker().deleteVM();
} catch (VMWorkerException e) {
- msg.openInfoDialog(" Delete [" + property.getName() + "] failed..."
+ msg.openWarningDialog(" Delete [" + property.getName() + "] failed..."
+ e.getMessage());
return false;
}
fd.setFilterExtensions(filter);
fd.setFilterNames(filterName);
fd.setFileName("emulimg-" + property.getName());
- fd.setFilterPath(FilePath.getInstance().getTizenWorkspacePath());
+ fd.setFilterPath(FilePathResouces.getInstance().getTizenWorkspacePath());
String path = null;
path = fd.open();
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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;
import org.eclipse.swt.SWT;
+++ /dev/null
-package org.tizen.emulator.manager.ui;
-
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.ui.widgets.VMButton;
-import org.tizen.emulator.manager.ui.widgets.VMButtonAttribute;
-import org.tizen.emulator.manager.ui.widgets.VMButtonClickEventListener;
-
-class VMCreateButton extends VMButton {
- public VMCreateButton(Composite parent, int style) {
- super(parent, style);
- // delete launchButton
- launchButton.dispose();
- launchButton = null;
- // set Image
- setImages(ImageResources.ADD_NEW_NOMAL.getImage(),
- ImageResources.ADD_NEW_PUSH.getImage(),
- ImageResources.ADD_NEW_HOVER.getImage(),
- ImageResources.VM_IMAGE_CREATE.getImage());
- }
-
- @Override
- public void setSelected(boolean selected) {
- ((VMButtonAttribute)attr).setSelected(selected);
- if (selected) {
- setEnabled(false);
- VMsMainView.getInstance().drawCreateVM(false);
- } else {
- setEnabled(true);
- }
- }
-}
-
-public class VMButtonFactory {
- private static ArrayList<VMButton> buttons = new ArrayList<VMButton> ();
- private static int selectedIndex = 0;
-
- public static VMButton getButton(Composite parent) {
- VMButton b = new VMButton(parent, SWT.NONE);
- b.addClickListener(new VMButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- VMButtonFactory.clickVMButton(button);
- }
- });
- buttons.add(b);
- return b;
- }
-
- public static VMButton getCreateButton(Composite parent) {
- VMCreateButton b = new VMCreateButton(parent, SWT.NONE);
- buttons.add(b);
- return b;
- }
-
- public static ArrayList<VMButton> getButtonList() {
- return buttons;
- }
-
- public static void clear() {
- for(VMButton b : buttons) {
- b.dispose();
- }
- buttons.clear();
- selectedIndex = 0;
- }
-
- public static void clickVMButton(DACustomButton button) {
- VMButton b = null;
- for(int i = 0; i < buttons.size(); i++) {
- b = buttons.get(i);
- if (button == b) {
- b.setSelected(true);
- b.redraw();
- selectedIndex = i;
- } else {
- b.setSelected(false);
- b.redraw();
- }
- }
- }
-
- public static void clickVMButton(int index) {
- clickVMButton(buttons.get(index));
- }
-
- public static int getSelectedButtonIndex() {
- return selectedIndex;
- }
-
- public static VMButton getSelectedButton() {
- return buttons.isEmpty()
- ? null
- : buttons.get(selectedIndex);
- }
-}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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;
import org.eclipse.swt.SWT;
private DetailViewPage modifyView = null;
private final StackLayout stackLayout = new StackLayout();
+
+ private boolean isModifyMode = false;
+
+ public boolean isModifyMode() {
+ return isModifyMode;
+ }
+
public void init(int width, int height) {
mainView = new Composite(parent, SWT.NONE);
mainView.setLayout(stackLayout);
}
public void drawEmptyVM() {
+ // for setting text
+ emptyView.drawPropertyView(null, false);
stackLayout.topControl = emptyView.getComposite();
- mainView.layout();
+ //mainView.layout();
}
public void drawDetailVM(VMProperty property) {
+ if (isModifyMode) {
+ isModifyMode = false;
+ detailView.reset();
+ }
+
detailView.drawPropertyView(property.getPropertyValue(), false);
- //detailView.setDetailViewOrigin(modifyView.getDetailViewOrigin().x,
- // modifyView.getDetailViewOrigin().y);
stackLayout.topControl = detailView.getComposite();
mainView.layout();
}
public void drawModifyVM(VMProperty property) {
+ isModifyMode = true;
+ modifyView.reset();
+
modifyView.drawPropertyView(property.getPropertyValue(), false);
- //modifyView.setDetailViewOrigin(detailView.getDetailViewOrigin().x,
- // detailView.getDetailViewOrigin().y);
stackLayout.topControl = modifyView.getComposite();
mainView.layout();
}
public void drawCreateVM(VMPropertyValue value) {
+ isModifyMode = true;
+ modifyView.reset();
+
stackLayout.topControl = modifyView.getComposite();
mainView.layout();
modifyView.drawPropertyView(value, true);
mainView.dispose();
}
- public void redraw() {
+ public void reset() {
emptyView.reset();
detailView.reset();
modifyView.reset();
stackLayout.topControl.redraw();
}
+
+ public void setFocus(boolean setFocus) {
+ if (isModifyMode) {
+ modifyView.setFocus(setFocus);
+ }
+ }
+
+ public void drawEmptyDetailVM() {
+ // for all tree view
+ ((PEmptyViewPage)emptyView).drawEmptyDetailVM();
+ stackLayout.topControl = emptyView.getComposite();
+ //mainView.layout();
+ }
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomComboSelectionListener;
-import org.tizen.emulator.manager.da.widgets.combo.TitleComboPopupRenderer;
-import org.tizen.emulator.manager.da.widgets.combo.TitleComboRenderer;
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.platform.TotalPlatform;
import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.ui.widgets.VMButton;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.list.AbstractListView;
+import org.tizen.emulator.manager.ui.list.ExtendTreeListView;
+import org.tizen.emulator.manager.ui.list.ItemListVew;
+import org.tizen.emulator.manager.ui.list.TreeListView;
+import org.tizen.emulator.manager.ui.widgets.ImageCombo;
-enum VIEW_STATE {
- EMPTY, DETAIL;
-}
public class VMsListView {
private Composite parent = null;
+ private Composite mainView = null;
private Composite listView = null;
+ AbstractListView imageListView = null;
+ AbstractListView treeListView = null;
+ AbstractListView extendTreeListView = null;
+
private int WIDTH = 510;
private int HEIGHT = 430;
- // TODO
- private int LIST_WIDTH = WIDTH - 10;
- private int LIST_HEIGHT = HEIGHT - 55;
- // for resize
- private VIEW_STATE state;
+ private final StackLayout stackLayout = new StackLayout();
+ private AbstractListView TopListView = null;;
public VMsListView(Composite parent) {
this.parent = parent;
+ imageListView = new ItemListVew();
+ treeListView = new TreeListView();
+ extendTreeListView = new ExtendTreeListView();
+ TopListView = imageListView;
}
public void setSize(int width, int height) {
- this.WIDTH = width;
- this.HEIGHT = height;
- this.LIST_WIDTH = WIDTH - 10;
- this.LIST_HEIGHT = HEIGHT - 55;
+ WIDTH = width;
+ HEIGHT = height;
+ imageListView.setSize(width, height);
+ treeListView.setSize(width, height);
+ extendTreeListView.setSize(width, height);
}
public Point getSize() {
}
public Composite getComposite() {
- if (listView == null) {
+ if (mainView == null) {
init();
}
- return listView;
+ return mainView;
}
- private DACustomCombo imageCombo = null;
- private ScrolledComposite scrolledList = null;
- private Composite vmList = null;
+ private ImageCombo imageCombo = null;
+ private Button itemButton = null;
+ private Button treeButton = null;
public void init(int width, int height) {
- listView = new Composite(parent, SWT.NONE);
- listView.setLayout(new FormLayout());
- listView.setSize(width, height);
+ mainView = new Composite(parent, SWT.NONE);
+ mainView.setLayout(new FormLayout());
+ mainView.setSize(width, height);
+
+ makeComboButton();
+ makeRadioButton();
+
+ listView = new Composite(mainView, SWT.NONE);
+ listView.setLayout(stackLayout);
//
+ mainView.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor());
listView.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor());
//
- makeComboButton();
- makeVMList();
- }
-
- public void init() {
- init(WIDTH, HEIGHT);
- }
- private static int COMBO_WIDTH = 145;
- private static int COMBO_HEIGHT = 24;
- private void makeComboButton() {
- imageCombo = new DACustomCombo(listView, SWT.NONE);
- imageCombo.setImages(ImageResources.COMBO_NORMAL.getImage(),
- ImageResources.COMBO_HOVER.getImage(),
- ImageResources.COMBO_PUSH.getImage(),
- ImageResources.COMBO_DISABLE.getImage());
- imageCombo.setEnabled(true);
-
- imageCombo.setItemHeight(COMBO_HEIGHT);
- imageCombo.setComboRender(new TitleComboRenderer());
- imageCombo.setComboPopupRender(new TitleComboPopupRenderer());
FormData data = new FormData();
data.left = new FormAttachment(0, 10);
data.top = new FormAttachment(0, 10);
data.width = COMBO_WIDTH;
data.height = COMBO_HEIGHT;
imageCombo.setLayoutData(data);
- imageCombo.select(0);
-
- imageCombo.addSelectionListener(new DACustomComboSelectionListener() {
- @Override
- public void selectionEvent(DACustomCombo combo) {
- int index = combo.getImageIndex();
- VMsMainView.getInstance().drawVMList(index);
- }
- });
- }
- private Text dumyText = null;
- private void makeVMList() {
- scrolledList = new ScrolledComposite(listView, SWT.V_SCROLL | SWT.BORDER);
- scrolledList.setBackground(ColorResources.LIST_BG_COLOR.getColor());
-
- vmList = new Composite(scrolledList, SWT.NONE);
- vmList.setBackground(ColorResources.LIST_BG_COLOR.getColor());
- vmList.setLayout(new FormLayout());
-
- scrolledList.setContent(vmList);
- scrolledList.setExpandHorizontal(true);
+ data = new FormData();
+ data.top = new FormAttachment(0, 10);
+ data.right = new FormAttachment(100, -10);
+ treeButton.setLayoutData(data);
- // for key event
- dumyText = new Text(listView, SWT.NONE);
- dumyText.setText("");
+ data = new FormData();
+ data.top = new FormAttachment(0, 10);
+ data.right = new FormAttachment(treeButton, -10);
+ itemButton.setLayoutData(data);
- FormData data = new FormData();
+ data = new FormData();
data.left = new FormAttachment(0, 10);
- data.top = new FormAttachment(0, 40);
+ data.top = new FormAttachment(imageCombo, 5);
data.right = new FormAttachment(100, 0);
- data.bottom = new FormAttachment(100, -10);
- scrolledList.setLayoutData(data);
+ data.bottom = new FormAttachment(100, -10);
+ listView.setLayoutData(data);
- data = new FormData();
- data.left = new FormAttachment(0, -100);
- data.top = new FormAttachment(0, 0);
- data.width = 0;
- data.height = 0;
- dumyText.setLayoutData(data);
- dumyText.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- controlKeyEvent(event);
- }
- });
+ imageListView.init(listView, width, height);
+ treeListView.init(listView, width, height);
+ extendTreeListView.init(listView, width, height);
+ stackLayout.topControl = TopListView.getComposite();
}
- public void drawPlatform(Platform platform, int imageIndex) {
- imageCombo.setEnabled(true);
- imageCombo.initCombo();
- for (BaseImage image : platform.getImageList()) {
- imageCombo.add(image.getName());
- }
-
- imageCombo.select(imageIndex);
- VMsMainView.getInstance().drawVMList(imageIndex);
+ public void init() {
+ init(WIDTH, HEIGHT);
}
- private int W_GAP = 10;
- private int H_GAP = 12;
- private int BUTTON_WIDTH = 106 + 4;
- private int BUTTON_HEIGHT = 146 + 4;
+ boolean isTreeViewSelect = false;
+ private void makeRadioButton() {
+ itemButton = new Button(mainView, SWT.RADIO);
+ // TODO
+ itemButton.setText("item");
+ itemButton.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor());
+ itemButton.setFont(FontResources.RADIO_BUTTON_FONT.getFont());
+ itemButton.addSelectionListener(new SelectionListener() {
- private int W_COUNT = 0;
- private int H_COUNT = 0;
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (itemButton.getSelection() && isTreeViewSelect) {
+ selectRadioButton(false);
+ VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getCurrentImage());
+ }
+ }
- private DACustomButton createButton = null; // for empty list
- private VMButton addNewButton = null;
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+ treeButton = new Button(mainView, SWT.RADIO);
+ treeButton.setText("tree");
+ treeButton.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor());
+ treeButton.setFont(FontResources.RADIO_BUTTON_FONT.getFont());
+ treeButton.addSelectionListener(new SelectionListener() {
- private int CREATE_BUTTON_WIDTH = 190;
- private int CREATE_BUTTON_HEIGHT = 190;
- public void drawEmptyVMList() {
- if (createButton != null) {
- createButton.dispose();
- createButton = null;
- }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (treeButton.getSelection() && !isTreeViewSelect) {
+ selectRadioButton(true);
+ VMsMainView.getInstance().drawVMList(VMsMainView.getInstance().getCurrentImage());
+ }
+ }
- // clear
- VMButtonFactory.clear();
-
- state = VIEW_STATE.EMPTY;
-
- int leftOffset = (LIST_WIDTH - CREATE_BUTTON_WIDTH) / 2;
- int topOffset = (LIST_HEIGHT - CREATE_BUTTON_HEIGHT) / 2;
- FormData data = new FormData();
- data.left = new FormAttachment(0, leftOffset);
- data.top = new FormAttachment(0, topOffset);
- data.width = CREATE_BUTTON_WIDTH;
- data.height = CREATE_BUTTON_HEIGHT;
- createButton = new DACustomButton(vmList,
- ImageResources.CREATE_NEW_NOMAL.getImage(),
- ImageResources.CREATE_NEW_PUSH.getImage(),
- ImageResources.CREATE_NEW_HOVER.getImage(),
- ImageResources.CREATE_NEW_NOMAL.getImage());
- createButton.setLayoutData(data);
-
- createButton.addClickListener(new DACustomButtonClickEventListener(){
@Override
- public void handleClickEvent(DACustomButton button) {
- VMsMainView.getInstance().drawCreateVM(true);
+ public void widgetDefaultSelected(SelectionEvent e) {
}
});
-
- vmList.setSize(LIST_WIDTH, LIST_HEIGHT);
- vmList.layout(true, true);
- scrolledList.layout(true, true);
}
- public void drawVMList(BaseImage base, int select, boolean isCreate) {
- if (createButton != null) {
- createButton.dispose();
- createButton = null;
+ private void selectRadioButton(boolean isTreeView) {
+ isTreeViewSelect = isTreeView;
+ if (isTreeView) {
+ treeButton.setSelection(true);
+ itemButton.setSelection(false);
+ if (VMsMainView.getInstance().getPlatform() instanceof TotalPlatform) {
+ TopListView = extendTreeListView;
+ } else {
+ TopListView = treeListView;
+ }
+ } else {
+ itemButton.setSelection(true);
+ treeButton.setSelection(false);
+ TopListView = imageListView;
}
+ stackLayout.topControl = TopListView.getComposite();
+ }
- if (select == -1) {
- select = 0;
- }
+ private static int COMBO_WIDTH = 145;
+ private static int COMBO_HEIGHT = 24;
+ private void makeComboButton() {
+ imageCombo = new ImageCombo(mainView, SWT.NONE);
+ imageCombo.setEnabled(true);
+ imageCombo.setItemHeight(COMBO_HEIGHT);
+ imageCombo.select(0);
- state = VIEW_STATE.DETAIL;
+ imageCombo.addSelectionListener(new SelectionListener() {
- VMButtonFactory.clear();
- if (base.getVmsList().size() != 0) {
- VMButton button = null;
- for (int i = 0; i < base.getVmsList().size(); i++) {
- button = VMButtonFactory.getButton(vmList);
- button.setProperty(base.getVmsList().get(i));
- if (i == select) {
- VMButtonFactory.clickVMButton(button);
- }
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int index = imageCombo.getSelectionIndex();
+ VMsMainView.getInstance().setCurrentProperty(null);
+ VMsMainView.getInstance().drawVMList(index);
}
- }
- // add create button
- addNewButton = VMButtonFactory.getCreateButton(vmList);
- if (isCreate) {
- addNewButton.setEnabled(false);
- } else {
- addNewButton.setEnabled(true);
- }
- addNewButton.addClickListener(new DACustomButtonClickEventListener(){
@Override
- public void handleClickEvent(DACustomButton button) {
- clickCreateButton();
+ public void widgetDefaultSelected(SelectionEvent e) {
+ int index = imageCombo.getSelectionIndex();
+ VMsMainView.getInstance().setCurrentProperty(null);
+ VMsMainView.getInstance().drawVMList(index);
}
+
});
-
- arrayVMList();
}
- private void arrayVMList() {
- W_COUNT = LIST_WIDTH / (BUTTON_WIDTH + W_GAP);
-
- int wIndex = 0;
- int hIndex = 0;
- int size = VMButtonFactory.getButtonList().size();
- if (size != 0) {
- H_COUNT = size / W_COUNT;
- if (size % W_COUNT != 0) {
- H_COUNT++;
+ public void drawPlatform(Platform platform, int imageIndex, boolean isRefresh) {
+ if (platform instanceof TotalPlatform) {
+ if (!isRefresh) {
+ selectRadioButton(true);
+ itemButton.setEnabled(false);
}
-
- if (((BUTTON_HEIGHT + H_GAP) * H_COUNT) > LIST_HEIGHT) {
- vmList.setSize(LIST_WIDTH, ((BUTTON_HEIGHT + H_GAP) * H_COUNT) + H_GAP);
- } else {
- vmList.setSize(LIST_WIDTH, LIST_HEIGHT);
+ imageCombo.removeAll();
+ imageCombo.setEnabled(false);
+ imageCombo.layout();
+ } else {
+ if (!isRefresh) {
+ selectRadioButton(false);
+ itemButton.setEnabled(true);
}
- FormData data = null;
- for (VMButton button : VMButtonFactory.getButtonList()) {
- data = new FormData();
- data.left = new FormAttachment(0, W_GAP + (BUTTON_WIDTH + W_GAP) * wIndex);
- data.top = new FormAttachment(0, H_GAP + (BUTTON_HEIGHT + H_GAP) * hIndex);
- data.width = BUTTON_WIDTH;
- data.height = BUTTON_HEIGHT;
-
- button.setLayoutData(data);
-
- button.redraw();
- ++wIndex;
- if (wIndex == W_COUNT) {
- wIndex = 0;
- hIndex++;
+ if (!platform.getImageList().isEmpty()) {
+ imageCombo.removeAll();
+ imageCombo.setEnabled(true);
+ for (BaseImage image : platform.getImageList()) {
+ imageCombo.add(image.getName());
}
+ imageCombo.select(imageIndex);
+ } else {
+ // TODO
+ return;
}
}
- vmList.layout(true, true);
- scrolledList.layout(true, true);
-
- scrolledList.showControl(VMButtonFactory.getSelectedButton());
+ TopListView.drawPlatform(platform, imageIndex);
}
- private void clickCreateButton() {
- VMButtonFactory.clickVMButton(addNewButton);
- VMsMainView.getInstance().drawCreateVM(true);
+ public void drawVMList(BaseImage base, int select, boolean isCreate) {
+ TopListView.drawVMList(base, select, isCreate);
+ mainView.layout(true, true);
}
- public void controlKeyEvent(KeyEvent event) {
- if (createButton != null) {
- switch(event.keyCode) {
- case SWT.CR:
- case SWT.KEYPAD_CR:
- clickCreateButton();
- break;
- default:
- break;
- }
- } else {
- switch (event.keyCode) {
- case SWT.CR:
- case SWT.KEYPAD_CR:
- if (VMButtonFactory.getSelectedButton() instanceof VMCreateButton) {
- clickCreateButton();
- } else {
- VMButtonFactory.getSelectedButton().clickLaunchButton();
- }
- break;
- case SWT.ARROW_UP:
- int size = VMButtonFactory.getButtonList().size();
- int index = VMButtonFactory.getSelectedButtonIndex() - W_COUNT;
- if (index >= 0) {
- VMButtonFactory.clickVMButton(index);
- }
- break;
- case SWT.ARROW_DOWN:
- size = VMButtonFactory.getButtonList().size();
- index = VMButtonFactory.getSelectedButtonIndex() + W_COUNT;
- if (index < size) {
- VMButtonFactory.clickVMButton(index);
- } else {
- VMButtonFactory.clickVMButton(VMButtonFactory.getButtonList().size() - 1);
- }
- break;
- case SWT.ARROW_LEFT:
- size = VMButtonFactory.getButtonList().size();
- index = VMButtonFactory.getSelectedButtonIndex() - 1;
- if (index >= 0) {
- VMButtonFactory.clickVMButton(index);
- }
- break;
- case SWT.ARROW_RIGHT:
- size = VMButtonFactory.getButtonList().size();
- index = VMButtonFactory.getSelectedButtonIndex() + 1;
- if (index < size) {
- VMButtonFactory.clickVMButton(index);
- }
- break;
- case SWT.DEL:
- if (!(VMButtonFactory.getSelectedButton() instanceof VMCreateButton)) {
- VMsMainView.getInstance().deleteEmulator();
- return;
- }
- break;
- case SWT.ESC:
- if (VMsMainView.getInstance().isCreateMode()) {
- VMsMainView.getInstance().drawCancelCreaetVM();
- } else {
- VMsMainView.getInstance().drawDetailVM();
- }
- }
-
- if (VMButtonFactory.getSelectedButton() != null) {
- scrolledList.showControl(VMButtonFactory.getSelectedButton());
- }
- }
+ public void drawEmptyVMList() {
+ TopListView.drawEmptyVMList();
+ mainView.layout(true, true);
}
public void cancelModify(int index) {
- if (addNewButton != null && !addNewButton.isDisposed()) {
- addNewButton.setEnabled(true);
- }
- if (index >= 0) {
- VMButtonFactory.clickVMButton(index);
- }
MainDialog.getStatusBar().reset();
- dumyText.setFocus();
+ TopListView.cancelModify(index);
+ mainView.layout(true, true);
}
public void draw() {
- vmList.layout(true, true);
- scrolledList.layout(true, true);
+ TopListView.draw();
+ mainView.layout(true, true);
}
public void redraw() {
-
- switch(state) {
- case EMPTY:
- drawEmptyVMList();
- break;
- case DETAIL:
- arrayVMList();
- break;
- default:
- break;
- }
-
+ TopListView.redraw();
+ mainView.layout(true, true);
}
public void close() {
imageCombo.dispose();
- VMButtonFactory.clear();
-
- vmList.dispose();
- scrolledList.dispose();
+ imageListView.close();
+ treeListView.close();
listView.dispose();
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
mainView.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor());
mainView.addControlListener(new ControlListener() {
-
@Override
public void controlMoved(ControlEvent e) {
}
-
@Override
public void controlResized(ControlEvent e) {
Composite c = (Composite)e.widget;
detailView.setSize(width, rect.height);
listView.redraw();
- detailView.redraw();
}
});
public void setSetFocus(boolean setFocus) {
this.setFocus = setFocus;
+ detailView.setFocus(setFocus);
+ }
+
+ public boolean isModifyMode() {
+ return detailView.isModifyMode();
}
private Platform currentPlatform = null;
private BaseImage currentImage = null;
private VMProperty currentProperty = null;
- public void setPlatform(Platform platform, int index) {
+ public void setPlatform(Platform platform, int index, boolean isRefresh) {
if (platform == null) {
// TODO
return;
}
this.currentPlatform = platform;
- if (platform.getImageList().isEmpty()) {
- // TODO
- } else {
- listView.drawPlatform(platform, index);
- }
+ listView.drawPlatform(platform, index, isRefresh);
}
public void setPlatform(Platform platform) {
- setPlatform(platform, 0);
+ setPlatform(platform, 0, false);
}
public void resetPlatform() {
- detailView.redraw();
+ detailView.reset();
setPlatform(currentPlatform,
- currentPlatform.getImageList().indexOf(currentImage));
+ currentPlatform.getImageList().indexOf(currentImage), true);
}
public void clearPlatform() {
return currentPlatform;
}
- void setCurrentImage(BaseImage image) {
+ public void setCurrentImage(BaseImage image) {
this.currentImage = image;
}
return currentProperty;
}
- void setCurrentProperty(VMProperty currentProperty) {
+ public void setCurrentProperty(VMProperty currentProperty) {
this.currentProperty = currentProperty;
}
public void drawVMList(BaseImage image) {
+ isCreateMode = false;
currentImage = image;
if (image.getVmsList().isEmpty()) {
drawEmptyVMList();
detailView.drawEmptyVM();
}
+ public void drawEmptyDetailVM() {
+ isCreateMode = false;
+ //listView.cancelModify(-1);
+ detailView.drawEmptyDetailVM();
+ }
+
public void drawDetailVM(VMProperty property, int index) {
assert property == null;
-
- currentProperty = property;
isCreateMode = false;
+ currentProperty = property;
listView.cancelModify(index);
detailView.drawDetailVM(property);
}
}
isCreateMode = false;
- setSetFocus(true);
detailView.drawModifyVM(property);
+ setSetFocus(true);
}
public void drawModifyVM() {
drawModifyVM(currentProperty);
}
- public void drawCreateVM(boolean setfocus) {
- isCreateMode = true;
- setSetFocus(setfocus);
-
+ public void drawCreateVM(boolean setFocus) {
if (currentImage.getVmsList().isEmpty()) {
listView.drawVMList(currentImage, -1, true);
}
-
BaseImage image = (currentPlatform.getName().equals("custom"))
? null : currentImage;
+
+ drawCreateVM(image, setFocus);
+ }
+
+ public void drawCreateVM(BaseImage image, boolean setFocus) {
+ if (isCreateMode) {
+ setSetFocus(setFocus);
+ return;
+ }
+ isCreateMode = true;
+
+ setSetFocus(setFocus);
detailView.drawCreateVM(
new VMPropertyValue(image, SelectTemplate.getInstance().getDefaultTemplate()));
}
listView.cancelModify(-1);
drawEmptyVMList();
} else {
- int i = currentImage.getVmsList().indexOf(currentProperty);
- listView.cancelModify(i);
- detailView.drawDetailVM(currentProperty);
+ if (currentProperty != null) {
+ int i = currentImage.getVmsList().indexOf(currentProperty);
+ listView.cancelModify(i);
+ detailView.drawDetailVM(currentProperty);
+ } else {
+ listView.cancelModify(-1);
+ }
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import java.util.ArrayList;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.emulator.manager.da.widgets.button.toggle.DACustomToggleButton;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.vms.VMPropertyValue;
class DetailItemList {
private boolean isCreateMode;
protected boolean isMinMode = false;
- protected DACustomToggleButton arrowButton;
+ protected ImageButton arrowButton;
protected int count;
protected DetailViewItem item;
private static int ARROW_BUTTON_HEIGHT = 7;
protected void initTitle(boolean supportMinMode) {
if (supportMinMode && count > 1) {
- arrowButton = new DACustomToggleButton(compList.get(0),
- ImageResources.ARROW_DOWN.getImage(),
+ arrowButton = new ImageButton(compList.get(0), SWT.TOGGLE);
+ arrowButton.setImages(ImageResources.ARROW_DOWN.getImage(),
ImageResources.ARROW_DOWN.getImage(),
ImageResources.ARROW_DOWN.getImage(),
- null,
ImageResources.ARROW_UP.getImage(),
- ImageResources.ARROW_UP.getImage());
+ ImageResources.ARROW_UP.getImage(),
+ ImageResources.ARROW_DOWN.getImage());
FormData data = new FormData();
data.left = new FormAttachment(0, 5);
data.height = ARROW_BUTTON_WIDTH;
data.width = ARROW_BUTTON_HEIGHT;
arrowButton.setLayoutData(data);
- arrowButton.addClickListener(new DACustomButtonClickEventListener() {
+ arrowButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
changeArrowState();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
@Override
public void mouseDoubleClick(MouseEvent e) {
if (arrowButton != null) {
- arrowButton.setToggled(arrowButton.isToggled() ? false : true);
+ arrowButton.setSelection(arrowButton.isSelection() ? false : true);
changeArrowState();
}
}
}
protected void changeArrowState() {
- if (arrowButton.isToggled()) {
+ if (arrowButton.isSelection()) {
/*
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
// TODO: need new name
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
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.Label;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.ui.VMsDetailView;
import org.tizen.emulator.manager.ui.widgets.CustomScrolledComposite;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.vms.VMPropertyValue;
public abstract class DetailViewPage {
return view;
}
- protected DACustomButton topButton = null;
+ protected ImageButton topButton = null;
private static int TOP_BUTTON_WIDTH = 21;
private static int TOP_BUTTON_HEIGHT = 21;
protected void makeListTop() {
scrolledList.setSize(data.width, data.height);
scrolledList.setLayoutData(data);
itemList.setSize(image3.getImageData().width, image3.getImageData().height);
- //scrolledList.layout();
}
public void resize(int height) {
settingItemList();
}
- public Point getDetailViewOrigin() {
- return scrolledList.getOrigin();
- }
-
- public void setDetailViewOrigin(int x, int y) {
- scrolledList.setOrigin(x, y);
- }
-
protected abstract void drawInitView();
public abstract void reset();
+ public abstract void setFocus(boolean setFocus);
public abstract void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate);
}
+++ /dev/null
-package org.tizen.emulator.manager.ui.detail;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer;
-
-public class EMComboButtonRenderer extends DACustomButtonDefaultRenderer {
-
- protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
- Rectangle imgRect = img.getBounds();
- int width = rect.width - imgRect.width;
- int height = rect.height - imgRect.height;
- int x = 0, y = 0;
- if (width > 0) {
- x = width / 2;
- }
-
- if (height > 0) {
- y = height / 2;
- }
- gc.drawImage(img, x, y);
- }
- }
-}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import org.eclipse.swt.SWT;
public class PEmptyViewPage extends DetailViewPage {
public static String NO_ITEM = "No items selected";
-
+ private Label title;
public PEmptyViewPage(VMsDetailView parent, int style) {
super(parent, style);
}
@Override
protected void drawInitView() {
// write message
- Label title = new Label(itemList, SWT.NONE);
+ title = new Label(itemList, SWT.NONE);
title.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
title.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
title.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
title.setLayoutData(data);
}
+ public void drawEmptyDetailVM() {
+ title.setText("");
+ }
+
@Override
public void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate) {
- // empty function
+ title.setText(NO_ITEM);
}
@Override
public void reset() {
// TODO Auto-generated method stub
}
+
+ @Override
+ public void setFocus(boolean setFocus) {
+ // TODO Auto-generated method stub
+ }
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import java.util.ArrayList;
+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.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.VMsDetailView;
import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.vms.VMPropertyValue;
public class PInfoViewPage extends DetailViewPage {
super(parent, style);
}
- private DACustomButton modifyButton;
+ private ImageButton modifyButton;
@Override
protected void drawInitView() {
- modifyButton = new DACustomButton(itemListTop,
- ImageResources.MODIFY_BUTTON_NOMAL.getImage(),
- ImageResources.MODIFY_BUTTON_PUSH.getImage(),
+ modifyButton = new ImageButton(itemListTop, SWT.PUSH);
+ modifyButton.setImages(ImageResources.MODIFY_BUTTON_NOMAL.getImage(),
ImageResources.MODIFY_BUTTON_HOVER.getImage(),
- null);
- modifyButton.addClickListener(new DACustomButtonClickEventListener() {
+ ImageResources.MODIFY_BUTTON_PUSH.getImage(),
+ null, null, null);
+ modifyButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
VMsMainView.getInstance().drawModifyVM();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
modifyButton.setToolTipText("modify property of vm");
itemList.layout(true, true);
}
- private DACustomButton exportButton;
- private DACustomButton deleteButton;
- private DACustomButton resetButton;
+ private ImageButton exportButton;
+ private ImageButton deleteButton;
+ private ImageButton resetButton;
private static int BUTTON_WIDTH = 92;
private static int BUTTON_HEIGHT = 36;
private static Image BUTTON_IMAGE = null;
if (BUTTON_IMAGE == null) {
BUTTON_IMAGE = PatchImageResources.getNomalButton(BUTTON_WIDTH);
}
- exportButton = new DACustomButton(buttonComp,
- BUTTON_IMAGE,
- BUTTON_IMAGE,
- BUTTON_IMAGE,
- null);
+ exportButton = new ImageButton(buttonComp, SWT.PUSH);
exportButton.setText(StringResources.EXPORT_IMAGE);
exportButton.setEnabled(true);
- deleteButton = new DACustomButton(buttonComp,
- BUTTON_IMAGE,
- BUTTON_IMAGE,
- BUTTON_IMAGE,
- null);
+ deleteButton = new ImageButton(buttonComp, SWT.PUSH);
deleteButton.setText(StringResources.DELETE);
deleteButton.setEnabled(true);
- resetButton = new DACustomButton(buttonComp,
- BUTTON_IMAGE,
- BUTTON_IMAGE,
- BUTTON_IMAGE,
- null);
+ resetButton = new ImageButton(buttonComp, SWT.PUSH);
resetButton.setText(StringResources.RESET);
resetButton.setEnabled(true);
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(0, 0);
- data.width = 92;
+ data.width = BUTTON_WIDTH;
data.height = BUTTON_HEIGHT;
exportButton.setLayoutData(data);
}
private void addButtonListener() {
- exportButton.addClickListener(new DACustomButtonClickEventListener() {
+ exportButton.addSelectionListener(new SelectionListener() {
+
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
VMsMainView.getInstance().createBaseImage();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
});
- deleteButton.addClickListener(new DACustomButtonClickEventListener() {
+ deleteButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
VMsMainView.getInstance().deleteEmulator();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
- resetButton.addClickListener(new DACustomButtonClickEventListener() {
+ resetButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
VMsMainView.getInstance().resetEmulator();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
assert propertyValue == null;
for (DetailViewItem item : list) {
- item.settingStatus(false);
item.settingDetailItem(propertyValue);
}
}
@Override
public void reset() {
- /*
scrolledList.setOrigin(0, 0);
for (int i = 0; i < list.size(); i++) {
list.get(i).settingStatus(true);
}
- */
+ }
+
+ @Override
+ public void setFocus(boolean setFocus) {
+ // TODO Auto-generated method stub
+
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import java.util.ArrayList;
+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.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.VMsDetailView;
import org.tizen.emulator.manager.ui.VMsMainView;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.VMPropertyValue;
super(parent, style);
}
- private DACustomButton cancelButton;
+ private ImageButton cancelButton;
private boolean isCreateMode = false;
@Override
protected void drawInitView() {
- cancelButton = new DACustomButton(itemListTop,
- ImageResources.CANCEL_BUTTON_NOMAL.getImage(),
- ImageResources.CANCEL_BUTTON_PUSH.getImage(),
+ cancelButton = new ImageButton(itemListTop, SWT.PUSH);
+ cancelButton.setImages(ImageResources.CANCEL_BUTTON_NOMAL.getImage(),
ImageResources.CANCEL_BUTTON_HOVER.getImage(),
- null);
- cancelButton.addClickListener(new DACustomButtonClickEventListener() {
+ ImageResources.CANCEL_BUTTON_PUSH.getImage(),
+ null, null, null);
+
+ cancelButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
cancelModify();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
cancelButton.setToolTipText("cancel modification of vm");
makeModifyView();
makeButton();
+
}
protected void cancelModify() {
private static int CONFIRM_BUTTON_WIDTH = 303;
private static int CONFIRM_BUTTON_HEIGHT = 36;
private static Image CONFIRM_BUTTON_IMAGE = null;
- private DACustomButton confirmButton;
+ private ImageButton confirmButton;
private void makeButton() {
if (CONFIRM_BUTTON_IMAGE == null) {
CONFIRM_BUTTON_IMAGE = PatchImageResources.getNomalButton(CONFIRM_BUTTON_WIDTH);
}
- confirmButton = new DACustomButton(buttonComp,
- CONFIRM_BUTTON_IMAGE,
- CONFIRM_BUTTON_IMAGE,
- CONFIRM_BUTTON_IMAGE,
- CONFIRM_BUTTON_IMAGE);
+ confirmButton = new ImageButton(buttonComp, SWT.PUSH);
confirmButton.setText(StringResources.CONFIRM);
confirmButton.setEnabled(false);
- confirmButton.setFontColor(DACustomButton.STATE_DISABLE,
- ColorResources.BUTTON_DISABLE_FONT_COLOR.getColor());
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.width = CONFIRM_BUTTON_WIDTH;
confirmButton.setLayoutData(data);
- confirmButton.addClickListener(new DACustomButtonClickEventListener() {
+ confirmButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
modifyVMProperty();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
public void drawPropertyView(VMPropertyValue propertyValue, boolean isCreate) {
assert propertyValue == null;
- if (isCreate) {
- scrolledList.setOrigin(0, 0);
- }
-
confirmButton.setEnabled(false);
buttonComp.layout(true, true);
newValue = oldValue.clone();
for (DetailViewItem item : list) {
item.setCreateMode(isCreate);
- item.settingStatus(false);
item.settingModifyItem(propertyValue);
}
}
@Override
public void reset() {
- // TODO Auto-generated method stub
+ scrolledList.setOrigin(0, 0);
+ for (int i = 0; i < list.size(); i++) {
+ list.get(i).settingStatus(true);
+ }
+ }
+
+ @Override
+ public void setFocus(boolean setFocus) {
+ for (int i = 0; i < list.size(); i++) {
+ list.get(i).settingStatus(false);
+ }
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+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.widgets.Spinner;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomComboSelectionListener;
-import org.tizen.emulator.manager.da.widgets.combo.TitleComboPopupRenderer;
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.platform.SkinList;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
+import org.tizen.emulator.manager.ui.widgets.ImageCombo;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.ui.widgets.ModifyViewCombo;
-import org.tizen.emulator.manager.ui.widgets.ModifyViewComboRenderer;
+import org.tizen.emulator.manager.ui.widgets.WSTATE;
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.SKIN_TYPE;
import org.tizen.emulator.manager.vms.VMPropertyValue;
reCategory = new ImageLabel(compList.get(0), SWT.NONE);
reCategory.setText("Resolution");
- reCategory.setImage(ImageLabel.STATE_ENABLE, CATEGORY_IMAGE);
+ reCategory.setEnableImage(CATEGORY_IMAGE);
reCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- reCategory.setForeground(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
+ reCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
FormData data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
dpiCategory = new ImageLabel(compList.get(1), SWT.NONE);
dpiCategory.setText("Density");
- dpiCategory.setImage(ImageLabel.STATE_ENABLE, CATEGORY_IMAGE);
+ dpiCategory.setEnableImage(CATEGORY_IMAGE);
dpiCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- dpiCategory.setForeground(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
+ dpiCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
skinCategory = new ImageLabel(compList.get(2), SWT.NONE);
skinCategory.setText("Skin");
- skinCategory.setImage(ImageLabel.STATE_ENABLE, CATEGORY_IMAGE);
+ skinCategory.setEnableImage(CATEGORY_IMAGE);
skinCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- skinCategory.setForeground(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
+ skinCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
}
resolution = new ImageLabel(compList.get(0), SWT.NONE);
- resolution.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE);
+ resolution.setEnableImage(INPUTBOX_OFF_IMAGE);
FormData data = new FormData();
data.left = new FormAttachment(reCategory, 4);
resolution.setLayoutData(data);
dpi = new ImageLabel(compList.get(1), SWT.NONE);
- dpi.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE);
+ dpi.setEnableImage(INPUTBOX_OFF_IMAGE);
data = new FormData();
data.left = new FormAttachment(dpiCategory, 4);
dpi.setLayoutData(data);
skin = new ImageLabel(compList.get(2), SWT.NONE);
- skin.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE);
+ skin.setEnableImage(INPUTBOX_OFF_IMAGE);
data = new FormData();
data.left = new FormAttachment(skinCategory, 4);
skin.setLayoutData(data);
}
- private DACustomCombo reCombo = null;
+ private ImageCombo reCombo = null;
private Spinner dpiSpinner = null;
- private DACustomCombo skinCombo = null;
+ private ImageCombo skinCombo = null;
@Override
public void drawModify() {
drawCategory();
INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
}
- reCombo = new ModifyViewCombo(compList.get(0), SWT.NONE);
- reCombo.setImages(INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE);
- reCombo.setButtonImages(ImageResources.ARROW_DROPDOWN.getImage(), null);
- reCombo.setEnabled(true);
+ reCombo = new ImageCombo(compList.get(0), SWT.NONE);
+ reCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
+ reCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
+ reCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
- // TODO
- reCombo.setComboRender(new ModifyViewComboRenderer());
- reCombo.setComboPopupRender(new TitleComboPopupRenderer());
+ reCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
+ reCombo.setEnabled(true);
reCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
- //
FormData data = new FormData();
data.left = new FormAttachment(reCategory, 4);
reCombo.setLayoutData(data);
dpi = new ImageLabel(compList.get(1), SWT.NONE);
- dpi.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_ON_IMAGE);
+ dpi.setEnableImage(INPUTBOX_ON_IMAGE);
data = new FormData();
data.left = new FormAttachment(dpiCategory, 4);
dpiSpinner.setLayoutData(data);
- skinCombo = new ModifyViewCombo(compList.get(2), SWT.NONE);
- skinCombo.setImages(INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE);
- skinCombo.setButtonImages(ImageResources.ARROW_DROPDOWN.getImage(), null);
- skinCombo.setEnabled(true);
+ skinCombo = new ImageCombo(compList.get(2), SWT.NONE);
+ skinCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
+ skinCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
+ skinCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
- skinCombo.setComboRender(new ModifyViewComboRenderer());
- skinCombo.setComboPopupRender(new TitleComboPopupRenderer());
+ skinCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
+ skinCombo.setEnabled(true);
skinCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
- //
data = new FormData();
data.left = new FormAttachment(skinCategory, 4);
}
private void addWidgetListener() {
- reCombo.addSelectionListener(new DACustomComboSelectionListener() {
+ reCombo.addSelectionListener(new SelectionListener() {
+
@Override
- public void selectionEvent(DACustomCombo combo) {
- String re = combo.getText();
- reCombo.setToolTipText(combo.getText());
+ public void widgetSelected(SelectionEvent e) {
+ String re = reCombo.getText();
+ reCombo.setToolTipText(reCombo.getText());
RESOLUTION d = DisplayResolution.getInstance().findResolution(re);
if (d != null) {
getListener().ChangeValue(getThis());
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
dpiSpinner.addModifyListener(new ModifyListener() {
}
});
- skinCombo.addSelectionListener(new DACustomComboSelectionListener() {
+ dpiSpinner.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent event) {
+ switch (event.keyCode) {
+ case SWT.CR:
+ case SWT.KEYPAD_CR:
+ ///TODO
+ getListener().ChangeState(State.CREATE);
+ break;
+ case SWT.ESC:
+ getListener().ChangeState(State.CANCEL);
+ break;
+ default:
+ // TODO
+ break;
+ }
+ }
+ });
+
+ skinCombo.addSelectionListener(new SelectionListener() {
@Override
- public void selectionEvent(DACustomCombo combo) {
- String name = combo.getText();
- skinCombo.setToolTipText(combo.getText());
+ public void widgetSelected(SelectionEvent e) {
+ String name = skinCombo.getText();
+ skinCombo.setToolTipText(skinCombo.getText());
newSkin = SkinList.getInstance().findSkinUseName(name);
if (newSkin == null && name.equals(oldSkin)) {
getListener().ChangeValue(getThis());
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
//RESOLUTION
DisplayResolution.getInstance().initialize(oldResolution);
- reCombo.initCombo();
+ reCombo.removeAll();
String r = null;
int f = -1;
// DPI
dpiSpinner.setSelection(value.dpi);
+ if (!isCreateMode()) {
+ dpiSpinner.setFocus();
+ }
// SKIN
settingSkinList(value.resolution);
}
private void settingSkinList(RESOLUTION re) {
- skinCombo.initCombo();
+ skinCombo.removeAll();
int find = -1;
ArrayList<Skin> skinList = null;
public void settingStatus(boolean isRefresh) {
if (isRefresh) {
if (isMinMode) {
- arrowButton.setToggled(false);
+ arrowButton.setSelection(false);
changeArrowState();
}
} else {
if (isShareMinMode != isMinMode) {
- arrowButton.setToggled(isShareMinMode);
+ arrowButton.setSelection(isShareMinMode);
changeArrowState();
}
}
+ if (!isCreateMode() && dpiSpinner != null) {
+ dpiSpinner.setFocus();
+ }
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import java.io.File;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.emulator.manager.da.widgets.button.toggle.DACustomToggleButton;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.MainDialog;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.vms.VMPropertyValue;
@Override
public void drawDetail() {
supportLabel = new ImageLabel(compList.get(0), SWT.NONE);
- supportLabel.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
+ supportLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
dirCategory = new ImageLabel(compList.get(1), SWT.NONE);
dirCategory.setText("Directory");
- dirCategory.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getCategoryBox(DIR_CATEGORY_WIDTH));
- dirCategory.setFontColor(ImageLabel.STATE_ENABLE,
- ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
+ dirCategory.setEnableImage(PatchImageResources.getCategoryBox(DIR_CATEGORY_WIDTH));
+ dirCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
directoryLabel = new ImageLabel(compList.get(1), SWT.NONE);
- directoryLabel.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getInputBoxOff(DIR_INPUTBOX_OFF_WIDTH));
+ directoryLabel.setEnableImage(PatchImageResources.getInputBoxOff(DIR_INPUTBOX_OFF_WIDTH));
FormData data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
}
private Label stateLabel;
- private DACustomToggleButton selectSupport;
- private DACustomButton selectDirButton;
+ private ImageButton selectSupport;
+ private ImageButton selectDirButton;
private static String toolTipforMac = "Please refer to file sharing section in SDK documentation.";
@Override
}
private void makeModifyWidget() {
- selectSupport = new DACustomToggleButton(compList.get(0),
- ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
+ selectSupport = new ImageButton(compList.get(0), SWT.TOGGLE);
+ selectSupport.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
ImageResources.TOGGLE_ON_HOVER.getImage(),
- null,
+ ImageResources.TOGGLE_ON_PUSH.getImage(),
ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage());
+ ImageResources.TOGGLE_OFF_HOVER.getImage(),
+ ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
+
+ selectSupport.addSelectionListener(new SelectionListener() {
- selectSupport.addClickListener(new DACustomButtonClickEventListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
- if (selectSupport.isToggled()) { // NOT SUPPORT
+ public void widgetSelected(SelectionEvent e) {
+ if (selectSupport.isSelection()) { // NOT SUPPORT
newSupport = false;
stateLabel.setText(StringResources.NOT_SUPPORTED);
directoryLabel.setText("");
getListener().ChangeValue(getThis());
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
});
stateLabel = new Label(compList.get(0), SWT.NONE);
stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
directoryLabel = new ImageLabel(compList.get(1), SWT.NONE);
- directoryLabel.setImage(ImageLabel.STATE_DISABLE,
- PatchImageResources.getInputBoxON(DIR_INPUTBOX_ON_WIDTH));
+ directoryLabel.setEnableImage(PatchImageResources.getInputBoxON(DIR_INPUTBOX_ON_WIDTH));
directoryLabel.setEnabled(false);
- selectDirButton = new DACustomButton(compList.get(1),
+ selectDirButton = new ImageButton(compList.get(1), SWT.PUSH);
+ selectDirButton.setImages(
ImageResources.BUTTON_FILE_NOMAL.getImage(),
- ImageResources.BUTTON_FILE_PUSH.getImage(),
ImageResources.BUTTON_FILE_HOVER.getImage(),
+ ImageResources.BUTTON_FILE_PUSH.getImage(),
+ ImageResources.BUTTON_FILE_NOMAL.getImage(),
+ ImageResources.BUTTON_FILE_NOMAL.getImage(),
ImageResources.BUTTON_FILE_DISABLE.getImage());
- selectDirButton.addClickListener(new DACustomButtonClickEventListener() {
+ selectDirButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
if(sharedFD == null) {
sharedFD = new DirectoryDialog(
MainDialog.getShell(), SWT.OPEN);
}
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
directoryLabel.setToolTipText(toolTipforMac);
} else {
if (oldSupport) {
- selectSupport.setToggled(false);
+ selectSupport.setSelection(false);
stateLabel.setText(StringResources.SUPPORTED);
directoryLabel.setText(oldPathName);
directoryLabel.setToolTipText(newPath);
selectDirButton.setEnabled(true);
} else {
- selectSupport.setToggled(true);
+ selectSupport.setSelection(true);
stateLabel.setText(StringResources.NOT_SUPPORTED);
directoryLabel.setText(oldPathName);
selectDirButton.setEnabled(false);
public void settingStatus(boolean isRefresh) {
if (isRefresh) {
if (isMinMode) {
- arrowButton.setToggled(false);
+ arrowButton.setSelection(false);
changeArrowState();
}
} else {
if (isShareMinMode != isMinMode) {
- arrowButton.setToggled(isShareMinMode);
+ arrowButton.setSelection(isShareMinMode);
changeArrowState();
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.emulator.manager.da.widgets.button.toggle.DACustomToggleButton;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.tool.CheckVirtualization;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.vms.VMPropertyValue;
+ StringResources.NEW_LINE + "Try upgrade graphic card driver.";
private void makeCategory() {
virtualCategory = new ImageLabel(compList.get(0), SWT.NONE);
- virtualCategory.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
- virtualCategory.setFontColor(ImageLabel.STATE_ENABLE,
- ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
+ virtualCategory.setEnableImage(PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
+ virtualCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
virtualCategory.setText("CPU VT");
GPUCategory = new ImageLabel(compList.get(1), SWT.NONE);
- GPUCategory.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
- GPUCategory.setFontColor(ImageLabel.STATE_ENABLE,
- ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
+ GPUCategory.setEnableImage(PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
+ GPUCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
GPUCategory.setText("GPU");
GPUCategory.setToolTipText(GPUToolTipText);
makeCategory();
virtualLabel = new ImageLabel(compList.get(0), SWT.NONE);
- virtualLabel.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
+ virtualLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
GPULabel = new ImageLabel(compList.get(1), SWT.NONE);
- GPULabel.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
+ GPULabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
GPULabel.setToolTipText(GPUToolTipText);
FormData data = new FormData();
GPULabel.setLayoutData(data);
}
- private DACustomToggleButton virtualButton;
- private DACustomToggleButton GPUButton;
+ private ImageButton virtualButton;
+ private ImageButton GPUButton;
private Label virtualState;
private Label GPUState;
@Override
}
private void makeModifyWidget() {
- virtualButton = new DACustomToggleButton(compList.get(0),
- ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
+ virtualButton = new ImageButton(compList.get(0), SWT.TOGGLE);
+ virtualButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
+ ImageResources.TOGGLE_ON_PUSH.getImage(),
ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage());
+ ImageResources.TOGGLE_OFF_HOVER.getImage(),
+ ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
- virtualButton.addClickListener(new DACustomButtonClickEventListener() {
+ virtualButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
- if (virtualButton.isToggled()) { // NOT SUPPORT
+ public void widgetSelected(SelectionEvent e) {
+ if (virtualButton.isSelection()) { // NOT SUPPORT
newHWSupport = false;
virtualState.setText(StringResources.NOT_SUPPORTED);
} else { // SUPPORT
getListener().ChangeValue(getThis());
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
virtualState = new Label(compList.get(0), SWT.NONE);
virtualState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
virtualState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- GPUButton = new DACustomToggleButton(compList.get(1),
- ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
+ GPUButton = new ImageButton(compList.get(1), SWT.TOGGLE);
+ GPUButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
+ ImageResources.TOGGLE_ON_PUSH.getImage(),
ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage());
+ ImageResources.TOGGLE_OFF_HOVER.getImage(),
+ ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
- GPUButton.addClickListener(new DACustomButtonClickEventListener() {
+ GPUButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
- if (GPUButton.isToggled()) { // NOT SUPPORT
+ public void widgetSelected(SelectionEvent e) {
+ if (GPUButton.isSelection()) { // NOT SUPPORT
newGPUSupport = false;
GPUState.setText(StringResources.NOT_SUPPORTED);
} else { // SUPPORT
getListener().ChangeValue(getThis());
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
GPUButton.setToolTipText(GPUToolTipText);
virtualState.setToolTipText(CPUDisableToolTipText);
} else {
if (oldHWSupport) {
- virtualButton.setToggled(false);
+ virtualButton.setSelection(false);
virtualState.setText(StringResources.SUPPORTED);
} else {
- virtualButton.setToggled(true);
+ virtualButton.setSelection(true);
virtualState.setText(StringResources.NOT_SUPPORTED);
}
virtualState.setToolTipText("");
} else {
if (oldGPUSupport /*&& !isArm
&& CheckVirtualization.getInstance().isSupportGPU()*/) {
- GPUButton.setToggled(false);
+ GPUButton.setSelection(false);
GPUState.setText(StringResources.SUPPORTED);
} else {
- GPUButton.setToggled(true);
+ GPUButton.setSelection(true);
GPUState.setText(StringResources.NOT_SUPPORTED);
}
GPUState.setToolTipText(GPUToolTipText);
public void settingStatus(boolean isRefresh) {
if (isRefresh) {
if (isMinMode) {
- arrowButton.setToggled(false);
+ arrowButton.setSelection(false);
changeArrowState();
}
} else {
if (isShareMinMode != isMinMode) {
- arrowButton.setToggled(isShareMinMode);
+ arrowButton.setSelection(isShareMinMode);
changeArrowState();
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import java.io.File;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+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.widgets.Text;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.ui.MenuHandling;
import org.tizen.emulator.manager.ui.VMsMainView;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
import org.tizen.emulator.manager.vms.EmulatorVMList;
import org.tizen.emulator.manager.vms.HelperClass;
}
nameLabel = new ImageLabel(compList.get(0), SWT.NONE);
- nameLabel.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE);
- nameLabel.setImage(ImageLabel.STATE_DISABLE, INPUTBOX_OFF_IMAGE);
+ nameLabel.setEnableImage(INPUTBOX_OFF_IMAGE);
+ nameLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
FormData data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
nameLabel.setLayoutData(data);
baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE);
- baseImageLabel.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_OFF_IMAGE);
- baseImageLabel.setImage(ImageLabel.STATE_DISABLE, INPUTBOX_OFF_IMAGE);
+ baseImageLabel.setEnableImage(INPUTBOX_OFF_IMAGE);
+ baseImageLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
}
private Text nameText;
- private DACustomButton selectImageButton;
+ private ImageButton selectImageButton;
@Override
public void drawModify() {
if (INPUTBOX_ON_IMAGE == null) {
private void makeModifyNameLabel() {
nameLabel = new ImageLabel(compList.get(0), SWT.NONE);
- nameLabel.setImage(ImageLabel.STATE_ENABLE, INPUTBOX_ON_IMAGE);
- nameLabel.setImage(ImageLabel.STATE_DISABLE, INPUTBOX_ON_IMAGE);
+ nameLabel.setEnableImage(INPUTBOX_ON_IMAGE);
+ nameLabel.setDisableImage(INPUTBOX_ON_IMAGE);
nameLabel.setLayout(new FormLayout());
nameText = new Text(nameLabel, SWT.NONE);
switch (event.keyCode) {
case SWT.CR:
case SWT.KEYPAD_CR:
- //TODO
- //System.out.println("Enter");
- getListener().ChangeState(State.CREATE);
+ ///TODO
+ getListener().ChangeState(State.CREATE);
break;
case SWT.ESC:
getListener().ChangeState(State.CANCEL);
break;
- case SWT.TAB:
- System.out.println("tab");
+ default:
+ // TODO
break;
}
}
private void makeModifyBaseImage() {
baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE);
- baseImageLabel.setImage(ImageLabel.STATE_ENABLE, IMAGE_INPUTBOX_IMAGE);
- baseImageLabel.setImage(ImageLabel.STATE_DISABLE, IMAGE_INPUTBOX_IMAGE);
+ baseImageLabel.setEnableImage(IMAGE_INPUTBOX_IMAGE);
+ baseImageLabel.setDisableImage(IMAGE_INPUTBOX_IMAGE);
- selectImageButton = new DACustomButton(compList.get(1),
+ selectImageButton = new ImageButton(compList.get(1), SWT.PUSH);
+ selectImageButton.setImages(
ImageResources.BUTTON_FILE_NOMAL.getImage(),
- ImageResources.BUTTON_FILE_PUSH.getImage(),
ImageResources.BUTTON_FILE_HOVER.getImage(),
+ ImageResources.BUTTON_FILE_PUSH.getImage(),
+ ImageResources.BUTTON_FILE_NOMAL.getImage(),
+ ImageResources.BUTTON_FILE_NOMAL.getImage(),
ImageResources.BUTTON_FILE_DISABLE.getImage());
- selectImageButton.addClickListener(new DACustomButtonClickEventListener() {
+
+ selectImageButton.addSelectionListener(new SelectionListener() {
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
if (baseImageFD == null) {
baseImageFD = new FileDialog(MainDialog.getShell(), SWT.OPEN);
baseImageFD.setText(String.format("Select existing Base Image"));
//false gl accelertaion
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
@Override
public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
+ if (isCreateMode() && VMsMainView.getInstance().isSetFocus()) {
+ setFocus();
+ }
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
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.widgets.Label;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomComboSelectionListener;
-import org.tizen.emulator.manager.da.widgets.combo.TitleComboPopupRenderer;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
import org.tizen.emulator.manager.resources.PatchImageResources;
+import org.tizen.emulator.manager.ui.widgets.ImageCombo;
import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.ui.widgets.ModifyViewCombo;
-import org.tizen.emulator.manager.ui.widgets.ModifyViewComboRenderer;
+import org.tizen.emulator.manager.ui.widgets.WSTATE;
import org.tizen.emulator.manager.vms.VMPropertyValue;
public class TRAMItem extends DetailViewItem {
}
private ImageLabel ramSize;
- private DACustomCombo ramSizeCombo;
+ private ImageCombo ramSizeCombo;
private Label stateLabel;
private static int INPUTBOX_WIDTH = 175;
@Override
public void drawDetail() {
ramSize = new ImageLabel(compList.get(0), SWT.NONE);
- ramSize.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
+ ramSize.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
FormData data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH - 40);
}
- ramSizeCombo = new ModifyViewCombo(compList.get(0), SWT.NONE);
- ramSizeCombo.setImages(INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE,
- INPUTBOX_ON_IMAGE);
+ ramSizeCombo = new ImageCombo(compList.get(0), SWT.NONE);
+ ramSizeCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
+ ramSizeCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
+ ramSizeCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
- ramSizeCombo.setButtonImages(ImageResources.ARROW_DROPDOWN.getImage(), null);
+ ramSizeCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
ramSizeCombo.setEnabled(true);
-
- ramSizeCombo.setComboRender(new ModifyViewComboRenderer());
- ramSizeCombo.setComboPopupRender(new TitleComboPopupRenderer());
ramSizeCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
+
//
stateLabel = new Label(compList.get(0), SWT.NONE);
ramSizeCombo.add(s);
}
- ramSizeCombo.addSelectionListener(new DACustomComboSelectionListener() {
+ ramSizeCombo.addSelectionListener(new SelectionListener() {
@Override
- public void selectionEvent(DACustomCombo combo) {
- String size = combo.getText();
+ public void widgetSelected(SelectionEvent e) {
+ String size = ramSizeCombo.getText();
newSize = Integer.valueOf(size);
if (!isCreateMode()) {
getListener().ChangeValue(getThis());
}
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
});
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.detail;
import org.eclipse.swt.SWT;
@Override
public void drawDetail() {
touchPoint = new ImageLabel(compList.get(0), SWT.NONE);
- touchPoint.setImage(ImageLabel.STATE_ENABLE,
- PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
+ touchPoint.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
FormData data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
@Override
public void drawModify() {
touchPoint = new ImageLabel(compList.get(0), SWT.NONE);
- touchPoint.setImage(ImageLabel.STATE_DISABLE,
- PatchImageResources.getInputBoxON(INPUTBOX_WIDTH));
+ touchPoint.setDisableImage(PatchImageResources.getInputBoxON(INPUTBOX_WIDTH));
FormData data = new FormData();
data.left = new FormAttachment(0, INPUTBOX_OFFSET);
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.dialog;
import org.eclipse.swt.SWT;
}
public int openInfoDialog(final String message) {
- return openInfoDialog("Info", message);
+ return openInfoDialog("Emulator Manager", message);
}
public int openInfoDialog(final String title, final String message) {
}
public int openWarningDialog(final String message) {
- return openWarningDialog("Warning", message);
+ return openWarningDialog("Emulator Manager", message);
}
public int openWarningDialog(final String title, final String message) {
}
public int openSelectionDialog(final String message) {
- return openSelectionDialog("Warning", message);
+ return openSelectionDialog("Emulator Manager", message);
}
public int openSelectionDialog(final String title, final String message) {
- return openMessageDialog(title, message, SWT.ICON_WARNING, SWT.OK | SWT.CANCEL);
+ return openMessageDialog(title, message, SWT.ICON_QUESTION, SWT.OK | SWT.CANCEL);
}
int msgResponse = 0;
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.list;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.platform.Platform;
+
+public abstract class AbstractListView {
+ protected Composite listView;
+
+ public abstract void init(Composite parent, int width, int height);
+ public abstract void drawPlatform(Platform platform, int imageIndex);
+ public abstract void drawVMList(BaseImage base, int select, boolean isCreate);
+ public abstract void drawEmptyVMList();
+ public abstract void cancelModify(int index);
+ public abstract void draw();
+ public abstract void redraw();
+ public abstract void close();
+ public abstract void setSize(int width, int height);
+ public abstract Point getSize();
+ public Composite getComposite() {
+ return listView;
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * MunKyu Im <munkyu.im@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * 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.list;
+
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.xml.DeviceType;
+import org.tizen.emulator.manager.vms.xml.DisplayType;
+
+public abstract class ColumnContentHelper {
+ static final int numberOfColumns = 4;
+ static final String[] columnTitles = new String[] { "Name", "CPU", "Resolution", "Density", "RAM size", };
+ static final ColumnContentHelper[] helpers = new ColumnContentHelper[] {
+ new NameContentHelper(0),
+ new ArchitectureHelper(1),
+ new ResolutionContentHelper(2),
+ new DensityContentHelper(3),
+ new RAMSizeContentHelper(4),
+ };
+
+ int index;
+
+ protected ColumnContentHelper(int index) {
+ this.index = index;
+ }
+
+ public String getTitle() {
+ return columnTitles[index];
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public abstract String getContent(VMProperty property);
+
+ public static int getContentCount() {
+ return numberOfColumns;
+ }
+
+ public static ColumnContentHelper[] getContentHelpers() {
+ return helpers;
+ }
+
+}
+
+class NameContentHelper extends ColumnContentHelper {
+ public NameContentHelper(int index) {
+ super(index);
+ }
+
+ @Override
+ public String getContent(VMProperty property) {
+ return property.getName();
+ }
+}
+
+class ArchitectureHelper extends ColumnContentHelper {
+ public ArchitectureHelper(int index) {
+ super(index);
+ }
+
+ @Override
+ public String getContent(VMProperty property) {
+ return property.getArch().name();
+ }
+}
+
+class ResolutionContentHelper extends ColumnContentHelper {
+ public ResolutionContentHelper(int index) {
+ super(index);
+ }
+
+ @Override
+ public String getContent(VMProperty property) {
+ DisplayType displayType = property.getConfiguration().getDevice().getDisplay();
+
+ return displayType.getResolution().getWidth()
+ + " x " + displayType.getResolution().getHeight();
+ }
+}
+
+class DensityContentHelper extends ColumnContentHelper {
+ public DensityContentHelper(int index) {
+ super(index);
+ }
+
+ @Override
+ public String getContent(VMProperty property) {
+ DisplayType displayType = property.getConfiguration().getDevice().getDisplay();
+ return displayType.getDensity().getValue() + "";
+ }
+}
+
+class RAMSizeContentHelper extends ColumnContentHelper {
+ public RAMSizeContentHelper(int index) {
+ super(index);
+ }
+
+ @Override
+ public String getContent(VMProperty property) {
+ DeviceType deviceType = property.getConfiguration().getDevice();
+ return deviceType.getRAM().getSize().getValue() + "";
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * MunKyu Im <munkyu.im@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * 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.list;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class ColumnSortListner implements SelectionListener {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ TreeColumn column = (TreeColumn)event.widget;
+ Tree tree = column.getParent();
+
+ tree.setSortColumn(column);
+ if(tree.getSortDirection() == SWT.NONE) {
+ tree.setSortDirection(SWT.UP);
+ } else if(tree.getSortDirection() == SWT.UP) {
+ tree.setSortDirection(SWT.DOWN);
+ } else if(tree.getSortDirection() == SWT.DOWN) {
+ tree.setSortDirection(SWT.UP);
+ }
+ for(TreeItem item : tree.getItems()) {
+ if(!(item.getData() instanceof Container)) {// double checking...
+ continue;
+ }
+
+ int count = item.getItemCount();
+
+ for(int i = 0; i < count - 1; ++i) {
+ TreeItem subItem0 = item.getItem(i);
+ if(subItem0.getData() instanceof TreeMarker) {
+ continue;
+ }
+
+ for(int j = i + 1; j < count; ++j) {
+ TreeItem subItem1 = item.getItem(j);
+
+ if(subItem1.getData() instanceof TreeMarker) {
+ continue;
+ }
+
+ if(tree.getSortDirection() == SWT.UP) {
+ if(subItem0.getText().compareTo(subItem1.getText()) > 0) {
+ PropertyContent content0 = (PropertyContent)subItem0.getData();
+ PropertyContent content1 = (PropertyContent)subItem1.getData();
+
+ RowItem rowItem = new PropertyContent(content1.getProperty(), subItem0);
+ subItem0.setData(rowItem);
+ rowItem = new PropertyContent(content0.getProperty(), subItem1);
+ subItem1.setData(rowItem);
+ }
+ }
+ else if(tree.getSortDirection() == SWT.DOWN) {
+ if(subItem0.getText().compareTo(subItem1.getText()) < 0) {
+ PropertyContent content0 = (PropertyContent)subItem0.getData();
+ PropertyContent content1 = (PropertyContent)subItem1.getData();
+
+ RowItem rowItem = new PropertyContent(content1.getProperty(), subItem0);
+ subItem0.setData(rowItem);
+ rowItem = new PropertyContent(content0.getProperty(), subItem1);
+ subItem1.setData(rowItem);
+ }
+ }
+ }
+ }
+ tree.redraw();
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent event) {
+ // TODO Auto-generated method stub
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.list;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMProperty.FSImageType;
+
+public class ExtendTreeListView extends AbstractListView {
+ protected Tree vmsTree;
+ private int width;
+ private int height;
+ private ArrayList<TreeItem> createItems = new ArrayList<TreeItem>();
+ private ArrayList<TreeItem> typeItems = new ArrayList<TreeItem>();
+ private Map<String, TreeItem> itemsMap = new HashMap<String, TreeItem>();
+
+ @Override
+ public void init(Composite parent, int width, int height) {
+ setSize(width, height);
+ listView = new Composite(parent, SWT.NONE);
+ listView.setLayout(new FillLayout());
+
+ vmsTree = new Tree(listView, SWT.BORDER | SWT.SINGLE);
+ vmsTree.setHeaderVisible(true);
+ vmsTree.setLinesVisible(true);
+
+ vmsTree.setBackground(ColorResources.WHITE.getColor());
+ // TODO
+ vmsTree.setFont(FontResources.TREE_HEADER_FONT.getFont());
+
+ for(ColumnContentHelper helper : ColumnContentHelper.getContentHelpers()) {
+ TreeColumn treeColumn = new TreeColumn(vmsTree, SWT.NONE);
+ treeColumn.setText(helper.getTitle());
+ /*
+ if("Name".equalsIgnoreCase(treeColumn.getText())) {
+ treeColumn.addSelectionListener(new ColumnSortListner());
+ }
+ */
+ }
+ settingListener();
+ }
+
+ private TreeItem currentItem = null;
+ private TreeItem oldItem = null;
+ private void settingListener() {
+ vmsTree.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (vmsTree.getSelectionCount() == 1) {
+ oldItem = currentItem;
+ currentItem = vmsTree.getSelection()[0];
+ Object data = currentItem.getData();
+
+ if(!(data instanceof RowItem)) {
+ return;
+ }
+
+ // TODO : select template using platform
+ if (data instanceof CreateMarker) {
+ VMsMainView.getInstance().drawCreateVM(
+ ((CreateMarker)data).getBaseImage(),
+ false);
+ } else if(data instanceof TreeMarker) {
+ VMsMainView.getInstance().drawEmptyDetailVM();
+ VMsMainView.getInstance().setCurrentProperty(null);
+ } else {
+ PropertyContent content = (PropertyContent)data;
+ VMsMainView.getInstance().drawDetailVM(content.property, -1);
+ }
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ /*
+ if (vmsTree.getSelectionCount() == 0) {
+
+ } else {
+ Object data = vmsTree.getSelection()[0].getData();
+
+ if(!(data instanceof TreeMarker)) {
+ return;
+ }
+
+ VMProperty property = ((PropertyContent)vmsTree.getSelection()[0].getData()).property;
+ VMsMainView.getInstance().launchEmulator(property);
+ }
+ */
+ }
+ });
+
+ vmsTree.addKeyListener(new KeyListener() {
+ @Override
+ public void keyReleased(KeyEvent e) {}
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (vmsTree.getSelectionCount() == 0) {
+ return;
+ }
+ Object data = vmsTree.getSelection()[0].getData();
+ switch (e.keyCode) {
+ case SWT.CR:
+ case SWT.KEYPAD_CR:
+ if(data instanceof CreateMarker) {
+ VMsMainView.getInstance().drawCreateVM(
+ ((CreateMarker)data).getBaseImage(),
+ true);
+ return;
+ } else if (data instanceof PropertyContent) {
+ if (!VMsMainView.getInstance().isModifyMode()) {
+ VMProperty property = ((PropertyContent)data).property;
+ VMsMainView.getInstance().launchEmulator(property);
+ }
+ }
+ break;
+ case SWT.DEL:
+ if(data instanceof PropertyContent) {
+ VMsMainView.getInstance().deleteEmulator();
+ }
+ break;
+ case SWT.ESC:
+ if (data instanceof CreateMarker) {
+ VMsMainView.getInstance().drawCancelCreaetVM();
+ } else if (data instanceof TreeMarker) {
+ // TODO
+ } else {
+ VMsMainView.getInstance().drawDetailVM();
+ }
+ default:
+ break;
+ }
+ }
+ });
+ }
+
+ @Override
+ public void drawVMList(BaseImage baseImage, int select, boolean isCreate) {
+ if (select < 0) {
+ return;
+ }
+ currentItem = null;
+ vmsTree.removeAll();
+ createItems.clear();
+ typeItems.clear();
+ itemsMap.clear();
+
+ RowItem rowItem = null;
+ TreeItem createItem = null;
+ TreeItem propertyItem = null;
+
+ // add standard image
+ for (Platform p : EmulatorManager.getPlatformList()) {
+ String standardVersion = p.getName();
+ if (!standardVersion.isEmpty()) {
+ TreeItem tempItem = new TreeItem(vmsTree, SWT.NONE);
+ rowItem = new StandardVMsMarker(standardVersion, tempItem);
+ tempItem.setData(rowItem);
+ itemsMap.put(p.getName(), tempItem);
+ typeItems.add(tempItem);
+
+ for (BaseImage b : p.getImageList()) {
+ TreeItem t = new TreeItem(tempItem, SWT.NONE);
+ rowItem = new StandardVMsMarker(b.getName(), t);
+ t.setData(rowItem);
+ itemsMap.put(p.getName()+b.getName(), t);
+ typeItems.add(t);
+
+ createItem = new TreeItem(t, SWT.NONE);
+ rowItem = new CreateMarker(createItem, b);
+ createItem.setData(rowItem);
+ createItems.add(createItem);
+ }
+ }
+ }
+ //
+
+ // add custom image
+ TreeItem customItem = new TreeItem(vmsTree, SWT.NONE);
+ rowItem = new CustomVMsMarker(customItem);
+ customItem.setData(rowItem);
+
+ createItem = new TreeItem(customItem, SWT.NONE);
+ rowItem = new CreateMarker(createItem, null);
+ createItem.setData(rowItem);
+ createItems.add(createItem);
+
+ // add VM
+ ArrayList<VMProperty> properties = VMsMainView.getInstance().getCurrentImage().getVmsList();
+ VMProperty prop;
+ for(int i = 0; i < properties.size(); ++i) {
+ // temporarily hard coded now...
+ //if(properties[i].getArch() == Architecture.ARM)
+ // continue;
+ prop = properties.get(i);
+ if(FSImageType.standard == prop.getImageType()) {
+ String version = prop.getConfiguration().getBaseInformation().getDiskImage().getVersion();
+ String base = prop.getConfiguration().getBaseInformation().getDiskImage().getBase();
+ propertyItem = itemsMap.get(version+base);
+ if(propertyItem == null) {
+ propertyItem = itemsMap.get(version);
+ if (propertyItem == null) {
+ propertyItem = new TreeItem(vmsTree, SWT.NONE);
+ rowItem = new StandardVMsMarker(version, propertyItem);
+ propertyItem.setData(rowItem);
+ itemsMap.put(version, propertyItem);
+ typeItems.add(propertyItem);
+ }
+ propertyItem = new TreeItem(propertyItem, SWT.NONE);
+ rowItem = new StandardVMsMarker(base, propertyItem);
+ propertyItem.setData(rowItem);
+
+ itemsMap.put(version+base, propertyItem);
+ typeItems.add(propertyItem);
+ }
+ propertyItem = new TreeItem(propertyItem, SWT.NONE);
+ }
+ else {
+ propertyItem = new TreeItem(customItem, SWT.NONE);
+ }
+
+ rowItem = new PropertyContent(prop, propertyItem);
+ propertyItem.setData(rowItem);
+ if (i == select) {
+ currentItem = propertyItem;
+ }
+ }
+
+ for (TreeItem item : createItems) {
+ item.setExpanded(true);
+ }
+ customItem.setExpanded(true);
+ for(TreeItem item : typeItems) {
+ item.setExpanded(true);
+ }
+
+ packAll();
+ packAll(); // FIXME: Need second pack avoid column becomes too narrow... why ???
+ setSelectProperty();
+ }
+
+ protected void packAll() {
+ for(TreeColumn column : vmsTree.getColumns()) {
+ column.pack();
+ }
+ vmsTree.pack();
+ }
+
+ @Override
+ public void drawEmptyVMList() {
+ drawVMList(null, 0, false);
+ }
+
+ @Override
+ public void drawPlatform(Platform platform, int imageIndex) {
+ VMsMainView.getInstance().drawVMList(imageIndex);
+ }
+
+ @Override
+ public void cancelModify(int index) {
+ if (currentItem.getData() instanceof CreateMarker) {
+ currentItem = oldItem;
+ }
+
+ setSelectProperty();
+ }
+
+ @Override
+ public void draw() {
+ vmsTree.layout(true, true);
+ }
+
+ @Override
+ public void redraw() {
+ vmsTree.redraw();
+ }
+
+ @Override
+ public void close() {
+ vmsTree.removeAll();
+ vmsTree.dispose();
+ }
+
+ @Override
+ public void setSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override
+ public Point getSize() {
+ return new Point(width, height);
+ }
+
+ public void setSelectProperty() {
+ vmsTree.forceFocus();
+ if (currentItem != null) {
+ vmsTree.setSelection(currentItem);
+ } else {
+ vmsTree.setSelection(vmsTree.getItem(0));
+ }
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.list;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+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.Text;
+import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.ImageResources;
+import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
+import org.tizen.emulator.manager.ui.widgets.VMButton;
+
+enum VIEW_STATE {
+ NONE, EMPTY, DETAIL;
+}
+
+public class ItemListVew extends AbstractListView {
+ private int LIST_WIDTH = 500;
+ private int LIST_HEIGHT = 375;
+ // for resize
+ private VIEW_STATE state = VIEW_STATE.NONE;
+
+ private ScrolledComposite scrolledList = null;
+ private Composite vmList = null;
+
+ private ImageButton createButton = null; // for empty list
+ private VMButton addNewButton = null;
+
+ private int W_GAP = 10;
+ private int H_GAP = 12;
+ private int BUTTON_WIDTH = 106 + 4;
+ private int BUTTON_HEIGHT = 146 + 4;
+
+ private int W_COUNT = 0;
+ private int H_COUNT = 0;
+
+ private int CREATE_BUTTON_WIDTH = 190;
+ private int CREATE_BUTTON_HEIGHT = 190;
+
+ @Override
+ public void init(Composite parent, int width, int height) {
+ listView = new Composite(parent, SWT.NONE);
+ listView.setLayout(new FormLayout());
+ listView.setBackground(ColorResources.TAB_CONTENTS_BG_COLOR.getColor());
+
+ this.setSize(width, height);
+
+ makeVMList();
+ }
+
+ private Text dumyText = null;
+ private void makeVMList() {
+ scrolledList = new ScrolledComposite(listView, SWT.V_SCROLL | SWT.BORDER);
+ scrolledList.setBackground(ColorResources.LIST_BG_COLOR.getColor());
+
+ vmList = new Composite(scrolledList, SWT.NONE);
+ vmList.setBackground(ColorResources.LIST_BG_COLOR.getColor());
+ vmList.setLayout(new FormLayout());
+
+ scrolledList.setContent(vmList);
+ scrolledList.setExpandHorizontal(true);
+
+ // for key event
+ dumyText = new Text(listView, SWT.NONE);
+ dumyText.setText("");
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.bottom = new FormAttachment(100, 0);
+ scrolledList.setLayoutData(data);
+
+ data = new FormData();
+ data.left = new FormAttachment(0, -100);
+ data.top = new FormAttachment(0, 0);
+ data.width = 0;
+ data.height = 0;
+ dumyText.setLayoutData(data);
+ dumyText.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent event) {
+ controlKeyEvent(event);
+ }
+ });
+ }
+
+ @Override
+ public void drawPlatform(Platform platform, int imageIndex) {
+ VMsMainView.getInstance().drawVMList(imageIndex);
+ }
+
+ @Override
+ public void drawVMList(BaseImage base, int select, boolean isCreate) {
+ if (createButton != null) {
+ createButton.dispose();
+ createButton = null;
+ }
+
+ if (select == -1) {
+ select = 0;
+ }
+
+ state = VIEW_STATE.DETAIL;
+
+ VMButtonFactory.clear();
+ if (base.getVmsList().size() != 0) {
+ VMButton button = null;
+ for (int i = 0; i < base.getVmsList().size(); i++) {
+ button = VMButtonFactory.getButton(vmList);
+ button.setProperty(base.getVmsList().get(i));
+ if (i == select) {
+ VMButtonFactory.clickVMButton(button);
+ }
+ }
+ }
+
+ // add create button
+ addNewButton = VMButtonFactory.getCreateButton(vmList);
+ if (isCreate) {
+ addNewButton.setEnabled(false);
+ } else {
+ addNewButton.setEnabled(true);
+ }
+ addNewButton.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ clickCreateButton();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ arrayVMList();
+ dumyText.setFocus();
+ }
+
+ @Override
+ public void drawEmptyVMList() {
+ if (createButton != null) {
+ createButton.dispose();
+ createButton = null;
+ }
+
+ // clear
+ VMButtonFactory.clear();
+
+ state = VIEW_STATE.EMPTY;
+
+ int leftOffset = (LIST_WIDTH - CREATE_BUTTON_WIDTH) / 2;
+ int topOffset = (LIST_HEIGHT - CREATE_BUTTON_HEIGHT) / 2;
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, leftOffset);
+ data.top = new FormAttachment(0, topOffset);
+ data.width = CREATE_BUTTON_WIDTH;
+ data.height = CREATE_BUTTON_HEIGHT;
+ createButton = new ImageButton(vmList, SWT.PUSH);
+ createButton.setImages(ImageResources.CREATE_NEW_NOMAL.getImage(),
+ ImageResources.CREATE_NEW_HOVER.getImage(),
+ ImageResources.CREATE_NEW_PUSH.getImage(),
+ null, null,
+ ImageResources.CREATE_NEW_NOMAL.getImage());
+ createButton.setLayoutData(data);
+
+ createButton.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ VMsMainView.getInstance().drawCreateVM(true);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ vmList.setSize(LIST_WIDTH, LIST_HEIGHT);
+ vmList.layout(true, true);
+ //scrolledList.layout(true, true);
+ }
+
+ @Override
+ public void cancelModify(int index) {
+ if (addNewButton != null && !addNewButton.isDisposed()) {
+ addNewButton.setEnabled(true);
+ }
+
+ if (index >= 0) {
+ VMButtonFactory.clickVMButton(index);
+ }
+
+ dumyText.setFocus();
+ }
+
+ @Override
+ public void draw() {
+ vmList.layout(true, true);
+ scrolledList.layout(true, true);
+ }
+
+ @Override
+ public void redraw() {
+ switch(state) {
+ case EMPTY:
+ drawEmptyVMList();
+ break;
+ case DETAIL:
+ arrayVMList();
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ public void close() {
+ VMButtonFactory.clear();
+
+ vmList.dispose();
+ scrolledList.dispose();
+ listView.dispose();
+ }
+
+ @Override
+ public void setSize(int width, int height) {
+ this.LIST_WIDTH = width - 10;
+ this.LIST_HEIGHT = height - 55;
+ if (listView != null) {
+ listView.setSize(LIST_WIDTH, LIST_HEIGHT);
+ }
+ }
+
+ @Override
+ public Point getSize() {
+ return new Point(LIST_WIDTH, LIST_HEIGHT);
+ }
+
+ private void arrayVMList() {
+ W_COUNT = LIST_WIDTH / (BUTTON_WIDTH + W_GAP);
+
+ int wIndex = 0;
+ int hIndex = 0;
+ int size = VMButtonFactory.getButtonList().size();
+ if (size != 0) {
+ H_COUNT = size / W_COUNT;
+ if (size % W_COUNT != 0) {
+ H_COUNT++;
+ }
+
+ if (((BUTTON_HEIGHT + H_GAP) * H_COUNT) > LIST_HEIGHT) {
+ vmList.setSize(LIST_WIDTH, ((BUTTON_HEIGHT + H_GAP) * H_COUNT) + H_GAP);
+ } else {
+ vmList.setSize(LIST_WIDTH, LIST_HEIGHT);
+ }
+
+ FormData data = null;
+ for (VMButton button : VMButtonFactory.getButtonList()) {
+ data = new FormData();
+ data.left = new FormAttachment(0, W_GAP + (BUTTON_WIDTH + W_GAP) * wIndex);
+ data.top = new FormAttachment(0, H_GAP + (BUTTON_HEIGHT + H_GAP) * hIndex);
+ data.width = BUTTON_WIDTH;
+ data.height = BUTTON_HEIGHT;
+
+ button.setLayoutData(data);
+
+ button.redraw();
+ ++wIndex;
+ if (wIndex == W_COUNT) {
+ wIndex = 0;
+ hIndex++;
+ }
+ }
+ }
+
+ vmList.layout(true, true);
+ scrolledList.layout(true, true);
+
+ scrolledList.showControl(VMButtonFactory.getSelectedButton());
+ }
+
+ private void clickCreateButton() {
+ VMButtonFactory.clickVMButton(addNewButton);
+ VMsMainView.getInstance().drawCreateVM(true);
+ }
+
+ public void controlKeyEvent(KeyEvent event) {
+ if (createButton != null) {
+ switch(event.keyCode) {
+ case SWT.CR:
+ case SWT.KEYPAD_CR:
+ clickCreateButton();
+ break;
+ default:
+ break;
+ }
+ } else {
+ switch (event.keyCode) {
+ case SWT.CR:
+ case SWT.KEYPAD_CR:
+ if (VMButtonFactory.getSelectedButton() instanceof VMCreateButton) {
+ clickCreateButton();
+ } else {
+ if (!VMsMainView.getInstance().isModifyMode()) {
+ VMButtonFactory.getSelectedButton().clickLaunchButton();
+ }
+ }
+ break;
+ case SWT.ARROW_UP:
+ int size = VMButtonFactory.getButtonList().size();
+ int index = VMButtonFactory.getSelectedButtonIndex() - W_COUNT;
+ if (index >= 0) {
+ VMButtonFactory.clickVMButton(index);
+ }
+ break;
+ case SWT.ARROW_DOWN:
+ size = VMButtonFactory.getButtonList().size();
+ index = VMButtonFactory.getSelectedButtonIndex() + W_COUNT;
+ if (index < size) {
+ VMButtonFactory.clickVMButton(index);
+ } else {
+ VMButtonFactory.clickVMButton(VMButtonFactory.getButtonList().size() - 1);
+ }
+ break;
+ case SWT.ARROW_LEFT:
+ size = VMButtonFactory.getButtonList().size();
+ index = VMButtonFactory.getSelectedButtonIndex() - 1;
+ if (index >= 0) {
+ VMButtonFactory.clickVMButton(index);
+ }
+ break;
+ case SWT.ARROW_RIGHT:
+ size = VMButtonFactory.getButtonList().size();
+ index = VMButtonFactory.getSelectedButtonIndex() + 1;
+ if (index < size) {
+ VMButtonFactory.clickVMButton(index);
+ }
+ break;
+ case SWT.DEL:
+ if (!(VMButtonFactory.getSelectedButton() instanceof VMCreateButton)) {
+ VMsMainView.getInstance().deleteEmulator();
+ return;
+ }
+ break;
+ case SWT.ESC:
+ if (VMsMainView.getInstance().isCreateMode()) {
+ VMsMainView.getInstance().drawCancelCreaetVM();
+ } else {
+ VMsMainView.getInstance().drawDetailVM();
+ }
+ }
+
+ if (VMButtonFactory.getSelectedButton() != null) {
+ scrolledList.showControl(VMButtonFactory.getSelectedButton());
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * MunKyu Im <munkyu.im@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * 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.list;
+
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.TreeItem;
+import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public interface RowItem {}
+
+interface TreeMarker extends RowItem {}
+
+interface TreeContent extends RowItem {}
+
+
+class PropertyContent implements TreeContent {
+ VMProperty property;
+ TreeItem item;
+
+ public PropertyContent(VMProperty property, TreeItem item) {
+ this.property = property;
+ this.item = item;
+
+ // TODO
+ item.setFont(FontResources.TREE_ITEM_FONT.getFont());
+ for(ColumnContentHelper helper : ColumnContentHelper.getContentHelpers()) {
+ item.setText(helper.getIndex(), helper.getContent(property));
+ }
+ }
+
+ public VMProperty getProperty() {
+ return property;
+ }
+
+ public TreeItem getItem() {
+ return item;
+ }
+}
+
+class CreateMarker implements TreeMarker {
+ private BaseImage image = null;
+ TreeItem item;
+ public CreateMarker(TreeItem item, BaseImage image) {
+ item.setText("<< Create new... >>");
+
+ // TODO
+ Font font = FontResources.TREE_CREATE_FONT.getFont();
+ item.setFont(font);
+
+ this.image =image;
+ this.item = item;
+ }
+
+ public BaseImage getBaseImage() {
+ return image;
+ }
+
+ public TreeItem getItem() {
+ return item;
+ }
+}
+
+abstract class Container {
+ private TreeItem item;
+ public Container(String text, TreeItem item) {
+ this.item = item;
+ item.setText(text);
+ }
+ public TreeItem getItem() {
+ return item;
+ }
+}
+
+class StandardVMsMarker extends Container implements TreeMarker {
+ public StandardVMsMarker(String version, TreeItem item) {
+ super(version, item);
+ }
+}
+
+class CustomVMsMarker extends Container implements TreeMarker {
+ public CustomVMsMarker(TreeItem item) {
+ super("Custom", item);
+ }
+}
+
\ No newline at end of file
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.list;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.vms.VMProperty;
+
+public class TreeListView extends AbstractListView {
+ protected Tree vmsTree;
+ private int width;
+ private int height;
+
+ @Override
+ public void init(Composite parent, int width, int height) {
+ setSize(width, height);
+ listView = new Composite(parent, SWT.NONE);
+ listView.setLayout(new FillLayout());
+
+ vmsTree = new Tree(listView, SWT.BORDER | SWT.SINGLE);
+ vmsTree.setHeaderVisible(true);
+ vmsTree.setLinesVisible(true);
+
+ vmsTree.setBackground(ColorResources.WHITE.getColor());
+ // TODO
+ vmsTree.setFont(FontResources.TREE_HEADER_FONT.getFont());
+
+ for(ColumnContentHelper helper : ColumnContentHelper.getContentHelpers()) {
+ TreeColumn treeColumn = new TreeColumn(vmsTree, SWT.NONE);
+ treeColumn.setText(helper.getTitle());
+ /*
+ if("Name".equalsIgnoreCase(treeColumn.getText())) {
+ treeColumn.addSelectionListener(new ColumnSortListner());
+ }
+ */
+ }
+ settingListener();
+ }
+
+ protected PropertyContent currentProp = null;
+
+ private void settingListener() {
+ vmsTree.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ System.out.println("gain focus");
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ // TODO Auto-generated method stub
+ System.out.println("lost focus");
+ }
+
+ });
+ vmsTree.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (vmsTree.getSelectionCount() == 1) {
+ Object data = vmsTree.getSelection()[0].getData();
+
+ if(!(data instanceof RowItem)) {
+ return;
+ }
+
+ // TODO : select template using platform
+ if (data instanceof CreateMarker) {
+ VMsMainView.getInstance().drawCreateVM(false);
+ //setSelectProperty();
+ vmsTree.setSelection(((CreateMarker) data).getItem());
+ return;
+ } else if(data instanceof TreeMarker) {
+ VMsMainView.getInstance().drawEmptyDetailVM();
+ return;
+ }
+
+ PropertyContent content = (PropertyContent)data;
+ currentProp = content;
+ VMsMainView.getInstance().drawDetailVM(content.property, -1);
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ /*
+ if (vmsTree.getSelectionCount() == 0) {
+
+ } else {
+ Object data = vmsTree.getSelection()[0].getData();
+
+ if(!(data instanceof TreeMarker)) {
+ return;
+ }
+
+ VMProperty property = ((PropertyContent)vmsTree.getSelection()[0].getData()).property;
+ VMsMainView.getInstance().launchEmulator(property);
+ }
+ */
+ }
+ });
+
+ vmsTree.addKeyListener(new KeyListener() {
+ @Override
+ public void keyReleased(KeyEvent e) {}
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (vmsTree.getSelectionCount() == 0) {
+ return;
+ }
+ Object data = vmsTree.getSelection()[0].getData();
+ switch (e.keyCode) {
+ case SWT.CR:
+ case SWT.KEYPAD_CR:
+ if(data instanceof CreateMarker) {
+ VMsMainView.getInstance().drawCreateVM(true);
+ return;
+ } else if (data instanceof PropertyContent) {
+ if (!VMsMainView.getInstance().isModifyMode()) {
+ VMProperty property = ((PropertyContent)data).property;
+ VMsMainView.getInstance().launchEmulator(property);
+ }
+ }
+ break;
+ case SWT.DEL:
+ if(data instanceof PropertyContent) {
+ VMsMainView.getInstance().deleteEmulator();
+ }
+ break;
+ case SWT.ESC:
+ if (data instanceof CreateMarker) {
+ VMsMainView.getInstance().drawCancelCreaetVM();
+ } else {
+ VMsMainView.getInstance().drawDetailVM();
+ }
+ default:
+ break;
+ }
+ }
+ });
+ }
+
+ protected void packAll() {
+ for(TreeColumn column : vmsTree.getColumns()) {
+ column.pack();
+ }
+ vmsTree.pack();
+ }
+
+ @Override
+ public void drawPlatform(Platform platform, int imageIndex) {
+ VMsMainView.getInstance().drawVMList(imageIndex);
+ }
+
+ //private ArrayList<TreeItem> createItems = new ArrayList<TreeItem>();
+ //private ArrayList<TreeItem> typeItems = new ArrayList<TreeItem>();
+ //private Map<String, TreeItem> itemsMap = new HashMap<String, TreeItem>();
+ @Override
+ public void drawVMList(BaseImage base, int select, boolean isCreate) {
+ if (select >= 0) {
+ vmsTree.removeAll();
+ currentProp = null;
+
+ RowItem rowItem = null;
+ TreeItem createItem = null;
+ TreeItem propertyItem = null;
+
+ createItem = new TreeItem(vmsTree, SWT.NONE);
+ rowItem = new CreateMarker(createItem, base);
+ createItem.setData(rowItem);
+
+ VMProperty prop = null;
+ for(int i = 0; i < base.getVmsList().size(); i++) {
+ prop = base.getVmsList().get(i);
+ propertyItem = new TreeItem(vmsTree, SWT.NONE);
+ rowItem = new PropertyContent(prop, propertyItem);
+ propertyItem.setData(rowItem);
+ if (i == select) {
+ currentProp = (PropertyContent)rowItem;
+ VMsMainView.getInstance().drawDetailVM(currentProp.property, -1);
+ }
+ }
+ packAll();
+ packAll(); // FIXME: Need second pack avoid column becomes too narrow... why ???
+ setSelectProperty();
+ }
+ }
+
+ @Override
+ public void drawEmptyVMList() {
+ drawVMList(VMsMainView.getInstance().getCurrentImage(), 0, false);
+ }
+
+ @Override
+ public void cancelModify(int index) {
+ if (index >= 0) {
+ currentProp = (PropertyContent)vmsTree.getItem(index + 1).getData(); // for create item
+ setSelectProperty();
+ }
+ //packAll();
+ }
+
+ @Override
+ public void draw() {
+ vmsTree.layout(true, true);
+ }
+
+ @Override
+ public void redraw() {
+ //TODO
+ vmsTree.redraw();
+ }
+
+ @Override
+ public void close() {
+ vmsTree.removeAll();
+ vmsTree.dispose();
+ }
+
+ @Override
+ public void setSize(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ @Override
+ public Point getSize() {
+ return new Point(width, height);
+ }
+
+ public void setSelectProperty() {
+ vmsTree.forceFocus();
+ if (currentProp != null) {
+ vmsTree.setSelection(currentProp.getItem());
+ }
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.list;
+
+import java.util.ArrayList;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.resources.ImageResources;
+import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.widgets.VMButton;
+
+class VMCreateButton extends VMButton {
+ public VMCreateButton(Composite parent, int style) {
+ super(parent, style);
+ // delete launchButton
+ launchButton.dispose();
+ launchButton = null;
+ // set Image
+ setImages(ImageResources.ADD_NEW_NOMAL.getImage(),
+ ImageResources.ADD_NEW_HOVER.getImage(),
+ ImageResources.ADD_NEW_PUSH.getImage(),
+ ImageResources.ADD_NEW_NOMAL.getImage(), //selected
+ ImageResources.ADD_NEW_HOVER.getImage(),
+ ImageResources.VM_IMAGE_CREATE.getImage()); //selected_hover
+ }
+
+ @Override
+ public void setSelection(boolean selected) {
+ super.setSelection(selected);
+ if (selected) {
+ setEnabled(false);
+ VMsMainView.getInstance().drawCreateVM(false);
+ } else {
+ setEnabled(true);
+ }
+ }
+}
+
+public class VMButtonFactory {
+ private static ArrayList<VMButton> buttons = new ArrayList<VMButton> ();
+ private static int selectedIndex = 0;
+
+ public static VMButton getButton(Composite parent) {
+ VMButton b = new VMButton(parent, SWT.NONE);
+ b.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ VMButtonFactory.clickVMButton((VMButton)e.widget);
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ buttons.add(b);
+ return b;
+ }
+
+ public static VMButton getCreateButton(Composite parent) {
+ VMCreateButton b = new VMCreateButton(parent, SWT.NONE);
+ buttons.add(b);
+ return b;
+ }
+
+ public static ArrayList<VMButton> getButtonList() {
+ return buttons;
+ }
+
+ public static void clear() {
+ for(VMButton b : buttons) {
+ b.dispose();
+ }
+ buttons.clear();
+ selectedIndex = 0;
+ }
+
+ public static void clickVMButton(VMButton button) {
+ VMButton b = null;
+ for(int i = 0; i < buttons.size(); i++) {
+ b = buttons.get(i);
+ if (button == b) {
+ b.setSelection(true);
+ selectedIndex = i;
+ } else {
+ b.setSelection(false);
+ b.redraw();
+ }
+ }
+ }
+
+ public static void clickVMButton(int index) {
+ clickVMButton(buttons.get(index));
+ }
+
+ public static int getSelectedButtonIndex() {
+ return selectedIndex;
+ }
+
+ public static VMButton getSelectedButton() {
+ return buttons.isEmpty()
+ ? null
+ : buttons.get(selectedIndex);
+ }
+}
+++ /dev/null
-package org.tizen.emulator.manager.ui.tabfolder;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-
-public class PlatformTabButton extends DACustomButton {
- private boolean isSelected = false;
-
- public void setSelected(boolean isSelected) {
- this.isSelected = isSelected;
- ((PlatformTabButtonAttribute)attr).setSelected(isSelected);
- }
-
- public PlatformTabButton(Composite parent, int style) {
- super(parent, style);
- // change Listener
- buttonMouseListener = buttonMouseListener2;
- attr = new PlatformTabButtonAttribute();
- this.addListeners();
-
- this.setRenderer(new PlatformTabButtonRenderer());
-
- // set Font
- this.setFont(FontResources.TAB_BUTTON_FONT.getFont());
-
- this.setFontColors(ColorResources.TAB_NORMAL_FONT_COLOR.getColor(),
- ColorResources.TAB_SELECTED_FONT_COLOR.getColor(),
- ColorResources.TAB_HOVER_FONT_COLOR.getColor(),
- ColorResources.TAB_NORMAL_FONT_COLOR.getColor());
-
- // set image
- this.setImages(PatchImageResources.getUnselectedTabFolder(120, 29),
- PatchImageResources.getSelectTabFolder(120, 29),
- PatchImageResources.getUnselectedTabFolderHover(120, 29),
- PatchImageResources.getUnselectedTabFolder(120, 29));
- }
-
- public PlatformTabButton(Composite parent, int style, String text) {
- this(parent, style);
- attr.setText(text);
- }
-
- private Listener buttonMouseListener2 = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (state == STATE_DISABLE) {
- return;
- }
-
- if (isSelected) {
- //changeButtonState(STATE_PUSH);
- //state = STATE_PUSH;
- } else {
- switch(event.type) {
- case SWT.MouseEnter:
- changeButtonState(STATE_HOVER);
- break;
- case SWT.MouseExit:
- changeButtonState(STATE_NORMAL);
- break;
- case SWT.MouseDown:
- changeButtonState(STATE_HOVER);
- break;
- case SWT.MouseUp: // FIXME
- changeButtonState(STATE_HOVER);
- break;
- default:
- changeButtonState(STATE_NORMAL);
- break;
- }
- }
- }
- };
-}
-
-class PlatformTabButtonRenderer extends DACustomButtonDefaultRenderer {
- @Override
- public void draw(GC gc, Canvas canvas, int state,
- DACustomButtonAttribute attr) {
- Rectangle rect = canvas.getClientArea();
-
- if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- PlatformTabButtonAttribute tabAttr = (PlatformTabButtonAttribute)attr;
- Image image = null;
- if (tabAttr.isSelected()) {
- // STATE_SELECT -> STATE_PUSH
- image = tabAttr.getImage(DACustomButton.STATE_PUSH);
- gc.drawImage(image, rect.x, rect.y);
- drawButtonText(gc, rect, tabAttr, DACustomButton.STATE_PUSH);
- } else {
- image = attr.getImage(state);
- gc.drawImage(image, rect.x, rect.y);
- drawButtonText(gc, rect, attr, state);
- }
- if (null == image) {
- return;
- }
- } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
- || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
- drawButton(gc, rect, state, attr);
- }
-
- drawButtonImage(gc, rect, attr);
- }
-}
-
-class PlatformTabButtonAttribute extends DACustomButtonAttribute {
- private boolean selected;
- public PlatformTabButtonAttribute() {
- this.selected = false;
- }
- public boolean isSelected() {
- return selected;
- }
- public void setSelected(boolean selected) {
- this.selected = selected;
- }
-}
\ No newline at end of file
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.tabfolder;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FillLayout;
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.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.resources.PatchImageResources;
import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
+import org.tizen.emulator.manager.ui.widgets.WSTATE;
public class PlatformTabFolder {
private static final int TAB_WIDTH = 120;
private ArrayList<PlatformTabItem> items
= new ArrayList<PlatformTabItem>(5);
- private ArrayList<PlatformTabButton> buttons
- = new ArrayList<PlatformTabButton>(5);
+ private ArrayList<ImageButton> buttons
+ = new ArrayList<ImageButton>(5);
- private ArrayList<DACustomButton> rightButtons
- = new ArrayList<DACustomButton>(5);
+ private ArrayList<ImageButton> rightButtons
+ = new ArrayList<ImageButton>(5);
private Composite mainComposite = null;
private Composite tabComposite = null;
if(!items.isEmpty()) {
// clear
if (!buttons.isEmpty()) {
- for (PlatformTabButton b : buttons) {
+ for (ImageButton b : buttons) {
b.dispose();
}
buttons.clear();
items.get(getSelectionIndex()).redraw();
}
- private PlatformTabButton makeTabButton(PlatformTabItem item) {
- PlatformTabButton tabButton = new PlatformTabButton(tabComposite, SWT.NONE);
+ private ImageButton makeTabButton(PlatformTabItem item) {
+ ImageButton tabButton = new ImageButton(tabComposite, SWT.NONE);
+ tabButton.setImages(PatchImageResources.getUnselectedTabFolder(120, 29),
+ PatchImageResources.getUnselectedTabFolderHover(120, 29),
+ PatchImageResources.getSelectTabFolder(120, 29),
+ PatchImageResources.getSelectTabFolder(120, 29),
+ PatchImageResources.getSelectTabFolder(120, 29),
+ PatchImageResources.getUnselectedTabFolder(120, 29));
+ tabButton.setFont(FontResources.TAB_BUTTON_FONT.getFont());
+ tabButton.setFontColor(WSTATE.NORMAL, ColorResources.TAB_NORMAL_FONT_COLOR.getColor());
+ tabButton.setFontColor(WSTATE.SELECTED, ColorResources.TAB_SELECTED_FONT_COLOR.getColor());
+ tabButton.setFontColor(WSTATE.HOVER, ColorResources.TAB_HOVER_FONT_COLOR.getColor());
+ tabButton.setFontColor(WSTATE.PUSH, ColorResources.TAB_SELECTED_FONT_COLOR.getColor());
tabButton.setText(item.getText());
tabButton.setEnabled(true);
data.height = TAB_HEIGHT;
tabButton.setLayoutData(data);
- tabButton.addClickListener(new DACustomButtonClickEventListener() {
+ tabButton.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectionItem((ImageButton)e.widget);
+ }
+
@Override
- public void handleClickEvent(DACustomButton button) {
- selectionItem((PlatformTabButton)button);
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
}
});
return tabButton;
}
- private void selectionItem(PlatformTabButton button) {
- PlatformTabButton b = null;
+ private void selectionItem(ImageButton button) {
+ ImageButton b = null;
for (int i = 0; i < buttons.size(); i++) {
b = buttons.get(i);
if (button == b) {
this.setSelection(i);
- b.setSelected(true);
+ b.setSelection(true);
b.redraw();
// draw main view using selected platform
items.get(i).draw();
contentsComposite.layout(true, true);
} else {
- b.setSelected(false);
+ b.setSelection(false);
b.redraw();
}
}
return items.remove(index);
}
- public void addTabRightButton(DACustomButton button) {
+ public void addTabRightButton(ImageButton button) {
rightButtons.add(button);
}
- public void addTabRightButton(int index, DACustomButton button) {
+ public void addTabRightButton(int index, ImageButton button) {
rightButtons.add(index, button);
}
- public void removeTabRightButton(DACustomButton button) {
+ public void removeTabRightButton(ImageButton button) {
rightButtons.remove(button);
}
- public DACustomButton removeTabRightButton(int index) {
+ public ImageButton removeTabRightButton(int index) {
return rightButtons.remove(index);
}
}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.tabfolder;
import org.tizen.emulator.manager.platform.Platform;
public class PlatformTabItem {
private Platform platform;
- /**
- * 모든 platform tab item 들이 공유
- */
private static VMsMainView view;
private String text;
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
import java.util.HashSet;
if (screenSizeY != size.y) {
// draw background
- this.setBackgroundImage(PatchImageResources.getScrollbarBackground(SCROLLBAR_WIDTH, size.y));
+ this.setBackgroundImage(PatchImageResources.getScrollbarBackground(SCROLLBAR_WIDTH + 2, size.y));
}
if (data.max > 0 && data.thumb > 0 && data.thumb <= data.max) {
screenThumb = (screenSizeY - (((data.max - data.thumb) * screenSizeY) / data.max));
// screenThumb = screenSizeY - (data.max- data.thumb);
// draw thumb
- Rectangle thumb = new Rectangle(0, 0, SCROLLBAR_WIDTH, 35);
- thumb.y = screenScrollTop;
- thumb.height = screenThumb;
+ Rectangle thumb = new Rectangle(1, screenScrollTop, SCROLLBAR_WIDTH, screenThumb);
+ //thumb.y = screenScrollTop;
+ //thumb.height = screenThumb;
g.setBackground(thumbColor);
g.setFillRule(SWT.FILL_WINDING);
g.fillRoundRectangle(thumb.x, thumb.y, thumb.width, thumb.height, 6, 6);
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
+ * - S-Core Co., Ltd
+ *
+ */
+
package org.tizen.emulator.manager.ui.widgets;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseWheelListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.resources.ColorResources;
-/**
- * A ScrolledComposite provides scrollbars and will scroll its content when the user
- * uses the scrollbars.
- *
- * <dl>
- * <dt><b>Styles:</b><dd>H_SCROLL, V_SCROLL
- * </dl>
- *
- * @see <a href="http://www.eclipse.org/swt/snippets/#scrolledcomposite">ScrolledComposite snippets</a>
- * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
- */
+
public class CustomScrolledComposite extends Composite {
- Control content;
- Listener contentListener;
- Listener filter;
+ private Control content;
+ private Listener resizeListener;
+ private DisposeListener disposeListener;
- boolean alwaysShowScroll = false;
- boolean showFocusedControl = false;
- CustomScrollBar verticalBar;
- Composite scrollComposite = null;
+ private CustomScrollBar verticalBar;
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#H_SCROLL
- * @see SWT#V_SCROLL
- * @see #getStyle()
- */
public CustomScrolledComposite(Composite parent, int style) {
super(parent, SWT.DOUBLE_BUFFERED);
super.setLayout(new FormLayout());
data.top = new FormAttachment(0, 2);
data.bottom = new FormAttachment(100, -2);
data.right = new FormAttachment(100, -2);
- data.width = 5;
+ data.width = 7;
verticalBar.setLayoutData(data);
verticalBar.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- contentListener = new Listener() {
- public void handleEvent(Event e) {
- if (e.type != SWT.Resize) return;
- settingScrollLayout(e);
- }
- };
-
- filter = new Listener() {
+ resizeListener = new Listener() {
+ @Override
public void handleEvent(Event event) {
- if (event.widget instanceof Control) {
- Control control = (Control) event.widget;
- if (contains(control)) showControl(control);
- }
+ if (event.type != SWT.Resize) return;
+ settingScrollLayout(event);
}
};
- addDisposeListener(new DisposeListener() {
+ disposeListener = new DisposeListener() {
+
+ @Override
public void widgetDisposed(DisposeEvent e) {
- getDisplay().removeFilter(SWT.FocusIn, filter);
+ verticalBar.dispose();
}
- });
+
+ };
- this.addListener(SWT.Resize, contentListener);
+ this.addListener(SWT.Resize, resizeListener);
+ this.addDisposeListener(disposeListener);
- this.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent e) {
- if (verticalBar != null && verticalBar.isVisible()) {
- verticalBar.mouseScrolled(e);
+ if (!EmulatorManager.isWin()) {
+ this.addMouseWheelListener(new MouseWheelListener() {
+ @Override
+ public void mouseScrolled(MouseEvent e) {
+ if (verticalBar != null && verticalBar.isVisible()) {
+ verticalBar.mouseScrolled(e);
+ }
}
- }
- });
+ });
+ }
}
return;
}
- layout(true, true);
+ //layout(true, true);
if (needVScroll(content.getBounds(), false)) {
verticalBar.setVisible(true);
verticalBar.setScrollSize(content.getBounds().height,
Math.min(content.getBounds().height, getClientArea().height), true);
} else {
verticalBar.setVisible(false);
+ verticalBar.setScrollPos(0);
}
}
- static int checkStyle (int style) {
- int mask = SWT.V_SCROLL | SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; //SWT.H_SCROLL
- return style & mask;
- }
-
boolean contains(Control control) {
if (control == null || control.isDisposed()) {
return false;
return false;
}
- /**
- * Returns the Always Show Scrollbars flag. True if the scrollbars are
- * always shown even if they are not required. False if the scrollbars are only
- * visible when some part of the composite needs to be scrolled to be seen.
- * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
- * horizontal and vertical directions.
- *
- * @return the Always Show Scrollbars flag value
- */
- public boolean getAlwaysShowScrollBars() {
- //checkWidget();
- return alwaysShowScroll;
- }
-
- /**
- * Get the content that is being scrolled.
- *
- * @return the control displayed in the content area
- */
public Control getContent() {
- //checkWidget();
return content;
}
- /**
- * Returns <code>true</code> if the receiver automatically scrolls to a focused child control
- * to make it visible. Otherwise, returns <code>false</code>.
- *
- * @return a boolean indicating whether focused child controls are automatically scrolled into the viewport
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.4
- */
- public boolean getShowFocusedControl() {
- checkWidget();
- return showFocusedControl;
- }
-
public CustomScrollBar getVScrollBar() {
return verticalBar;
}
int border = getBorderWidth();
hostRect.height -= 2*border;
- /*
- if (hVisible && verticalBar != null) {
- hostRect.height -= verticalBar.getSize().y;
- }
- */
-
if (contentRect.height > hostRect.height) {
return true;
}
return false;
}
- /**
- * Return the point in the content that currently appears in the top left
- * corner of the scrolled composite.
- *
- * @return the point in the content that currently appears in the top left
- * corner of the scrolled composite. If no content has been set, this returns
- * (0, 0).
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 2.0
- */
public Point getOrigin() {
checkWidget();
if (content == null) {
return new Point(-location.x, -location.y);
}
- /**
- * Scrolls the content so that the specified point in the content is in the top
- * left corner. If no content has been set, nothing will occur.
- *
- * Negative values will be ignored. Values greater than the maximum scroll
- * distance will result in scrolling to the end of the scrollbar.
- *
- * @param origin the point on the content to appear in the top left corner
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - value of origin is outside of content
- * </ul>
- * @since 2.0
- */
public void setOrigin(Point origin) {
setOrigin(origin.x, origin.y);
}
- /**
- * Scrolls the content so that the specified point in the content is in the top
- * left corner. If no content has been set, nothing will occur.
- *
- * Negative values will be ignored. Values greater than the maximum scroll
- * distance will result in scrolling to the end of the scrollbar.
- *
- * @param x the x coordinate of the content to appear in the top left corner
- *
- * @param y the y coordinate of the content to appear in the top left corner
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 2.0
- */
public void setOrigin(int x, int y) {
checkWidget();
if (content == null) return;
content.setLocation(x, y);
}
- /**
- * Set the Always Show Scrollbars flag. True if the scrollbars are
- * always shown even if they are not required. False if the scrollbars are only
- * visible when some part of the composite needs to be scrolled to be seen.
- * The H_SCROLL and V_SCROLL style bits are also required to enable scrollbars in the
- * horizontal and vertical directions.
- *
- * @param show true to show the scrollbars even when not required, false to show scrollbars only when required
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setAlwaysShowScrollBars(boolean show) {
- checkWidget();
- if (show == alwaysShowScroll) {
- return;
- }
- alwaysShowScroll = show;
- if (verticalBar != null && alwaysShowScroll) {
- verticalBar.setVisible(true);
- }
- }
-
- /**
- * Set the content that will be scrolled.
- *
- * @param content the control to be displayed in the content area
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
public void setContent(Composite content) {
checkWidget();
if (this.content != null && !this.content.isDisposed()) {
- this.content.removeListener(SWT.Resize, contentListener);
+ this.content.removeListener(SWT.Resize, resizeListener);
this.content.setBounds(new Rectangle(-200, -200, 0, 0));
}
content.setLayoutData(data);
content.setLocation(0, 0);
layout(false);
- this.content.addListener(SWT.Resize, contentListener);
- } else {
- if (verticalBar != null) verticalBar.setVisible(alwaysShowScroll);
- }
- }
-
- /**
- * Configure the receiver to automatically scroll to a focused child control
- * to make it visible.
- *
- * If show is <code>false</code>, show a focused control is off.
- * By default, show a focused control is off.
- *
- * @param show <code>true</code> to show a focused control.
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.4
- */
- public void setShowFocusedControl(boolean show) {
- checkWidget();
- if (showFocusedControl == show) {
- return;
- }
- Display display = getDisplay();
- display.removeFilter(SWT.FocusIn, filter);
- showFocusedControl = show;
- if (!showFocusedControl) {
- return;
- }
- display.addFilter(SWT.FocusIn, filter);
- Control control = display.getFocusControl();
- if (contains(control)) {
- showControl(control);
- }
- }
-
- /**
- * Scrolls the content of the receiver so that the control is visible.
- *
- * @param control the control to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the control is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @since 3.4
- */
- public void showControl(Control control) {
- checkWidget ();
- if (control == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (control.isDisposed ()) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (!contains(control)) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- Rectangle itemRect = getDisplay().map(control.getParent(), this, control.getBounds());
- Rectangle area = getClientArea();
- Point origin = getOrigin();
- if (itemRect.x < 0) {
- origin.x = Math.max(0, origin.x + itemRect.x);
- } else {
- if (area.width < itemRect.x + itemRect.width) origin.x = Math.max(0, origin.x + itemRect.x + Math.min(itemRect.width, area.width) - area.width);
- }
- if (itemRect.y < 0) {
- origin.y = Math.max(0, origin.y + itemRect.y);
- } else {
- if (area.height < itemRect.y + itemRect.height) origin.y = Math.max(0, origin.y + itemRect.y + Math.min(itemRect.height, area.height) - area.height);
+ this.content.addListener(SWT.Resize, resizeListener);
}
- setOrigin(origin);
}
void vScroll() {
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+
+import java.util.ArrayList;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TypedListener;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.resources.PatchImageResources;
+
+public class ImageButton extends Canvas {
+ private Composite parent;
+ private int style = 0;
+
+ protected WSTATE state = WSTATE.NORMAL;
+ // index of list is WSTATE
+ protected ArrayList<Image> images = null;
+ protected ArrayList<Color> colors = null;
+ protected ArrayList<Color> fontColors = null;
+ protected ArrayList<Font> fonts = null;
+
+ private String text = "";
+ private boolean selected = false;
+ private boolean defaultPush = true;
+
+ private int RADIO_IMAGE_SIZE = 21;
+ public ImageButton(Composite parent, int style) {
+ super(parent, SWT.DOUBLE_BUFFERED | style);
+ this.parent = parent;
+ if (style == SWT.NONE) {
+ style = SWT.PUSH;
+ }
+ this.style = style;
+
+ initButton();
+ addListeners();
+
+
+ this.setFont(FontResources.BUTTON_FONT.getFont());
+ }
+
+ protected void initButton() {
+ images = new ArrayList<Image>();
+ colors = new ArrayList<Color>();
+ fontColors = new ArrayList<Color>();
+ fonts = new ArrayList<Font>();
+
+ for (WSTATE s : WSTATE.values()) {
+ colors.add(s.getId(), ColorResources.BUTTON_BG_COLOR.getColor());
+ fontColors.add(s.getId(), ColorResources.BUTTON_ENABLE_FONT_COLOR.getColor());
+ fonts.add(s.getId(), FontResources.BUTTON_FONT.getFont());
+ images.add(s.getId(), null);
+ }
+
+ fontColors.set(WSTATE.DISABLE.getId(),
+ ColorResources.BUTTON_DISABLE_FONT_COLOR.getColor());
+ }
+
+ private void addListeners() {
+ addPaintListener(paintListener);
+ addListener(SWT.MouseDown, mouseListener);
+ addListener(SWT.MouseUp, mouseListener);
+ addListener(SWT.MouseEnter, mouseListener);
+ addListener(SWT.MouseExit, mouseListener);
+ addDisposeListener(disposeListener);
+ }
+
+ public void setPainListener(PaintListener listener) {
+ removePaintListener(paintListener);
+ this.paintListener = listener;
+ addPaintListener(paintListener);
+ }
+
+ private boolean checkStyle(int style, int bit) {
+ if ((style & bit) == 0) {
+ return false;
+ }
+ return true;
+ }
+
+ public void setFont(WSTATE state, Font font) {
+ fonts.set(state.getId(), font);
+ }
+
+ public void setFontColor(WSTATE state, Color color) {
+ fontColors.set(state.getId(), color);
+ }
+
+ public void setImage(WSTATE state, Image image) {
+ images.set(state.getId(), image);
+ }
+
+ public void setBackgroundColor(WSTATE state, Color color) {
+ colors.set(state.getId(), color);
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ this.redraw();
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public Image getImage() {
+ return images.get(WSTATE.NORMAL.getId());
+ }
+
+ public Image getImage(WSTATE state) {
+ return images.get(state.getId());
+ }
+
+ private Image nomalImage = null;
+ private Image hoverImage = null;
+ private Image pushImage = null;;
+ public void drawPushImage(GC gc, WSTATE state, int width, int height) {
+ Image image = null;
+ switch(state) {
+ case HOVER:
+ if (hoverImage == null) {
+ hoverImage = PatchImageResources.getHoverButton(width);
+ }
+ image = hoverImage;
+ break;
+ case PUSH:
+ if (pushImage == null) {
+ pushImage = PatchImageResources.getNomalButton(width);
+ }
+ image = pushImage;
+ break;
+ default:
+ if (nomalImage == null) {
+ nomalImage = PatchImageResources.getNomalButton(width);
+ }
+ image = nomalImage;
+ break;
+ }
+
+ Rectangle rect = image.getBounds();
+ gc.drawImage(image, rect.x, rect.y);
+ }
+
+ public void setImages(Image normal, Image hover, Image pushed,
+ Image selected, Image selected_hover, Image disable) {
+ images.set(WSTATE.NORMAL.getId(), normal);
+ images.set(WSTATE.HOVER.getId(), hover);
+ images.set(WSTATE.PUSH.getId(), pushed);
+ images.set(WSTATE.SELECTED.getId(), selected);
+ images.set(WSTATE.SELECTED_HOVER.getId(), selected_hover);
+ images.set(WSTATE.DISABLE.getId(), disable);
+
+ if (checkStyle(style, SWT.PUSH)) {
+ defaultPush = false;
+ }
+ redraw();
+ }
+
+ public void setForeground(Color normal, Color hover, Color selected,
+ Color pushed, Color disable, Color selected_hover) {
+ fontColors.set(WSTATE.NORMAL.getId(), normal);
+ fontColors.set(WSTATE.HOVER.getId(), hover);
+ fontColors.set(WSTATE.SELECTED.getId(), selected);
+ fontColors.set(WSTATE.PUSH.getId(), pushed);
+ fontColors.set(WSTATE.DISABLE.getId(), disable);
+ fontColors.set(WSTATE.SELECTED_HOVER.getId(), selected_hover);
+
+ redraw();
+ }
+
+ @Override
+ public Point computeSize(int wHint, int hHint, boolean changed) {
+ int width = 0, height = 0;
+
+ if (checkStyle(style, SWT.RADIO)
+ && images.get(WSTATE.NORMAL.getId()) != null) {
+ Rectangle bounds = images.get(WSTATE.NORMAL.getId()).getBounds();
+ width = bounds.width + 14;
+ height = bounds.height;
+ }
+
+ if (text != null) {
+ GC gc = new GC(this);
+ Point extent = gc.stringExtent(text);
+ gc.dispose();
+ width += extent.x;
+ height = Math.max(height, extent.y);
+ }
+
+ if (wHint != SWT.DEFAULT)
+ width = wHint;
+
+ if (hHint != SWT.DEFAULT)
+ height = hHint;
+
+ if (checkStyle(style, SWT.PUSH) && defaultPush) {
+ if (width < 13) {
+ width = 13;
+ }
+ if (height < 22) {
+ height = 22;
+ }
+ }
+
+ return new Point(width, height);
+ }
+
+ private DisposeListener disposeListener = new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent arg0) {
+ int i = 0;
+ for (WSTATE s : WSTATE.values()) {
+ i = s.getId();
+ WidgetHelper.tryDispose(images.get(i), colors.get(i), fontColors.get(i), fonts.get(i));
+ }
+ WidgetHelper.tryDispose(nomalImage, hoverImage, pushImage);
+ }
+ };
+
+ private PaintListener paintListener = new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle rect = ((Canvas) e.widget).getClientArea();
+ Image img = images.get(state.getId());
+
+ if (colors.get(state.getId()) != null) {
+ e.gc.setBackground(colors.get(state.getId()));
+ e.gc.fillRectangle(rect);
+ }
+
+ int x = rect.x;
+ int y = rect.y;
+
+ if (checkStyle(style, SWT.RADIO)) {
+ y = rect.y + (rect.height - RADIO_IMAGE_SIZE) / 2;
+ } else if (defaultPush && checkStyle(style, SWT.PUSH)) {
+ drawPushImage(e.gc, state, rect.width, rect.height);
+ defaultPush = true;
+ } else if (img == null) {
+ return;
+ }
+
+ if (null != img) {
+ e.gc.drawImage(img, x, y);
+ }
+
+ if (checkStyle(style, SWT.RADIO)) {
+ x += RADIO_IMAGE_SIZE + 6;
+ } else {
+ Point extent = e.gc.stringExtent(text);
+ x += rect.x + ((rect.width - extent.x) / 2);
+ }
+ int fontHeight = e.gc.getFontMetrics().getHeight();
+ y = rect.y + (rect.height - fontHeight) / 2 - 1;
+
+ if (fontColors.get(state.getId()) != null) {
+ e.gc.setForeground(fontColors.get(state.getId()));
+ }
+
+ if (text != null) {
+ e.gc.drawText(text, x, y, true);
+ }
+ }
+ };
+
+ public void addSelectionListener(SelectionListener listener) {
+ addListener(SWT.Selection, new TypedListener(listener));
+ addListener(SWT.DefaultSelection, new TypedListener(listener));
+ }
+
+ public void removeSelectionListener(SelectionListener listener) {
+ removeListener(SWT.Selection, listener);
+ removeListener(SWT.DefaultSelection, listener);
+ }
+
+ protected Listener mouseListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.type == SWT.MouseDown) {
+ ImageButton btn = (ImageButton) event.widget;
+ btn.setFocus();
+ if (state == WSTATE.NORMAL) {
+ state = WSTATE.PUSH;
+ redraw();
+ }
+ } else if (event.type == SWT.MouseUp) {
+ ImageButton button = (ImageButton) event.widget;
+ Rectangle rect = button.getClientArea();
+
+ if (rect.contains(event.x, event.y)) {
+ if (checkStyle(style, SWT.RADIO)) {
+ selectRadio();
+ } else if (checkStyle(style, SWT.PUSH)) {
+ if (state == WSTATE.PUSH) {
+ state = WSTATE.HOVER;
+ redraw();
+ }
+
+ } else if (checkStyle(style, SWT.TOGGLE)) {
+ if (isSelection()) {
+ setSelection(false);
+ } else {
+ setSelection(true);
+ }
+ redraw();
+ }
+ notifyListeners(SWT.Selection, new Event());
+ notifyListeners(SWT.DefaultSelection, new Event());
+ }
+ } else if (event.type == SWT.MouseEnter) {
+ if ((state != WSTATE.HOVER) && (state != WSTATE.SELECTED_HOVER)) {
+ if (selected) {
+ state = WSTATE.SELECTED_HOVER;
+ } else {
+ state = WSTATE.HOVER;
+ }
+ redraw();
+ }
+ } else if (event.type == SWT.MouseExit) {
+ if (state == WSTATE.HOVER || state == WSTATE.SELECTED_HOVER
+ || state == WSTATE.PUSH) {
+ if (selected) {
+ state = WSTATE.SELECTED;
+ } else {
+ state = WSTATE.NORMAL;
+ }
+ redraw();
+ }
+ }
+ }
+ };
+
+ public void setSelection(boolean selected) {
+ if (selected) {
+ state = WSTATE.SELECTED;
+ this.selected = true;
+ } else {
+ state = WSTATE.NORMAL;
+ this.selected = false;
+ }
+ redraw();
+ }
+
+ public boolean isSelection() {
+ return selected;
+ }
+
+ public void selectRadio() {
+ Control[] children = parent.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof ImageButton && child != this) {
+ ((ImageButton) child).setSelection(false);
+ }
+ }
+ setSelection(true);
+ }
+
+ @Override
+ public void setEnabled(boolean enable) {
+ super.setEnabled(enable);
+ state = (enable ? WSTATE.NORMAL : WSTATE.DISABLE);
+ redraw();
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+
+import java.util.ArrayList;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+import org.tizen.emulator.manager.resources.ImageResources;
+
+public class ImageCombo extends Canvas {
+ private Composite parent;
+
+ private WSTATE state = WSTATE.NORMAL;
+ // index of list is WSTATE
+ private ArrayList<Image> images = null;
+ private ArrayList<Color> colors = null;
+ private ArrayList<Color> fontColors = null;
+ private ArrayList<Font> fonts = null;
+
+ private ArrayList<String> items;
+ private int selectedIndex = 0;
+ private String selectedText = "";
+ private int itemHeight = 0;
+
+ private ImageComboPopup popup = null;
+
+ private Image arrowButtonImage = null;
+
+ public ImageCombo(Composite parent, int style) {
+ super(parent, style);
+ this.parent = parent;
+ popup = new ImageComboPopup(this);
+
+ initCombo();
+ addListeners();
+ }
+
+ private void initCombo() {
+ items = new ArrayList<String>();
+
+ images = new ArrayList<Image>();
+ colors = new ArrayList<Color>();
+ fontColors = new ArrayList<Color>();
+ fonts = new ArrayList<Font>();
+
+ for (WSTATE s : WSTATE.values()) {
+ images.add(s.getId(), ImageResources.COMBO_NORMAL.getImage());
+ colors.add(s.getId(), ColorResources.COMBO_BG_COLOR.getColor());
+ fontColors.add(s.getId(), ColorResources.COMOB_ENABLE_FONT_COLOR.getColor());
+ fonts.add(s.getId(), FontResources.COMBO_BUTTON_FONT.getFont());
+ }
+
+ images.set(WSTATE.DISABLE.getId(),
+ ImageResources.COMBO_DISABLE.getImage());
+ images.set(WSTATE.HOVER.getId(),
+ ImageResources.COMBO_HOVER.getImage());
+ images.set(WSTATE.PUSH.getId(),
+ ImageResources.COMBO_PUSH.getImage());
+
+ fontColors.add(WSTATE.DISABLE.getId(),
+ ColorResources.COMBO_DISABLE_FONT_COLOR.getColor());
+ }
+
+ public void addListeners() {
+ addPaintListener(comboPaintListener);
+ addDisposeListener(disposeListener);
+
+ addListener(SWT.MouseEnter, comboMouseListener);
+ addListener(SWT.MouseHover, comboMouseListener);
+ addListener(SWT.MouseExit, comboMouseListener);
+ addListener(SWT.MouseDown, comboMouseListener);
+ addListener(SWT.MouseMove, comboMouseListener);
+ addListener(SWT.MouseUp, comboMouseListener);
+ }
+
+ public void addSelectionListener(SelectionListener listener) {
+ popup.addSelectionListener(listener);
+ }
+
+ public void removeSelectionListener(SelectionListener listener) {
+ popup.removeSelectionListener(listener);
+ }
+
+ public void add(String string) {
+ add(string, items.size());
+ }
+
+ public void add(String string, int index) {
+ assert string == null;
+ if (index < 0 || index > items.size()) {
+ // TODO
+ return;
+ }
+ items.add(index, string);
+ }
+
+ public String getItem (int index) {
+ if (index < 0 || index >= items.size()) {
+ // TODO
+ return null;
+ }
+
+ return items.get(index);
+ }
+
+ public int getItemCount() {
+ return items.size();
+ }
+
+ public String[] getItems() {
+ String[] ar = new String[items.size()];
+ for (int i = 0; i < items.size(); i++) {
+ ar[i] = items.get(i);
+ }
+ return ar;
+ }
+
+ public ArrayList<String> getItemArray() {
+ return items;
+ }
+
+ public int getSelectionIndex() {
+ return selectedIndex;
+ }
+
+ public String getText() {
+ return selectedText;
+ }
+
+ public int getItemHeight() {
+ return itemHeight;
+ }
+
+ public void removeAll() {
+ if (items != null) {
+ items.clear();
+ }
+ selectedIndex = -1;
+ selectedText = "";
+ if (!popup.isDispose()) {
+ popup.dispose();
+ }
+ }
+
+ // for ImageComboPopup
+ void setIndex(int index) {
+ if (index < 0 || index >= items.size()) {
+ return;
+ }
+ selectedIndex = index;
+ }
+
+ public void select(int index) {
+ if (index < 0 || index >= items.size()) {
+ return;
+ }
+
+ selectedIndex = index;
+ selectedText = items.get(index);
+
+ // TODO
+ redraw();
+ }
+
+ public void setText(String string) {
+ assert string == null;
+ setText(items.indexOf(string), string);
+ }
+
+ public void setText(int index, String string) {
+ assert string == null;
+ if (index < 0 || index >= items.size()) {
+ // TODO
+ return;
+ }
+
+ items.set(index, string);
+
+ redraw();
+ }
+
+ public void setItemHeight(int itemHeight) {
+ this.itemHeight = itemHeight;
+ }
+
+ public void setFont(WSTATE state, Font font) {
+ fonts.set(state.getId(), font);
+ }
+
+ public void setFontColor(WSTATE state, Color color) {
+ fontColors.set(state.getId(), color);
+ }
+
+ public void setImage(WSTATE state, Image image) {
+ images.set(state.getId(), image);
+ }
+
+ public void setBackgroundColor(WSTATE state, Color color) {
+ colors.set(state.getId(), color);
+ }
+
+ public void setArrowButtonImage (Image image) {
+ this.arrowButtonImage = image;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ super.setEnabled(enabled);
+ if (!enabled) {
+ state = WSTATE.DISABLE;
+ } else {
+ state = WSTATE.NORMAL;
+ }
+ redraw();
+ }
+
+ private Listener comboMouseListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (isEnabled()) {
+ switch (event.type) {
+ case SWT.MouseEnter:
+ changeComboState(WSTATE.HOVER);
+ break;
+ case SWT.MouseHover:
+ {
+ if (!isOutOfBounds(event.x, event.y)) {
+ if ((event.stateMask & SWT.BUTTON1) != 0) {
+ changeComboState(WSTATE.PUSH);
+ } else {
+ changeComboState(WSTATE.HOVER);
+ }
+ }
+ }
+ break;
+ case SWT.MouseDown:
+ changeComboState(WSTATE.PUSH);
+ break;
+ case SWT.MouseUp:
+ changeComboState(WSTATE.HOVER);
+ if (popup.isDispose()) {
+ popup.open();
+ } else {
+ popup.dispose();
+ }
+ break;
+ case SWT.MouseMove:
+ {
+ if (isOutOfBounds(event.x, event.y)) {
+ changeComboState(WSTATE.NORMAL);
+ } else {
+ if ((event.stateMask & SWT.BUTTON1) != 0) {
+ changeComboState(WSTATE.PUSH);
+ } else {
+ changeComboState(WSTATE.HOVER);
+ }
+ }
+ }
+ break;
+ case SWT.MouseExit:
+ changeComboState(WSTATE.NORMAL);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ };
+
+ protected boolean isOutOfBounds(int x, int y) {
+ Rectangle rect = this.getBounds();
+
+ if (x < 0 || x > rect.width || y < 0 || y > rect.height) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // for ImageComboPopup
+ Shell getParentShell() {
+ if (parent == null) {
+ return null;
+ } else {
+ return parent.getShell();
+ }
+ }
+
+ private void changeComboState(WSTATE s) {
+ state = s;
+ redraw();
+ }
+
+ private static int ARROW_OFFSET = 4;
+ private static int LEFT_OFFSET = 5;
+ private PaintListener comboPaintListener = new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Rectangle rect = ((Canvas) e.widget).getClientArea();
+
+ Image img = images.get(state.getId());
+ e.gc.setBackground(colors.get(state.getId()));
+
+ int x = rect.x;
+ int y = rect.y;
+ if (img != null) {
+ e.gc.drawImage(img, x, y);
+ }
+
+ if (arrowButtonImage != null) {
+ int w = arrowButtonImage.getImageData().width;
+ int h = arrowButtonImage.getImageData().height;
+ x += rect.width - w - ARROW_OFFSET;
+ y += (rect.height - h) / 2;
+ e.gc.drawImage(arrowButtonImage, x, y);
+ Rectangle clipping = new Rectangle(rect.x, rect.y,
+ rect.width - w - ARROW_OFFSET - 2, rect.height);
+ e.gc.setClipping(clipping);
+ }
+
+ e.gc.setForeground(fontColors.get(state.getId()));
+ e.gc.setFont(fonts.get(state.getId()));
+
+ x = rect.x + LEFT_OFFSET;
+ int fontHeight = e.gc.getFontMetrics().getHeight();
+ y = rect.y + (rect.height - fontHeight) / 2;
+
+ if (selectedText != null) {
+ e.gc.drawText(selectedText, x, y, true);
+ }
+ }
+ };
+
+ private DisposeListener disposeListener = new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent arg0) {
+ int i = 0;
+ for (WSTATE s : WSTATE.values()) {
+ i = s.getId();
+ WidgetHelper.tryDispose(images.get(i), colors.get(i), fontColors.get(i), fonts.get(i));
+ }
+ }
+ };
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FontResources;
+
+class ImageComboPopup {
+ private Shell popupShell = null;
+ private Canvas popupCanvas = null;
+ private List<Rectangle> itemRects;
+ ImageCombo parent = null;
+ public ImageComboPopup(ImageCombo parent) {
+ this.parent = parent;
+ initPopup();
+ }
+
+ private void initPopup() {
+ itemRects = new ArrayList<Rectangle>();
+ }
+
+ private int getShellWidth() {
+ ArrayList<String> items = parent.getItemArray();
+ if (items.isEmpty()) {
+ return 0;
+ }
+
+ int maxWidth = 0;
+ int size = items.size();
+ GC gc = new GC(parent.getDisplay(), SWT.NONE);
+ for (int i = 0; i < size; i++) {
+ Point p = gc.textExtent(items.get(i), SWT.DRAW_MNEMONIC);
+ if (p.x > maxWidth) {
+ maxWidth = p.x;
+ }
+ }
+
+ maxWidth += 10;
+ gc.dispose();
+
+ return maxWidth;
+ }
+
+ public void open() {
+ popupShell = new Shell(parent.getParentShell(), SWT.ON_TOP);
+ popupShell.setLayout(new FormLayout());
+
+ Point p = parent.toDisplay(0, 0);
+ Rectangle rect = parent.getBounds();
+ ArrayList<String>items = parent.getItemArray();
+
+ int textWidth = getShellWidth() + 4;
+ int shellWidth = (textWidth > rect.width) ? textWidth : rect.width;
+ int height = 0;
+
+ if (parent.getItemHeight() == 0) {
+ height = rect.height;
+ } else {
+ height = parent.getItemHeight();
+ }
+
+ int shellHeight = height * items.size() + 5;
+
+ popupShell.setSize(shellWidth, shellHeight);
+ popupShell.setLocation(p.x, p.y + rect.height);
+
+ popupCanvas = new Canvas(popupShell, SWT.DOUBLE_BUFFERED);
+ popupCanvas.setData(this);
+ popupCanvas.setBackground(ColorResources.WHITE.getColor());
+ popupCanvas.addPaintListener(paintListener);
+ popupCanvas.addDisposeListener(disposeListener);
+
+ popupCanvas.addListener(SWT.MouseUp, popupMouseEventListener);
+ popupCanvas.addListener(SWT.MouseMove, popupMouseEventListener);
+ popupCanvas.addListener(SWT.FocusOut, popupMouseEventListener);
+ popupCanvas.addListener(SWT.MouseUp, popupSelectionListener);
+
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.height = shellHeight - 2;
+ popupCanvas.setLayoutData(data);
+
+ itemRects.clear();
+ Rectangle re;
+ for (int i = 0; i < items.size(); i++) {
+ re = new Rectangle(2, 2 + i * height, shellWidth - 2, height);
+ itemRects.add(re);
+ }
+
+ popupShell.open();
+ }
+
+ private Listener popupMouseEventListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ switch(event.type) {
+ case SWT.MouseMove:
+ Rectangle rect;
+ for (int i = 0; i < itemRects.size(); i++) {
+ rect = itemRects.get(i);
+ if (rect.contains(event.x, event.y)) {
+ parent.setIndex(i);
+ popupCanvas.redraw();
+ break;
+ }
+ }
+ break;
+ case SWT.FocusOut:
+ dispose();
+ break;
+ case SWT.MouseUp:
+ parent.select(parent.getSelectionIndex());
+ parent.redraw();
+ dispose();
+ break;
+ default:
+ break;
+ }
+
+ }
+ };
+
+ private Listener popupSelectionListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ if (event.type == SWT.MouseUp) {
+ for (SelectionListener listener : SelectionListenerList) {
+ listener.widgetSelected(new SelectionEvent(event));
+ }
+ }
+ }
+ };
+
+ private ArrayList<SelectionListener> SelectionListenerList
+ = new ArrayList<SelectionListener>();
+
+ public void addSelectionListener(SelectionListener listener) {
+ SelectionListenerList.add(listener);
+ }
+
+ public void removeSelectionListener(SelectionListener listener) {
+ SelectionListenerList.remove(listener);
+ }
+
+ public boolean isDispose() {
+ if (popupShell == null || popupShell.isDisposed()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void dispose() {
+ popupShell.close();
+ popupShell = null;
+ }
+
+ private PaintListener paintListener = new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ ArrayList<String> items = parent.getItemArray();
+
+ GC gc = e.gc;
+ Rectangle rect = null;
+ int selectedIndex = parent.getSelectionIndex();
+ int size = itemRects.size();
+ int totalHeight = 0;
+ for (int i = 0; i < size; i++) {
+ rect = itemRects.get(i);
+ if (selectedIndex == i) {
+ gc.setBackground(ColorResources.COMBO_ITEM_SELECT_COLOR.getColor());
+ } else {
+ gc.setBackground(ColorResources.COMBO_ITEM_NORMAL_COLOR.getColor());
+ }
+ gc.fillRectangle(rect);
+
+ if (i != 0) {
+ gc.setForeground(ColorResources.COMBO_ITEM_SEPERATE_TOP_COLOR.getColor());
+ gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
+ }
+ if (i != size - 1) {
+ gc.setForeground(ColorResources.COMBO_ITEM_SEPERATE_BOTTOM_COLOR.getColor());
+ gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width,
+ rect.y + rect.height - 1);
+ }
+
+ gc.setForeground(ColorResources.COMBO_ITEM_FONT_COLOR.getColor());
+ gc.setFont(FontResources.COMBO_BUTTON_FONT.getFont());
+
+ int fontHeight = e.gc.getFontMetrics().getHeight();
+ gc.drawText(items.get(i), 5, (rect.height - fontHeight) / 2 + totalHeight + 2, true);
+ totalHeight += rect.height;
+ }
+
+ Rectangle clientRect= popupShell.getClientArea();
+ gc.setForeground(ColorResources.COMBO_POPUP_OUTER_1_COLOR.getColor());
+ gc.drawRectangle(clientRect);
+ gc.setForeground(ColorResources.COMBO_POPUP_OUTER_2_COLOR.getColor());
+ gc.drawRectangle(clientRect.x + 1,
+ clientRect.y + 1,
+ clientRect.width - 2,
+ clientRect.height - 2);
+ }
+ };
+
+ private DisposeListener disposeListener = new DisposeListener() {
+ @Override
+ public void widgetDisposed(DisposeEvent arg0) {
+ WidgetHelper.tryDispose(popupCanvas, popupShell);
+ for (Rectangle rect : itemRects) {
+ WidgetHelper.tryDispose(rect);
+ }
+ }
+ };
+}
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
public class ImageLabel extends Canvas{
- public static final int STATE_ENABLE = 0;
- public static final int STATE_DISABLE = 1;
-
- private ImageLabelRenderer renderer = new ImageLabelDefaultRenderer();
- private ImageLabelAttribute attr = new ImageLabelAttribute();
-
+ private WSTATE state = WSTATE.NORMAL;
+ private Image enableImage;
+ private Image disableImage;
+ private Font font;
+ private Color enableFontColor;
+ private Color disableFontColor;
+ private Point fontPoint;
+ private String text;
public ImageLabel(Composite parent, int style) {
super(parent, style);
- attr.setState(STATE_ENABLE);
- attr.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- attr.setFontColor(STATE_ENABLE, ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- attr.setFontColor(STATE_DISABLE, ColorResources.DETAIL_DISABLE_FONT_COLOR.getColor());
+ setFont(FontResources.DETAIL_LABEL_FONT.getFont());
+ setEnableFontColor(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
+ setDisableFontColor(ColorResources.DETAIL_DISABLE_FONT_COLOR.getColor());
this.addPaintListener(labelPaintListener);
}
@Override
public void paintControl(PaintEvent e) {
- renderer.draw(e.gc, (Canvas) e.widget, attr);
+ Image image = (state == WSTATE.NORMAL
+ ? enableImage : disableImage);
+ if (image == null) {
+ return;
+ }
+
+ Rectangle rect = ((Canvas)e.widget).getClientArea();
+ GC gc = e.gc;
+ gc.drawImage(image, rect.x, rect.y);
+ drawText(gc, rect);
+ }
+
+ private void drawText(GC gc, Rectangle rect) {
+ Point p = null;
+
+ if (text != null) {
+ if (font == null) {
+ font = FontResources.DETAIL_LABEL_FONT.getFont();
+ setFont(font);
+ }
+ gc.setFont(font);
+ gc.setForeground((state == WSTATE.NORMAL ? enableFontColor : disableFontColor));
+
+ int x = 0, y = 0;
+ int offset = 0;
+ if (fontPoint == null) {
+ p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+ x = (rect.width - p.x) / 2;
+ y = (rect.height - p.y) / 2;
+ x = (x < 0) ? 0 : x;
+ offset = 0;
+ } else {
+ x = fontPoint.x;
+ y = fontPoint.y;
+ }
+
+ gc.drawText(text, x + offset , y, true);
+ }
}
};
public void setText(String text) {
- attr.setText(text);
+ this.text = text;
this.redraw();
}
public String getText() {
- return attr.getText();
+ return text;
}
- public void setImage(int state, Image img) {
- attr.setImage(state, img);
+ public void setEnableImage(Image img) {
+ enableImage = img;
+ if (disableImage == null) {
+ disableImage = img;
+ }
this.setSize(img.getImageData().width, img.getImageData().height);
}
- public Image getImage(int state) {
- return attr.getImage(state);
+ public void setDisableImage(Image img) {
+ disableImage = img;
+ if (enableImage == null) {
+ enableImage = img;
+ }
+ this.setSize(img.getImageData().width, img.getImageData().height);
}
public void setFont(Font font) {
- attr.setFont(font);
+ this.font = font;
}
public void setFontPoint(Point p) {
- attr.setFontPoint(p);
+ fontPoint = p;
}
- public void setForeground (Color color) {
- this.setFontColor(STATE_ENABLE, color);
- this.setFontColor(STATE_DISABLE, color);
- super.setForeground(color);
+ public void setEnabled(boolean enabled) {
+ if (enabled) {
+ state = WSTATE.NORMAL;
+ } else {
+ state = WSTATE.DISABLE;
+ }
+ this.redraw();
}
- public void setFontColor(int state, Color color) {
- attr.setFontColor(state, color);
+ public boolean isEnabled() {
+ return state == WSTATE.NORMAL ? true : false;
}
- public void setRenderer(ImageLabelRenderer newRenderer) {
- renderer = newRenderer;
+ public Color getEnableFontColor() {
+ return enableFontColor;
}
- public void setEnabled(boolean enabled) {
- if (enabled) {
- changeState(STATE_ENABLE);
- } else {
- changeState(STATE_DISABLE);
- }
+ public void setEnableFontColor(Color enableFontColor) {
+ this.enableFontColor = enableFontColor;
}
- public boolean isEnabled() {
- return attr.getState() == STATE_ENABLE ? true : false;
+ public Color getDisableFontColor() {
+ return disableFontColor;
}
- protected void changeState(int s) {
- attr.setState(s);
- this.redraw();
+ public void setDisableFontColor(Color disableFontColor) {
+ this.disableFontColor = disableFontColor;
}
}
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import java.util.ArrayList;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-
-public class ImageLabelAttribute {
- private ArrayList<Color> fontColors = new ArrayList<Color>(5);
- private ArrayList<Image> images = new ArrayList<Image>(5);
- private int state;
- private Font font;
- private Point fontPoint;
- private String text;
-
- public ImageLabelAttribute() {
- images.add(ImageLabel.STATE_ENABLE, null);
- images.add(ImageLabel.STATE_DISABLE, null);
-
- fontColors.add(ImageLabel.STATE_ENABLE, null);
- fontColors.add(ImageLabel.STATE_DISABLE, null);
- }
-
- public void setImage(int state, Image image) {
- images.add(state, image);
- }
-
- public Image getImage(int state) {
- return images.get(state);
- }
-
- public void setFontColor(int state, Color color) {
- fontColors.add(state, color);
- }
-
- public Color getFontColor(int state) {
- return fontColors.get(state);
- }
-
- public Point getFontPoint() {
- return fontPoint;
- }
-
- public void setFontPoint(Point fontPoint) {
- this.fontPoint = fontPoint;
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
- public int getState() {
- return state;
- }
-
- public void setState(int state) {
- this.state = state;
- }
-
- public Font getFont() {
- return font;
- }
-
- public void setFont(Font font) {
- this.font = font;
- }
-}
\ No newline at end of file
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-
-public class ImageLabelDefaultRenderer extends ImageLabelRenderer{
-
- @Override
- public void draw(GC gc, Canvas canvas, ImageLabelAttribute attr) {
- Image image = attr.getImage(attr.getState());
- if (null == image) {
- return;
- }
-
- Rectangle rect = canvas.getClientArea();
- gc.drawImage(image, rect.x, rect.y);
- drawText(gc, rect, attr);
- }
-
- public int computeFontSize(Rectangle rect) {
- if (rect.height > 20)
- return 10;
- else
- return 8;
- }
-
- protected void drawText(GC gc, Rectangle rect, ImageLabelAttribute attr) {
- String text = attr.getText();
- Font font = null;
- Point p = null;
-
- if (null != text) {
- if (null == (font = attr.getFont())) {
- font = new Font(Display.getCurrent(), "Arial",
- computeFontSize(rect), SWT.BOLD);
- attr.setFont(font);
- }
- gc.setFont(font);
- gc.setForeground(attr.getFontColor(attr.getState()));
-
- int x = 0, y = 0;
- int offset = 0;
- if (null == (p = attr.getFontPoint())) {
- p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- x = (rect.width - p.x) / 2;
- y = (rect.height - p.y) / 2;
- x = (x < 0) ? 0 : x;
- offset = 0;
- } else {
- x = p.x;
- y = p.y;
- }
-
- gc.drawText(text, x + offset , y, true);
- }
- }
-
-}
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.widgets.Canvas;
-
-public abstract class ImageLabelRenderer {
- public abstract void draw(GC gc, Canvas canvas, ImageLabelAttribute attr);
-}
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.manager.da.widgets.combo.DACustomCombo;
-
-public class ModifyViewCombo extends DACustomCombo {
-
- public ModifyViewCombo(Composite parent, int style) {
- super(parent, style);
- addPaintListener(comboPaintListener);
- }
-
- private PaintListener comboPaintListener = new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- if (!isImageCombo()) {
- comboRenderer.draw(e.gc, combo, getText(), state);
- } else {
- comboRenderer.drawImage(e.gc, combo,
- buttonUp != null ? buttonUp : getImages().get(state), getText(),
- state);
- }
- }
- };
-
-}
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.da.widgets.combo.TitleComboRenderer;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-
-public class ModifyViewComboRenderer extends TitleComboRenderer {
- @Override
- public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
- Rectangle rect = canvas.getClientArea();
- gc.drawImage(canvas.getBackgroundImage(), rect.x, rect.y);
- Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- gc.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- gc.drawString(text, 5, (rect.height - p.y) / 2 + 2, true);
- Rectangle clipping = new Rectangle(rect.x + rect.width - 19, rect.y,
- 19, rect.height);
- gc.setClipping(clipping);
- gc.drawImage(canvas.getBackgroundImage(), rect.x, rect.y);
- // image is drop down image
- gc.drawImage(image, rect.x + rect.width - 12,
- rect.y + 7 /*(rect.height - image.getImageData().height)/2*/);
- }
-}
/*
- * UI Builder
+ * Emulator Manager
*
- * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
- * Changyeon Lee <changyeon.lee@samsung.com>
- * Gyeongmin Ju <gyeongmin.ju@samsung.com>
- * Hoon Kang <h245.kang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
*
- * 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
+ * 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.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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.
*
- * 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.
+ * 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.widgets;
public interface ScrollbarScrolledListener {
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+import java.util.ArrayList;
+
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonDefaultRenderer;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.resources.ColorResources;
import org.tizen.emulator.manager.resources.FontResources;
import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.ui.VMButtonFactory;
import org.tizen.emulator.manager.ui.VMsMainView;
+import org.tizen.emulator.manager.ui.list.VMButtonFactory;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.VMPropertyValue;
-public class VMButton extends DACustomButton {
+public class VMButton extends ImageButton {
private VMButton button = null;
private VMProperty property = null;
- protected DACustomButton launchButton = null;
+ protected ImageButton launchButton = null;
static int W_OFFSET = 2;
static int H_OFFSET = 3;
super(parent, style);
button = this;
- this.attr = new VMButtonAttribute();
- this.setRenderer(new VMButtonRenderer());
-
- // set font
- this.setFontColors(ColorResources.VM_BUTTON_FONT_COLOR.getColor(),
- ColorResources.VM_BUTTON_FONT_COLOR.getColor(),
- ColorResources.VM_BUTTON_FONT_COLOR.getColor(),
- ColorResources.VM_BUTTON_FONT_COLOR.getColor());
- this.setFont(FontResources.VM_BUTTON_FONT.getFont());
-
- // set image
- this.setImages(ImageResources.VM_IMAGE_NOMAL.getImage(),
- ImageResources.VM_IMAGE_NOMAL.getImage(),
- ImageResources.VM_IMAGE_HOVER.getImage(),
- null);
-
- this.setBackground(ColorResources.LIST_BG_COLOR.getColor());
this.setLayout(new FormLayout());
+ this.setPainListener(VMButtonPaintListener);
settingLaunchButton();
}
+ @Override
+ protected void initButton() {
+ images = new ArrayList<Image>();
+ colors = new ArrayList<Color>();
+ fontColors = new ArrayList<Color>();
+ fonts = new ArrayList<Font>();
+
+ for (WSTATE s : WSTATE.values()) {
+ colors.add(s.getId(), ColorResources.LIST_BG_COLOR.getColor());
+ fontColors.add(s.getId(), ColorResources.VM_BUTTON_FONT_COLOR.getColor());
+ fonts.add(s.getId(), FontResources.VM_BUTTON_FONT.getFont());
+ images.add(s.getId(), ImageResources.VM_IMAGE_NOMAL.getImage());
+ }
+
+ images.set(WSTATE.HOVER.getId(), ImageResources.VM_IMAGE_HOVER.getImage());
+ images.set(WSTATE.SELECTED_HOVER.getId(), ImageResources.VM_IMAGE_HOVER.getImage());
+ fontColors.set(WSTATE.SELECTED.getId(), ColorResources.BLUE.getColor());
+ }
+
private void settingLaunchButton() {
- // TODO
Image image = ImageResources.BUTTON_LAUNCH_NOMAL.getImage();
LAUNCH_BUTTON_WIDTH = image.getImageData().width;
LAUNCH_BUTTON_HEIGHT = image.getImageData().height;
- launchButton = new DACustomButton(this,
- image,
- ImageResources.BUTTON_LAUNCH_PUSH.getImage(),
+ launchButton = new ImageButton(this, SWT.PUSH);
+
+ launchButton.setImages(image,
ImageResources.BUTTON_LAUNCH_HOVER.getImage(),
- image);
+ ImageResources.BUTTON_LAUNCH_PUSH.getImage(),
+ ImageResources.BUTTON_LAUNCH_PUSH.getImage(),
+ image, image);
+
FormData data = new FormData();
data.top = new FormAttachment(0, 119 + H_OFFSET);
data.left = new FormAttachment(0, 10 + W_OFFSET);
launchButton.setLayoutData(data);
launchButton.setToolTipText("Launch emulator");
- launchButton.addClickListener(new DACustomButtonClickEventListener() {
+ launchButton.addSelectionListener(new SelectionListener() {
+
@Override
- public void handleClickEvent(DACustomButton button) {
+ public void widgetSelected(SelectionEvent e) {
VMButtonFactory.clickVMButton(getThis());
clickLaunchButton();
}
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
});
}
return button;
}
- public void setSelected(boolean selected) {
- ((VMButtonAttribute)attr).setSelected(selected);
+ @Override
+ public void setSelection(boolean selected) {
+ super.setSelection(selected);
if (selected && property != null) {
VMsMainView.getInstance().drawDetailVM(property, -1);
}
}
public void setProperty(VMProperty property) {
- ((VMButtonAttribute)attr).setProperty(property);
this.property = property;
}
-}
-class VMButtonRenderer extends DACustomButtonDefaultRenderer {
- @Override
- public void draw(GC gc, Canvas canvas, int state,
- DACustomButtonAttribute attr) {
- Rectangle rect = canvas.getClientArea();
+ public VMProperty getProperty() {
+ return property;
+ }
- if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- Image image = null;
- image = attr.getImage(state);
+ private PaintListener VMButtonPaintListener = new PaintListener() {
- if (null == image) {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Image image = images.get(state.getId());
+ if (image == null) {
return;
}
- VMButtonAttribute vmAttr = (VMButtonAttribute)attr;
+ Rectangle rect = ((Canvas) e.widget).getClientArea();
+ GC gc = e.gc;
+ gc.setBackground(colors.get(state.getId()));
+ gc.fillRectangle(rect);
gc.drawImage(image, rect.x + VMButton.W_OFFSET, rect.y + VMButton.H_OFFSET);
- if (vmAttr.isSelected()) {
+ if (isSelection()) {
gc.drawImage(ImageResources.VM_IMAGE_SELECTED.getImage(), rect.x, rect.y);
}
- drawButtonText(gc, rect, attr, state);
- } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
- || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
- drawButton(gc, rect, state, attr);
+ drawButtonText(gc, rect);
}
- drawButtonImage(gc, rect, attr);
- }
- private static int X_POINT = 40 + VMButton.W_OFFSET;
- private static int Y_POINT = 27 + VMButton.H_OFFSET;
- private static int Y_GAP = 23;
- private static int RE_X_POINT = 16 + VMButton.W_OFFSET;
- protected void drawButtonText(GC gc, Rectangle rect,
- DACustomButtonAttribute attr, int state) {
- VMButtonAttribute vmAttr = (VMButtonAttribute)attr;
- VMProperty property = vmAttr.getProperty();
- if (property == null) {
- return;
- }
-
- int x = 0;
- Point p = null;
- p = gc.textExtent(property.getName(), SWT.DRAW_MNEMONIC);
- x = (rect.width - p.x) / 2;
+ private int X_POINT = 40 + VMButton.W_OFFSET;
+ private int Y_POINT = 27 + VMButton.H_OFFSET;
+ private int Y_GAP = 23;
+ private int RE_X_POINT = 16 + VMButton.W_OFFSET;
+ private void drawButtonText(GC gc, Rectangle rect) {
+ VMProperty property = getProperty();
+ if (property == null) {
+ return;
+ }
- gc.setFont(FontResources.VM_BUTTON_TITLE_FONT.getFont());
- gc.setForeground(attr.getFontColor(state));
+ int x = 0;
+ Point p = null;
+ p = gc.textExtent(property.getName(), SWT.DRAW_MNEMONIC);
+ x = (rect.width - p.x) / 2;
- if (vmAttr.isSelected()) {
- gc.setForeground(ColorResources.BLUE.getColor());
- }
+ // drawing Title
+ gc.setFont(FontResources.VM_BUTTON_TITLE_FONT.getFont());
+ gc.setForeground(fontColors.get(state.getId()));
+ gc.drawString(property.getName(), x, 8, true);
- gc.drawString(property.getName(), x, 8, true);
+ // reset font coloer
+ gc.setForeground(fontColors.get(WSTATE.NORMAL.getId()));
- // reset font coloer
- gc.setForeground(attr.getFontColor(state));
+ VMPropertyValue value = property.getPropertyValue();
- VMPropertyValue value = property.getPropertyValue();
-
- gc.drawString(property.getArch().name(), X_POINT, Y_POINT, true);
- gc.drawString(Integer.toString(value.ramSize), X_POINT, Y_POINT + Y_GAP * 2, true);
- gc.drawString(Integer.toString(value.dpi), X_POINT, Y_POINT + Y_GAP, true);
- gc.drawString(value.resolution.getStrValue(), RE_X_POINT, Y_POINT + Y_GAP * 3, true);
- }
+ gc.drawString(property.getArch().name(), X_POINT, Y_POINT, true);
+ gc.drawString(Integer.toString(value.ramSize), X_POINT, Y_POINT + Y_GAP, true);
+ gc.drawString(Integer.toString(value.dpi), X_POINT, Y_POINT + Y_GAP * 2, true);
+ gc.drawString(value.resolution.getStrValue(), RE_X_POINT, Y_POINT + Y_GAP * 3, true);
+ }
+
+ };
}
\ No newline at end of file
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonAttribute;
-import org.tizen.emulator.manager.vms.VMProperty;
-
-public class VMButtonAttribute extends DACustomButtonAttribute{
- private boolean selected = false;
- private VMProperty property = null;
-
- public boolean isSelected() {
- return selected;
- }
- public void setSelected(boolean selected) {
- this.selected = selected;
- }
- public VMProperty getProperty() {
- return property;
- }
- public void setProperty(VMProperty property) {
- this.property = property;
- }
-}
+++ /dev/null
-package org.tizen.emulator.manager.ui.widgets;
-
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Event;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButton;
-import org.tizen.emulator.manager.da.widgets.button.DACustomButtonClickEventListener;
-
-public abstract class VMButtonClickEventListener extends DACustomButtonClickEventListener{
- @Override
- public void handleEvent(Event event) {
- DACustomButton button = (DACustomButton) event.widget;
- if (null != button && button.getState() != DACustomButton.STATE_DISABLE) {
- Rectangle rectangle = button.getBounds();
- int x = event.x;
- int y = event.y;
-
- if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
- return;
- } else {
- // -> open detail view
- // -> start emulator
- /*
- if ((x > 33 && x < 73) && (y > 118 && y < 133)) {
- //new MessageDialog().openInfoDialog("TEST");
- } else {
-
- }
- */
- }
- } else {
- return;
- }
-
- handleClickEvent(button);
- }
-}
\ No newline at end of file
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+
+public enum WSTATE {
+ NORMAL(0),
+ HOVER(1),
+ PUSH(2),
+ SELECTED(3),
+ SELECTED_HOVER(4),
+ DISABLE(5);
+
+ private int id;
+ WSTATE(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.widgets;
+
+import org.eclipse.swt.widgets.Widget;
+
+class WidgetHelper {
+ public static void tryDispose(final Object... Disposables) {
+ if (null == Disposables) {
+ return;
+ }
+
+ for (Object obj : Disposables) {
+ if (null == obj) {
+ continue;
+ }
+ if (obj instanceof Widget) {
+ ((Widget) obj).dispose();
+ }
+ }
+ }
+}
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.platform.SkinList;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
this.property = EmulatorVMList.getInstance().getNewProperty(newVM.vmsName);
this.newVM = newVM;
- this.folder = new File(FilePath.getInstance().getVirtualTargetPath(newVM.vmsName));
+ this.folder = new File(FilePathResouces.getInstance().getVirtualTargetPath(newVM.vmsName));
}
public VMProperty createInternal() throws VMWorkerException {
throw e;
}
- File log = new File(FilePath.getInstance().getVirtualTargetLogPath(newVM.vmsName));
+ File log = new File(FilePathResouces.getInstance().getVirtualTargetLogPath(newVM.vmsName));
log.mkdir();
settingProperty();
createInitialVMImageInternal(newVM.baseImagePath, customPath);
- String swap_base_path = FilePath.getInstance().getSwapPath() + File.separator + StringResources.SWAP_IMAGE;
+ String swap_base_path = FilePathResouces.getInstance().getSwapPath() + File.separator + StringResources.SWAP_IMAGE;
if (!new File(swap_base_path).exists()) {
return;
}
}
private void createSwapImageInternal(String basePath, String targetPath) throws VMCreatorException {
- String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
+ String exe_path = FilePathResouces.getInstance().getBinPath() + File.separator + "qemu-img";
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
if (!new QemuImgProc(cmd).Running()) {
throw new VMCreatorException("Failed to create the VM because of failed qemu-img processing.\n"
+ "You can get more information in log file ("
- + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
+ + FilePathResouces.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
}
}
private void checkCustomBaseImage(final String path) throws VMCreatorException {
- String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
+ String exe_path = FilePathResouces.getInstance().getBinPath() + File.separator + "qemu-img";
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
}
public void createInitialVMImageInternal(String baseImagePath, String targetImagePath) throws VMCreatorException {
- String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
+ String exe_path = FilePathResouces.getInstance().getBinPath() + File.separator + "qemu-img";
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
if (!new QemuImgProc(cmd).Running()) {
throw new VMCreatorException("Failed to create the VM because of failed qemu-img processing.\n"
+ "You can get more information in log file ("
- + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
+ + FilePathResouces.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
}
}
import javax.xml.transform.stream.StreamSource;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
public void setVMsBaseDirectory(String baseVMsDir) {
vmsBaseDirectoryName = baseVMsDir;
vmsConfigDirectory = vmsBaseDirectoryName + File.separator + "vms";
- FilePath.setVMSPath();
+ FilePathResouces.setVMSPath();
}
public String getTizenSdkDataPath() {
}
public VMProperty getNewProperty(String name) {
- String configDirectoryName = FilePath.getInstance().getTizenVmsPath() + File.separator + name;
+ String configDirectoryName = FilePathResouces.getInstance().getTizenVmsPath() + File.separator + name;
String configFilename = configDirectoryName + File.separator + StringResources.PROPERTY_XML_NAME;
File configFile = new File(configFilename);
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.tool.PortHelper;
logger.log(Level.INFO, String.format("MAC set as default = %s", macAddr));
}
- FilePath fio = FilePath.getInstance();
+ FilePathResouces fio = FilePathResouces.getInstance();
if (path == null || path.isEmpty()) {
cmd.add(fio.getBinPath() + File.separator + binary);
} else {
}
public Process launch(List<String> cmd) {
- FilePath fio = FilePath.getInstance();
+ FilePathResouces fio = FilePathResouces.getInstance();
ProcessBuilder pb = new ProcessBuilder(cmd);
if (this.binPath == null || this.binPath.isEmpty()) {
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.vms;
import java.io.BufferedReader;
import java.util.logging.Level;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
public class QemuImgProc {
private List<String> cmd = null;
isError = false;
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePath.getInstance().getBinPath()));
+ pb.directory(new File(FilePathResouces.getInstance().getBinPath()));
try {
Process process = pb.start();
if (process != null) {
"Error while running 'qemu-img'. Exit value : " + process.exitValue());
errorMsg = "Error while running 'qemu-img'. Exit value : " + process.exitValue() +
"\nYou can get more information in log file ("
- + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)";
+ + FilePathResouces.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)";
}
} catch (InterruptedException e) {
isError = true;
isError = false;
ProcessBuilder pb = new ProcessBuilder(cmd);
- pb.directory(new File(FilePath.getInstance().getBinPath()));
+ pb.directory(new File(FilePathResouces.getInstance().getBinPath()));
try {
Process process = pb.start();
if (process != null) {
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ *
+ * 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.vms;
public enum SKIN_TYPE {
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePath;
+import org.tizen.emulator.manager.resources.FilePathResouces;
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.MenuHandling;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
+ "File does not exist :" + baseImage.getAbsolutePath());
}
- String exe_path = FilePath.getInstance().getBinPath() + File.separator + "qemu-img";
+ String exe_path = FilePathResouces.getInstance().getBinPath() + File.separator + "qemu-img";
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
throw new VMWorkerException("Failed to create new base image becauese of failed qemu-img processing!"
+ StringResources.NEW_LINE
+ "You can get more information in log file ("
- + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
+ + FilePathResouces.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
}
}
} else {
throw new VMWorkerException("Failed to create new base image becauese of failed qemu-img processing!"
+ StringResources.NEW_LINE
+ "You can get more information in log file ("
- + FilePath.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
+ + FilePathResouces.getInstance().getTizenVmsPath() + File.separator + "emulator-manager)");
}
}
}
}
if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) {
- String swapBasePath = FilePath.getInstance().getSwapPath() + File.separator + StringResources.SWAP_IMAGE;
+ String swapBasePath = FilePathResouces.getInstance().getSwapPath() + File.separator + StringResources.SWAP_IMAGE;
String swapTargetPath = property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue();
if (!new File(swapBasePath).exists()) {
return;