[openrtm-commit:00533] r232 - in trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor: restoration ui/dialog
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 1月 3日 (火) 01:29:53 JST
Author: sakamoto
Date: 2012-01-03 01:29:53 +0900 (Tue, 03 Jan 2012)
New Revision: 232
Added:
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ConnectorDialogBase.java
Modified:
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/restoration/Restoration.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java
Log:
Update ConnectorProfile Properties #1611,#2295
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/restoration/Restoration.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/restoration/Restoration.java 2012-01-02 16:29:19 UTC (rev 231)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/restoration/Restoration.java 2012-01-02 16:29:53 UTC (rev 232)
@@ -47,9 +47,8 @@
public static void processAllRestoreConfigurationSet(Result result,
SystemDiagram systemDiagram) {
- List<CorbaConfigurationSet> remoteConfigurationSets = new ArrayList<CorbaConfigurationSet>();
-
for (Component c : systemDiagram.getRegisteredComponents()) {
+ List<CorbaConfigurationSet> remoteConfigurationSets = new ArrayList<CorbaConfigurationSet>();
if (!(c instanceof CorbaComponent)) {
continue;
}
Added: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ConnectorDialogBase.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ConnectorDialogBase.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ConnectorDialogBase.java 2012-01-02 16:29:53 UTC (rev 232)
@@ -0,0 +1,239 @@
+package jp.go.aist.rtm.systemeditor.ui.dialog;
+
+import static jp.go.aist.rtm.systemeditor.nl.Messages.getString;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+
+public class ConnectorDialogBase extends TitleAreaDialog {
+
+ static final int PROPERTY_NAME = 0;
+ static final int PROPERTY_VALUE = 1;
+ static final int EXEC_BUTTON_WIDTH = 70;
+
+ private List<AdditionalEntry> additional;
+
+ public ConnectorDialogBase(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.CENTER | SWT.RESIZE);
+ additional = new ArrayList<AdditionalEntry>();
+ }
+
+ protected TableViewer createAdditionalTableViewer(Composite parent) {
+ Composite baseComposite = new Composite(parent, SWT.NONE);
+ GridLayout gl = new GridLayout(2, false);
+ gl.numColumns = 2;
+ GridData gd = new GridData();
+ gd.verticalAlignment = SWT.FILL;
+ gd.horizontalAlignment = SWT.FILL;
+ gd.grabExcessVerticalSpace = true;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalSpan = 2;
+ baseComposite.setLayout(gl);
+ baseComposite.setLayoutData(gd);
+
+ final TableViewer additionalTableViewer = new TableViewer(baseComposite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER);
+ additionalTableViewer.setContentProvider(new ArrayContentProvider());
+ Table additionalTable = additionalTableViewer.getTable();
+
+ gl = new GridLayout(1, false);
+ gl.numColumns = 1;
+ gd = new GridData();
+ gd.verticalAlignment = SWT.FILL;
+ gd.horizontalAlignment = SWT.FILL;
+ gd.grabExcessVerticalSpace = true;
+ gd.grabExcessHorizontalSpace = true;
+ gd.heightHint = 120;
+ additionalTable.setLayout(gl);
+ additionalTable.setLayoutData(gd);
+ additionalTable.setLinesVisible(true);
+ additionalTable.setHeaderVisible(true);
+
+ TableViewerColumn col = null;
+ col = createColumn(additionalTableViewer, "Name", 200);
+ col.setEditingSupport(new AdditionalTableEdittingSupport(
+ additionalTableViewer, PROPERTY_NAME));
+ col = createColumn(additionalTableViewer, "Value", 200);
+ col.setEditingSupport(new AdditionalTableEdittingSupport(
+ additionalTableViewer, PROPERTY_VALUE));
+
+ additionalTableViewer
+ .setLabelProvider(new AdditionalEntryLabelProvider());
+ additionalTableViewer.setInput(additional);
+
+ Composite buttonComposite = new Composite(baseComposite, SWT.NONE);
+ gl = new GridLayout();
+ gd = new GridData(GridData.FILL_VERTICAL);
+ buttonComposite.setLayout(gl);
+ buttonComposite.setLayoutData(gd);
+
+ Button addButton = new Button(buttonComposite, SWT.TOP);
+ addButton.setText(getString("ServiceConnectorCreaterDialog.9"));
+ gd = new GridData();
+ gd.widthHint = EXEC_BUTTON_WIDTH;
+ addButton.setLayoutData(gd);
+ addButton.setEnabled(true);
+ addButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ AdditionalEntry entry = new AdditionalEntry();
+ additional.add(entry);
+ additionalTableViewer.refresh();
+ }
+ });
+
+ Button deleteButton = new Button(buttonComposite, SWT.TOP);
+ deleteButton.setText(getString("ServiceConnectorCreaterDialog.10"));
+ gd = new GridData();
+ gd.widthHint = EXEC_BUTTON_WIDTH;
+ deleteButton.setLayoutData(gd);
+ deleteButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int selectionIndex = additionalTableViewer.getTable().getSelectionIndex();
+ if (selectionIndex >= 0
+ && ((List) additionalTableViewer.getInput()).size() >= selectionIndex + 1) {
+ ((List) additionalTableViewer.getInput()).remove(selectionIndex);
+ additionalTableViewer.refresh();
+ }
+ }
+ });
+
+ return additionalTableViewer;
+ }
+
+ protected TableViewerColumn createColumn(TableViewer tv, String title, int width) {
+ TableViewerColumn col = new TableViewerColumn(tv, SWT.NONE);
+ col.getColumn().setText(title);
+ col.getColumn().setWidth(width);
+ col.getColumn().setResizable(true);
+ col.getColumn().setMoveable(false);
+ return col;
+ }
+
+ public class AdditionalEntry {
+ private String name;
+ private String value;
+
+ public AdditionalEntry() {
+ name = "NewName";
+ value = "NewValue";
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+
+ protected class AdditionalEntryLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if( (element instanceof AdditionalEntry) == false ) return "";
+ AdditionalEntry entry = (AdditionalEntry) element;
+ if (columnIndex == PROPERTY_NAME) {
+ return entry.getName();
+ } else if (columnIndex == PROPERTY_VALUE) {
+ return entry.getValue();
+ }
+ return null;
+ }
+ }
+
+ protected class AdditionalTableEdittingSupport extends EditingSupport {
+ CellEditor editor;
+ int column;
+
+ public AdditionalTableEdittingSupport(ColumnViewer viewer, int column) {
+ super(viewer);
+
+ // Create the correct editor based on the column index
+ this.column = column;
+ switch (this.column) {
+ case PROPERTY_NAME:
+ case PROPERTY_VALUE:
+ editor = new TextCellEditor(((TableViewer) viewer).getTable());
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ return editor;
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ AdditionalEntry entry = (AdditionalEntry) element;
+ //
+ String label = null;
+ if (column == PROPERTY_NAME) {
+ label = entry.getName();
+ } else if (column == PROPERTY_VALUE) {
+ label = entry.getValue();
+ }
+ if (label == null) {
+ return null;
+ }
+ return label;
+ }
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if (!(element instanceof AdditionalEntry)) {
+ return;
+ }
+ AdditionalEntry entry = (AdditionalEntry) element;
+ //
+ if (column == PROPERTY_NAME) {
+ entry.setName( (String) value);
+ } else if (column == PROPERTY_VALUE) {
+ entry.setValue( (String) value);
+ }
+ getViewer().update(element, null);
+ }
+ }
+}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java 2012-01-02 16:29:19 UTC (rev 231)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java 2012-01-02 16:29:53 UTC (rev 232)
@@ -14,7 +14,7 @@
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -42,7 +42,7 @@
* サブスクリプションタイプは、データフロータイプが「Push」の時のみ表示される。<br>
* PushRateは、サブスクリプションタイプが「Periodic」であり、かつデータフロータイプが「Push」の時のみ表示される<br>
*/
-public class DataConnectorCreaterDialog extends TitleAreaDialog {
+public class DataConnectorCreaterDialog extends ConnectorDialogBase {
static final String LABEL_PUSH_POLICY = Messages.getString("DataConnectorCreaterDialog.20");
static final String LABEL_SKIP_COUNT = Messages.getString("DataConnectorCreaterDialog.21");
@@ -67,37 +67,24 @@
static final String MSG_ERROR_INPORT_READ_TIMEOUT_NOT_NUMERIC = Messages.getString("DataConnectorCreaterDialog.36");
private Text nameText;
-
private Combo dataTypeCombo;
-
private Combo interfaceTypeCombo;
-
private Combo dataflowTypeCombo;
-
private Combo subscriptionTypeCombo;
-
private Text pushRateText;
-
private Combo pushPolicyCombo;
-
private Text skipCountText;
Composite detailComposite;
-
Point defaultDialogSize;
-
private ConnectorProfile connectorProfile;
-
private ConnectorProfile dialogResult;
-
private OutPort outport;
-
private InPort inport;
-
BufferPackage ob;
-
BufferPackage ib;
+ TableViewer additionalTableViewer;
boolean disableNotify;
static class BufferPackage {
@@ -110,7 +97,6 @@
public DataConnectorCreaterDialog(Shell parentShell) {
super(parentShell);
- setShellStyle(getShellStyle() | SWT.CENTER | SWT.RESIZE);
}
/**
@@ -420,7 +406,9 @@
ib = new BufferPackage();
createBufferComposite(detailComposite, LABEL_INPORT_BUFFER, ib);
-
+
+ additionalTableViewer = createAdditionalTableViewer(detailComposite);
+
loadDetailData();
defaultDialogSize = getShell().getSize();
@@ -779,6 +767,12 @@
* {@inheritDoc}
*/
protected void okPressed() {
+ if( additionalTableViewer!=null ) {
+ List<AdditionalEntry> additional = (List<AdditionalEntry>)additionalTableViewer.getInput();
+ for(AdditionalEntry target : additional) {
+ connectorProfile.setProperty(target.getName(), target.getValue());
+ }
+ }
dialogResult = connectorProfile;
super.okPressed();
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java 2012-01-02 16:29:19 UTC (rev 231)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java 2012-01-02 16:29:53 UTC (rev 232)
@@ -1,11 +1,15 @@
package jp.go.aist.rtm.systemeditor.ui.dialog;
+import static jp.go.aist.rtm.systemeditor.nl.Messages.getString;
+import static jp.go.aist.rtm.systemeditor.ui.util.RTMixin.form;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import jp.go.aist.rtm.systemeditor.ui.dialog.ConnectorDialogBase.AdditionalEntry;
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.ConnectorProfile;
@@ -13,7 +17,6 @@
import jp.go.aist.rtm.toolscommon.model.component.ServicePort;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
@@ -43,9 +46,6 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
-import static jp.go.aist.rtm.systemeditor.nl.Messages.getString;
-import static jp.go.aist.rtm.systemeditor.ui.util.RTMixin.*;
-
/**
* サービスポート間の接続のコネクタプロファイルの選択ダイアログ
* <P>
@@ -66,7 +66,7 @@
* provider={1}」</li>
* </ul>
*/
-public class ServiceConnectorCreaterDialog extends TitleAreaDialog {
+public class ServiceConnectorCreaterDialog extends ConnectorDialogBase {
static final int EXEC_BUTTON_WIDTH = 70;
@@ -123,10 +123,10 @@
List<String> providerLabels;
String baseMessage;
+ TableViewer additionalTableViewer;
public ServiceConnectorCreaterDialog(Shell parentShell) {
super(parentShell);
- setShellStyle(getShellStyle() | SWT.CENTER | SWT.RESIZE);
}
/**
@@ -150,6 +150,7 @@
.createConnectorProfile();
this.connectorProfile.setName(first.getNameL() + "_"
+ second.getNameL());
+ this.connectorProfile.setProperty("port.connection.strictness", "strict");
open();
@@ -399,6 +400,8 @@
}
});
+ additionalTableViewer = createAdditionalTableViewer(detailComposite);
+
loadDetailData();
defaultDialogSize = getShell().getSize();
@@ -413,15 +416,6 @@
return l;
}
- TableViewerColumn createColumn(TableViewer tv, String title, int width) {
- TableViewerColumn col = new TableViewerColumn(tv, SWT.NONE);
- col.getColumn().setText(title);
- col.getColumn().setWidth(width);
- col.getColumn().setResizable(true);
- col.getColumn().setMoveable(false);
- return col;
- }
-
/**
* モデル情報にアクセスし、表示に設定する
*/
@@ -478,6 +472,13 @@
String provider = e.provider.toString();
connectorProfile.setProperty(consumer, provider);
}
+
+ if( additionalTableViewer!=null ) {
+ List<AdditionalEntry> additional = (List<AdditionalEntry>)additionalTableViewer.getInput();
+ for(AdditionalEntry target : additional) {
+ connectorProfile.setProperty(target.getName(), target.getValue());
+ }
+ }
}
/** Consumer/Providerのエントリの整合性チェック */
openrtm-commit メーリングリストの案内