private static final int BUTTON_WIDTH = 32;
private static final int BUTTON_HEIGHT = 26;
- Hyperlink baseImageList;
- ImageButton refreshButton;
+ private Hyperlink baseImageList;
+ private ImageButton refreshButton;
private Composite comp;
private boolean isTableInitialize = false;
@Override
public void widgetSelected(SelectionEvent arg0) {
- // TODO
+ refreshDeviceTemplateList();
}
});
setLayout();
}
+ @Override
+ void showTableComposite() {
+ if (!isTableInitialize) {
+ setTemplateList();
+ isTableInitialize = true;
+ }
+
+ }
+
+ public void refreshDeviceTemplateList() {
+ ProfileList.settingDeviceTemplateList();
+ setTemplateList();
+ }
+
private void makeProfileButton() {
profileButtonList = new ArrayList<ProfileButton>();
profileButtonList.add(ProfileButtonMaker.getProfileButton("mobile", comp));
});
}
- private String[] titles = {"", "Type", "Name", "Resolution", "Display Size", "Ram", "Processor"};
+ private String[] titles = {"Type", "Name", "Resolution", "Display Size", "Ram", "Processor"};
private void makeTable() {
table = new Table(comp, SWT.BORDER);
table.setSelectedItemHeight(table.getItemHeight());
table.getColumn(0).setResizable(false);
- table.getColumn(1).setResizable(false);
table.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
}
});
+ table.getColumn(1).addListener(SWT.Selection, table.getDefaultSortListener());
table.getColumn(2).addListener(SWT.Selection, table.getDefaultSortListener());
table.getColumn(3).addListener(SWT.Selection, table.getDefaultSortListener());
table.getColumn(4).addListener(SWT.Selection, table.getDefaultSortListener());
table.getColumn(5).addListener(SWT.Selection, table.getDefaultSortListener());
- table.getColumn(6).addListener(SWT.Selection, table.getDefaultSortListener());
- table.getColumn(1).addListener(SWT.Selection, new Listener() {
+ table.getColumn(0).addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
TableColumn column = (TableColumn)event.widget;
// set column
table.settingSortColumn(column);
- // make item compareable list
+ // make comparable item list
int dir = table.getSortDirection();
ItemProfilePair[] pairs = new ItemProfilePair[table.getItemCount()];
for (int i = 0; i < table.getItemCount(); i++) {
});
}
- protected void tableSelected() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- void showTableComposite() {
- if (!isTableInitialize) {
- setTemplateList();
- isTableInitialize = true;
- }
-
- }
-
private void setTemplateList() {
table.removeAll();
for (ProfileButton pButton : profileButtonList) {
}
}
- table.getColumn(0).setWidth(30);
- table.getColumn(1).setWidth(100);
+ table.getColumn(0).setWidth(100);
for (int i = 1; i < titles.length; i++) {
table.getColumn(i).pack();
}
}
//
- item.setImage(1, pButton.getIcon());
+ if (template.getValue().isStandard()) {
+ item.setImage(0, pButton.getIcon());
+ } else {
+ item.setImage(0, pButton.getCustomIcon());
+ }
setTableItemProperty(item, template);
//
}
private void setTableItemProperty(TableItem item, DeviceTemplate template) {
DeviceTemplateValue value = template.getValue();
- item.setText(2, value.getName());
- item.setText(3, value.getResolution().toString());
- item.setText(4, String.valueOf(value.getDisplaySize()) + " " + value.getDisplaySizeUnit());
- item.setText(5, String.valueOf(value.getRamSize()) + " " + value.getRamSizeUnit());
- item.setText(6, String.valueOf(value.getCpuCount()));
+ item.setText(1, value.getName());
+ item.setText(2, value.getResolution().toString());
+ item.setText(3, String.valueOf(value.getDisplaySize()) + " " + value.getDisplaySizeUnit());
+ item.setText(4, String.valueOf(value.getRamSize()) + " " + value.getRamSizeUnit());
+ item.setText(5, String.valueOf(value.getCpuCount()));
item.setData(template);
}
}
}
}
+
+ tableSelected();
}
@Override
}
}
});
+
+ deleteButton.setEnabled(false);
+ modifyButton.setEnabled(false);
+ cloneButton.setEnabled(false);
}
+ private void tableSelected() {
+ if (table.getSelectionCount() == 0) {
+ deleteButton.setEnabled(false);
+ modifyButton.setEnabled(false);
+ cloneButton.setEnabled(false);
+ } else {
+ DeviceTemplate template = (DeviceTemplate)table.getSelection()[0].getData();
+ if (template.getValue().isStandard()) {
+ deleteButton.setEnabled(false);
+ modifyButton.setEnabled(false);
+ cloneButton.setEnabled(true);
+ } else {
+ deleteButton.setEnabled(true);
+ modifyButton.setEnabled(true);
+ cloneButton.setEnabled(true);
+ }
+ }
+ }
private void setLayout() {
// composite is form layout
profileButton.setIcon(ImageResources.ICON_TYPE_MOBILE.getImage());
profileButton.setSelectedIcon(ImageResources.ICON_SELECTED_MOBILE.getImage());
profileButton.setCreateIcon(ImageResources.ICON_CREATE_MOBILE.getImage());
+ profileButton.setCustomIcon(ImageResources.ICON_TYPE_MOBILE_CUSTOM.getImage());
}
} else if (name.equals("tv")){
button = makeTVButton(comp);
profileButton.setIcon(ImageResources.ICON_TYPE_TV.getImage());
profileButton.setSelectedIcon(ImageResources.ICON_SELECTED_TV.getImage());
profileButton.setCreateIcon(ImageResources.ICON_CREATE_TV.getImage());
+ profileButton.setCustomIcon(ImageResources.ICON_TYPE_TV_CUSTOM.getImage());
}
} else if (name.equals("wearable")) {
button = makeWearableButton(comp);
profileButton.setIcon(ImageResources.ICON_TYPE_WEARABLE.getImage());
profileButton.setSelectedIcon(ImageResources.ICON_SELECTED_WEARABLE_SQUARE.getImage());
profileButton.setCreateIcon(ImageResources.ICON_CREATE_WEARABLE.getImage());
+ profileButton.setCustomIcon(ImageResources.ICON_TYPE_WEARABLE_CUSTOM.getImage());
}
} else {
Profile profile = ProfileList.getProfile(name);
profileButton.setSelectedIcon(PluginImageResources.ICON_SELECTED_TYPE.getImage(p.getName()));
// TODO
profileButton.setSelectedIcon(PluginImageResources.ICON_CREATE_TYPE.getImage(p.getName()));
+ //profileButton.setCustomIcon(ImageResources.ICON_TYPE_CUSTOM.getImage());
}
}
}