Add tuner option.
- Move some common function to CategoryItem.
Change-Id: I8994b26fbdda6e4b49e1ecced5fcc251bd81212f
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
ICON_TITLE_OCI_DEVICE2("icon_title_oci_device"),
ICON_TITLE_SENSOR("icon_title_sensor"),
ICON_TITLE_TUNER("icon_title_tuner"),
+ ICON_TITLE_TUNER_01("icon_title_tuner_01"),
ICON_TITLE_VERSION("icon_title_version"),
ICON_TITLE_PROCESSOR("icon_title_processor"),
ICON_TITLE_TREE_EXPANDED("icon_title_tree_expanded"),
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.NetTapDeviceItemForWin;
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.NetworkItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.OCIDeviceItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerCountryItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerSystemItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.TunerTableItem;
public class CommonItemListFactory implements IItemListFactory{
} else if (name.equals(ItemName.CAMERA_IMAGE_REAR)) {
categoryItem.addSubItems(new CameraImageItem(name, title));
+
+ } else if (name.equals(ItemName.TUNER_SYSTEM)) {
+ categoryItem.addSubItems(new TunerSystemItem(title,
+ VMTemplateUtil.getOptionList(item.getOptions())));
+
+ } else if (name.equals(ItemName.TUNER_COUNTRY)) {
+ categoryItem.addSubItems(new TunerCountryItem(title,
+ VMTemplateUtil.getOptionList(item.getOptions())));
+
+ } else if (name.equals(ItemName.TUNER_TABLE)) {
+ categoryItem.addSubItems(new TunerTableItem(title));
}
+
}
} else if (name.equals(ItemName.OCI_DEVICE)) {
// TODO this may be moved to tv plugin.
itemList.add(new OCIDeviceItem(title));
+
+ } else if (name.equals(ItemName.TUNER)) {
+ TunerItem tunerItem = new TunerItem(title);
+ itemList.add(tunerItem);
+ addSubItems(item.getSubItems(), tunerItem);
}
}
public static final String TUNER_NUMBER="number"; //$NON-NLS-1$
public static final String TUNER_SYSTEM="system"; //$NON-NLS-1$
public static final String TUNER_COUNTRY="country"; //$NON-NLS-1$
+ public static final String TUNER_TABLE = "table";
public static final String TUNER_FILE_PATH="tunerFilePath"; //$NON-NLS-1$
public static final String TUNER_FILE_NAME="tunerFileName"; //$NON-NLS-1$
protected Canvas createDetailItem(String text) {
+ if (text == null) {
+ text = "";
+ }
item.setBodyLayoutForm();
Canvas canvas = new Canvas(item.getBody(), SWT.NONE) ;
canvas.setLayoutData(getDetailItemFormData());
}
- private void createSubItems() {
- for (ModifyDialogItem item : subItems) {
- item.setParentItem(this);
- item.setItemListComp(this.getItemListComp());
- item.setInitialValue(this.getItemListComp().getPropertyValue());
- item.create(this.item.getBody());
- item.setVisible();
- }
+
+ @Override
+ protected void createSubItems() {
+ super.createSubItems();
if (getItemListComp().isDetailMode()) {
return;
boolean useRear = value.getCheckBoxValue(ItemName.CAMERA, ItemName.CAMERA_REAR);
setRearCameraCheck(useRear);
}
+
}
}
}
- @Override
- public void setInitialValue(PropertyValue value) {
- // override this if you want.
- }
protected ModifyDialogItem getSubItemByName(String itemName) {
for (ModifyDialogItem subItem : subItems) {
return null;
}
+ protected void createSubItems() {
+ for (ModifyDialogItem item : subItems) {
+ item.setParentItem(this);
+ item.setItemListComp(this.getItemListComp());
+ item.setInitialValue(this.getItemListComp().getPropertyValue());
+ item.create(this.item.getBody());
+ item.setVisible();
+ }
+ }
+
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ // nothing to do
+ }
+
+
+
+ @Override
+ public boolean isValid() {
+ if (getItemListComp().isDetailMode()) {
+ return true;
+ }
+ boolean isValid = true;
+ for (ModifyDialogItem item : subItems) {
+ if(!item.isValid()) {
+ isValid = false;
+ }
+ }
+ return isValid;
+ }
+
}
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
-import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
public class NetworkItem extends CategoryItem {
createSubItems();
}
- private void createSubItems() {
- for (ModifyDialogItem item : subItems) {
- item.setItemListComp(this.getItemListComp());
- item.setInitialValue(this.getItemListComp().getPropertyValue());
- item.setParentItem(this);
- item.create(this.item.getBody());
- item.setVisible();
- }
- }
-
- @Override
- public void setInitialValue(PropertyValue value) {
- for (ModifyDialogItem item : subItems) {
- item.setInitialValue(value);
- }
- }
-
-
-
- @Override
- public boolean isValid() {
- if (getItemListComp().isDetailMode()) {
- return true;
- }
- boolean isValid = true;
- for (ModifyDialogItem item : subItems) {
- if(!item.isValid()) {
- isValid = false;
- }
- }
- return isValid;
- }
-
- @Override
- public ModifyDialogItem cloneItem() {
- NetworkItem item = new NetworkItem();
- for (ModifyDialogItem subItem : subItems) {
- item.addSubItems(subItem.cloneItem());
- }
- return item;
- }
public boolean isNATType() {
String connectType = getItemListComp().getPropertyValue().
item.changeItem(srcDialogItem);
}
}
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ NetworkItem item = new NetworkItem();
+ for (ModifyDialogItem subItem : subItems) {
+ item.addSubItems(subItem.cloneItem());
+ }
+
+ return item;
+ }
}
--- /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.modify.vm;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+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.PropertyValue;
+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.ComboBox;
+
+public class TunerCountryItem extends ComboItem {
+
+ List<String> optionList;
+ private String tunerCountry = "";
+ public static String SYSTEM_ATSC = "ATSC"; //$NON-NLS-1$
+
+ public TunerCountryItem(String title, List<String> optionList) {
+ super(ItemName.TUNER_COUNTRY, title);
+ this.optionList = optionList;
+ }
+
+ @Override
+ public void create(Composite parent) {
+ item = new SubModifyItem(this);
+ item.setItemHeight(SubModifyItem.ITEM_HEIGHT);
+ item.init(parent);
+ item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(),
+ ColorResources.WHITE));
+ item.create();
+
+ makeBody();
+ }
+
+ private void createDetailItem() {
+ createDetailItem(tunerCountry);
+ String tunerSystem = getItemListComp().getPropertyValue().getSubOptionValue(
+ ItemName.TUNER, ItemName.TUNER_SYSTEM);
+
+ setTitleEnable(SYSTEM_ATSC.equals(tunerSystem));
+ }
+
+
+ protected void makeBody() {
+ if (isDetailMode()) {
+ createDetailItem();
+ return;
+ }
+ // create combo
+ createCombo(item, SubModifyItem.BOX_WIDTH);
+
+ // init combo list
+ initComboList();
+ resetCombo(getItemListComp().getPropertyValue().getSubOptionValue(
+ ItemName.TUNER, ItemName.TUNER_SYSTEM));
+ }
+
+
+ public void resetCombo(String tunerSystem) {
+ if (getItemListComp().isCreateMode()
+ && tunerSystem == null || tunerSystem.isEmpty()) {
+ tunerSystem = SYSTEM_ATSC;
+ }
+
+ if (SYSTEM_ATSC.equals(tunerSystem)) {
+ // enable & init combo
+ setItemEnable(true);
+
+ // select item
+ selectItem();
+
+ } else {
+ // disable
+ tunerCountry = "";
+ comboBox.setText("");
+ setItemEnable(false);
+ }
+ }
+
+
+ private void initComboList() {
+ for (String str : optionList) {
+ addComboItem(str);
+ }
+
+ selectItem();
+ }
+
+ private void selectItem() {
+ if (comboBox == null || comboBox.isDisposed()) {
+ return;
+ }
+
+ int index = -1;
+ for (int i=0 ; i < getComboItemList().size() ; i++) {
+ if (getComboItemList().get(i).equals(tunerCountry)) {
+ index = i;
+ break;
+ }
+ }
+
+ if (index == -1 || getItemListComp().isCreateMode()) {
+ index = 0;
+ tunerCountry = getComboItem(index);
+ }
+ selectComboItem(index, false);
+ comboSelected();
+ }
+
+ @Override
+ public void itemSelected(ComboBox comboBox) {
+ // This is called when combo item is selected
+ tunerCountry = comboBox.getSelectedItem();
+
+ comboSelected();
+ }
+
+ private void comboSelected() {
+ getItemListComp().checkValid();
+ }
+
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ tunerCountry = value.getSubOptionValue(ItemName.TUNER, getName());
+ }
+
+ @Override
+ public void setValue(PropertyValue value) {
+ value.setSubOptionValue(ItemName.TUNER, getName(), tunerCountry);
+ }
+
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ return new TunerCountryItem(getTitle(), optionList);
+ }
+
+}
--- /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.modify.vm;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+
+public class TunerItem extends CategoryItem {
+
+ public TunerItem(String title) {
+ super(ItemName.TUNER, title);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void create(Composite parent) {
+ int itemHeight = 0;
+ if (subItems.size() == 0) {
+ itemHeight = ModifyItem.ITEM_HEIGHT;
+
+ } else {
+ subItems.get(subItems.size()-1).setDrawBottomLine(false);
+ itemHeight = getItemHeight();
+ }
+
+ for (ModifyDialogItem subItem : subItems) {
+ subItem.setDrawBottomLine(false);
+ }
+
+ item = new ModifyItem(this);
+// item.setItemHeight(ModifyItem.ITEM_HEIGHT * subItems.size());
+ item.setItemHeight(itemHeight);
+ item.init(parent);
+ item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_TUNER));
+ item.create();
+
+ makeBody();
+ }
+
+
+ private void makeBody() {
+ item.setBodyLayoutGrid(1, 0);
+ createSubItems();
+ }
+
+ public void resetCountryItem(String tunerSystem) {
+ TunerCountryItem item = (TunerCountryItem)getSubItemByName(ItemName.TUNER_COUNTRY);
+ if (item == null) {
+ return;
+ }
+ item.resetCombo(tunerSystem);
+ }
+
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ TunerItem item = new TunerItem(getTitle());
+ for (ModifyDialogItem subItem : subItems) {
+ item.addSubItems(subItem.cloneItem());
+ }
+
+ return item;
+ }
+
+}
--- /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.modify.vm;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+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.PropertyValue;
+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.ComboBox;
+
+public class TunerSystemItem extends ComboItem {
+
+ private String tunerSystem = "";
+ List<String> optionList;
+
+ public TunerSystemItem(String title, List<String> optionList) {
+ super(ItemName.TUNER_SYSTEM, title);
+ this.optionList = optionList;
+ }
+
+ @Override
+ public void create(Composite parent) {
+ item = new SubModifyItem(this);
+ item.setItemHeight(SubModifyItem.ITEM_HEIGHT);
+ item.init(parent);
+ item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(),
+ ColorResources.WHITE));
+ item.create();
+
+ makeBody();
+ }
+
+
+ protected void makeBody() {
+ if (isDetailMode()) {
+ createDetailItem(tunerSystem);
+ return;
+ }
+ // create combo
+ createCombo(item, SubModifyItem.BOX_WIDTH);
+
+ // init combo list
+ initComboList();
+ }
+
+
+ private void initComboList() {
+ for (String str : optionList) {
+ addComboItem(str);
+ }
+
+ selectItem();
+ }
+
+ private void selectItem() {
+ if (comboBox == null || comboBox.isDisposed()) {
+ return;
+ }
+
+ int index = -1;
+ for (int i=0 ; i < getComboItemList().size() ; i++) {
+ if (getComboItemList().get(i).equals(tunerSystem)) {
+ index = i;
+ break;
+ }
+ }
+
+ if (index == -1 || getItemListComp().isCreateMode()) {
+ index = 0;
+ tunerSystem = getComboItem(index);
+ }
+ selectComboItem(index, false);
+ comboSelected();
+ }
+
+ @Override
+ public void itemSelected(ComboBox comboBox) {
+ // This is called when combo item is selected
+ tunerSystem = comboBox.getSelectedItem();
+ ((TunerItem)getParentItem()).resetCountryItem(tunerSystem);
+
+ comboSelected();
+ }
+
+ private void comboSelected() {
+ getItemListComp().checkValid();
+ }
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ tunerSystem = value.getSubOptionValue(ItemName.TUNER, getName());
+ }
+
+ @Override
+ public void setValue(PropertyValue value) {
+ value.setSubOptionValue(ItemName.TUNER, getName(), tunerSystem);
+ }
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ return new TunerSystemItem(getTitle(), optionList);
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2012 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@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.modify.vm;
+
+import java.io.File;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+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.modify.common.FileDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem;
+
+public class TunerTableItem extends FileDialogItem {
+
+ private String newTableFilePath = "";
+ private String newTableFileName = "";
+ private static final int BOX_WIDTH = 154;
+
+ private static FileDialog fd;
+
+ public static String TABLE_DEFAULT = "tuner_default.cfg"; //$NON-NLS-1$
+
+ public TunerTableItem(String title) {
+ super(ItemName.TUNER_TABLE, title);
+ }
+
+ @Override
+ public void create(Composite parent) {
+ item = new SubModifyItem(this);
+ item.setItemHeight(SubModifyItem.ITEM_HEIGHT);
+ item.init(parent);
+ item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(),
+ ColorResources.WHITE));
+ item.create();
+
+ makeBody(BOX_WIDTH);
+
+ }
+
+ @Override
+ protected void makeBody(int textBoxWidth) {
+ item.setBodyLayoutForm();
+ if (getItemListComp().isDetailMode()) {
+ createDetailItem();
+
+ } else {
+ createTextBox(textBoxWidth);
+ createFileDialogButton();
+ String text = newTableFilePath.isEmpty() ? newTableFileName
+ : newTableFilePath;
+ setTextBox(text);
+ }
+ }
+
+ private void createDetailItem() {
+ item.setBodyLayoutForm();
+ Canvas canvas = new Canvas(item.getBody(), SWT.NONE) ;
+ canvas.setLayoutData(getDetailItemFormData());
+
+ String text = newTableFilePath.isEmpty() ? newTableFileName
+ : newTableFilePath;
+ settingDetailItemPath(text, canvas);
+
+ }
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ newTableFileName = value.getSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_NAME);
+ newTableFilePath = value.getSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_PATH);
+
+ if (newTableFileName.isEmpty()) {
+ newTableFileName = TABLE_DEFAULT;
+ newTableFilePath = "";
+ }
+ }
+
+ @Override
+ public void setValue(PropertyValue value) {
+ value.setSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_NAME, newTableFileName);
+ value.setSubOptionValue(ItemName.TUNER, ItemName.TUNER_FILE_PATH, newTableFilePath);
+
+ }
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ return new TunerTableItem(getTitle());
+ }
+
+ @Override
+ public void fileSelected() {
+ newTableFilePath = filePath;
+ newTableFileName = newTableFilePath.substring(newTableFilePath
+ .lastIndexOf(File.separator) + 1, newTableFilePath.length());
+ getItemListComp().checkValid();
+ }
+
+
+ @Override
+ protected String clickFileDialogButon() {
+ if (fd == null) {
+ fd = new FileDialog(MainDialog.getShell(), SWT.OPEN);
+ fd.setText("Select tuner file");
+
+ String[] filter = null;
+ String[] filterName = null;
+ filter = new String[] {"*.cfg", "*"};
+ fd.setFilterExtensions(filter);
+
+ filterName = new String[] {
+ "Tuner config file (*.cfg) ", "All Files"};
+ fd.setFilterNames(filterName);
+ }
+
+
+ fd.setFilterPath(getLastDirectoryPath());
+ return fd.open();
+ }
+
+ @Override
+ public boolean isValid() {
+ boolean isValid = true;
+ String msg = "";
+ if (newTableFilePath != null && !newTableFilePath.isEmpty()) {
+ if (!new File(newTableFilePath).exists()) {
+ msg = "Tuner file is not exist";
+ isValid = false;
+ }
+ }
+
+ changeItemState(!isValid, BOX_WIDTH + 37 /* TODO: dialog button width*/, msg);
+ return isValid;
+ }
+}
gc.setForeground(ColorResources.DISABLED_TEXT.getColor());
gc.setFont(FontResources.CONTENT.getFont());
+ String displayText = WidgetHelper.shortenText(gc, text, ((Composite)e.widget).getClientArea());
int itemHeight = ((Composite)e.widget).getBounds().height;
- Point textExt = gc.textExtent(text);
+ Point textExt = gc.textExtent(displayText);
int posY = (itemHeight - textExt.y) / 2;
int posX = TEXT_INDENT;
int itemWidth = ((Composite)e.widget).getBounds().width;
posX = (itemWidth - textExt.x)/ 2;
}
- gc.drawText(text, posX, posY);
+ gc.drawText(displayText, posX, posY);
}
});
<option name="defaultOnCreate">Native</option>
</item>
<!-- <item name="ociDevice" title="OCI Device" type="combo" /> -->
+<!-- <item name="tuner" title="Tuner" type="label" > -->
+<!-- <item name="system" title="System" type="combo" > -->
+<!-- <option name="list">ATSC,DVB,ISDB</option> -->
+<!-- <option name="defaultOnCreate">ATSC</option> -->
+<!-- </item> -->
+<!-- <item name="country" title="Country" type="combo" > -->
+<!-- <option name="list">KOR,USA</option> -->
+<!-- <option name="defaultOnCreate">KOR</option> -->
+<!-- </item> -->
+<!-- <item name="table" title="Table" type="file"> -->
+<!-- <option name="filter">*.cfg</option> -->
+<!-- <option name="defaultOnCreate">tuner_default.cfg</option> -->
+<!-- </item> -->
+<!-- </item> -->
</itemGroup>
</ItemList>