[openrtm-commit:01807] r561 - in trunk/rtmtools/jp.go.aist.rtm.systemeditor: src/jp/go/aist/rtm/systemeditor/nl src/jp/go/aist/rtm/systemeditor/ui/views/configurationview src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 3月 5日 (土) 18:37:31 JST
Author: ga
Date: 2016-03-05 18:37:31 +0900 (Sat, 05 Mar 2016)
New Revision: 561
Added:
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/Secretable.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapperTest.java
Modified:
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapper.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapper.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapper.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapperTest.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapperTest.java
Log:
Modified for ConfigrationView And NameServiceView #3444, #3445
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties 2016-03-05 09:37:31 UTC (rev 561)
@@ -252,6 +252,7 @@
ConfigurationView.40=The name already exists.
ConfigurationView.43=The key already exists.
ConfigurationView.47=Show detail
+ConfigurationView.48=Detail
ConfigurationCondition.3=Format error of constraints immediate value [value]
ConfigurationCondition.6=Format error of constraints left-hand side [left]
ConfigurationCondition.7=Format error of constraints left-hand side [left]
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -4,25 +4,6 @@
import java.util.Collections;
import java.util.List;
-import jp.go.aist.rtm.systemeditor.RTSystemEditorPlugin;
-import jp.go.aist.rtm.systemeditor.nl.Messages;
-import jp.go.aist.rtm.systemeditor.ui.dialog.ConfigurationDialog;
-import jp.go.aist.rtm.systemeditor.ui.editor.AbstractSystemDiagramEditor;
-import jp.go.aist.rtm.systemeditor.ui.util.ComponentUtil;
-import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.ComponentConfigurationWrapper;
-import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.ConfigurationSetConfigurationWrapper;
-import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.NamedValueConfigurationWrapper;
-import jp.go.aist.rtm.toolscommon.model.component.Component;
-import jp.go.aist.rtm.toolscommon.model.component.ComponentFactory;
-import jp.go.aist.rtm.toolscommon.model.component.ComponentPackage;
-import jp.go.aist.rtm.toolscommon.model.component.ConfigurationSet;
-import jp.go.aist.rtm.toolscommon.model.component.CorbaComponent;
-import jp.go.aist.rtm.toolscommon.model.component.ExecutionContext;
-import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
-import jp.go.aist.rtm.toolscommon.ui.views.propertysheetview.RtcPropertySheetPage;
-import jp.go.aist.rtm.toolscommon.util.AdapterUtil;
-import jp.go.aist.rtm.toolscommon.util.SDOUtil;
-
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
@@ -74,11 +55,31 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import jp.go.aist.rtm.systemeditor.RTSystemEditorPlugin;
+import jp.go.aist.rtm.systemeditor.nl.Messages;
+import jp.go.aist.rtm.systemeditor.ui.dialog.ConfigurationDialog;
+import jp.go.aist.rtm.systemeditor.ui.editor.AbstractSystemDiagramEditor;
+import jp.go.aist.rtm.systemeditor.ui.util.ComponentUtil;
+import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.ComponentConfigurationWrapper;
+import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.ConfigurationSetConfigurationWrapper;
+import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.NamedValueConfigurationWrapper;
+import jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper.Secretable;
+import jp.go.aist.rtm.toolscommon.model.component.Component;
+import jp.go.aist.rtm.toolscommon.model.component.ComponentFactory;
+import jp.go.aist.rtm.toolscommon.model.component.ComponentPackage;
+import jp.go.aist.rtm.toolscommon.model.component.ConfigurationSet;
+import jp.go.aist.rtm.toolscommon.model.component.CorbaComponent;
+import jp.go.aist.rtm.toolscommon.model.component.ExecutionContext;
+import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
+import jp.go.aist.rtm.toolscommon.ui.views.propertysheetview.RtcPropertySheetPage;
+import jp.go.aist.rtm.toolscommon.util.AdapterUtil;
+import jp.go.aist.rtm.toolscommon.util.SDOUtil;
+
/**
* ConfigurationViewを定義するクラス
* <p>
* Applyボタン押下までは、修正の適用は保留され、変更された場所は色がついて表示される。
- * NameValueの値の編集ができるのはStirngクラスのみであり、それ以外のオブジェクトが含まれていた場合には、編集することはできない(削除は可能)
+ * NameValueの値の編集ができるのはStringクラスのみであり、それ以外のオブジェクトが含まれていた場合には、編集することはできない(削除は可能)
*/
public class ConfigurationView extends ViewPart {
@@ -124,62 +125,42 @@
private static final int BUTTON_WIDTH = 70;
- private static final String LABEL_COMPONENT_NAME = Messages
- .getString("ConfigurationView.15");
+ private static final String LABEL_COMPONENT_NAME = Messages.getString("ConfigurationView.15");
- private static final String LABEL_BUTTON_EDIT = Messages
- .getString("ConfigurationView.7");
- private static final String LABEL_BUTTON_APPLY = Messages
- .getString("ConfigurationView.8");
- private static final String LABEL_BUTTON_CANCEL = Messages
- .getString("ConfigurationView.9");
- private static final String LABEL_TOOLTIP_DETAIL = Messages
- .getString("ConfigurationView.47");
+ private static final String LABEL_BUTTON_EDIT = Messages.getString("ConfigurationView.7");
+ private static final String LABEL_BUTTON_APPLY = Messages.getString("ConfigurationView.8");
+ private static final String LABEL_BUTTON_CANCEL = Messages.getString("ConfigurationView.9");
- private static final String LABEL_COLUMN_ACTIVE = Messages
- .getString("ConfigurationView.16");
- private static final String LABEL_COLUMN_CONFIG = Messages
- .getString("ConfigurationView.17");
+ private static final String LABEL_COLUMN_ACTIVE = Messages.getString("ConfigurationView.16");
+ private static final String LABEL_COLUMN_CONFIG = Messages.getString("ConfigurationView.17");
- private static final String LABEL_BUTTON_ADD = Messages
- .getString("ConfigurationView.18");
- private static final String LABEL_BUTTON_DEL = Messages
- .getString("ConfigurationView.22");
- private static final String LABEL_BUTTON_COPY = Messages
- .getString("ConfigurationView.23");
+ private static final String LABEL_BUTTON_ADD = Messages.getString("ConfigurationView.18");
+ private static final String LABEL_BUTTON_DEL = Messages.getString("ConfigurationView.22");
+ private static final String LABEL_BUTTON_COPY = Messages.getString("ConfigurationView.23");
+ private static final String LABEL_BUTTON_DETAIL = Messages.getString("ConfigurationView.48");
+ private static final String LABEL_TOOLTIP_DETAIL = Messages.getString("ConfigurationView.47");
- private static final String LABE_CONFIGSET_NAME = Messages
- .getString("ConfigurationView.26");
+ private static final String LABE_CONFIGSET_NAME = Messages.getString("ConfigurationView.26");
- private static final String LABEL_COLUMN_KEY = Messages
- .getString("ConfigurationView.27");
- private static final String LABEL_COLUMN_VALUE = Messages
- .getString("ConfigurationView.21");
+ private static final String LABEL_COLUMN_KEY = Messages.getString("ConfigurationView.27");
+ private static final String LABEL_COLUMN_VALUE = Messages.getString("ConfigurationView.21");
- private static final String LAVEL_DEFAULT_NV_VALUE = Messages
- .getString("ConfigurationView.21");
+ private static final String LAVEL_DEFAULT_NV_VALUE = Messages.getString("ConfigurationView.21");
- private static final String LABEL_BUTTON_NV_ADD = Messages
- .getString("ConfigurationView.29");
- private static final String LABEL_BUTTON_NV_DEL = Messages
- .getString("ConfigurationView.32");
+ private static final String LABEL_BUTTON_NV_ADD = Messages.getString("ConfigurationView.29");
+ private static final String LABEL_BUTTON_NV_DEL = Messages.getString("ConfigurationView.32");
+ private static final String LABEL_BUTTON_NV_DETAIL = Messages.getString("ConfigurationView.48");
+ private static final String LABEL_TOOLTIP_NV_DETAIL = Messages.getString("ConfigurationView.47");
- private static final String MSG_ERROR = Messages
- .getString("ConfigurationView.12");
- private static final String MSG_UPDATE_FAILURE = Messages
- .getString("ConfigurationView.13");
+ private static final String MSG_ERROR = Messages.getString("ConfigurationView.12");
+ private static final String MSG_UPDATE_FAILURE = Messages.getString("ConfigurationView.13");
- private static final String MSG_CONFIRM = Messages
- .getString("ConfigurationView.10");
- private static final String MSG_CHECK_APPLY_CHANGE = Messages
- .getString("ConfigurationView.11");
+ private static final String MSG_CONFIRM = Messages.getString("ConfigurationView.10");
+ private static final String MSG_CHECK_APPLY_CHANGE = Messages.getString("ConfigurationView.11");
- private static final String MSG_WARNING = Messages
- .getString("ConfigurationView.39");
- private static final String MSG_NAME_ALREADY_EXIST = Messages
- .getString("ConfigurationView.40");
- private static final String MSG_KEY_ALREADY_EXIST = Messages
- .getString("ConfigurationView.43");
+ private static final String MSG_WARNING = Messages.getString("ConfigurationView.39");
+ private static final String MSG_NAME_ALREADY_EXIST = Messages.getString("ConfigurationView.40");
+ private static final String MSG_KEY_ALREADY_EXIST = Messages.getString("ConfigurationView.43");
private Component targetComponent;
private ComponentConfigurationWrapper copiedComponent;
@@ -187,10 +168,11 @@
private Table leftTable;
private TableViewer leftTableViewer;
+ private DetailTableViewerFilter leftTableViewerFilter;
private Table rightTable;
private TableViewer rightTableViewer;
- private RightTableViewerFilter rightTableViewerFilter;
+ private DetailTableViewerFilter rightTableViewerFilter;
private Label componentNameLabel;
private Label configrationSetNameLabel;
@@ -198,14 +180,15 @@
private Button addConfigurationSetButton;
private Button copyConfigurationSetButton;
private Button deleteConfigurationSetButton;
+ private Button detailConfigurationSetCheckButton;
private Button addNamedValueButton;
private Button deleteNamedValueButton;
+ private Button detailNamedValueCheckButton;
private Button editButton;
private Button applyButton;
private Button cancelButton;
- private Button detailCheckButton;
private static ColorRegistry colorRegistry = null;
@@ -478,6 +461,8 @@
leftTableViewer.setCellEditors(new CellEditor[] {
new CheckboxCellEditor(leftTableViewer.getTable()),
new TextCellEditor(leftTableViewer.getTable()) });
+ this.leftTableViewerFilter = new DetailTableViewerFilter();
+ this.leftTableViewer.addFilter(this.leftTableViewerFilter);
leftTable = leftTableViewer.getTable();
leftTable.setLinesVisible(true);
@@ -518,7 +503,7 @@
Composite buttonCompsite = new Composite(composite, SWT.BOTTOM);
gl = new GridLayout();
- gl.numColumns = 3;
+ gl.numColumns = 4;
buttonCompsite.setLayout(gl);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
@@ -623,14 +608,29 @@
refreshRightData();
}
}
- });
- leftTableViewer
- .addPostSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateDeleteConfigurationSetButtonEnable();
- }
- });
+ });
+
+ this.detailConfigurationSetCheckButton = new Button(buttonCompsite, SWT.BOTTOM | SWT.CHECK);
+ this.detailConfigurationSetCheckButton.setEnabled(false);
+ this.detailConfigurationSetCheckButton.setToolTipText(LABEL_TOOLTIP_DETAIL);
+ gd = new GridData();
+ gd.horizontalAlignment = SWT.END;
+ this.detailConfigurationSetCheckButton.setLayoutData(gd);
+ this.detailConfigurationSetCheckButton.setText(LABEL_BUTTON_DETAIL);
+ this.detailConfigurationSetCheckButton.setSelection(false);
+ this.detailConfigurationSetCheckButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshLeftData();
+ }
+ });
+
+ leftTableViewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateDeleteConfigurationSetButtonEnable();
+ }
+ });
}
// Copyボタンの追加 2008.12.17
@@ -729,7 +729,7 @@
rightTableViewer.setCellEditors(new CellEditor[] {
new TextCellEditor(rightTableViewer.getTable()),
new TextCellEditor(rightTableViewer.getTable()) });
- this.rightTableViewerFilter = new RightTableViewerFilter();
+ this.rightTableViewerFilter = new DetailTableViewerFilter();
this.rightTableViewer.addFilter(this.rightTableViewerFilter);
rightTable = rightTableViewer.getTable();
@@ -786,26 +786,11 @@
gd.horizontalAlignment = SWT.FILL;
buttonCompsite.setLayoutData(gd);
- this.detailCheckButton = new Button(buttonCompsite, SWT.BOTTOM
- | SWT.CHECK);
- this.detailCheckButton.setEnabled(false);
- this.detailCheckButton.setToolTipText(LABEL_TOOLTIP_DETAIL);
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = SWT.END;
- this.detailCheckButton.setLayoutData(gd);
- this.detailCheckButton.setSelection(false);
- this.detailCheckButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- refreshRightData();
- }
- });
-
addNamedValueButton = new Button(buttonCompsite, SWT.NONE);
addNamedValueButton.setText(LABEL_BUTTON_NV_ADD);
addNamedValueButton.setEnabled(false);
gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.END;
gd.widthHint = BUTTON_WIDTH;
addNamedValueButton.setLayoutData(gd);
@@ -869,13 +854,28 @@
}
}
});
- rightTableViewer
- .addPostSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- updateDeleteNamedValueButtonEnable();
- }
- });
+
+ this.detailNamedValueCheckButton = new Button(buttonCompsite, SWT.BOTTOM | SWT.CHECK);
+ this.detailNamedValueCheckButton.setEnabled(false);
+ this.detailNamedValueCheckButton.setToolTipText(LABEL_TOOLTIP_NV_DETAIL);
+ gd = new GridData();
+ gd.horizontalAlignment = SWT.END;
+ this.detailNamedValueCheckButton.setLayoutData(gd);
+ this.detailNamedValueCheckButton.setText(LABEL_BUTTON_NV_DETAIL);
+ this.detailNamedValueCheckButton.setSelection(false);
+ this.detailNamedValueCheckButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ refreshRightData();
+ }
+ });
+
+ rightTableViewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateDeleteNamedValueButtonEnable();
+ }
+ });
}
private String createDefaultNamedValueKey(String preString) {
@@ -1013,39 +1013,41 @@
}
private void refreshData() {
- editButton.setEnabled(false);
- applyButton.setEnabled(false);
- cancelButton.setEnabled(false);
- this.detailCheckButton.setEnabled(false);
+ this.editButton.setEnabled(false);
+ this.applyButton.setEnabled(false);
+ this.cancelButton.setEnabled(false);
refreshLeftData();
- if (copiedComponent != null) {
- leftTable.setSelection(copiedComponent.getConfigurationSetList()
- .indexOf(copiedComponent.getActiveConfigSet()));
+ if (this.copiedComponent != null) {
+ this.leftTable.setSelection(
+ this.copiedComponent.getConfigurationSetList().indexOf(this.copiedComponent.getActiveConfigSet()));
}
refreshRightData();
- if (copiedComponent != null) {
- editButton.setEnabled(true);
- applyButton.setEnabled(true);
- cancelButton.setEnabled(true);
- this.detailCheckButton.setEnabled(true);
+ if (this.copiedComponent != null) {
+ this.editButton.setEnabled(true);
+ this.applyButton.setEnabled(true);
+ this.cancelButton.setEnabled(true);
}
}
private void refreshLeftData() {
- leftTableViewer.setInput(Collections.EMPTY_LIST);
- componentNameLabel.setText("");
- addConfigurationSetButton.setEnabled(false);
+ this.leftTableViewer.setInput(Collections.EMPTY_LIST);
+ this.componentNameLabel.setText("");
+ this.addConfigurationSetButton.setEnabled(false);
+ this.detailConfigurationSetCheckButton.setEnabled(false);
- if (copiedComponent != null) {
- addConfigurationSetButton.setEnabled(true);
- componentNameLabel.setText(targetComponent.getInstanceNameL());
- leftTableViewer.setInput(copiedComponent.getConfigurationSetList());
+ if (this.copiedComponent != null) {
+ this.addConfigurationSetButton.setEnabled(true);
+ this.detailConfigurationSetCheckButton.setEnabled(true);
+ this.componentNameLabel.setText(this.targetComponent.getInstanceNameL());
- if (leftTable.getItemCount() > 0) {
- leftTable.select(0);
+ this.leftTableViewerFilter.setDetail(this.detailConfigurationSetCheckButton.getSelection());
+ this.leftTableViewer.setInput(this.copiedComponent.getConfigurationSetList());
+
+ if (this.leftTable.getItemCount() > 0) {
+ this.leftTable.select(0);
}
}
@@ -1061,24 +1063,24 @@
}
private void refreshRightData() {
- rightTableViewer.setInput(Collections.EMPTY_LIST);
- configrationSetNameLabel.setText("");
- addNamedValueButton.setEnabled(false);
+ this.rightTableViewer.setInput(Collections.EMPTY_LIST);
+ this.configrationSetNameLabel.setText("");
+ this.addNamedValueButton.setEnabled(false);
+ this.detailNamedValueCheckButton.setEnabled(false);
- if (copiedComponent != null && leftTable.getSelectionIndex() != -1) {
- ConfigurationSetConfigurationWrapper currentConfugurationSet = copiedComponent
- .getConfigurationSetList().get(
- leftTable.getSelectionIndex());
+ if (this.copiedComponent != null && this.leftTable.getSelectionIndex() != -1) {
+ if (this.leftTableViewer.getSelection() instanceof StructuredSelection) {
+ ConfigurationSetConfigurationWrapper currentConfugurationSet = (ConfigurationSetConfigurationWrapper) ((StructuredSelection) this.leftTableViewer
+ .getSelection()).getFirstElement();
+ this.configrationSetNameLabel.setText(currentConfugurationSet.getId());
- configrationSetNameLabel.setText(currentConfugurationSet.getId());
+ this.rightTableViewerFilter.setDetail(this.detailNamedValueCheckButton.getSelection());
+ this.rightTableViewer.setInput(currentConfugurationSet.getNamedValueList());
- this.rightTableViewerFilter.setDetail(this.detailCheckButton
- .getSelection());
- this.rightTableViewer.setInput(currentConfugurationSet
- .getNamedValueList());
-
- if (!(targetComponent instanceof CorbaComponent)) {
- addNamedValueButton.setEnabled(true);
+ if (!(this.targetComponent instanceof CorbaComponent)) {
+ this.addNamedValueButton.setEnabled(true);
+ }
+ this.detailNamedValueCheckButton.setEnabled(true);
}
}
updateDeleteNamedValueButtonEnable();
@@ -1169,6 +1171,15 @@
@Override
public boolean canModify(Object element, String property) {
+ ConfigurationSetConfigurationWrapper configurationSet = null;
+ if (element instanceof ConfigurationSetConfigurationWrapper) {
+ configurationSet = (ConfigurationSetConfigurationWrapper) element;
+ }
+ if (PROPERTY_ACTIVE_CONFIGSET.equals(property)) {
+ if (configurationSet.isSecret()) {
+ return false;
+ }
+ }
return true;
}
@@ -1178,10 +1189,8 @@
if (PROPERTY_ACTIVE_CONFIGSET.equals(property)) {
result = Boolean.TRUE;
} else if (PROPERTY_CONFIG_SET.equals(property)) {
- result = ((ConfigurationSetConfigurationWrapper) element)
- .getId();
+ result = ((ConfigurationSetConfigurationWrapper) element).getId();
}
-
return result;
}
@@ -1189,38 +1198,29 @@
public void modify(Object element, String property, Object value) {
ConfigurationSetConfigurationWrapper configurationSet = null;
if (element instanceof Item) {
- configurationSet = ((ConfigurationSetConfigurationWrapper) ((Item) element)
- .getData());
+ configurationSet = ((ConfigurationSetConfigurationWrapper) ((Item) element).getData());
}
-
if (PROPERTY_ACTIVE_CONFIGSET.equals(property)) {
copiedComponent.setActiveConfigSet(configurationSet);
-
viewer.refresh();
} else if (PROPERTY_CONFIG_SET.equals(property)) {
boolean isDuplicate = false;
- for (ConfigurationSetConfigurationWrapper current : copiedComponent
- .getConfigurationSetList()) {
- if (configurationSet != current
- && ((String) value).equals(current.getId())) {
+ for (ConfigurationSetConfigurationWrapper current : copiedComponent.getConfigurationSetList()) {
+ if (configurationSet != current && ((String) value).equals(current.getId())) {
isDuplicate = true;
break;
}
}
-
String newConfigurationSetName = (String) value;
if (isDuplicate) {
- MessageDialog.openWarning(viewer.getControl().getShell(),
- MSG_WARNING, MSG_NAME_ALREADY_EXIST);
+ MessageDialog.openWarning(viewer.getControl().getShell(), MSG_WARNING, MSG_NAME_ALREADY_EXIST);
newConfigurationSetName = createDefaultConfigurationSetName((String) value);
}
-
configurationSet.setId(newConfigurationSetName);
-
viewer.update(configurationSet, null);
}
-
}
+
}
/**
@@ -1417,14 +1417,14 @@
}
/**
- * ConfigurationSetの設定値一覧テーブルの表示フィルタ<br>
- * 「_」で始まる設定値は、詳細モードのときのみ表示します。
+ * ConfigurationSet、およびNamedValueの一覧テーブルの表示フィルタ<br>
+ * 「__」で始まる設定値は、詳細モードのときのみ表示します。
*/
- private static class RightTableViewerFilter extends ViewerFilter {
+ private static class DetailTableViewerFilter extends ViewerFilter {
private boolean isDetail;
- public RightTableViewerFilter() {
+ public DetailTableViewerFilter() {
this.isDetail = false;
}
@@ -1439,16 +1439,15 @@
}
/**
- * 詳細モード、かつNameValueのキーが「_」で始まっていない場合はtrue
+ * 詳細モード、かつNameValueのキーが「__」で始まっていない場合はtrue
*/
@Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
- if (!(element instanceof NamedValueConfigurationWrapper)) {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (!(element instanceof Secretable)) {
return false;
}
- NamedValueConfigurationWrapper nv = (NamedValueConfigurationWrapper) element;
- return (this.isDetail || !nv.isSecret());
+ Secretable sc = (Secretable) element;
+ return (this.isDetail || !sc.isSecret());
}
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapper.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapper.java 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapper.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -4,7 +4,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -19,11 +18,9 @@
*/
public class ComponentConfigurationWrapper {
- @SuppressWarnings("unchecked")
public static ComponentConfigurationWrapper create(Component target) {
ComponentConfigurationWrapper result = new ComponentConfigurationWrapper();
- List<ConfigurationSetConfigurationWrapper> configurationSetList = result
- .getConfigurationSetList();
+ List<ConfigurationSetConfigurationWrapper> configurationSetList = result.getConfigurationSetList();
// パラメータ名−widget種別
Map<String, String> widgets = new HashMap<String, String>();
@@ -51,68 +48,52 @@
result.widgetSetting = widgets;
result.conditionSetting = conditions;
- for (Iterator iter = target.getConfigurationSets().iterator(); iter
- .hasNext();) {
- ConfigurationSet configurationSet = (ConfigurationSet) iter.next();
-
- if (configurationSet.getId().startsWith("__"))
- continue;
-
+ for (ConfigurationSet configurationSet : target.getConfigurationSets()) {
ConfigurationSetConfigurationWrapper configurationSetConfigurationWrapper = new ConfigurationSetConfigurationWrapper(
configurationSet, configurationSet.getId());
-
List<NamedValueConfigurationWrapper> namedValueList = configurationSetConfigurationWrapper
.getNamedValueList();
- // configurationSetに対応する制約条件(なければdefaultを使用)
- Map<String, String> conds = conditions.get(configurationSet.getId());
- if (conds == null)
- conds = conditions.get("constraints__");
-
- for (Iterator iterator = configurationSet.getConfigurationData()
- .iterator(); iterator.hasNext();) {
-
- NameValue nameValue = (NameValue) iterator.next();
+ // configurationSetに対応する制約条件(なければデフォルトを使用)
+ Map<String, String> conds = null;
+ if (!configurationSet.getId().startsWith("__")) {
+ conds = conditions.get(configurationSet.getId());
+ if (conds == null) {
+ conds = conditions.get("constraints__");
+ }
+ }
+ for (NameValue nameValue : configurationSet.getConfigurationData()) {
NamedValueConfigurationWrapper namedValueConfigurationWrapper = new NamedValueConfigurationWrapper(
nameValue.getName(), nameValue.getValue(), nameValue.getTypeName());
-
if (conds != null) {
String type = widgets.get(nameValue.getName());
String cond = conds.get(nameValue.getName());
namedValueConfigurationWrapper.setWidgetAndCondition(type, cond);
}
-
namedValueList.add(namedValueConfigurationWrapper);
Collections.sort(namedValueList);
}
if (target.getActiveConfigurationSet() != null
- && target.getActiveConfigurationSet().getId().equals(
- configurationSet.getId())) {
+ && target.getActiveConfigurationSet().getId().equals(configurationSet.getId())) {
result.setActiveConfigSet(configurationSetConfigurationWrapper);
}
-
configurationSetList.add(configurationSetConfigurationWrapper);
Collections.sort(configurationSetList);
}
return result;
}
-
private List<ConfigurationSetConfigurationWrapper> configurationSetList = new ArrayList<ConfigurationSetConfigurationWrapper>();
-
private ConfigurationSetConfigurationWrapper activeConfigurationSet;
-
private Map<String, String> widgetSetting;
-
private Map<String, Map<String, String>> conditionSetting;
public List<ConfigurationSetConfigurationWrapper> getConfigurationSetList() {
return configurationSetList;
}
- public void setActiveConfigSet(
- ConfigurationSetConfigurationWrapper configurationSet) {
+ public void setActiveConfigSet(ConfigurationSetConfigurationWrapper configurationSet) {
this.activeConfigurationSet = configurationSet;
}
@@ -120,13 +101,11 @@
return activeConfigurationSet;
}
- public void addConfigurationSet(
- ConfigurationSetConfigurationWrapper configurationSet) {
+ public void addConfigurationSet(ConfigurationSetConfigurationWrapper configurationSet) {
configurationSetList.add(configurationSet);
}
- public void removeConfigurationSet(
- ConfigurationSetConfigurationWrapper configurationSet) {
+ public void removeConfigurationSet(ConfigurationSetConfigurationWrapper configurationSet) {
configurationSetList.remove(configurationSet);
}
@@ -178,8 +157,7 @@
@Override
public ComponentConfigurationWrapper clone() {
ComponentConfigurationWrapper result = new ComponentConfigurationWrapper();
- List<ConfigurationSetConfigurationWrapper> configurationSetList = result
- .getConfigurationSetList();
+ List<ConfigurationSetConfigurationWrapper> configurationSetList = result.getConfigurationSetList();
for (ConfigurationSetConfigurationWrapper cs : this.configurationSetList) {
configurationSetList.add(cs.clone());
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapper.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapper.java 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapper.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -3,30 +3,26 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.lang.builder.CompareToBuilder;
+
import jp.go.aist.rtm.toolscommon.model.component.ConfigurationSet;
-import org.apache.commons.lang.builder.CompareToBuilder;
-
/**
* 変更前と変更後のConfigurationSetを保持するラッパー
- *
*/
-public class ConfigurationSetConfigurationWrapper implements Comparable<ConfigurationSetConfigurationWrapper> {
+public class ConfigurationSetConfigurationWrapper
+ implements Comparable<ConfigurationSetConfigurationWrapper>, Secretable {
private List<NamedValueConfigurationWrapper> namedValueList = new ArrayList<NamedValueConfigurationWrapper>();
-
private String id;
-
private boolean isNameModified = false;
-
private ConfigurationSet configurationSet;
public ConfigurationSet getConfigurationSet() {
return configurationSet;
}
- public ConfigurationSetConfigurationWrapper(
- ConfigurationSet configurationSet, String name) {
+ public ConfigurationSetConfigurationWrapper(ConfigurationSet configurationSet, String name) {
this.id = name;
this.configurationSet = configurationSet;
}
@@ -64,9 +60,20 @@
return false;
}
+ /**
+ * 隠し設定値(ID名が「__」で始まる)を判定します
+ *
+ * @return 隠し設定値の場合はtrue
+ */
@Override
+ public boolean isSecret() {
+ return (this.id != null && this.id.startsWith("__"));
+ }
+
+ @Override
public ConfigurationSetConfigurationWrapper clone() {
- ConfigurationSetConfigurationWrapper result = new ConfigurationSetConfigurationWrapper(this.configurationSet, this.id);
+ ConfigurationSetConfigurationWrapper result = new ConfigurationSetConfigurationWrapper(this.configurationSet,
+ this.id);
for (NamedValueConfigurationWrapper nv : this.namedValueList) {
result.namedValueList.add(nv.clone());
}
@@ -76,8 +83,9 @@
/**
* @see java.lang.Comparable#compareTo(Object)
*/
+ @Override
public int compareTo(ConfigurationSetConfigurationWrapper object) {
- return new CompareToBuilder().append(this.id, object.id)
- .toComparison();
+ return new CompareToBuilder().append(this.id, object.id).toComparison();
}
+
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapper.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapper.java 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapper.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -12,8 +12,7 @@
/**
* NamedValueを編集するためのラッパー
*/
-public class NamedValueConfigurationWrapper implements
- Comparable<NamedValueConfigurationWrapper> {
+public class NamedValueConfigurationWrapper implements Comparable<NamedValueConfigurationWrapper>, Secretable {
private String key;
private String value;
@@ -27,8 +26,7 @@
private String typeName;
- public NamedValueConfigurationWrapper(String key, String value,
- String typeName) {
+ public NamedValueConfigurationWrapper(String key, String value, String typeName) {
this.key = key;
this.value = value;
this.typeName = typeName;
@@ -67,15 +65,6 @@
}
/**
- * 隠し設定値(キー名が「_」で始まる)を判定します
- *
- * @return 隠し設定値の場合はtrue
- */
- public boolean isSecret() {
- return (this.key != null && this.key.startsWith("_"));
- }
-
- /**
* 設定値の値を取得します。
*
* @return 設定値
@@ -224,8 +213,7 @@
// widget種別、制約条件がない場合は空のwidgetを生成
if (widgetList == null) {
widgetList = new ArrayList<ConfigurationWidget>();
- ConfigurationWidget w = new ConfigurationWidget(
- ConfigurationWidget.TEXT,
+ ConfigurationWidget w = new ConfigurationWidget(ConfigurationWidget.TEXT,
ConfigurationCondition.NULL_CONDITION);
widgetList.add(w);
}
@@ -329,10 +317,19 @@
return result;
}
+ /**
+ * 隠し設定値(キー名が「__」で始まる)を判定します
+ *
+ * @return 隠し設定値の場合はtrue
+ */
@Override
+ public boolean isSecret() {
+ return (this.key != null && this.key.startsWith("__"));
+ }
+
+ @Override
public NamedValueConfigurationWrapper clone() {
- NamedValueConfigurationWrapper result = new NamedValueConfigurationWrapper(
- key);
+ NamedValueConfigurationWrapper result = new NamedValueConfigurationWrapper(key);
result.setValue(getValueAsString());
result.isKeyModified = isKeyModified;
result.isValueModified = isValueModified;
@@ -357,10 +354,8 @@
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
- buffer.append("key=").append(key).append(" keyModify=")
- .append(isKeyModified).append(" value=")
- .append(getValueAsString()).append(" valueModify=")
- .append(isValueModified);
+ buffer.append("key=").append(key).append(" keyModify=").append(isKeyModified).append(" value=")
+ .append(getValueAsString()).append(" valueModify=").append(isValueModified);
if (widgetList != null) {
buffer.append(" ").append(widgetList.toString());
}
@@ -376,8 +371,7 @@
*/
@Override
public int compareTo(NamedValueConfigurationWrapper object) {
- return new CompareToBuilder().append(this.key, object.key)
- .toComparison();
+ return new CompareToBuilder().append(this.key, object.key).toComparison();
}
public boolean canModify() {
Added: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/Secretable.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/Secretable.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/Secretable.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -0,0 +1,15 @@
+package jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper;
+
+/**
+ * 隠しパラメータを判定するインターフェース
+ */
+public interface Secretable {
+
+ /**
+ * 隠しパラメータか判定します。
+ *
+ * @return 隠しパラメータの場合はtrue
+ */
+ boolean isSecret();
+
+}
Property changes on: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/Secretable.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapperTest.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapperTest.java 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ComponentConfigurationWrapperTest.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -14,6 +14,9 @@
for (ConfigurationSetConfigurationWrapper cs : config
.getConfigurationSetList()) {
String csId = cs.getId();
+ if ("__widget__".equals(csId) || "__constraints__".equals(csId) || "__config1".equals(csId)) {
+ continue;
+ }
if (csId == "default") {
for (NamedValueConfigurationWrapper nv : cs.getNamedValueList()) {
if (nv.getKey() == "int_param1") {
Added: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapperTest.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapperTest.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapperTest.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -0,0 +1,32 @@
+package jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import jp.go.aist.rtm.systemeditor.ui.views.configurationview.mock.ConfigurationSetMock;
+
+public class ConfigurationSetConfigurationWrapperTest {
+
+ @Test
+ public void testIsSecret() throws Exception {
+ ConfigurationSetMock cs = new ConfigurationSetMock();
+ ConfigurationSetConfigurationWrapper cw;
+ cw = new ConfigurationSetConfigurationWrapper(cs, "key");
+ assertFalse(cw.isSecret());
+ cw = new ConfigurationSetConfigurationWrapper(cs, "_key");
+ assertFalse(cw.isSecret());
+ cw = new ConfigurationSetConfigurationWrapper(cs, "__key");
+ assertTrue(cw.isSecret());
+ cw = new ConfigurationSetConfigurationWrapper(cs, "___key");
+ assertTrue(cw.isSecret());
+ cw = new ConfigurationSetConfigurationWrapper(cs, "key_");
+ assertFalse(cw.isSecret());
+ cw = new ConfigurationSetConfigurationWrapper(cs, "key__");
+ assertFalse(cw.isSecret());
+ cw = new ConfigurationSetConfigurationWrapper(cs, null);
+ assertFalse(cw.isSecret());
+ }
+
+}
Property changes on: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/ConfigurationSetConfigurationWrapperTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapperTest.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapperTest.java 2016-03-05 09:37:12 UTC (rev 560)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapperTest.java 2016-03-05 09:37:31 UTC (rev 561)
@@ -356,11 +356,15 @@
nv = new NamedValueConfigurationWrapper("key", "value");
assertFalse(nv.isSecret());
nv = new NamedValueConfigurationWrapper("_key", "value");
+ assertFalse(nv.isSecret());
+ nv = new NamedValueConfigurationWrapper("__key", "value");
assertTrue(nv.isSecret());
+ nv = new NamedValueConfigurationWrapper("___key", "value");
+ assertTrue(nv.isSecret());
nv = new NamedValueConfigurationWrapper("key_", "value");
assertFalse(nv.isSecret());
- nv = new NamedValueConfigurationWrapper("__key", "value");
- assertTrue(nv.isSecret());
+ nv = new NamedValueConfigurationWrapper("key__", "value");
+ assertFalse(nv.isSecret());
nv = new NamedValueConfigurationWrapper(null, "value");
assertFalse(nv.isSecret());
}
More information about the openrtm-commit
mailing list