import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
import org.tizen.installmanager.core.Config;
import org.tizen.installmanager.core.IMFatalException;
import org.tizen.installmanager.core.InstallManager;
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.ui.model.Item;
-import org.tizen.installmanager.pkg.lib.PackageManager;
import org.tizen.installmanager.pkg.model.Package;
/**
static final String STRING_TITLE = "Install Type";
// Web, Native minimal packages name.
- static final String TYPICAL_PACKAGE_NAME = "TYPICAL";
- static final String MINIMAL_PACKAGE_NAME = "MINIMAL";
- static final String WEB_MINIMAL_PACKAGE_NAME = "WEB-MINIMAL";
+ static final String WEB_APP_DEVELOPMENT_PACKAGE = "WEB-APP-DEV";
+ static final String PLATFORMS_DEVELOPMENT_PACKAGE = "PLATFORM-DEV";
+ static final String ALL_DEVELOPMENT = "ALL-DEV";
static final String NATIVE_MINIMAL_PACKAGE_NAME = "NATIVE-MINIMAL";
// UI button names
- static final String TYPICAL_BUTTON_NAME = "Typical";
- static final String MINIMAL_BUTTON_NAME = "Minimal";
+ static final String WEB_APP_DEVELOPMENT_BUTTON_NAME = "Web App Development";
+ static final String PLATFORMS_DEVELOPMENT_BUTTON_NAME = "Platforms Development";
static final String CUSTOM_BUTTON_NAME = "Custom";
- static final String WEB_MINIMAL_BUTTON_NAME = "Web app tools";
- static final String NATIVE_MINIMAL_BUTTON_NAME = "Native app tools";
private Composite buttonComposite;
// Install Type button
- private Button typicalButton;
- private Button minimalButton;
+ private Button webAppButton;
+ private Button platformsButton;
private Button customButton;
- private Button webMinimalButton;
- private Button nativeMinimalButton;
- // Install Type Explain Label
- private Label typicalLabel;
- private Label minimalLabel;
-
/**
* @param parent
* @param style
* Set Install Type radio buttons.
*/
private void setButtons() {
- setTypicalButton();
- setMinimalButton();
+ setWebAppButton();
+ setPlatformButton();
setCustomButton();
-
- setWebMinimalButton();
- setNativeMinimalButton();
}
/**
* Set Typical Type radio button.
*/
- private void setTypicalButton() {
- if (typicalButton == null) {
- typicalButton = new Button(buttonComposite, SWT.RADIO);
+ private void setWebAppButton() {
+ if (webAppButton == null) {
+ webAppButton = new Button(buttonComposite, SWT.CHECK);
}
- typicalButton.setSelection(true);
+ webAppButton.setSelection(true);
- typicalButton.addSelectionListener(new SelectionAdapter() {
+ webAppButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- refreshByType(InstallType.TYPICAL);
-
- if (viewController.hasWebNativeMinimal()) {
- minimalLabel.setVisible(true);
-
- webMinimalButton.setVisible(false);
- nativeMinimalButton.setVisible(false);
-
- // These checkbox button can be enabled for only Minimal button.
- webMinimalButton.setEnabled(false);
- nativeMinimalButton.setEnabled(false);
+ String description = "";
+ if (webAppButton.getSelection()) {
+ if (platformsButton.getSelection()) {
+ refreshByType(InstallType.ALL);
+ description = viewController.getDescription(ALL_DEVELOPMENT);
+ } else {
+ refreshByType(InstallType.WEBAPP);
+ description = viewController.getDescription(WEB_APP_DEVELOPMENT_PACKAGE);
+ }
+ } else {
+ if (!platformsButton.getSelection()) {
+ platformsButton.setSelection(true);
+ }
+ refreshByType(InstallType.PLATFORMS);
+ description = viewController.getDescription(PLATFORMS_DEVELOPMENT_PACKAGE);
}
+
+ customButton.setSelection(false);
- String description = viewController.getDescription(TYPICAL_PACKAGE_NAME);
setComponentDescriptionText(description);
}
});
- typicalButton.setBounds(0, 0, 82, 17);
- typicalButton.setText(TYPICAL_BUTTON_NAME + ":");
- typicalButton.setBackground(InstallManagerWindow.getBackgroundColor());
-
- typicalLabel = new Label(buttonComposite, SWT.NONE);
- typicalLabel.setBounds(84, 0, 410, 17);
+ webAppButton.setBounds(0, 0, 250, 17);
+ webAppButton.setText(WEB_APP_DEVELOPMENT_BUTTON_NAME);
+ webAppButton.setBackground(InstallManagerWindow.getBackgroundColor());
}
/**
* Set Minimal Type radio button.
*/
- private void setMinimalButton() {
- if (minimalButton == null) {
- minimalButton = new Button(buttonComposite, SWT.RADIO);
+ private void setPlatformButton() {
+ if (platformsButton == null) {
+ platformsButton = new Button(buttonComposite, SWT.CHECK);
}
- minimalButton.addSelectionListener(new SelectionAdapter() {
+ platformsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- if (viewController.hasWebNativeMinimal()) {
- if (webMinimalButton.getSelection() && !nativeMinimalButton.getSelection()) {
- refreshByType(InstallType.WEB_MINIMAL);
- } else if (!webMinimalButton.getSelection() && nativeMinimalButton.getSelection()) {
- refreshByType(InstallType.NATIVE_MINIMAL);
- } else if (webMinimalButton.getSelection() && nativeMinimalButton.getSelection()) {
- refreshByType(InstallType.MINIMAL);
- }
-
- minimalLabel.setVisible(false);
-
- webMinimalButton.setVisible(true);
- webMinimalButton.setEnabled(true);
-
- nativeMinimalButton.setVisible(true);
- nativeMinimalButton.setEnabled(true);
+ String description = "";
+ if (platformsButton.getSelection()) {
+ if (webAppButton.getSelection()) {
+ refreshByType(InstallType.ALL);
+ description = viewController.getDescription(ALL_DEVELOPMENT);
+ } else {
+ refreshByType(InstallType.PLATFORMS);
+ description = viewController.getDescription(PLATFORMS_DEVELOPMENT_PACKAGE);
+ }
} else {
- refreshByType(InstallType.MINIMAL);
+ if (!webAppButton.getSelection()) {
+ webAppButton.setSelection(true);
+ }
+ refreshByType(InstallType.WEBAPP);
+ description = viewController.getDescription(WEB_APP_DEVELOPMENT_PACKAGE);
}
- String description = viewController.getDescription(MINIMAL_PACKAGE_NAME);
+ customButton.setSelection(false);
+
setComponentDescriptionText(description);
}
});
- minimalButton.setBounds(0, 20, 82, 17);
- minimalButton.setText(MINIMAL_BUTTON_NAME + ":");
- minimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
-
- minimalLabel = new Label(buttonComposite, SWT.NONE);
- minimalLabel.setBounds(84, 20, 410, 17);
- }
-
- /**
- * Set Web Minimal Type checkbox button.
- */
- private void setWebMinimalButton() {
- if (webMinimalButton == null) {
- webMinimalButton = new Button(buttonComposite, SWT.CHECK);
- }
-
- webMinimalButton.setBounds(100, 20, 150, 17);
- webMinimalButton.setText(WEB_MINIMAL_BUTTON_NAME);
- webMinimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
- webMinimalButton.setVisible(false);
- webMinimalButton.setEnabled(false);
- webMinimalButton.setSelection(true);
-
- webMinimalButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (webMinimalButton.getSelection()) {
- if (nativeMinimalButton.getSelection()) {
- refreshByType(InstallType.MINIMAL);
- } else {
- refreshByType(InstallType.WEB_MINIMAL);
- }
- } else {
- if (!nativeMinimalButton.getSelection()) {
- nativeMinimalButton.setSelection(true);
- }
-
- refreshByType(InstallType.NATIVE_MINIMAL);
- }
- }
- });
- }
-
- /**
- * Set Native Minimal Type checkbox button.
- */
- private void setNativeMinimalButton() {
- if (nativeMinimalButton == null) {
- nativeMinimalButton = new Button(buttonComposite, SWT.CHECK);
- }
-
- nativeMinimalButton.setBounds(250, 20, 150, 17);
- nativeMinimalButton.setText(NATIVE_MINIMAL_BUTTON_NAME);
- nativeMinimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
- nativeMinimalButton.setVisible(false);
- nativeMinimalButton.setEnabled(false);
-
- nativeMinimalButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (nativeMinimalButton.getSelection()) {
- if (webMinimalButton.getSelection()) {
- refreshByType(InstallType.MINIMAL);
- } else {
- refreshByType(InstallType.NATIVE_MINIMAL);
- }
- } else {
- if (!webMinimalButton.getSelection()) {
- webMinimalButton.setSelection(true);
- }
- refreshByType(InstallType.WEB_MINIMAL);
- }
- }
- });
+ platformsButton.setBounds(0, 20, 250, 17);
+ platformsButton.setText(PLATFORMS_DEVELOPMENT_BUTTON_NAME);
+ platformsButton.setBackground(InstallManagerWindow.getBackgroundColor());
}
/**
*/
private void setCustomButton() {
if (customButton == null) {
- customButton = new Button(buttonComposite, SWT.RADIO);
+ customButton = new Button(buttonComposite, SWT.CHECK);
}
- customButton.setBounds(0, 40, 80, 17);
+ customButton.setBounds(0, 40, 250, 17);
customButton.setText(CUSTOM_BUTTON_NAME);
customButton.setBackground(InstallManagerWindow.getBackgroundColor());
@Override
public void widgetSelected(SelectionEvent e) {
if (viewController.hasWebNativeMinimal()) {
- minimalLabel.setVisible(true);
-
- webMinimalButton.setVisible(false);
- nativeMinimalButton.setVisible(false);
-
- // These checkbox button can be enabled for only Minimal button.
- webMinimalButton.setEnabled(false);
- nativeMinimalButton.setEnabled(false);
+ webAppButton.setSelection(false);
+ platformsButton.setSelection(false);
setComponentDescriptionText("Position your mouse pointer over an item to view its description.");
}
private void refreshByType(InstallType instType) {
String iType = null;
- if (instType == InstallType.TYPICAL) {
- iType = TYPICAL_PACKAGE_NAME;
- } else if (instType == InstallType.MINIMAL) {
- iType = MINIMAL_PACKAGE_NAME;
- } else if (instType == InstallType.WEB_MINIMAL) {
- iType = WEB_MINIMAL_PACKAGE_NAME;
- } else if (instType == InstallType.NATIVE_MINIMAL) {
- iType = NATIVE_MINIMAL_PACKAGE_NAME;
+ if (instType == InstallType.WEBAPP) {
+ iType = WEB_APP_DEVELOPMENT_PACKAGE;
+ } else if (instType == InstallType.PLATFORMS) {
+ iType = PLATFORMS_DEVELOPMENT_PACKAGE;
+ } else if (instType == InstallType.ALL) {
+ iType = ALL_DEVELOPMENT;
+ } else {
+ // not support install type.
}
setCheckedByType(iType);
setCheckbox(item, true);
}
}
-
- /**
- * Initialize minimal selection when installable page is re-loaded.
- */
- private void initMinimalSetting() {
- minimalLabel.setVisible(true);
-
- webMinimalButton.setSelection(true);
- nativeMinimalButton.setSelection(false);
-
- webMinimalButton.setVisible(false);
- nativeMinimalButton.setVisible(false);
- }
/**
* Display installable package list from view controller.
getItems().clear();
// back to next on component selection page case.
- // in this case, page status should be typical selection case.
+ // in this case, page status should be web app development selection case.
if (customButton.getSelection()) {
customButton.setSelection(false);
- typicalButton.setSelection(true);
- } else if (minimalButton.getSelection()) {
- minimalButton.setSelection(false);
- typicalButton.setSelection(true);
+ webAppButton.setSelection(true);
+ } else if (platformsButton.getSelection()) {
+ webAppButton.setSelection(false);
+ platformsButton.setSelection(true);
}
-
- initMinimalSetting();
try {
if (Config.isSupportMultiSDK()) {
return false;
}
- refreshByType(InstallType.TYPICAL);
+ refreshByType(InstallType.WEBAPP);
initDescriptionToInstallType();
}
private void initDescriptionToInstallType() {
- PackageManager pm = PackageManager.getInstance();
-
- //set typical description
- String typicalExplain = "";
- Package typicalPackage = pm.getPackageByName(TYPICAL_PACKAGE_NAME);
- if (typicalPackage != null) {
- typicalExplain = typicalPackage.getDescription();
- }
-
- typicalLabel.setText(typicalExplain);
- typicalLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- //set minimal description
- String minimalExplain = "";
- Package minimalPackage = pm.getPackageByName(MINIMAL_PACKAGE_NAME);
- if (minimalPackage != null) {
- minimalExplain = minimalPackage.getDescription();
- }
-
- minimalLabel.setText(minimalExplain);
- minimalLabel.setBackground(InstallManagerWindow.getBackgroundColor());
-
- String description = viewController.getDescription(TYPICAL_PACKAGE_NAME);
+ String description = viewController.getDescription(WEB_APP_DEVELOPMENT_PACKAGE);
setComponentDescriptionText(description);
}