[openrtm-commit:01740] r554 - in trunk/rtmtools/jp.go.aist.rtm.systemeditor: src/jp/go/aist/rtm/systemeditor/nl src/jp/go/aist/rtm/systemeditor/ui/editor/editpart src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy src/jp/go/aist/rtm/systemeditor/ui/editor/figure 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 test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock test/jp/go/aist/rtm/systemeditor/ui/views/managercontrolview/mock
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 2月 22日 (月) 13:53:20 JST
Author: ga
Date: 2016-02-22 13:53:20 +0900 (Mon, 22 Feb 2016)
New Revision: 554
Added:
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AutoConnectorCreationTool.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/editor/editpart/ComponentEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortHelper.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/SystemDiagramEditPart.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/PortGraphicalNodeEditPolicy.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedInPortFigure.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedOutPortFigure.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedServicePortFigure.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/InPortFigure.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/OutPortFigure.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ServicePortFigure.java
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/NamedValueConfigurationWrapper.java
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/mock/ComponentMock.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ConfigurationSetMock.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/PortMock.java
trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/managercontrolview/mock/RTCManagerMock.java
Log:
Modified Port Nme position #2689
Display at the time of the port connection #3443
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-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties 2016-02-22 04:53:20 UTC (rev 554)
@@ -247,14 +247,11 @@
ConfigurationView.27=name
ConfigurationView.28=Value
ConfigurationView.29=Add
-ConfigurationView.31=value
ConfigurationView.32=Delete
ConfigurationView.39=Warning
ConfigurationView.40=The name already exists.
-ConfigurationView.41=<Unknown>
-ConfigurationView.42=Warning
ConfigurationView.43=The key already exists.
-ConfigurationView.46=<Unknown>
+ConfigurationView.47=Show 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]
Added: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AutoConnectorCreationTool.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AutoConnectorCreationTool.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AutoConnectorCreationTool.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -0,0 +1,155 @@
+package jp.go.aist.rtm.systemeditor.ui.editor.editpart;
+
+import java.util.List;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.tools.ConnectionDragCreationTool;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.TraverseEvent;
+import org.eclipse.ui.PlatformUI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * コネクタを作成するツール
+ */
+public class AutoConnectorCreationTool extends ConnectionDragCreationTool {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutoConnectorCreationTool.class);
+
+ @Override
+ protected void handleFinished() {
+ getDomain().setActiveTool(getDomain().getDefaultTool());
+ super.handleFinished();
+ }
+
+ @Override
+ protected boolean handleDragStarted() {
+ LOGGER.trace("handleDragStarted: currViewer={} currCommand={} target={}", getCurrentViewer(),
+ getCurrentCommand(), getTargetEditPart());
+ // ポート接続モード開始
+ final SystemDiagramEditPart sd = getSystemDiagramEditPart();
+ final EditPart target = getTargetEditPart();
+ LOGGER.trace("handleDragStarted: diagram=<{}> target=<{}>", sd, target);
+ if (sd != null) {
+ sd.setConnectingPortEditPart((PortEditPart) target);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ sd.refreshViewAllConnectablePort();
+ }
+ });
+ }
+ return super.handleDragStarted();
+ }
+
+ @Override
+ protected boolean handleCreateConnection() {
+ LOGGER.trace("handleCreateConnection: currViewer={} currCommand={} target={}", getCurrentViewer(),
+ getCurrentCommand(), getTargetEditPart());
+ // ポート接続モード終了
+ final SystemDiagramEditPart sd = getSystemDiagramEditPart();
+ LOGGER.trace("handleCreateConnection: diagram=<{}>", sd);
+ if (sd != null) {
+ sd.setConnectingPortEditPart(null);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ sd.refreshViewAllConnectablePort();
+ }
+ });
+ }
+ return super.handleCreateConnection();
+ }
+
+ SystemDiagramEditPart getSystemDiagramEditPart() {
+ EditPartViewer viewer = getCurrentViewer();
+ List<?> list = viewer.getRootEditPart().getChildren();
+ if (!list.isEmpty() && list.get(0) instanceof SystemDiagramEditPart) {
+ SystemDiagramEditPart sd = (SystemDiagramEditPart) list.get(0);
+ return sd;
+ }
+ return null;
+ }
+
+ @Override
+ protected boolean handleDrag() {
+ return super.handleDrag();
+ }
+
+ @Override
+ protected boolean handleMove() {
+ return super.handleMove();
+ }
+
+ @Override
+ protected boolean handleDragInProgress() {
+ return super.handleDragInProgress();
+ }
+
+ @Override
+ protected boolean handleKeyDown(KeyEvent e) {
+ return super.handleKeyDown(e);
+ }
+
+ @Override
+ protected boolean handleKeyUp(KeyEvent e) {
+ return super.handleKeyUp(e);
+ }
+
+ @Override
+ protected void handleKeyTraversed(TraverseEvent event) {
+ super.handleKeyTraversed(event);
+ }
+
+ @Override
+ protected boolean handleEnteredEditPart() {
+ return super.handleEnteredEditPart();
+ }
+
+ @Override
+ protected boolean handleExitingEditPart() {
+ return super.handleExitingEditPart();
+ }
+
+ @Override
+ protected boolean handleFocusGained() {
+ return super.handleFocusGained();
+ }
+
+ @Override
+ protected boolean handleFocusLost() {
+ return super.handleFocusLost();
+ }
+
+ @Override
+ protected boolean handleHover() {
+ return super.handleHover();
+ }
+
+ @Override
+ protected boolean handleHoverStop() {
+ return super.handleHoverStop();
+ }
+
+ @Override
+ protected boolean handleViewerEntered() {
+ return super.handleViewerEntered();
+ }
+
+ @Override
+ protected boolean handleViewerExited() {
+ return super.handleViewerExited();
+ }
+
+ @Override
+ protected void handleSourceDeactivated() {
+ super.handleSourceDeactivated();
+ }
+
+ public boolean isStartedState() {
+ return super.isInState(STATE_CONNECTION_STARTED);
+ }
+
+}
Property changes on: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/AutoConnectorCreationTool.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/ComponentEditPart.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -65,7 +65,7 @@
public class ComponentEditPart extends AbstractEditPart {
/** コンポーネントの周りとコンポーネントのボディまでのスペース(ポートあり) */
- public static final int PORT_SPACE = 23;
+ public static final int PORT_SPACE = 32;
/** コンポーネントの周りとコンポーネントのボディまでのスペース(ポートなし) */
public static final int NONE_SPACE = 7;
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/InPortEditPart.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,11 +1,5 @@
package jp.go.aist.rtm.systemeditor.ui.editor.editpart;
-import jp.go.aist.rtm.systemeditor.manager.SystemEditorPreferenceManager;
-import jp.go.aist.rtm.systemeditor.ui.editor.figure.ExportedInPortFigure;
-import jp.go.aist.rtm.systemeditor.ui.editor.figure.InPortFigure;
-import jp.go.aist.rtm.toolscommon.model.component.InPort;
-import jp.go.aist.rtm.toolscommon.model.component.Port;
-
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Panel;
@@ -18,6 +12,12 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.PlatformUI;
+import jp.go.aist.rtm.systemeditor.manager.SystemEditorPreferenceManager;
+import jp.go.aist.rtm.systemeditor.ui.editor.figure.ExportedInPortFigure;
+import jp.go.aist.rtm.systemeditor.ui.editor.figure.InPortFigure;
+import jp.go.aist.rtm.toolscommon.model.component.InPort;
+import jp.go.aist.rtm.toolscommon.model.component.Port;
+
/**
* InPortのEditPartクラス
*/
@@ -83,11 +83,11 @@
@Override
protected void refreshVisuals() {
- Color color = SystemEditorPreferenceManager.getInstance().getColor(
- SystemEditorPreferenceManager.COLOR_DATAPORT_NO_CONNECT);
+ Color color = SystemEditorPreferenceManager.getInstance()
+ .getColor(SystemEditorPreferenceManager.COLOR_DATAPORT_NO_CONNECT);
if (isConnected()) {
- color = SystemEditorPreferenceManager.getInstance().getColor(
- SystemEditorPreferenceManager.COLOR_DATAPORT_CONNECTED);
+ color = SystemEditorPreferenceManager.getInstance()
+ .getColor(SystemEditorPreferenceManager.COLOR_DATAPORT_CONNECTED);
}
getFigure().setBackgroundColor(color);
@@ -95,8 +95,7 @@
getFigure().setToolTip(getDataPortToolTip(getModel()));
if (getFigure().getParent() != null)
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
- getFigure(), getFigure().getBounds());
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), getFigure().getBounds());
}
/**
@@ -112,20 +111,15 @@
String labelString = "";
try {
+ labelString = labelString + (port.getNameL() == null ? "<unknown>" : port.getNameL()) + "\r\n";
+ labelString = labelString + (port.getDataTypes() == null ? "<unknown>" : port.getDataTypes().toString())
+ + "\r\n";
+ labelString = labelString + (port.getInterfaceTypes().size() == 0 ? "<unknown>" : port.getInterfaceTypes())
+ + "\r\n";
+ labelString = labelString + (port.getDataflowTypes().size() == 0 ? "<unknown>" : port.getDataflowTypes())
+ + "\r\n";
labelString = labelString
- + (port.getNameL() == null ? "<unknown>" : port.getNameL()) + "\r\n";
- labelString = labelString
- + (port.getDataTypes() == null ? "<unknown>"
- : port.getDataTypes().toString()) + "\r\n";
- labelString = labelString
- + (port.getInterfaceTypes().size() == 0 ? "<unknown>"
- : port.getInterfaceTypes()) + "\r\n";
- labelString = labelString
- + (port.getDataflowTypes().size() == 0 ? "<unknown>"
- : port.getDataflowTypes()) + "\r\n";
- labelString = labelString
- + (port.getSubscriptionTypes().size() == 0 ? "<unknown>"
- : port.getSubscriptionTypes()) + ""; // \r\nは最後はいらない
+ + (port.getSubscriptionTypes().size() == 0 ? "<unknown>" : port.getSubscriptionTypes()) + ""; // \r\nは最後はいらない
} catch (RuntimeException e) {
// void
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/OutPortEditPart.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,11 +1,5 @@
package jp.go.aist.rtm.systemeditor.ui.editor.editpart;
-import jp.go.aist.rtm.systemeditor.manager.SystemEditorPreferenceManager;
-import jp.go.aist.rtm.systemeditor.ui.editor.figure.ExportedOutPortFigure;
-import jp.go.aist.rtm.systemeditor.ui.editor.figure.OutPortFigure;
-import jp.go.aist.rtm.toolscommon.model.component.OutPort;
-import jp.go.aist.rtm.toolscommon.model.component.impl.PortConnectorImpl;
-
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.MouseEvent;
import org.eclipse.draw2d.MouseListener;
@@ -17,16 +11,25 @@
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.requests.SimpleFactory;
-import org.eclipse.gef.tools.ConnectionDragCreationTool;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.swt.graphics.Color;
import org.eclipse.ui.PlatformUI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import jp.go.aist.rtm.systemeditor.manager.SystemEditorPreferenceManager;
+import jp.go.aist.rtm.systemeditor.ui.editor.figure.ExportedOutPortFigure;
+import jp.go.aist.rtm.systemeditor.ui.editor.figure.OutPortFigure;
+import jp.go.aist.rtm.toolscommon.model.component.OutPort;
+import jp.go.aist.rtm.toolscommon.model.component.impl.PortConnectorImpl;
+
/**
* OutPortのEditPartクラス
*/
public class OutPortEditPart extends PortEditPart {
+ private static final Logger LOGGER = LoggerFactory.getLogger(OutPortEditPart.class);
+
/**
* コンストラクタ
*
@@ -49,8 +52,6 @@
public void run() {
if (isActive()) {
refresh();
-// refreshVisuals();
-// refreshSourceConnections();
}
}
});
@@ -88,20 +89,20 @@
/**
* ポート上で、自動的にコネクタを作成するモードに変更する機能を付加するメソッド
*/
- public static void supportAutoCreateConnectorToolMode(
- final EditPartViewer viewer, IFigure figure) {
+ public static void supportAutoCreateConnectorToolMode(final EditPartViewer viewer, IFigure figure) {
+
final EditDomain domain = viewer.getEditDomain();
final AutoConnectorCreationTool connectionCreationTool = new AutoConnectorCreationTool();
figure.addMouseMotionListener(new MouseMotionListener() {
+
@Override
public void mouseDragged(MouseEvent me) {
}
@Override
public void mouseEntered(MouseEvent me) {
- connectionCreationTool.setFactory(new SimpleFactory(
- PortConnectorImpl.class));
+ connectionCreationTool.setFactory(new SimpleFactory(PortConnectorImpl.class));
domain.setActiveTool(connectionCreationTool);
}
@@ -121,8 +122,8 @@
public void mouseMoved(MouseEvent me) {
}
});
-
- figure.addMouseListener(new MouseListener.Stub(){
+
+ figure.addMouseListener(new MouseListener.Stub() {
@Override
public void mousePressed(MouseEvent me) {
// right click
@@ -133,38 +134,17 @@
});
}
- /**
- * コネクタを作成するツール
- */
- public static class AutoConnectorCreationTool extends
- ConnectionDragCreationTool {
- @Override
- protected void handleFinished() {
- getDomain().setActiveTool(getDomain().getDefaultTool());
- super.handleFinished();
- }
-
- public boolean isStartedState() {
- return super.isInState(STATE_CONNECTION_STARTED);
- }
- }
-
@Override
protected void refreshVisuals() {
- Color color = SystemEditorPreferenceManager.getInstance().getColor(
- SystemEditorPreferenceManager.COLOR_DATAPORT_NO_CONNECT);
-
+ Color color = SystemEditorPreferenceManager.getInstance()
+ .getColor(SystemEditorPreferenceManager.COLOR_DATAPORT_NO_CONNECT);
if (isConnected()) {
- color = SystemEditorPreferenceManager.getInstance().getColor(
- SystemEditorPreferenceManager.COLOR_DATAPORT_CONNECTED);
+ color = SystemEditorPreferenceManager.getInstance()
+ .getColor(SystemEditorPreferenceManager.COLOR_DATAPORT_CONNECTED);
}
-
getFigure().setBackgroundColor(color);
-
getFigure().setToolTip(InPortEditPart.getDataPortToolTip(getModel()));
-
- ((GraphicalEditPart) getParent()).setLayoutConstraint(this,
- getFigure(), getFigure().getBounds());
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), getFigure().getBounds());
}
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortEditPart.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -7,19 +7,6 @@
import java.util.List;
import java.util.Map;
-import jp.go.aist.rtm.systemeditor.manager.SystemEditorPreferenceManager;
-import jp.go.aist.rtm.systemeditor.ui.editor.AbstractSystemDiagramEditor;
-import jp.go.aist.rtm.systemeditor.ui.editor.editpolicy.PortGraphicalNodeEditPolicy;
-import jp.go.aist.rtm.systemeditor.ui.editor.figure.PortAnchor;
-import jp.go.aist.rtm.systemeditor.ui.editor.figure.PortFigure;
-import jp.go.aist.rtm.systemeditor.ui.util.ComponentUtil;
-import jp.go.aist.rtm.toolscommon.model.component.Component;
-import jp.go.aist.rtm.toolscommon.model.component.ComponentPackage;
-import jp.go.aist.rtm.toolscommon.model.component.ComponentSpecification;
-import jp.go.aist.rtm.toolscommon.model.component.Port;
-import jp.go.aist.rtm.toolscommon.model.component.PortConnector;
-import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
-
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
@@ -34,13 +21,30 @@
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.ui.PlatformUI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import jp.go.aist.rtm.systemeditor.manager.SystemEditorPreferenceManager;
+import jp.go.aist.rtm.systemeditor.ui.editor.AbstractSystemDiagramEditor;
+import jp.go.aist.rtm.systemeditor.ui.editor.editpolicy.PortGraphicalNodeEditPolicy;
+import jp.go.aist.rtm.systemeditor.ui.editor.figure.PortAnchor;
+import jp.go.aist.rtm.systemeditor.ui.editor.figure.PortFigure;
+import jp.go.aist.rtm.systemeditor.ui.util.ComponentUtil;
+import jp.go.aist.rtm.toolscommon.model.component.Component;
+import jp.go.aist.rtm.toolscommon.model.component.ComponentPackage;
+import jp.go.aist.rtm.toolscommon.model.component.ComponentSpecification;
+import jp.go.aist.rtm.toolscommon.model.component.Port;
+import jp.go.aist.rtm.toolscommon.model.component.PortConnector;
+import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
+
/**
* ポートのEditPartクラス
*/
public abstract class PortEditPart extends AbstractEditPart implements
NodeEditPart {
+ private static final Logger LOGGER = LoggerFactory.getLogger(PortEditPart.class);
+
FloatingLabel portLabel;
/**
@@ -83,11 +87,13 @@
if (Component.OUTPORT_DIRECTION_RIGHT_LITERAL.equals(direction)) {
Point p = rect.getTopRight();
labelRect.x = baseRect.x + p.x;
- labelRect.y = baseRect.y + p.y - labelRect.height;
+ labelRect.y = baseRect.y + p.y - labelRect.height
+ + (rect.height / 2);
} else if (Component.OUTPORT_DIRECTION_LEFT_LITERAL.equals(direction)) {
Point p = rect.getTopLeft();
labelRect.x = baseRect.x + p.x - labelRect.width;
- labelRect.y = baseRect.y + p.y - labelRect.height;
+ labelRect.y = baseRect.y + p.y - labelRect.height
+ + (rect.height / 2);
} else if (Component.OUTPORT_DIRECTION_UP_LITERAL.equals(direction)) {
Point p = rect.getTop();
labelRect.x = baseRect.x + p.x - labelRect.width / 2;
@@ -109,22 +115,26 @@
@Override
public ConnectionAnchor getSourceConnectionAnchor(
ConnectionEditPart connection) {
+ LOGGER.trace("getSourceConnectionAnchor: editpart=<{}>", connection);
return new PortAnchor(getFigure());
}
@Override
public ConnectionAnchor getTargetConnectionAnchor(
ConnectionEditPart connection) {
+ LOGGER.trace("getTargetConnectionAnchor: editpart=<{}>", connection);
return new PortAnchor(getFigure());
}
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ LOGGER.trace("getSourceConnectionAnchor: request=<{}>", request);
return new PortAnchor(getFigure());
}
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ LOGGER.trace("getTargetConnectionAnchor: request=<{}>", request);
return new PortAnchor(getFigure());
}
@@ -203,8 +213,8 @@
private class Adapter extends AdapterImpl {
@Override
public void notifyChanged(Notification msg) {
- if (ComponentPackage.eINSTANCE.getPort_ConnectorProfiles()
- .equals(msg.getFeature())
+ if (ComponentPackage.eINSTANCE.getPort_ConnectorProfiles().equals(
+ msg.getFeature())
&& (msg.getEventType() == Notification.ADD || msg
.getEventType() == Notification.REMOVE)) {
if (getModel().eContainer().eContainer() instanceof SystemDiagram) {
@@ -212,22 +222,22 @@
.eContainer().eContainer();
SystemDiagram rootDiagram = systemDiagram.getRootDiagram();
if (rootDiagram.isConnectorProcessing()) {
- //void
- }else{
+ // void
+ } else {
rootDiagram.setConnectorProcessing(true);
- AbstractSystemDiagramEditor editor = ComponentUtil.findEditor(systemDiagram);
- if (editor != null) editor.refresh();
+ AbstractSystemDiagramEditor editor = ComponentUtil
+ .findEditor(systemDiagram);
+ if (editor != null)
+ editor.refresh();
}
rootDiagram.setConnectorProcessing(false);
}
}
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ @Override
public void run() {
if (isActive()) {
refresh();
-// refreshVisuals();
-// refreshTargetConnections();
-// refreshSourceConnections();
}
}
});
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortHelper.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortHelper.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/PortHelper.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,51 +1,59 @@
package jp.go.aist.rtm.systemeditor.ui.editor.editpart;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
import jp.go.aist.rtm.toolscommon.model.component.Component;
import jp.go.aist.rtm.toolscommon.model.component.Port;
import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
/**
* ポートに関するユーティリティクラス
- *
*/
public class PortHelper {
/**
* 指定したポートにコネクタが存在するかを返す
+ *
* @param port
* @return
*/
public static boolean isConnected(Port port) {
- if (port == null) return false;
+ if (port == null)
+ return false;
return !port.getConnectorProfiles().isEmpty();
}
/**
* 選択されているポートを返す
+ *
* @param selection
* @return
*/
public static Port getPort(ISelection selection) {
PortEditPart part = getPortPart(selection);
- if (part == null) return null;
+ if (part == null)
+ return null;
return part.getModel();
}
/**
* ポートが公開されているかを返す
+ *
* @param port
* @return
*/
public static boolean isExported(Port port) {
- if (port == null) return false;
- if (port.eContainer() == null) return false;
- if (!(port.eContainer().eContainer() instanceof SystemDiagram)) return false;
+ if (port == null)
+ return false;
+ if (port.eContainer() == null)
+ return false;
+ if (!(port.eContainer().eContainer() instanceof SystemDiagram))
+ return false;
SystemDiagram diagram = (SystemDiagram) port.eContainer().eContainer();
Component component = diagram.getCompositeComponent();
- if (component == null) return false;
+ if (component == null)
+ return false;
for (Object element : component.getPorts()) {
Port temp = (Port) element;
if (temp.getOriginalPortString().equals(port.getOriginalPortString()))
@@ -56,14 +64,35 @@
/**
* 選択されているポートのEditPartを返す
+ *
* @param selection
* @return
*/
public static PortEditPart getPortPart(ISelection selection) {
- if (!(selection instanceof IStructuredSelection)) return null;
+ if (!(selection instanceof IStructuredSelection))
+ return null;
Object part = ((IStructuredSelection) selection).getFirstElement();
- if (!(part instanceof PortEditPart)) return null;
+ if (!(part instanceof PortEditPart))
+ return null;
return (PortEditPart) part;
}
+ /**
+ * ポートの接続可否の描画を切り替えます。
+ *
+ * @param port
+ * 対象ポート
+ * @param connectable
+ * 接続可能な場合はtrue
+ */
+ public static void refreshViewPortAsConnectable(PortEditPart port, boolean connectable) {
+ if (connectable) {
+ port.getFigure().setLineWidth(2);
+ port.getFigure().setScale(1.2, 1.2);
+ } else {
+ port.getFigure().setLineWidth(1);
+ port.getFigure().setScale(1.0, 1.0);
+ }
+ }
+
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/SystemDiagramEditPart.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/SystemDiagramEditPart.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpart/SystemDiagramEditPart.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,10 +1,8 @@
package jp.go.aist.rtm.systemeditor.ui.editor.editpart;
+import java.util.ArrayList;
import java.util.List;
-import jp.go.aist.rtm.systemeditor.ui.editor.editpolicy.SystemXYLayoutEditPolicy;
-import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
-
import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.FreeformLayout;
import org.eclipse.draw2d.IFigure;
@@ -12,11 +10,23 @@
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.ui.PlatformUI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import jp.go.aist.rtm.systemeditor.ui.editor.editpolicy.GraphicalConnectorCreateManager;
+import jp.go.aist.rtm.systemeditor.ui.editor.editpolicy.SystemXYLayoutEditPolicy;
+import jp.go.aist.rtm.toolscommon.model.component.SystemDiagram;
+
/**
* システムダイアグラムのEditPartクラス
*/
public class SystemDiagramEditPart extends AbstractEditPart {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SystemDiagramEditPart.class);
+
+ private GraphicalConnectorCreateManager connectingPortManager;
+ private PortEditPart connectingPortEditPart;
+
/**
* コンストラクタ
*
@@ -25,7 +35,6 @@
*/
public SystemDiagramEditPart(ActionRegistry actionRegistry) {
super(actionRegistry);
-
}
@Override
@@ -80,4 +89,72 @@
public SystemDiagram getModel() {
return (SystemDiagram) super.getModel();
}
+
+ /**
+ * 接続先選択中となっているポートを設定します。<br>
+ * 選択状態を解除する場合はnullを指定します。
+ *
+ * @param connectingPortEditPart
+ * 接続先選択中のポート
+ */
+ public void setConnectingPortEditPart(PortEditPart connectingPortEditPart) {
+ if (connectingPortEditPart == null) {
+ this.connectingPortEditPart = null;
+ this.connectingPortManager = null;
+ return;
+ }
+ this.connectingPortEditPart = connectingPortEditPart;
+ this.connectingPortManager = new GraphicalConnectorCreateManager(getViewer().getControl().getShell());
+ this.connectingPortManager.setFirst(this.connectingPortEditPart.getModel());
+ }
+
+ /**
+ * 接続先選択中のポートを取得します。
+ *
+ * @return 接続先選択中のポート
+ */
+ public PortEditPart getConnectingPortEditPart() {
+ return this.connectingPortEditPart;
+ }
+
+ /**
+ * 現在、接続先選択中のポートと接続可能か判定します。
+ *
+ * @param part
+ * 対象ポート
+ * @return 接続先選択中のポートと接続可能な場合はtrue
+ */
+ public boolean isConnectablePortEditPart(PortEditPart part) {
+ if (this.connectingPortManager != null && part != null) {
+ this.connectingPortManager.setSecond(part.getModel());
+ return this.connectingPortManager.validate();
+ }
+ return false;
+ }
+
+ /**
+ * ダイアグラム内の全ポートの接続可否を判定し、ポートの描画を更新します。
+ */
+ public void refreshViewAllConnectablePort() {
+ for (Object o : getChildren()) {
+ if (!(o instanceof ComponentEditPart)) {
+ continue;
+ }
+ ComponentEditPart comp = (ComponentEditPart) o;
+ @SuppressWarnings("unchecked")
+ List<?> children = new ArrayList<>(comp.getChildren());
+ for (Object o2 : children) {
+ if (!(o2 instanceof PortEditPart)) {
+ continue;
+ }
+ PortEditPart port = (PortEditPart) o2;
+ if (isConnectablePortEditPart(port)) {
+ PortHelper.refreshViewPortAsConnectable(port, true);
+ } else {
+ PortHelper.refreshViewPortAsConnectable(port, false);
+ }
+ }
+ }
+ }
+
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/PortGraphicalNodeEditPolicy.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/PortGraphicalNodeEditPolicy.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/PortGraphicalNodeEditPolicy.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,50 +1,45 @@
package jp.go.aist.rtm.systemeditor.ui.editor.editpolicy;
-import jp.go.aist.rtm.systemeditor.ui.editor.command.CreateConnectorCommand;
-import jp.go.aist.rtm.systemeditor.ui.editor.command.ReconnectConnectorCommand;
-import jp.go.aist.rtm.toolscommon.model.component.Port;
-import jp.go.aist.rtm.toolscommon.model.component.PortConnector;
-
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gef.requests.ReconnectRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import jp.go.aist.rtm.systemeditor.ui.editor.command.CreateConnectorCommand;
+import jp.go.aist.rtm.systemeditor.ui.editor.command.ReconnectConnectorCommand;
+import jp.go.aist.rtm.toolscommon.model.component.Port;
+import jp.go.aist.rtm.toolscommon.model.component.PortConnector;
+
/**
* コネクタの作成や付け替えに関するEditPolicyクラス
*/
public class PortGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
- @Override
+ private static final Logger LOGGER = LoggerFactory.getLogger(PortGraphicalNodeEditPolicy.class);
+
/**
* {@inheritDoc}
*/
- protected Command getConnectionCompleteCommand(
- CreateConnectionRequest request) {
-
- CreateConnectorCommand command = (CreateConnectorCommand) request
- .getStartCommand();
-
- if (getHost().getModel() instanceof Port == false
- || command.getManager().getFirst() == getHost().getModel()) {
+ @Override
+ protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+ CreateConnectorCommand command = (CreateConnectorCommand) request.getStartCommand();
+ if (getHost().getModel() instanceof Port == false || command.getManager().getFirst() == getHost().getModel()) {
return null;
}
-
command.getManager().setSecond((Port) getHost().getModel());
-
return command;
}
- @SuppressWarnings("unchecked")
- @Override
/**
* {@inheritDoc}
*/
+ @Override
protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
if (getHost().getModel() instanceof Port == false) {
return null;
}
-
GraphicalConnectorCreateManager manager = new GraphicalConnectorCreateManager(
(getHost().getViewer().getControl().getShell()));
manager.setFirst((Port) getHost().getModel());
@@ -56,42 +51,35 @@
return command;
}
- @Override
/**
* {@inheritDoc}
*/
+ @Override
protected Command getReconnectTargetCommand(ReconnectRequest request) {
if (getHost().getModel() instanceof Port == false
- || ((PortConnector) request.getConnectionEditPart().getModel())
- .getSource() == getHost().getModel()) {
+ || ((PortConnector) request.getConnectionEditPart().getModel()).getSource() == getHost().getModel()) {
return null;
}
-
ReconnectConnectorCommand command = new ReconnectConnectorCommand(
(PortConnector) request.getConnectionEditPart().getModel(),
- new GraphicalConnectorCreateManager(getHost().getViewer()
- .getControl().getShell()));
+ new GraphicalConnectorCreateManager(getHost().getViewer().getControl().getShell()));
command.setNewTarget((Port) getHost().getModel());
return command;
}
- @Override
/**
* {@inheritDoc}
*/
+ @Override
protected Command getReconnectSourceCommand(ReconnectRequest request) {
if (getHost().getModel() instanceof Port == false
- || ((PortConnector) request.getConnectionEditPart().getModel())
- .getTarget() == getHost().getModel()) {
+ || ((PortConnector) request.getConnectionEditPart().getModel()).getTarget() == getHost().getModel()) {
return null;
}
-
GraphicalConnectorCreateManager graphicalConnectorCreateManager = new GraphicalConnectorCreateManager(
getHost().getViewer().getControl().getShell());
ReconnectConnectorCommand command = new ReconnectConnectorCommand(
- (PortConnector) request.getConnectionEditPart().getModel(),
- graphicalConnectorCreateManager);
-
+ (PortConnector) request.getConnectionEditPart().getModel(), graphicalConnectorCreateManager);
command.setNewSource((Port) getHost().getModel());
return command;
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ComponentLayout.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -17,7 +17,7 @@
* コンポーネントFigureのデフォルトサイズ(ポートの数から計算)、方向やポートの位置を計算する
*/
public class ComponentLayout extends XYLayout {
- private static final int MIN_WIDTH = 50;
+ private static final int MIN_WIDTH = 60;
private static final int MIN_HEIGHT = 25;
@@ -171,7 +171,7 @@
int height = ComponentEditPart.NONE_SPACE * 2 + MIN_HEIGHT
+ MIN_Component_INTERBAL * (count - 1);
- int width = 93;
+ int width = 111;
Dimension result = new Dimension();
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedInPortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedInPortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedInPortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -2,42 +2,15 @@
import jp.go.aist.rtm.toolscommon.model.component.InPort;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.PointList;
-
/**
* 公開されたInportのフィギュア(子RTCウィンドウで使用される)
- *
*/
public class ExportedInPortFigure extends InPortFigure {
+
public ExportedInPortFigure(InPort port) {
super(port);
- setScale(1.0, 1.0);
- setFill(true);
- setTemplate(createPointList());
- setSize(20 + 1, 20 + 1);
- setBackgroundColor(ColorConstants.darkBlue);
- setForegroundColor(ColorConstants.red);
-
+ setTemplate(PortFigure.P_INPORT_EXPORTED);
}
- private PointList createPointList() {
- PointList result = new PointList(13);
- result.addPoint(0, 0);
- result.addPoint(5, -5);
- result.addPoint(-5, -5);
- result.addPoint(-5, 5);
- result.addPoint(5, 5);
- result.addPoint(0, 0);
- result.addPoint(10, 0);
- result.addPoint(10, 5);
- result.addPoint(20, 5);
- result.addPoint(15, 0);
- result.addPoint(20, -5);
- result.addPoint(10, -5);
- result.addPoint(10, 0);
-
- return result;
- }
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedOutPortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedOutPortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedOutPortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -2,42 +2,15 @@
import jp.go.aist.rtm.toolscommon.model.component.OutPort;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.PointList;
-
/**
* 公開されたOutportのフィギュア(子RTCウィンドウで使用される)
- *
*/
public class ExportedOutPortFigure extends OutPortFigure {
+
public ExportedOutPortFigure(OutPort port) {
super(port);
- setScale(1.0, 1.0);
- setFill(true);
- setTemplate(createPointList());
- setSize(20 + 1, 20 + 1);
- setBackgroundColor(ColorConstants.darkGreen);
- setForegroundColor(ColorConstants.red);
+ setTemplate(PortFigure.P_OUTPORT_EXPORTED);
}
- private PointList createPointList() {
- PointList result = new PointList(13);
- result.addPoint(5, 0);
- result.addPoint(0, -5);
- result.addPoint(-5, -5);
- result.addPoint(-5, 5);
- result.addPoint(0, 5);
- result.addPoint(5, 0);
-
- result.addPoint(10, 0);
- result.addPoint(10, 5);
- result.addPoint(15, 5);
- result.addPoint(20, 0);
- result.addPoint(15, -5);
- result.addPoint(10, -5);
- result.addPoint(10, 0);
-
- return result;
- }
-}
\ No newline at end of file
+}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedServicePortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedServicePortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ExportedServicePortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -2,42 +2,15 @@
import jp.go.aist.rtm.toolscommon.model.component.ServicePort;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.PointList;
-
/**
* 公開されたServiceportのフィギュア(子RTCウィンドウで使用される)
- *
*/
public class ExportedServicePortFigure extends ServicePortFigure {
+
public ExportedServicePortFigure(ServicePort port) {
super(port);
- setScale(1.0, 1.0);
- setFill(true);
- setTemplate(createPointList());
- setSize(20 + 1, 20 + 1);
- setBackgroundColor(ColorConstants.lightBlue);
- setForegroundColor(ColorConstants.red);
+ setTemplate(PortFigure.P_SVCPORT_EXPORTED);
}
- private PointList createPointList() {
- PointList result = new PointList(13);
- result.addPoint(5, 0);
- result.addPoint(5, -5);
- result.addPoint(-5, -5);
- result.addPoint(-5, 5);
- result.addPoint(5, 5);
- result.addPoint(5, 0);
-
- result.addPoint(10, 0);
- result.addPoint(10, -5);
- result.addPoint(20, -5);
- result.addPoint(20, 5);
- result.addPoint(10, 5);
- result.addPoint(10, 0);
-
- return result;
- }
-
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/InPortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/InPortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/InPortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -2,9 +2,6 @@
import jp.go.aist.rtm.toolscommon.model.component.InPort;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.PointList;
-
/**
* InPortのFigure
*/
@@ -17,22 +14,12 @@
* モデル
*/
public InPortFigure(InPort inport) {
- setScale(1.0, 1.0);
- setFill(true);
+ init();
- PointList pointList = new PointList(5);
- pointList.addPoint(-6, -6);
- pointList.addPoint(-6, 6);
- pointList.addPoint(6, 6);
- pointList.addPoint(0, 0);
- pointList.addPoint(6, -6);
-
- setTemplate(pointList);
- setSize(24 + 1, 24 + 1);
+ setTemplate(PortFigure.P_INPORT);
- setBackgroundColor(ColorConstants.darkBlue);
- setForegroundColor(ColorConstants.red);
-
+ setBackgroundColor(PortFigure.S_INPORT.bg);
+ setForegroundColor(PortFigure.S_INPORT.fg);
}
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/OutPortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/OutPortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/OutPortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -2,9 +2,6 @@
import jp.go.aist.rtm.toolscommon.model.component.OutPort;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.PointList;
-
/**
* OutPortのFigure
*/
@@ -12,26 +9,17 @@
/**
* コンストラクタ
- * @param outport モデル
+ *
+ * @param outport
+ * モデル
*/
public OutPortFigure(OutPort outport) {
+ init();
- setScale(1.0, 1.0);
- setFill(true);
+ setTemplate(PortFigure.P_OUTPORT);
- PointList pointList = new PointList(5);
- pointList.addPoint(-6, -6);
- pointList.addPoint(0, -6);
- pointList.addPoint(6, 0);
- pointList.addPoint(0, 6);
- pointList.addPoint(-6, 6);
- setTemplate(pointList);
-
- setSize(24 + 1, 24 + 1);
-
- setBackgroundColor(ColorConstants.darkGreen);
- setForegroundColor(ColorConstants.red);
-
+ setBackgroundColor(PortFigure.S_OUTPORT.bg);
+ setForegroundColor(PortFigure.S_OUTPORT.fg);
}
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/PortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,22 +1,127 @@
package jp.go.aist.rtm.systemeditor.ui.editor.figure;
-import jp.go.aist.rtm.toolscommon.model.component.Component;
-import jp.go.aist.rtm.toolscommon.model.component.Port;
-
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.Panel;
import org.eclipse.draw2d.PolygonDecoration;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Color;
+import jp.go.aist.rtm.toolscommon.model.component.Component;
+import jp.go.aist.rtm.toolscommon.model.component.Port;
+
/**
* PortのFigure
*/
public class PortFigure extends PolygonDecoration {
+ /** 出力ポートの描画テンプレート */
+ public static final PointList P_OUTPORT;
+ /** 入力ポートの描画テンプレート */
+ public static final PointList P_INPORT;
+ /** サービスポートの描画テンプレート */
+ public static final PointList P_SVCPORT;
+
+ /** 公開出力ポートの描画テンプレート */
+ public static final PointList P_OUTPORT_EXPORTED;
+ /** 公開入力ポートの描画テンプレート */
+ public static final PointList P_INPORT_EXPORTED;
+ /** 公開サービスポートの描画テンプレート */
+ public static final PointList P_SVCPORT_EXPORTED;
+
+ /** 出力ポートのスタイル */
+ public static final PortFigureStyle S_OUTPORT;
+ /** 入力ポートのスタイル */
+ public static final PortFigureStyle S_INPORT;
+ /** サービスポートのスタイル */
+ public static final PortFigureStyle S_SVCPORT;
+
+ static {
+ PointList p = new PointList(5);
+ p.addPoint(-6, -6);
+ p.addPoint(0, -6);
+ p.addPoint(6, 0);
+ p.addPoint(0, 6);
+ p.addPoint(-6, 6);
+ P_OUTPORT = p;
+
+ p = new PointList(5);
+ p.addPoint(-6, -6);
+ p.addPoint(-6, 6);
+ p.addPoint(6, 6);
+ p.addPoint(0, 0);
+ p.addPoint(6, -6);
+ P_INPORT = p;
+
+ p = new PointList(5);
+ p.addPoint(-6, -6);
+ p.addPoint(-6, 6);
+ p.addPoint(6, 6);
+ p.addPoint(6, -6);
+ P_SVCPORT = p;
+
+ p = new PointList(13);
+ p.addPoint(6, 0);
+ p.addPoint(0, -6);
+ p.addPoint(-6, -6);
+ p.addPoint(-6, 6);
+ p.addPoint(0, 6);
+ p.addPoint(6, 0);
+ p.addPoint(12, 0);
+ p.addPoint(12, 6);
+ p.addPoint(18, 6);
+ p.addPoint(24, 0);
+ p.addPoint(18, -6);
+ p.addPoint(12, -6);
+ p.addPoint(12, 0);
+ P_OUTPORT_EXPORTED = p;
+
+ p = new PointList(13);
+ p.addPoint(0, 0);
+ p.addPoint(6, -6);
+ p.addPoint(-6, -6);
+ p.addPoint(-6, 6);
+ p.addPoint(6, 6);
+ p.addPoint(0, 0);
+ p.addPoint(12, 0);
+ p.addPoint(12, 6);
+ p.addPoint(24, 6);
+ p.addPoint(18, 0);
+ p.addPoint(24, -6);
+ p.addPoint(12, -6);
+ p.addPoint(12, 0);
+ P_INPORT_EXPORTED = p;
+
+ p = new PointList(13);
+ p.addPoint(6, 0);
+ p.addPoint(6, -6);
+ p.addPoint(-6, -6);
+ p.addPoint(-6, 6);
+ p.addPoint(6, 6);
+ p.addPoint(6, 0);
+ p.addPoint(12, 0);
+ p.addPoint(12, -6);
+ p.addPoint(24, -6);
+ p.addPoint(24, 6);
+ p.addPoint(12, 6);
+ p.addPoint(12, 0);
+ P_SVCPORT_EXPORTED = p;
+
+ S_OUTPORT = new PortFigureStyle(ColorConstants.darkGreen, ColorConstants.red);
+ S_INPORT = new PortFigureStyle(ColorConstants.darkBlue, ColorConstants.red);
+ S_SVCPORT = new PortFigureStyle(ColorConstants.lightBlue, ColorConstants.red);
+ }
+
private String direction;
+ protected void init() {
+ setScale(1.0, 1.0);
+ setFill(true);
+ }
+
/**
* 方向を設定する
*
@@ -63,9 +168,7 @@
String labelString = "";
try {
- labelString = labelString
- + (port.getNameL() == null ? "<unknown>" : port
- .getNameL()) + ""; // \r\nは最後はいらない
+ labelString = labelString + (port.getNameL() == null ? "<unknown>" : port.getNameL()) + ""; // \r\nは最後はいらない
} catch (RuntimeException e) {
// void
}
@@ -82,8 +185,20 @@
}
public Rectangle getBaseBounds() {
- return (getParent() != null) ? getParent().getBounds()
- : new Rectangle();
+ return (getParent() != null) ? getParent().getBounds() : new Rectangle();
}
-
+
+ /**
+ * ポートのスタイル定義を表します。
+ */
+ public static class PortFigureStyle {
+ public final Color bg;
+ public final Color fg;
+
+ PortFigureStyle(Color bg, Color fg) {
+ this.bg = bg;
+ this.fg = fg;
+ }
+ }
+
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ServicePortFigure.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ServicePortFigure.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/figure/ServicePortFigure.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -2,9 +2,6 @@
import jp.go.aist.rtm.toolscommon.model.component.ServicePort;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.geometry.PointList;
-
/**
* ServicePortのFigure
*/
@@ -17,23 +14,14 @@
* モデル
*/
public ServicePortFigure(ServicePort servicePort) {
- setScale(1.0, 1.0);
- setFill(true);
+ init();
- PointList pointList = new PointList(5);
- pointList.addPoint(-6, -6);
- pointList.addPoint(-6, 6);
- pointList.addPoint(6, 6);
- pointList.addPoint(6, -6);
+ setTemplate(PortFigure.P_SVCPORT);
- setTemplate(pointList);
- setSize(24 + 1, 24 + 1);
+ setBackgroundColor(PortFigure.S_SVCPORT.bg);
+ setForegroundColor(PortFigure.S_SVCPORT.fg);
- setBackgroundColor(ColorConstants.lightBlue);
- setForegroundColor(ColorConstants.red);
-
setToolTip(getServicePortToolTip(servicePort));
-
}
}
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-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -44,6 +44,8 @@
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ControlAdapter;
@@ -69,6 +71,8 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* ConfigurationViewを定義するクラス
@@ -77,7 +81,10 @@
* NameValueの値の編集ができるのはStirngクラスのみであり、それ以外のオブジェクトが含まれていた場合には、編集することはできない(削除は可能)
*/
public class ConfigurationView extends ViewPart {
-
+
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(ConfigurationView.class);
+
/** 編集ボタン押下時に呼び出されるリスナー */
public static class EditSelectionAdapter implements SelectionListener {
@@ -87,81 +94,125 @@
this.configurationView = configurationView;
}
-// @Override
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
}
-// @Override
+ @Override
public void widgetSelected(SelectionEvent e) {
ConfigurationDialog dialog = new ConfigurationDialog(
configurationView);
if (dialog.open() == IDialogConstants.OK_ID) {
// ConfigurationDialog内でapplyを実行する 2009.11.16
-// if (dialog.isApply()) {
-// applyConfiguration();
-// }
+ // if (dialog.isApply()) {
+ // applyConfiguration();
+ // }
configurationView.refreshData();
}
}
}
- private static final String PROPERTY_ACTIVE_CONFIGSET = "PROPERTY_ACTIVE_CONFIGSET"; //$NON-NLS-1$
+ private static final String PROPERTY_ACTIVE_CONFIGSET = "PROPERTY_ACTIVE_CONFIGSET";
+ private static final String PROPERTY_CONFIG_SET = "PROPERTY_CONFIG_SET";
+ private static final String PROPERTY_KEY = "PROPERTY_KEY";
+ private static final String PROPERTY_VALUE = "PROPERTY_VALUE";
- private static final String PROPERTY_CONFIG_SET = "PROPERTY_CONFIG_SET"; //$NON-NLS-1$
+ private static final String MODIFY_COLOR = "MODIFY_COLOR";
+ private static final String CANT_MODIFY_COLOR = "CANT_MODIFY_COLOR";
+ private static final String WHITE_COLOR = "WHITE_COLOR";
- private static final String PROPERTY_KEY = "PROPERTY_KEY"; //$NON-NLS-1$
+ private static final int BUTTON_WIDTH = 70;
- private static final String PROPERTY_VALUE = "PROPERTY_VALUE"; //$NON-NLS-1$
+ private static final String LABEL_COMPONENT_NAME = Messages
+ .getString("ConfigurationView.15");
- private static final String MODIFY_COLOR = "MODIFY_COLOR"; //$NON-NLS-1$
+ 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 CANT_MODIFY_COLOR = "CANT_MODIFY_COLOR"; //$NON-NLS-1$
+ 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 WHITE_COLOR = "WHITE_COLOR"; //$NON-NLS-1$
+ 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 int BUTTON_WIDTH = 70;
+ 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 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 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_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;
-
private ComponentConfigurationWrapper originalComponent;
private Table leftTable;
+ private TableViewer leftTableViewer;
private Table rightTable;
+ private TableViewer rightTableViewer;
+ private RightTableViewerFilter rightTableViewerFilter;
private Label componentNameLabel;
-
private Label configrationSetNameLabel;
- private TableViewer leftTableViewer;
-
- private TableViewer rightTableViewer;
-
private Button addConfigurationSetButton;
-
- // ConfigSetのコピーボタン 2008.12.17
private Button copyConfigurationSetButton;
-
private Button deleteConfigurationSetButton;
+ private Button addNamedValueButton;
private Button deleteNamedValueButton;
- private Button addNamedValueButton;
-
private Button editButton;
-
private Button applyButton;
-
private Button cancelButton;
+ private Button detailCheckButton;
private static ColorRegistry colorRegistry = null;
/**
* {@inheritDoc}
*/
+ @Override
public void createPartControl(Composite parent) {
if (colorRegistry == null) {
colorRegistry = new ColorRegistry();
@@ -201,7 +252,7 @@
executionButtonComposite.setLayoutData(gd);
editButton = new Button(executionButtonComposite, SWT.NONE);
- editButton.setText(Messages.getString("ConfigurationView.7")); //$NON-NLS-1$
+ editButton.setText(LABEL_BUTTON_EDIT);
gd = new GridData();
gd.horizontalAlignment = SWT.END;
gd.widthHint = BUTTON_WIDTH;
@@ -210,24 +261,26 @@
editButton.addSelectionListener(new EditSelectionAdapter(this));
applyButton = new Button(executionButtonComposite, SWT.TOP);
- applyButton.setText(Messages.getString("ConfigurationView.8")); //$NON-NLS-1$
+ applyButton.setText(LABEL_BUTTON_APPLY);
gd = new GridData();
gd.widthHint = BUTTON_WIDTH;
applyButton.setLayoutData(gd);
applyButton.setEnabled(false);
applyButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
applyConfiguration(true);
}
});
cancelButton = new Button(executionButtonComposite, SWT.TOP);
- cancelButton.setText(Messages.getString("ConfigurationView.9")); //$NON-NLS-1$
+ cancelButton.setText(LABEL_BUTTON_CANCEL);
gd = new GridData();
gd.widthHint = BUTTON_WIDTH;
cancelButton.setLayoutData(gd);
cancelButton.setEnabled(false);
cancelButton.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
buildData();
}
@@ -240,7 +293,9 @@
* Configurationの変更を反映します。
*/
public void applyConfiguration(boolean first) {
- if (first && !confirmActiveApply()) return;
+ LOGGER.trace("applyConfiguration START: first=<{}>", first);
+ if (first && !confirmActiveApply())
+ return;
int selectionIndex = leftTable.getSelectionIndex();
List<ConfigurationSet> newConfigurationSetList = createNewConfigurationSetList(copiedComponent);
@@ -251,7 +306,7 @@
copiedComponent.getActiveConfigSet());
ConfigurationSet newActiveConfigurationSet = null;
- if (activeConfigurationIndex != -1) {
+ if (activeConfigurationIndex != -1) {
newActiveConfigurationSet = newConfigurationSetList
.get(activeConfigurationIndex);
}
@@ -260,7 +315,8 @@
newConfigurationSetList, newActiveConfigurationSet,
originalConfigurationSetList);
if (result == false) {
- MessageDialog.openError(getSite().getShell(), Messages.getString("ConfigurationView.12"), Messages.getString("ConfigurationView.13")); //$NON-NLS-1$ //$NON-NLS-2$
+ MessageDialog.openError(getSite().getShell(), MSG_ERROR,
+ MSG_UPDATE_FAILURE);
} else {
setDirty();
}
@@ -280,12 +336,12 @@
/** ActiveなRTCのコンフィグを変更するかを確認する */
public boolean confirmActiveApply() {
+ LOGGER.trace("confirmActiveApply START");
if (targetComponent instanceof CorbaComponent) {
if (((CorbaComponent) targetComponent).getComponentState() == ExecutionContext.RTC_ACTIVE
&& isActiveConfigurationSetModified()) {
- return MessageDialog.openConfirm(getViewSite()
- .getShell(), Messages.getString("ConfigurationView.10"), //$NON-NLS-1$
- Messages.getString("ConfigurationView.11")); //$NON-NLS-1$
+ return MessageDialog.openConfirm(getViewSite().getShell(),
+ MSG_CONFIRM, MSG_CHECK_APPLY_CHANGE);
}
}
return true;
@@ -293,10 +349,13 @@
private void setDirty() {
final EObject container = targetComponent.eContainer();
- if (!(container instanceof SystemDiagram)) return;
+ if (!(container instanceof SystemDiagram))
+ return;
SystemDiagram diagram = (SystemDiagram) container;
- AbstractSystemDiagramEditor editor = ComponentUtil.findEditor(diagram.getRootDiagram());
- if (editor == null) return;
+ AbstractSystemDiagramEditor editor = ComponentUtil.findEditor(diagram
+ .getRootDiagram());
+ if (editor == null)
+ return;
editor.setDirty();
}
@@ -337,7 +396,7 @@
}
return false;
}
-
+
/**
* 編集後の新しいConfigurationSetを作成する。
* <p>
@@ -345,18 +404,18 @@
* @param copiedComponent
* @return
*/
- @SuppressWarnings("unchecked") //$NON-NLS-1$
private List<ConfigurationSet> createNewConfigurationSetList(
ComponentConfigurationWrapper copiedComponent) {
ArrayList<ConfigurationSet> result = new ArrayList<ConfigurationSet>();
for (ConfigurationSetConfigurationWrapper configset : copiedComponent
.getConfigurationSetList()) {
- ConfigurationSet configurationSet = ComponentFactory.eINSTANCE.createConfigurationSet();
+ ConfigurationSet configurationSet = ComponentFactory.eINSTANCE
+ .createConfigurationSet();
for (NamedValueConfigurationWrapper namedValue : configset
.getNamedValueList()) {
configurationSet.getConfigurationData().add(
SDOUtil.createNameValue(namedValue.getKey(),
- namedValue.getValue()));
+ namedValue.getValue()));
}
configurationSet.setId(configset.getId());
@@ -396,7 +455,7 @@
gd.horizontalSpan = 0;
gd.verticalSpan = 0;
componentNameLabelConst.setLayoutData(gd);
- componentNameLabelConst.setText(Messages.getString("ConfigurationView.15")); //$NON-NLS-1$
+ componentNameLabelConst.setText(LABEL_COMPONENT_NAME);
componentNameLabel = new Label(componentNameComposite, SWT.BORDER);
gd = new GridData();
@@ -437,14 +496,15 @@
leftTable.setLayout(gl);
final TableColumn activeCol = new TableColumn(leftTable, SWT.RIGHT);
- activeCol.setText(Messages.getString("ConfigurationView.16")); //$NON-NLS-1$
+ activeCol.setText(LABEL_COLUMN_ACTIVE);
activeCol.setWidth(50);
final TableColumn configCol = new TableColumn(leftTable, SWT.LEFT);
- configCol.setText(Messages.getString("ConfigurationView.17")); //$NON-NLS-1$
+ configCol.setText(LABEL_COLUMN_CONFIG);
activeCol.setWidth(50);
ControlAdapter controlAdapter = new ControlAdapter() {
+ @Override
public void controlResized(ControlEvent e) {
composite.getParent().forceFocus();
int width = composite.getClientArea().width - 2
@@ -466,9 +526,9 @@
// Copyボタンの追加 2008.12.17
createCopyConfigurationSetButton(buttonCompsite);
-
+
addConfigurationSetButton = new Button(buttonCompsite, SWT.NONE);
- addConfigurationSetButton.setText(Messages.getString("ConfigurationView.18")); //$NON-NLS-1$
+ addConfigurationSetButton.setText(LABEL_BUTTON_ADD);
addConfigurationSetButton.setEnabled(false);
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
@@ -480,7 +540,7 @@
public void widgetSelected(SelectionEvent e) {
ConfigurationSetConfigurationWrapper csw = new ConfigurationSetConfigurationWrapper(
null, null);
- csw.setId(createDefaultConfigurationSetName("configSet")); // modified_name //$NON-NLS-1$
+ csw.setId(createDefaultConfigurationSetName("configSet"));
copiedComponent.addConfigurationSet(csw);
@@ -489,11 +549,14 @@
}
// デフォルトのwidgetと制約条件からNVList作成
- List<NamedValueConfigurationWrapper> nvlist = csw.getNamedValueList();
+ List<NamedValueConfigurationWrapper> nvlist = csw
+ .getNamedValueList();
for (String key : copiedComponent.getDefaultNameSet()) {
- NamedValueConfigurationWrapper nvw = new NamedValueConfigurationWrapper(key, Messages.getString("ConfigurationView.21"));
+ NamedValueConfigurationWrapper nvw = new NamedValueConfigurationWrapper(
+ key, LAVEL_DEFAULT_NV_VALUE);
String type = copiedComponent.getWidgetSetting().get(key);
- String cond = copiedComponent.getDefaultConditionSetting().get(key);
+ String cond = copiedComponent.getDefaultConditionSetting()
+ .get(key);
nvw.setWidgetAndCondition(type, cond);
nvlist.add(nvw);
}
@@ -508,7 +571,7 @@
});
deleteConfigurationSetButton = new Button(buttonCompsite, SWT.NONE);
- deleteConfigurationSetButton.setText(Messages.getString("ConfigurationView.22")); //$NON-NLS-1$
+ deleteConfigurationSetButton.setText(LABEL_BUTTON_DEL);
gd = new GridData();
gd.horizontalAlignment = SWT.END;
gd.widthHint = BUTTON_WIDTH;
@@ -563,16 +626,17 @@
});
leftTableViewer
.addPostSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
updateDeleteConfigurationSetButtonEnable();
}
});
}
- // Copyボタンの追加 2008.12.17
+ // Copyボタンの追加 2008.12.17
private void createCopyConfigurationSetButton(Composite buttonCompsite) {
copyConfigurationSetButton = new Button(buttonCompsite, SWT.NONE);
- copyConfigurationSetButton.setText(Messages.getString("ConfigurationView.23")); //$NON-NLS-1$
+ copyConfigurationSetButton.setText(LABEL_BUTTON_COPY);
copyConfigurationSetButton.setEnabled(false);
GridData gd = new GridData();
gd.grabExcessHorizontalSpace = true;
@@ -582,19 +646,23 @@
copyConfigurationSetButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- if (leftTable.getSelectionIndex() < 0) return;
-
+ if (leftTable.getSelectionIndex() < 0)
+ return;
+
ConfigurationSetConfigurationWrapper csw = new ConfigurationSetConfigurationWrapper(
null, null);
- csw.setId(createDefaultConfigurationSetName("configSet")); // modified_name //$NON-NLS-1$
+ csw.setId(createDefaultConfigurationSetName("configSet")); // modified_name
copiedComponent.addConfigurationSet(csw);
// 選択されているコンフィグセットの設定値をそのままコピー
- List<NamedValueConfigurationWrapper> nvlist = csw.getNamedValueList();
- ConfigurationSetConfigurationWrapper currentConfugurationSet = copiedComponent.getConfigurationSetList().get(
- leftTable.getSelectionIndex());
- for (NamedValueConfigurationWrapper oldNavedValue : currentConfugurationSet.getNamedValueList()) {
+ List<NamedValueConfigurationWrapper> nvlist = csw
+ .getNamedValueList();
+ ConfigurationSetConfigurationWrapper currentConfugurationSet = copiedComponent
+ .getConfigurationSetList().get(
+ leftTable.getSelectionIndex());
+ for (NamedValueConfigurationWrapper oldNavedValue : currentConfugurationSet
+ .getNamedValueList()) {
nvlist.add(oldNavedValue.clone());
}
Collections.sort(nvlist);
@@ -606,7 +674,7 @@
refreshRightData();
}
});
-
+
}
private void createRightControl(SashForm sashForm) {
@@ -638,7 +706,7 @@
gd.horizontalSpan = 0;
gd.verticalSpan = 0;
configurationNameLabelConst.setLayoutData(gd);
- configurationNameLabelConst.setText(Messages.getString("ConfigurationView.26")); //$NON-NLS-1$
+ configurationNameLabelConst.setText(LABE_CONFIGSET_NAME);
configrationSetNameLabel = new Label(configurationNameComposite,
SWT.BORDER);
@@ -659,17 +727,20 @@
rightTableViewer.setCellModifier(new RightTableCellModifier(
rightTableViewer));
rightTableViewer.setCellEditors(new CellEditor[] {
- new TextCellEditor(rightTableViewer.getTable())
- , new TextCellEditor(rightTableViewer.getTable()) });
+ new TextCellEditor(rightTableViewer.getTable()),
+ new TextCellEditor(rightTableViewer.getTable()) });
+ this.rightTableViewerFilter = new RightTableViewerFilter();
+ this.rightTableViewer.addFilter(this.rightTableViewerFilter);
rightTable = rightTableViewer.getTable();
rightTable.setLinesVisible(true);
leftTable.addSelectionListener(new SelectionListener() {
- // caution leftTable
+ @Override
public void widgetSelected(SelectionEvent e) {
refreshRightData();
}
+ @Override
public void widgetDefaultSelected(SelectionEvent e) {
refreshRightData();
}
@@ -687,14 +758,15 @@
rightTable.setHeaderVisible(true);
final TableColumn keyCol = new TableColumn(rightTable, SWT.LEFT);
- keyCol.setText(Messages.getString("ConfigurationView.27")); //$NON-NLS-1$
+ keyCol.setText(LABEL_COLUMN_KEY);
keyCol.setWidth(150);
final TableColumn valueCol = new TableColumn(rightTable, SWT.LEFT);
- valueCol.setText(Messages.getString("ConfigurationView.28")); //$NON-NLS-1$
+ valueCol.setText(LABEL_COLUMN_VALUE);
valueCol.setWidth(300);
ControlAdapter controlAdapter = new ControlAdapter() {
+ @Override
public void controlResized(ControlEvent e) {
composite.getParent().forceFocus();
int width = composite.getClientArea().width - 2
@@ -714,11 +786,26 @@
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(Messages.getString("ConfigurationView.29")); //$NON-NLS-1$
+ 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);
@@ -732,8 +819,8 @@
NamedValueConfigurationWrapper namedValueConfigurationWrapper = new NamedValueConfigurationWrapper(
null, null);
namedValueConfigurationWrapper
- .setKey(createDefaultNamedValueKey("name")); // modified_key //$NON-NLS-1$
- namedValueConfigurationWrapper.setValue(Messages.getString("ConfigurationView.31"));// modified_value
+ .setKey(createDefaultNamedValueKey("name")); // modified_key
+ namedValueConfigurationWrapper.setValue(LAVEL_DEFAULT_NV_VALUE);
currentConfugurationSet
.addNamedValue(namedValueConfigurationWrapper);
@@ -748,7 +835,7 @@
});
deleteNamedValueButton = new Button(buttonCompsite, SWT.NONE);
- deleteNamedValueButton.setText(Messages.getString("ConfigurationView.32")); //$NON-NLS-1$
+ deleteNamedValueButton.setText(LABEL_BUTTON_NV_DEL);
gd = new GridData();
gd.horizontalAlignment = SWT.END;
gd.widthHint = BUTTON_WIDTH;
@@ -757,8 +844,9 @@
deleteNamedValueButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- if (leftTable.getSelectionIndex() < 0) return;
-
+ if (leftTable.getSelectionIndex() < 0)
+ return;
+
if (rightTable.getSelectionIndex() != -1) {
ConfigurationSetConfigurationWrapper currentConfugurationSet = copiedComponent
.getConfigurationSetList().get(
@@ -774,8 +862,8 @@
if (rightTable.getItemCount() >= 1) {
rightTable.forceFocus();
- rightTable.setSelection(Math.min(rightTable
- .getItemCount() - 1, selectionIndex));
+ rightTable.setSelection(Math.min(
+ rightTable.getItemCount() - 1, selectionIndex));
updateDeleteNamedValueButtonEnable();
}
}
@@ -783,6 +871,7 @@
});
rightTableViewer
.addPostSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
public void selectionChanged(SelectionChangedEvent event) {
updateDeleteNamedValueButtonEnable();
}
@@ -795,22 +884,23 @@
int number = getNumber(preString, currentConfugurationSet);
- return (preString + "_" + number); //$NON-NLS-1$
+ return (preString + "_" + number);
}
private int getNumber(String preString,
ConfigurationSetConfigurationWrapper currentConfugurationSet) {
- for (int number = 1;;number++) {
+ for (int number = 1;; number++) {
boolean isExist = false;
for (NamedValueConfigurationWrapper current : currentConfugurationSet
.getNamedValueList()) {
- if ((preString + "_" + number).equals(current.getKey())) { //$NON-NLS-1$
+ if ((preString + "_" + number).equals(current.getKey())) {
isExist = true;
break;
}
}
- if (!isExist) return number;
+ if (!isExist)
+ return number;
}
}
@@ -820,7 +910,7 @@
boolean isExist = false;
for (ConfigurationSetConfigurationWrapper current : copiedComponent
.getConfigurationSetList()) {
- if ((preString + "_" + number).equals(current.getId())) { //$NON-NLS-1$
+ if ((preString + "_" + number).equals(current.getId())) {
isExist = true;
break;
}
@@ -833,14 +923,14 @@
++number;
}
- return preString + "_" + number; //$NON-NLS-1$
+ return preString + "_" + number;
}
- @SuppressWarnings("unchecked")
- @Override
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("rawtypes")
+ @Override
public Object getAdapter(Class adapter) {
if (adapter.equals(IPropertySheetPage.class)) {
return new RtcPropertySheetPage();
@@ -882,6 +972,7 @@
* 選択を監視するリスナ
*/
private ISelectionListener selectionListener = new ISelectionListener() {
+ @Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (targetComponent != null) {
targetComponent.eAdapters().remove(eAdapter);
@@ -889,10 +980,13 @@
targetComponent = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection sSelection = (IStructuredSelection) selection;
- Object selectedComponent = AdapterUtil.getAdapter(sSelection
- .getFirstElement(), Component.class);
+ Object selectedComponent = AdapterUtil.getAdapter(
+ sSelection.getFirstElement(), Component.class);
if (selectedComponent != null) {
targetComponent = (Component) selectedComponent;
+ LOGGER.trace(
+ "selectionChanged: target component is selected. comp=<{}>",
+ targetComponent);
targetComponent.synchronizeManually();
targetComponent.eAdapters().add(eAdapter);
}
@@ -901,10 +995,10 @@
}
};
- @Override
/**
* {@inheritDoc}
*/
+ @Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
}
@@ -915,7 +1009,6 @@
copiedComponent = createConfigurationWrapper(targetComponent);
originalComponent = createConfigurationWrapper(targetComponent);
}
-
refreshData();
}
@@ -923,6 +1016,7 @@
editButton.setEnabled(false);
applyButton.setEnabled(false);
cancelButton.setEnabled(false);
+ this.detailCheckButton.setEnabled(false);
refreshLeftData();
@@ -936,12 +1030,13 @@
editButton.setEnabled(true);
applyButton.setEnabled(true);
cancelButton.setEnabled(true);
+ this.detailCheckButton.setEnabled(true);
}
}
private void refreshLeftData() {
leftTableViewer.setInput(Collections.EMPTY_LIST);
- componentNameLabel.setText(""); //$NON-NLS-1$
+ componentNameLabel.setText("");
addConfigurationSetButton.setEnabled(false);
if (copiedComponent != null) {
@@ -959,7 +1054,7 @@
// ConfigSetのDeleteボタンとCopyボタンのenable属性は同じ 2008.12.17
private void updateDeleteConfigurationSetButtonEnable() {
- boolean deleteConfigurationSetEnabled = (leftTable.getSelectionIndex() != -1) ;
+ boolean deleteConfigurationSetEnabled = (leftTable.getSelectionIndex() != -1);
deleteConfigurationSetButton.setEnabled(deleteConfigurationSetEnabled);
copyConfigurationSetButton.setEnabled(deleteConfigurationSetEnabled);
@@ -967,7 +1062,7 @@
private void refreshRightData() {
rightTableViewer.setInput(Collections.EMPTY_LIST);
- configrationSetNameLabel.setText(""); //$NON-NLS-1$
+ configrationSetNameLabel.setText("");
addNamedValueButton.setEnabled(false);
if (copiedComponent != null && leftTable.getSelectionIndex() != -1) {
@@ -977,14 +1072,15 @@
configrationSetNameLabel.setText(currentConfugurationSet.getId());
- rightTableViewer.setInput(currentConfugurationSet
+ this.rightTableViewerFilter.setDetail(this.detailCheckButton
+ .getSelection());
+ this.rightTableViewer.setInput(currentConfugurationSet
.getNamedValueList());
- //
+
if (!(targetComponent instanceof CorbaComponent)) {
addNamedValueButton.setEnabled(true);
}
}
-
updateDeleteNamedValueButtonEnable();
}
@@ -998,20 +1094,20 @@
}
}
- @Override
/**
* {@inheritDoc}
*/
+ @Override
public void dispose() {
getSite().getWorkbenchWindow().getSelectionService()
.removeSelectionListener(selectionListener);
super.dispose();
}
- @Override
/**
* {@inheritDoc}
*/
+ @Override
public void setFocus() {
}
@@ -1032,10 +1128,12 @@
.addSelectionListener(selectionListener);
getSite().setSelectionProvider(new ISelectionProvider() {
+ @Override
public void addSelectionChangedListener(
ISelectionChangedListener listener) {
}
+ @Override
public ISelection getSelection() {
StructuredSelection result = null;
if (targetComponent != null) {
@@ -1045,18 +1143,20 @@
return result;
}
+ @Override
public void removeSelectionChangedListener(
ISelectionChangedListener listener) {
}
+ @Override
public void setSelection(ISelection selection) {
}
});
-
- selectionListener.selectionChanged(null, getSite().getWorkbenchWindow().getSelectionService().getSelection());
+
+ selectionListener.selectionChanged(null, getSite().getWorkbenchWindow()
+ .getSelectionService().getSelection());
}
-
/**
* 左テーブルのCellModifierクラス
*/
@@ -1067,10 +1167,12 @@
this.viewer = viewer;
}
+ @Override
public boolean canModify(Object element, String property) {
return true;
}
+ @Override
public Object getValue(Object element, String property) {
Object result = null;
if (PROPERTY_ACTIVE_CONFIGSET.equals(property)) {
@@ -1083,6 +1185,7 @@
return result;
}
+ @Override
public void modify(Object element, String property, Object value) {
ConfigurationSetConfigurationWrapper configurationSet = null;
if (element instanceof Item) {
@@ -1108,7 +1211,7 @@
String newConfigurationSetName = (String) value;
if (isDuplicate) {
MessageDialog.openWarning(viewer.getControl().getShell(),
- Messages.getString("ConfigurationView.39"), Messages.getString("ConfigurationView.40")); //$NON-NLS-1$ //$NON-NLS-2$
+ MSG_WARNING, MSG_NAME_ALREADY_EXIST);
newConfigurationSetName = createDefaultConfigurationSetName((String) value);
}
@@ -1130,6 +1233,7 @@
this.viewer = viewer;
}
+ @Override
public boolean canModify(Object element, String property) {
if (PROPERTY_KEY.equals(property)) {
@@ -1142,6 +1246,7 @@
return false;
}
+ @Override
public Object getValue(Object element, String property) {
NamedValueConfigurationWrapper item = (NamedValueConfigurationWrapper) element;
@@ -1154,8 +1259,10 @@
return null;
}
+ @Override
public void modify(Object element, String property, Object value) {
- if (leftTable.getSelectionIndex() < 0) return;
+ if (leftTable.getSelectionIndex() < 0)
+ return;
if (element instanceof TableItem == false) {
return;
}
@@ -1180,7 +1287,7 @@
String newKey = (String) value;
if (isDuplicate) {
MessageDialog.openWarning(viewer.getControl().getShell(),
- Messages.getString("ConfigurationView.42"), Messages.getString("ConfigurationView.43")); //$NON-NLS-1$ //$NON-NLS-2$
+ MSG_WARNING, MSG_KEY_ALREADY_EXIST);
newKey = createDefaultNamedValueKey((String) value);
}
@@ -1199,22 +1306,24 @@
public class ConfigSetLabelProvider extends LabelProvider implements
ITableLabelProvider, ITableColorProvider {
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
Image result = null;
if (columnIndex == 0) {
ConfigurationSetConfigurationWrapper item = (ConfigurationSetConfigurationWrapper) element;
if (item == copiedComponent.getActiveConfigSet()) {
result = RTSystemEditorPlugin
- .getCachedImage("icons/Radiobutton_Checked.png"); //$NON-NLS-1$
+ .getCachedImage("icons/Radiobutton_Checked.png");
} else {
result = RTSystemEditorPlugin
- .getCachedImage("icons/Radiobutton_Unchecked.png"); //$NON-NLS-1$
+ .getCachedImage("icons/Radiobutton_Unchecked.png");
}
}
return result;
}
+ @Override
public String getColumnText(Object element, int columnIndex) {
ConfigurationSetConfigurationWrapper item = (ConfigurationSetConfigurationWrapper) element;
@@ -1227,6 +1336,7 @@
return result;
}
+ @Override
public Color getBackground(Object element, int columnIndex) {
ConfigurationSetConfigurationWrapper configurationSetConfigurationWrapper = (ConfigurationSetConfigurationWrapper) element;
@@ -1252,6 +1362,7 @@
return color;
}
+ @Override
public Color getForeground(Object element, int columnIndex) {
return null;
}
@@ -1263,10 +1374,12 @@
public class MapEntryLabelProvider extends LabelProvider implements
ITableLabelProvider, ITableColorProvider {
+ @Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
+ @Override
public String getColumnText(Object element, int columnIndex) {
NamedValueConfigurationWrapper item = (NamedValueConfigurationWrapper) element;
@@ -1280,10 +1393,12 @@
return null;
}
+ @Override
public Color getForeground(Object element, int columnIndex) {
return null;
}
+ @Override
public Color getBackground(Object element, int columnIndex) {
NamedValueConfigurationWrapper namedValueConfigurationWrapper = (NamedValueConfigurationWrapper) element;
if (columnIndex == 0
@@ -1301,17 +1416,53 @@
}
}
+ /**
+ * ConfigurationSetの設定値一覧テーブルの表示フィルタ<br>
+ * 「_」で始まる設定値は、詳細モードのときのみ表示します。
+ */
+ private static class RightTableViewerFilter extends ViewerFilter {
+
+ private boolean isDetail;
+
+ public RightTableViewerFilter() {
+ this.isDetail = false;
+ }
+
+ /**
+ * 詳細モードを設定します。
+ *
+ * @param isDetail
+ * 詳細モードの場合はtrue
+ */
+ public void setDetail(boolean isDetail) {
+ this.isDetail = isDetail;
+ }
+
+ /**
+ * 詳細モード、かつNameValueのキーが「_」で始まっていない場合はtrue
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (!(element instanceof NamedValueConfigurationWrapper)) {
+ return false;
+ }
+ NamedValueConfigurationWrapper nv = (NamedValueConfigurationWrapper) element;
+ return (this.isDetail || !nv.isSecret());
+ }
+
+ }
+
private String getModiedLabelString(boolean bool) {
- String result = ""; //$NON-NLS-1$
+ String result = "";
if (bool) {
- result = "*"; //$NON-NLS-1$
+ result = "*";
}
-
return result;
}
- /** 編集用のコンフィグを返す */
+ /** 編集用のコンフィグを返す */
public ComponentConfigurationWrapper getComponentConfig() {
- return copiedComponent;
+ return copiedComponent;
}
}
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-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapper.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -11,78 +11,120 @@
/**
* NamedValueを編集するためのラッパー
- *
*/
-public class NamedValueConfigurationWrapper implements Comparable<NamedValueConfigurationWrapper> {
+public class NamedValueConfigurationWrapper implements
+ Comparable<NamedValueConfigurationWrapper> {
private String key;
+ private String value;
private boolean isKeyModified = false;
-
- private String value;
-
private boolean isValueModified = false;
private List<ConfigurationWidget> widgetList;
-
private Map<String, ConfigurationWidget> widgetMap;
-
private boolean loadedWidgetValue;
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;
+ this.typeName = typeName;
}
public NamedValueConfigurationWrapper(String key) {
- this(key,null,null);
+ this(key, null, null);
}
public NamedValueConfigurationWrapper(String key, String value) {
this(key, value, null);
}
+ /**
+ * 設定値のキー名を取得します
+ *
+ * @return キー名
+ */
public String getKey() {
- return key;
+ return this.key;
}
+ /**
+ * 設定値のキー名を設定します。<br>
+ * 現在のキー名から変更になる場合は、キー変更中状態になります。
+ *
+ * @param key
+ * キー名
+ */
public void setKey(String key) {
if (this.key != null && this.key.equals(key)) {
return;
}
this.key = key;
- isKeyModified = true;
+ this.isKeyModified = true;
}
+ /**
+ * 隠し設定値(キー名が「_」で始まる)を判定します
+ *
+ * @return 隠し設定値の場合はtrue
+ */
+ public boolean isSecret() {
+ return (this.key != null && this.key.startsWith("_"));
+ }
+
+ /**
+ * 設定値の値を取得します。
+ *
+ * @return 設定値
+ */
public String getValue() {
- return value;
+ return this.value;
}
+ /**
+ * 設定値の値を設定します。<br>
+ * 現在の設定値から変更になる場合は、値変更中状態になります。
+ *
+ * @param value
+ * 設定値
+ */
public void setValue(String value) {
if (this.value != null && this.value.equals(value)) {
return;
}
this.value = value;
- typeName = null;
- isValueModified = true;
+ this.typeName = null;
+ this.isValueModified = true;
}
+ /**
+ * キー変更状態を判定します。
+ *
+ * @return キー変更中の場合はtrue
+ */
public boolean isKeyModified() {
return isKeyModified;
}
+ /**
+ * 設定値変更状態を判定します。
+ *
+ * @return 設定値変更中の場合はtrue
+ */
public boolean isValueModified() {
return isValueModified;
}
/**
* widget種別、制約条件を設定します。
- * @param widgets widget種別設定 (ConfigurationSetの_widget_で設定)
- * @param conditions 制約条件 (ConfigurationSetの_<config名>で設定)
+ *
+ * @param widgets
+ * widget種別設定 (ConfigurationSetの_widget_で設定)
+ * @param conditions
+ * 制約条件 (ConfigurationSetの_<config名>で設定)
*/
public void setWidgetAndCondition(String widgets, String conditions) {
ConfigurationCondition cc = ConfigurationCondition.NULL_CONDITION;
@@ -104,6 +146,7 @@
/**
* デフォルトのwidgetを取得します。
+ *
* @return widgetオブジェクト
*/
public ConfigurationWidget widget() {
@@ -112,7 +155,9 @@
/**
* 配列の場合のwidgetを取得します。
- * @param index widgetのインデックス
+ *
+ * @param index
+ * widgetのインデックス
* @return widgetオブジェクト
*/
public ConfigurationWidget widget(int index) {
@@ -121,6 +166,7 @@
/**
* 配列の場合のwidget数を取得します。
+ *
* @return widget数。デフォルト時は1
*/
public int widgetSize() {
@@ -131,7 +177,9 @@
/**
* ハッシュの場合のwidgetを取得します。
- * @param key widgetのキー
+ *
+ * @param key
+ * widgetのキー
* @return widgetオブジェクト
*/
public ConfigurationWidget widget(String key) {
@@ -140,6 +188,7 @@
/**
* ハッシュの場合のwidgetのキーセットを取得します。
+ *
* @return widgetのキーセット
*/
public Set<String> widgetKeySet() {
@@ -175,7 +224,8 @@
// 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);
}
@@ -198,7 +248,8 @@
}
public String getValueAsString() {
- if (value == null) return typeName;
+ if (value == null)
+ return typeName;
return value;
}
@@ -280,7 +331,8 @@
@Override
public NamedValueConfigurationWrapper clone() {
- NamedValueConfigurationWrapper result = new NamedValueConfigurationWrapper(key);
+ NamedValueConfigurationWrapper result = new NamedValueConfigurationWrapper(
+ key);
result.setValue(getValueAsString());
result.isKeyModified = isKeyModified;
result.isValueModified = isValueModified;
@@ -305,8 +357,9 @@
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
- buffer.append("key=").append(key).append(" keyModify=").append(isKeyModified)
- .append(" value=").append(getValueAsString()).append(" valueModify=")
+ 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());
@@ -321,13 +374,16 @@
/**
* @see java.lang.Comparable#compareTo(Object)
*/
+ @Override
public int compareTo(NamedValueConfigurationWrapper object) {
return new CompareToBuilder().append(this.key, object.key)
.toComparison();
}
public boolean canModify() {
- if (value != null) return true;
+ if (value != null)
+ return true;
return typeName == null;
}
+
}
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-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/configurationwrapper/NamedValueConfigurationWrapperTest.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,13 +1,19 @@
package jp.go.aist.rtm.systemeditor.ui.views.configurationview.configurationwrapper;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import java.util.Map;
-import junit.framework.TestCase;
+import org.junit.Test;
-public class NamedValueConfigurationWrapperTest extends TestCase {
+public class NamedValueConfigurationWrapperTest {
+ @Test
public void testSetWidgetAndCondition() throws Exception {
- NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper("key");
+ NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper(
+ "key");
// 制約条件なし
nv.setWidgetAndCondition("text", null);
assertEquals(true, nv.widget().isText());
@@ -112,7 +118,6 @@
assertEquals(true, nv.widget().isText());
assertEquals(true, nv.widget().getCondition().isNull());
-
// TODO widgetの配列表記
// 配列表記
@@ -156,8 +161,10 @@
assertEquals(true, nv.widget("key1").getCondition().isNull());
}
+ @Test
public void testLoadWidgetValue() throws Exception {
- NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper("key", null);
+ NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper(
+ "key", null);
nv.setValue("1, 2,3");
// 制約条件なし
nv.setWidgetAndCondition("text", null);
@@ -240,7 +247,8 @@
assertEquals(true, nv.widget("key1").isValueModified());
// ハッシュ (valueがwidgetより少ない)
- nv.setWidgetAndCondition("text", "{ key0: 0<x<1, key1:1<x<2, key2: 2<x<3,key3: 3<x<4}");
+ nv.setWidgetAndCondition("text",
+ "{ key0: 0<x<1, key1:1<x<2, key2: 2<x<3,key3: 3<x<4}");
nv.loadWidgetValue();
assertEquals(4, nv.widgetKeySet().size());
assertEquals(true, nv.widget("key0").isText());
@@ -253,8 +261,10 @@
assertEquals("", nv.widget("key3").getValue());
}
+ @Test
public void testSaveWidgetValue() throws Exception {
- NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper("key", null);
+ NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper(
+ "key", null);
// 制約条件なし
nv.setWidgetAndCondition("text", null);
nv.widget().setValue("1");
@@ -300,8 +310,10 @@
assertEquals(true, nv.widget("key1").isValueModified());
}
+ @Test
public void testParseMap() throws Exception {
- NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper("key", null);
+ NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper(
+ "key", null);
Map<String, String> map;
// {key0:1, key1: 2,key2:3 }
@@ -323,9 +335,11 @@
assertEquals("2", map.get("key1"));
}
+ @Test
public void testClone() throws Exception {
String value = "hoge";
- NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper("key", value);
+ NamedValueConfigurationWrapper nv = new NamedValueConfigurationWrapper(
+ "key", value);
nv.setWidgetAndCondition("slider", "0<x<100");
NamedValueConfigurationWrapper clone = nv.clone();
assertEquals(nv.getKey(), clone.getKey());
@@ -335,4 +349,20 @@
assertEquals(nv.widgetSize(), clone.widgetSize());
assertEquals(nv.widgetKeySet(), clone.widgetKeySet());
}
+
+ @Test
+ public void testIsSecret() throws Exception {
+ NamedValueConfigurationWrapper nv;
+ 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("__key", "value");
+ assertTrue(nv.isSecret());
+ nv = new NamedValueConfigurationWrapper(null, "value");
+ assertFalse(nv.isSecret());
+ }
+
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ComponentMock.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -378,6 +378,12 @@
public void eUnset(EStructuralFeature feature) {
}
+ @Override
+ public Object eInvoke(EOperation operation, EList<?> arguments)
+ throws InvocationTargetException {
+ return null;
+ }
+
@SuppressWarnings("unchecked")
public EList eAdapters() {
return null;
@@ -641,10 +647,4 @@
// TODO Auto-generated method stub
}
- @Override
- public Object eInvoke(EOperation operation, EList<?> arguments) throws InvocationTargetException {
- // TODO 自動生成されたメソッド・スタブ
- return null;
- }
-
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ConfigurationSetMock.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ConfigurationSetMock.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/ConfigurationSetMock.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,13 +1,13 @@
package jp.go.aist.rtm.systemeditor.ui.views.configurationview.mock;
+import java.lang.reflect.InvocationTargetException;
+
import jp.go.aist.rtm.toolscommon.model.component.ConfigurationSet;
import jp.go.aist.rtm.toolscommon.model.component.NameValue;
import jp.go.aist.rtm.toolscommon.model.core.Rectangle;
import jp.go.aist.rtm.toolscommon.model.core.Visiter;
import jp.go.aist.rtm.toolscommon.synchronizationframework.SynchronizationSupport;
-import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
@@ -104,6 +104,12 @@
public void eUnset(EStructuralFeature feature) {
}
+ @Override
+ public Object eInvoke(EOperation operation, EList<?> arguments)
+ throws InvocationTargetException {
+ return null;
+ }
+
@SuppressWarnings("unchecked")
public EList eAdapters() {
return null;
@@ -131,10 +137,4 @@
public void setSynchronizationSupport(
SynchronizationSupport synchronizationSupport) {
}
-
- @Override
- public Object eInvoke(EOperation operation, EList<?> arguments) throws InvocationTargetException {
- // TODO 自動生成されたメソッド・スタブ
- return null;
- }
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/PortMock.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/PortMock.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/configurationview/mock/PortMock.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -108,6 +108,12 @@
public void eUnset(EStructuralFeature feature) {
}
+ @Override
+ public Object eInvoke(EOperation operation, EList<?> arguments)
+ throws InvocationTargetException {
+ return null;
+ }
+
@SuppressWarnings("unchecked")
public EList eAdapters() {
return null;
@@ -277,10 +283,4 @@
return null;
}
- @Override
- public Object eInvoke(EOperation operation, EList<?> arguments) throws InvocationTargetException {
- // TODO 自動生成されたメソッド・スタブ
- return null;
- }
-
}
Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/managercontrolview/mock/RTCManagerMock.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/managercontrolview/mock/RTCManagerMock.java 2016-02-22 04:52:47 UTC (rev 553)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/test/jp/go/aist/rtm/systemeditor/ui/views/managercontrolview/mock/RTCManagerMock.java 2016-02-22 04:53:20 UTC (rev 554)
@@ -1,13 +1,13 @@
package jp.go.aist.rtm.systemeditor.ui.views.managercontrolview.mock;
+import java.lang.reflect.InvocationTargetException;
+
import jp.go.aist.rtm.toolscommon.model.component.Component;
import jp.go.aist.rtm.toolscommon.model.core.Rectangle;
import jp.go.aist.rtm.toolscommon.model.core.Visiter;
import jp.go.aist.rtm.toolscommon.model.manager.RTCManager;
import jp.go.aist.rtm.toolscommon.synchronizationframework.SynchronizationSupport;
-import java.lang.reflect.InvocationTargetException;
-
import org.apache.commons.lang.StringUtils;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
@@ -238,6 +238,12 @@
public void eUnset(EStructuralFeature feature) {
}
+ @Override
+ public Object eInvoke(EOperation operation, EList<?> arguments)
+ throws InvocationTargetException {
+ return null;
+ }
+
public EList<Adapter> eAdapters() {
return null;
}
@@ -430,10 +436,4 @@
public EList<ModuleProfile> getLoadedModuleProfiles() {
return null;
}
-
- @Override
- public java.lang.Object eInvoke(EOperation operation, EList<?> arguments) throws InvocationTargetException {
- // TODO 自動生成されたメソッド・スタブ
- return null;
- }
}
More information about the openrtm-commit
mailing list