- Show mark ("*") when mandatory option is empty or not selected.
- In New base image dialog, apply highlight box to image file
text box.
Change-Id: I9c49ec8db0d959c223e31f32befa585a66383d62
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
ADVANCED_OPTION_BORDER(194, 208, 211),
+ ESSENTIAL_MARK(0, 86, 167),
+
// TODO I guess .. little brighter than MESSAGE_BOX_CONTENTS_FONT
DISABLED_TEXT(160, 160, 160);
TEXT_INPUT_BOX_SELECT_RT("9p_text_input_box_selected_rt"),
TEXT_INPUT_BOX_SELECT_T("9p_text_input_box_selected_t"),
+ TEXT_INPUT_BOX_LEAD_B("9p_text_input_box_lead_b"),
+ TEXT_INPUT_BOX_LEAD_L("9p_text_input_box_lead_l"),
+ TEXT_INPUT_BOX_LEAD_LB("9p_text_input_box_lead_lb"),
+ TEXT_INPUT_BOX_LEAD_LT("9p_text_input_box_lead_lt"),
+ TEXT_INPUT_BOX_LEAD_R("9p_text_input_box_lead_r"),
+ TEXT_INPUT_BOX_LEAD_RB("9p_text_input_box_lead_rb"),
+ TEXT_INPUT_BOX_LEAD_RT("9p_text_input_box_lead_rt"),
+ TEXT_INPUT_BOX_LEAD_T("9p_text_input_box_lead_t"),
+
+
// drop down box
DROP_DOWN_BOX_DISABLE_B("9p_drop_down_box_disable_b"),
DROP_DOWN_BOX_DISABLE_L("9p_drop_down_box_disable_l"),
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@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.renewal.item;
+
+public enum ItemState {
+ NORMAL(0),
+ WARNING(1),
+ ERROR(2),
+ EMPTY(3);
+
+ int code;
+
+ private ItemState(int code) {
+ this.code = code;
+ }
+}
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.renewal.MainDialog;
import org.tizen.emulator.manager.ui.renewal.dialog.MessageBox;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.FileDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
import org.tizen.emulator.manager.vms.VMProperty.Architecture;
import org.tizen.emulator.manager.vms.helper.HelperClass;
import org.tizen.emulator.manager.vms.helper.QemuImgProc;
public boolean isValid() {
boolean isValid = true;
String msg = "";
+ ItemState itemState = ItemState.NORMAL;
if (filePath == null || filePath.isEmpty()) {
msg = "select base image path";
isValid = false;
+ itemState = ItemState.EMPTY;
}
- changeItemState(!isValid, TEXT_BOX_WIDTH + 37 /* TODO: dialog button width*/, msg);
+ changeItemState(itemState, TEXT_BOX_WIDTH + 37 /* TODO: dialog button width*/, msg);
return isValid;
}
+
@Override
- public void changeWidgetState(boolean isError) {
+ public void changeWidgetState() {
if (textBox == null) {
return;
}
if (getItemListComp().isCreateMode()) {
- textBox.setError(isError);
+ if (isNormalState()) {
+ textBox.setWidgetState(WSTATE.NORMAL);
+ item.getItemTitle().redrawMark(false);
+
+ } else if (isErrorState()) {
+ textBox.setWidgetState(WSTATE.ERROR);
+ item.getItemTitle().redrawMark(false);
+
+ } else if (isEmptyState()) {
+ textBox.setWidgetState(WSTATE.LEAD);
+ item.getItemTitle().redrawMark(true);
+ }
}
}
+
}
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.renewal.resources.ImageResources;
import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.NameItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.TextInputBoxItem;
// create(clone), modify mode
msg = checkBaseImageName(value);
+ ItemState itemState = ItemState.NORMAL;
if (!msg.isEmpty()) {
isValid = false;
+ if (value.isEmpty()) {
+ itemState = ItemState.EMPTY;
+
+ } else {
+ itemState = ItemState.ERROR;
+ }
}
// changeItemState() -> changeWidgetState()
- changeItemState(!isValid, INPUT_BOX_WIDTH, msg);
+ changeItemState(itemState, INPUT_BOX_WIDTH, msg);
return isValid;
}
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
public abstract class ComboItem extends ModifyDialogItem {
@Override
- public void changeWidgetState(boolean isError) {
- comboBox.setError(isError);
+ public void changeWidgetState() {
+ if (isNormalState()) {
+ comboBox.setWidgetState(WSTATE.NORMAL);
+
+ } else if (isErrorState()) {
+ comboBox.setWidgetState(WSTATE.ERROR);
+ }
}
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
import org.tizen.emulator.manager.ui.renewal.widgets.BlueButton;
import org.tizen.emulator.manager.ui.renewal.widgets.TextBox;
+import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
public abstract class FileDialogItem extends ModifyDialogItem {
}
@Override
- public void changeWidgetState(boolean isError) {
+ public void changeWidgetState() {
if (!getItemListComp().isDetailMode()) {
- textBox.setError(isError);
+ if (isNormalState()) {
+ textBox.setWidgetState(WSTATE.NORMAL);
+
+ } else if (isErrorState()) {
+ textBox.setWidgetState(WSTATE.ERROR);
+ }
}
}
+
+
@Override
public boolean isItemDisabled() {
if (textBox.isDisabled()) {
import org.eclipse.swt.widgets.Canvas;
import org.tizen.emulator.manager.renewal.resources.ImageResources;
import org.tizen.emulator.manager.ui.renewal.dialog.ItemListComp;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.IconItemTitle;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ItemTitle;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
protected PropertyValue propertyValue;
protected Canvas stateIconCanvas;
+ private ItemState itemState;
public static final int ERROR_ICON_SIZE = 16;
public static final int ERROR_ICON_SPACING = 6;
return ModifyItem.ITEM_HEIGHT;
}
- public void changeWidgetState(boolean isError) {
+ public void changeWidgetState() {
// Override this.
// In this function, you change widget in item to error state.
// For example, change border color red of combobox, input text box.
}
/** This change item's state : error or normal */
- public void changeItemState(boolean isError, int contentRight, String msg) {
- changeWidgetState(isError);
- changeStateIcon(isError, ModifyItem.BODY_MARGIN_LEFT + contentRight, msg);
+ public void changeItemState(ItemState itemState, int contentRight, String msg) {
+ this.itemState = itemState;
+ changeWidgetState();
+ changeStateIcon(ModifyItem.BODY_MARGIN_LEFT + contentRight, msg);
}
public void removeStateIcon() {
- changeStateIcon(false, 0, "");
+ itemState = ItemState.NORMAL;
+ changeStateIcon(0, "");
}
- public void changeStateIcon(boolean isError, int contentRight, String msg) {
+ public void changeStateIcon(int contentRight, String msg) {
if (item == null) {
return;
}
- if (isError) {
+ if (isNormalState() || isEmptyState()) {
+ if (stateIconCanvas == null || stateIconCanvas.isDisposed()) {
+ return;
+ }
+ // hide error icon
+ FormData data = new FormData(0, 0);
+ stateIconCanvas.setLayoutData(data);
+
+ } else {
// show error icon
if (stateIconCanvas == null || stateIconCanvas.isDisposed()) {
stateIconCanvas = new Canvas(item.getBody(), SWT.NONE);
stateIconCanvas.setLayoutData(data);
stateIconCanvas.setToolTipText(msg);
stateIconCanvas.moveAbove(null);
-
- } else {
- if (stateIconCanvas == null || stateIconCanvas.isDisposed()) {
- return;
- }
- // hide error icon
- FormData data = new FormData(0, 0);
- stateIconCanvas.setLayoutData(data);
}
stateIconCanvas.redraw();
-
item.getBody().layout(true,true);
}
public boolean isDetailMode() {
return itemListComp.isDetailMode();
}
+
+ public boolean isNormalState() {
+ return itemState == ItemState.NORMAL;
+ }
+
+ public ItemState getItemState() {
+ return itemState;
+ }
+
+ public boolean isWarningState() {
+ return itemState == ItemState.WARNING;
+ }
+
+ public boolean isErrorState() {
+ return itemState == ItemState.ERROR;
+ }
+
+ public boolean isEmptyState() {
+ return itemState == ItemState.EMPTY;
+ }
+
+ public void checkEmptyState() {
+ if (isEmptyState()) {
+ item.getItemTitle().redrawMark(true);
+ return;
+ }
+
+ item.getItemTitle().redrawMark(false);
+ }
}
+
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.Messages;
import org.tizen.emulator.manager.ui.renewal.dialog.DIALOG_MODE;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.helper.HelperClass;
// TODO
}
+ ItemState itemState = ItemState.NORMAL;
if (!msg.isEmpty()) {
isValid = false;
+ if (value.isEmpty()) {
+ itemState = ItemState.EMPTY;
+
+ } else {
+ itemState = ItemState.ERROR;
+ }
}
- changeItemState(!isValid, INPUT_BOX_WIDTH, msg);
+ changeItemState(itemState, INPUT_BOX_WIDTH, msg);
return isValid;
}
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.IconItemTitle;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
import org.tizen.emulator.manager.ui.renewal.widgets.TextInputBox;
+import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
public abstract class TextInputBoxItem extends ModifyDialogItem {
protected String value = "";
+ private int bodyMarginLeft = ModifyItem.BODY_MARGIN_LEFT;
+
/** This is called when text is modified */
public abstract void textModified();
item.setTitleEnable(enable);
textInputBox.setEnabled(enable);
removeStateIcon();
+ item.getItemTitle().redrawMark(false);
}
}
}
}
+ public void setBodyMarginLeft(int margin) {
+ bodyMarginLeft = margin;
+ }
private void createDetailItem() {
item.setBodyLayoutForm();
protected void createTextBox(int textBoxWidth, boolean needClearButton) {
FormData data = new FormData(textBoxWidth, ModifyItem.WIDGET_HEIGHT);
data.top = new FormAttachment(0, (item.getHeight() - ModifyItem.WIDGET_HEIGHT) / 2);
- data.left = new FormAttachment(0, ModifyItem.BODY_MARGIN_LEFT);
+ data.left = new FormAttachment(0, bodyMarginLeft);
textInputBox = new TextInputBox(item.getBody(), SWT.NONE, needClearButton);
textInputBox.setLayoutData(data);
}
@Override
- public void changeWidgetState(boolean isError) {
+ public void changeWidgetState() {
if (!getItemListComp().isDetailMode()) {
- textInputBox.setError(isError);
+ changeInputboxState();
}
}
+
+ public void changeInputboxState() {
+ checkEmptyState();
+
+ if (isNormalState() || isEmptyState()) {
+ textInputBox.setWidgetState(WSTATE.NORMAL);
+
+ } else if (isErrorState()) {
+ textInputBox.setWidgetState(WSTATE.ERROR);
+ }
+ // TODO warning state
+ }
+
}
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.tizen.emulator.manager.renewal.resources.ColorResources;
private void makeIcon() {
// init
- GridData data = new GridData(ICON_WIDTH, ICON_HEIGHT);
- data.verticalAlignment = SWT.CENTER;
- data.grabExcessVerticalSpace = true;
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, marginLeft);
+ data.width = ICON_WIDTH;
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, -1);
+
iconCanvas = new Canvas(this, SWT.NONE);
iconCanvas.setLayoutData(data);
@Override
public void paintControl(PaintEvent e) {
GC gc = e.gc;
- gc.drawImage(iconResource.getImage(), 0, 0);
+ int itemHeight = ((Canvas)e.widget).getBounds().height - ModifyItem.LINE_WIDTH;
+ gc.drawImage(iconResource.getImage(), 0, (itemHeight - ICON_HEIGHT) / 2);
}
});
}
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.renewal.resources.FontResources;
+import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
public class ItemTitle extends Canvas{
ColorResources.MODIFY_ITEM_TITLE_BACKGROUND;
protected final String title;
- private int marginLeft = 0;
+ protected int marginLeft = 0;
private int titleIndent = 0;
protected final ColorResources background;
boolean isDrawBottomLine = true;
+ protected Canvas titleCanvas;
+ protected Canvas markCanvas; // for essential mark ("*")
+ private boolean drawMark = false;
+ private static final String ESSENTIAL_MARK = "*";
+ private static final int MARK_SPACING = 4;
+
protected boolean isTitleEnable = true;
public ItemTitle(Composite parent, String title, int marginLeft, int titleIndent, ColorResources background) {
init();
isDrawBottomLine = drawLine;
makeTitle();
+ makeMark();
+ }
+
+ protected void makeMark() {
+ markCanvas = new Canvas(this, SWT.NONE);
+ FormData data = new FormData();
+ layoutMark(data);
+ markCanvas.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ int itemHeight = ((Canvas)e.widget).getBounds().height - ModifyItem.LINE_WIDTH;
+
+ // draw text
+ String text = "";
+ if (drawMark) {
+ text = ESSENTIAL_MARK;
+ }
+ gc.setFont(FontResources.MODIFY_ITEM_TITLE.getFont());
+ gc.setForeground(ColorResources.ESSENTIAL_MARK.getColor());
+ Point textExt = gc.textExtent(text);
+ int titleY = (itemHeight - textExt.y) / 2 + 1;
+ gc.drawText(text, 0, titleY);
+ }
+ });
+ }
+
+ private void layoutMark(FormData data) {
+ if (drawMark) {
+ data.left = new FormAttachment(titleCanvas, MARK_SPACING);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, -1);
+ data.width = WidgetHelper.calcTextWidth(markCanvas, ESSENTIAL_MARK,
+ FontResources.MODIFY_ITEM_TITLE.getFont());
+
+ } else {
+ data.left = new FormAttachment(0,-1);
+ data.top = new FormAttachment(0,-1);
+ data.width = 0;
+ data.height = 0;
+ }
+
+ markCanvas.setLayoutData(data);
+ layout();
+ }
+
+ public void redrawMark(boolean draw) {
+ drawMark = draw;
+ layoutMark((FormData)markCanvas.getLayoutData());
+ markCanvas.redraw();
}
public boolean isTitleEnable() {
redraw();
}
+ @Override
+ public void redraw() {
+ super.redraw();
+ titleCanvas.redraw();
+ markCanvas.redraw();
+ }
+
protected void init() {
GridData data = new GridData();
data.grabExcessVerticalSpace = true;
this.setBackgroundMode(SWT.INHERIT_FORCE);
// layout
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = marginLeft;
- this.setLayout(layout);
+ this.setLayout(new FormLayout());
+
}
private void makeTitle() {
- // draw title, under line
- this.addPaintListener(new PaintListener() {
+ titleCanvas = new Canvas(this, SWT.NONE);
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, titleIndent);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, -1);
+ data.width = WidgetHelper.calcTextWidth(titleCanvas, title,
+ FontResources.MODIFY_ITEM_TITLE.getFont());
+ titleCanvas.setLayoutData(data);
+
+ // draw title
+ titleCanvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
Point textExt = gc.textExtent(title);
int titleY = (itemHeight - textExt.y) / 2;
- gc.drawText(title,
- titleIndent, titleY);
+ gc.drawText(title, 0, titleY);
+
+ }
+
+ });
+
+ // draw under line
+ this.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ int itemHeight = ((Canvas)e.widget).getBounds().height - ModifyItem.LINE_WIDTH;
// draw under line
if (isDrawBottomLine) {
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
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.layout.GridData;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.renewal.resources.FontResources;
+import org.tizen.emulator.manager.ui.renewal.widgets.WidgetHelper;
public class SubItemTitle extends ItemTitle{
protected void create(boolean drawBottomLine) {
init();
makeTitle(drawBottomLine);
+ makeEmptyMark();
+ }
+
+
+ private void makeEmptyMark() {
+ super.makeMark();
+// markCanvas = new Canvas(this, SWT.NONE);
+// markCanvas.setLayoutData(new FormData(0, 0));
}
@Override
this.setBackgroundMode(SWT.INHERIT_FORCE);
// layout
-// GridLayout layout = new GridLayout();
-// layout.numColumns = 1;
-// layout.marginWidth = MARGIN_LEFT;
-// this.setLayout(layout);
+ this.setLayout(new FormLayout());
}
private void makeTitle(final boolean drawLine) {
- // draw title, under line
- this.addPaintListener(new PaintListener() {
+ titleCanvas = new Canvas(this, SWT.NONE);
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, MARGIN_LEFT);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, -1);
+ data.width = WidgetHelper.calcTextWidth(titleCanvas, title,
+ FontResources.MODIFY_ITEM_TITLE.getFont());
+ titleCanvas.setLayoutData(data);
+
+ // draw title
+ titleCanvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
+ // TODO Auto-generated method stub
GC gc = e.gc;
int itemHeight = ((Canvas)e.widget).getBounds().height - ModifyItem.LINE_WIDTH;
gc.setFont(FontResources.MODIFY_ITEM_TITLE.getFont());
Point textExt = gc.textExtent(title);
int titleY = (itemHeight - textExt.y) / 2;
- gc.drawText(title, MARGIN_LEFT, titleY);
+ gc.drawText(title, 0, titleY);
+ }
+ });
+
+ // draw under line
+ this.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ int itemHeight = ((Canvas)e.widget).getBounds().height - ModifyItem.LINE_WIDTH;
// draw right vertical line
if (drawVerticalLine) {
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
private void makeArrow() {
// init
- GridData data = new GridData(IconItemTitle.ICON_WIDTH, IconItemTitle.ICON_HEIGHT);
- data.verticalAlignment = SWT.CENTER;
- data.grabExcessVerticalSpace = true;
+ FormData data = new FormData(ICON_WIDTH, ICON_HEIGHT);
+ data.left = new FormAttachment(0, marginLeft);
+ data.top = new FormAttachment(0, (ModifyItem.ITEM_HEIGHT - ICON_HEIGHT) / 2);
+
arrowCanvas = new Canvas(this, SWT.NONE);
arrowCanvas.setLayoutData(data);
import org.tizen.emulator.manager.resources.FilePathResources;
import org.tizen.emulator.manager.ui.Messages;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.FileDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
}
}
+ ItemState itemState = ItemState.NORMAL;
if (!msg.isEmpty()) {
isValid = false;
+ itemState = ItemState.ERROR;
}
- changeItemState(!isValid, getContentRight(SubModifyItem.BOX_WIDTH), msg);
+ changeItemState(itemState, getContentRight(SubModifyItem.BOX_WIDTH), msg);
return isValid;
}
import org.tizen.emulator.manager.platform.Profile;
import org.tizen.emulator.manager.platform.ProfileList;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
String msg = "";
boolean isValid = true;
+ ItemState itemState = ItemState.NORMAL;
if (template == null) {
isValid = false;
msg = "Please select device-template.";
+ itemState = ItemState.ERROR;
}
- changeItemState(!isValid, COMBO_WIDTH, msg);
+ changeItemState(itemState, COMBO_WIDTH, msg);
return isValid;
}
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.tool.TapUtil;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.TextInputBoxItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
@Override
public boolean isValid() {
- if (getItemListComp().isDetailMode()) {
+ if (getItemListComp().isDetailMode() || !textInputBox.isEnabled()) {
return true;
}
boolean isValid = true;
String msg = TapUtil.checkIPString(textInputBox.isEnabled(), super.value, getTitle());
+
+ ItemState itemState = ItemState.NORMAL;
if (!msg.isEmpty()) {
isValid = false;
+
+ if (super.value.isEmpty()) {
+ itemState = ItemState.EMPTY;
+
+ } else {
+ itemState = ItemState.ERROR;
+ }
}
- changeItemState(!isValid, INPUT_BOX_WIDTH, msg);
+ changeItemState(itemState, INPUT_BOX_WIDTH, msg);
return isValid;
}
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.tool.TapUtil;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.TextInputBoxItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.WSTATE;
public class NetIPSubItem extends TextInputBoxItem {
private final int BOX_WIDTH = 125;
- private final int TITLE_WIDTH = 80;
+ private final int TITLE_WIDTH = 85;
public NetIPSubItem(String name, String title) {
super(name, title);
setDrawBottomLine(false); // for item body
item.create();
+ setBodyMarginLeft(5);
makeBody(BOX_WIDTH, false, true);
resetItem();
boolean isValid = true;
String msg = "";
msg = TapUtil.checkIPString(textInputBox.isEnabled(), super.value, getTitle());
+
+ ItemState itemState = ItemState.NORMAL;
if (!msg.isEmpty()) {
isValid = false;
- }
- changeItemState(!isValid, BOX_WIDTH, msg);
+ if (super.value.isEmpty()) {
+ itemState = ItemState.EMPTY;
+
+ } else {
+ itemState = ItemState.ERROR;
+ }
+ }
+ changeItemState(itemState, BOX_WIDTH, msg);
return isValid;
}
+ @Override
+ public void changeInputboxState() {
+ if (isEmptyState()) {
+ textInputBox.setWidgetState(WSTATE.NORMAL);
+ item.getItemTitle().redrawMark(true);
+
+ } else if (isNormalState()) {
+ textInputBox.setWidgetState(WSTATE.NORMAL);
+ item.getItemTitle().redrawMark(false);
+
+ } else if (isErrorState()) {
+ textInputBox.setWidgetState(WSTATE.ERROR);
+ item.getItemTitle().redrawMark(false);
+ }
+ // TODO warning state
+ }
+
public void resetItem() {
boolean useDHCP = propertyValue.getCheckBoxValue(
ItemName.NET_IP_INFO, ItemName.NET_USE_DHCP);
import org.tizen.emulator.manager.ui.Messages;
import org.tizen.emulator.manager.ui.dialog.ProxyDialog;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
}
}
- changeItemState(!isValid, SubModifyItem.ERROR_BUTTON_RIGHT, msg);
+ changeItemState(isValid? ItemState.NORMAL : ItemState.ERROR,
+ SubModifyItem.ERROR_BUTTON_RIGHT, msg);
return isValid;
}
import org.tizen.emulator.manager.tool.TapUtil;
import org.tizen.emulator.manager.ui.renewal.dialog.TapDeviceDialogForWin;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem;
import org.tizen.emulator.manager.ui.renewal.widgets.ImageButton;
isValid = false;
}
}
- changeItemState(!isValid, SubModifyItem.BOX_WIDTH + SubModifyItem.BUTTON_SPACE
+ changeItemState(isValid? ItemState.NORMAL : ItemState.ERROR,
+ SubModifyItem.BOX_WIDTH + SubModifyItem.BUTTON_SPACE
+ SubModifyItem.BUTTON_WIDTH, msg);
return isValid;
}
import org.tizen.emulator.manager.renewal.resources.ColorResources;
import org.tizen.emulator.manager.ui.renewal.MainDialog;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.ItemState;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.FileDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
}
}
- changeItemState(!isValid, BOX_WIDTH + 37 /* TODO: dialog button width*/, msg);
+ changeItemState(isValid? ItemState.NORMAL : ItemState.ERROR,
+ BOX_WIDTH + 37 /* TODO: dialog button width*/, msg);
return isValid;
}
}
});
}
- public void setError(boolean isError) {
- if (isError) {
- setState(WSTATE.ERROR);
-
- } else {
- // TODO is enough ?
- if (!isDisabled()) {
- setState(WSTATE.NORMAL);
- }
- }
+
+ public void setWidgetState(WSTATE state) {
+ setState(state);
redraw();
}
ImageResources.INPUT_BOX_ERROR_B,
ImageResources.INPUT_BOX_ERROR_LB,
ImageResources.INPUT_BOX_ERROR_L);
+
+ ninePatchResourceMap.setImages(WSTATE.LEAD, ColorResources.WHITE,
+ ColorResources.WHITE,
+ ImageResources.TEXT_INPUT_BOX_LEAD_LT,
+ ImageResources.TEXT_INPUT_BOX_LEAD_T,
+ ImageResources.TEXT_INPUT_BOX_LEAD_RT,
+ ImageResources.TEXT_INPUT_BOX_LEAD_R,
+ ImageResources.TEXT_INPUT_BOX_LEAD_RB,
+ ImageResources.TEXT_INPUT_BOX_LEAD_B,
+ ImageResources.TEXT_INPUT_BOX_LEAD_LB,
+ ImageResources.TEXT_INPUT_BOX_LEAD_L);
}
}
ImageResources.INPUT_BOX_ERROR_B,
ImageResources.INPUT_BOX_ERROR_LB,
ImageResources.INPUT_BOX_ERROR_L);
+
+ ninePatchResourceMap.setImages(WSTATE.LEAD, ColorResources.WHITE,
+ ColorResources.BLACK,
+ ImageResources.TEXT_INPUT_BOX_LEAD_LT,
+ ImageResources.TEXT_INPUT_BOX_LEAD_T,
+ ImageResources.TEXT_INPUT_BOX_LEAD_RT,
+ ImageResources.TEXT_INPUT_BOX_LEAD_R,
+ ImageResources.TEXT_INPUT_BOX_LEAD_RB,
+ ImageResources.TEXT_INPUT_BOX_LEAD_B,
+ ImageResources.TEXT_INPUT_BOX_LEAD_LB,
+ ImageResources.TEXT_INPUT_BOX_LEAD_L);
}
public void setClearButtonStatus() {
SELECTED_PUSH(5),
DISABLE_ON(6),
DISABLE_OFF(7),
- ERROR(8);
+ ERROR(8),
+ LEAD(9); // highlight box
private int id;
WSTATE(int id) {
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
});
}
+ public static int calcTextWidth(Composite comp, String text, Font font) {
+ Point p = null;
+ comp.setFont(font);
+ GC gc = new GC(comp);
+ gc.setFont(comp.getFont());
+ p = gc.textExtent(text);
+ gc.dispose();
+ return p.x;
+ }
+
public static void drawSubTitle(Composite comp, final String text, final int horizentalAlign,
final int titleWidth) {
comp.addPaintListener(new PaintListener() {