下面列出了怎么用com.google.inject.assistedinject.Assisted的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Creates a new instance.
*
* @param drawingEditor A <code>DrawingEditor</code> instance.
* @param undoRedoManager The application's undo/redo manager.
* @param eventHandler Where this instance sends events.
* @param componentsFactory The components factory.
* @param copyAll Indicates whether the values of ALL points and locations
* shall be copied when the menu item is clicked. If false only the selected
* figures will be considered.
*/
@Inject
public LayoutToModelMenuItem(OpenTCSDrawingEditor drawingEditor,
UndoRedoManager undoRedoManager,
@ApplicationEventBus EventHandler eventHandler,
PropertiesComponentsFactory componentsFactory,
@Assisted boolean copyAll) {
super(ResourceBundleUtil.getBundle(I18nPlantOverview.MENU_PATH)
.getString("layoutToModelMenuItem.text"));
this.drawingEditor = requireNonNull(drawingEditor, "drawingEditor");
this.undoRedoManager = requireNonNull(undoRedoManager, "undoRedoManager");
this.eventHandler = requireNonNull(eventHandler, "eventHandler");
this.componentsFactory = requireNonNull(componentsFactory, "componentsFactory");
this.copyAll = copyAll;
setIcon(new ImageIcon(
getClass().getClassLoader().getResource("org/opentcs/guing/res/symbols/menu/arrow-up-3.png")));
setMargin(new Insets(0, 2, 0, 2));
addActionListener();
}
/**
* Creates a new instance.
*
* @param drawingEditor A <code>DrawingEditor</code> instance.
* @param undoRedoManager The application's undo/redo manager.
* @param eventHandler Where this instance sends events.
* @param componentsFactory The components factory.
* @param copyAll Indicates whether the values of ALL points and locations
* shall be copied when the menu item is clicked. If false only the selected
* figures will be considered.
*/
@Inject
public ModelToLayoutMenuItem(OpenTCSDrawingEditor drawingEditor,
UndoRedoManager undoRedoManager,
@ApplicationEventBus EventHandler eventHandler,
PropertiesComponentsFactory componentsFactory,
@Assisted boolean copyAll) {
super(ResourceBundleUtil.getBundle(I18nPlantOverview.MENU_PATH).getString("modelToLayoutMenuItem.text"));
this.drawingEditor = requireNonNull(drawingEditor, "drawingEditor");
this.undoRedoManager = requireNonNull(undoRedoManager, "undoRedoManager");
this.eventBus = requireNonNull(eventHandler, "eventHandler");
this.componentsFactory = requireNonNull(componentsFactory, "componentsFactory");
this.copyAll = copyAll;
setIcon(new ImageIcon(
getClass().getClassLoader().getResource("org/opentcs/guing/res/symbols/menu/arrow-down-3.png")));
setMargin(new Insets(0, 2, 0, 2));
addActionListener();
}
/**
* Creates a new instance.
*
* @param appState Stores the application's current state.
* @param menuFactory A factory for menu items in popup menus created by this
* tool.
* @param selectAreaTracker The tracker to be used for area selections in the
* drawing.
* @param dragTracker The tracker to be used for dragging figures.
* @param drawingActions Drawing-related actions for the popup menus created
* by this tool.
* @param selectionActions Selection-related actions for the popup menus
* created by this tool.
*/
@Inject
public MultipleSelectionTool(ApplicationState appState,
MenuFactory menuFactory,
SelectAreaTracker selectAreaTracker,
DragTracker dragTracker,
@Assisted("drawingActions") Collection<Action> drawingActions,
@Assisted("selectionActions") Collection<Action> selectionActions) {
super(drawingActions, selectionActions);
this.appState = requireNonNull(appState, "appState");
this.menuFactory = requireNonNull(menuFactory, "menuFactory");
requireNonNull(selectAreaTracker, "selectAreaTracker");
requireNonNull(dragTracker, "dragTracker");
this.drawingActions = requireNonNull(drawingActions, "drawingActions");
this.selectionActions = requireNonNull(selectionActions, "selectionActions");
setSelectAreaTracker(selectAreaTracker);
setDragTracker(dragTracker);
}
/**
* Creates a new instance.
*
* @param vehicles The selected vehicles.
* @param level The level to to change the vehicles to.
* @param portalProvider Provides access to a shared portal.
*/
@Inject
public IntegrationLevelChangeAction(@Assisted Collection<VehicleModel> vehicles,
@Assisted Vehicle.IntegrationLevel level,
SharedKernelServicePortalProvider portalProvider) {
this.vehicles = requireNonNull(vehicles, "vehicles");
this.level = requireNonNull(level, "level");
this.portalProvider = requireNonNull(portalProvider, "portalProvider");
String actionName;
switch (level) {
case TO_BE_NOTICED:
actionName = bundle.getString("integrationLevelChangeAction.notice.name");
break;
case TO_BE_RESPECTED:
actionName = bundle.getString("integrationLevelChangeAction.respect.name");
break;
case TO_BE_UTILIZED:
actionName = bundle.getString("integrationLevelChangeAction.utilize.name");
break;
default:
actionName = bundle.getString("integrationLevelChangeAction.ignore.name");
break;
}
putValue(NAME, actionName);
}
/**
* Creates a new instance.
*
* @param vehicles The selected vehicles.
* @param immediateAbort Whether or not to abort immediately
* @param portalProvider Provides access to a shared portal.
* @param dialogParent The parent component for dialogs shown by this action.
*/
@Inject
public WithdrawAction(@Assisted Collection<VehicleModel> vehicles,
@Assisted boolean immediateAbort,
SharedKernelServicePortalProvider portalProvider,
@ApplicationFrame Component dialogParent) {
this.vehicles = requireNonNull(vehicles, "vehicles");
this.immediateAbort = requireNonNull(immediateAbort, "immediateAbort");
this.portalProvider = requireNonNull(portalProvider, "portalProvider");
this.dialogParent = requireNonNull(dialogParent, "dialogParent");
if (immediateAbort) {
putValue(NAME, BUNDLE.getString("withdrawAction.withdrawImmediately.name"));
}
else {
putValue(NAME, BUNDLE.getString("withdrawAction.withdraw.name"));
}
}
/**
* Creates a new instance.
*
* @param cellEditorFactory A factory for cell editors.
* @param tableProvider Provides attribute tables.
* @param tableModelProvider Provides attribute table models.
* @param eventBus The application's event bus.
* @param dialogParent A parent for dialogs created by this instance.
* @param componentsFactory The components factory.
*/
@Inject
public PropertiesTableContent(CellEditorFactory cellEditorFactory,
Provider<AttributesTable> tableProvider,
Provider<AttributesTableModel> tableModelProvider,
@ApplicationEventBus EventBus eventBus,
@Assisted JPanel dialogParent,
PropertiesComponentsFactory componentsFactory) {
super(tableProvider);
this.cellEditorFactory = requireNonNull(cellEditorFactory,
"cellEditorFactory");
this.tableModelProvider = requireNonNull(tableModelProvider,
"tableModelProvider");
this.eventBus = requireNonNull(eventBus, "eventBus");
this.dialogParent = requireNonNull(dialogParent, "dialogParent");
this.componentsFactory = requireNonNull(componentsFactory, "componentsFactory");
}
/**
* Creates a new instance.
*
* @param contentMap Provides the appropriate content for a given property.
* @param dialogParent A parent for dialogs created by this instance.
*/
@Inject
public ComplexPropertyCellEditor(
Map<Class<? extends AbstractComplexProperty>, Provider<DetailsDialogContent>> contentMap,
@Assisted JPanel dialogParent) {
this.contentMap = requireNonNull(contentMap, "contentMap");
this.dialogParent = requireNonNull(dialogParent, "dialogParent");
fButton.setFont(new Font("Dialog", Font.PLAIN, 12));
fButton.setBorder(null);
fButton.setHorizontalAlignment(JButton.LEFT);
fButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showDialog();
}
});
}
/**
* Creates a new instance.
*
* @param model The model corresponding to this graphical object.
* @param textGenerator The tool tip text generator.
*/
@Inject
public LinkConnection(@Assisted LinkModel model,
ToolTipTextGenerator textGenerator) {
super(model);
this.textGenerator = requireNonNull(textGenerator, "textGenerator");
double[] dash = {5.0, 5.0};
set(AttributeKeys.START_DECORATION, null);
set(AttributeKeys.END_DECORATION, null);
set(AttributeKeys.STROKE_WIDTH, 1.0);
set(AttributeKeys.STROKE_CAP, BasicStroke.CAP_BUTT);
set(AttributeKeys.STROKE_JOIN, BasicStroke.JOIN_MITER);
set(AttributeKeys.STROKE_MITER_LIMIT, 1.0);
set(AttributeKeys.STROKE_DASHES, dash);
set(AttributeKeys.STROKE_DASH_PHASE, 0.0);
}
@Inject
public NamedVehicleFigure(VehicleTheme vehicleTheme,
MenuFactory menuFactory,
PlantOverviewApplicationConfiguration appConfig,
@Assisted VehicleModel model,
ToolTipTextGenerator textGenerator,
ModelManager modelManager,
ApplicationState applicationState) {
super(vehicleTheme,
menuFactory,
appConfig,
model,
textGenerator,
modelManager,
applicationState);
}
/**
* Creates a new instance.
*
* @param vehicleTheme The vehicle theme to be used.
* @param menuFactory A factory for popup menus.
* @param appConfig The application's configuration.
* @param model The model corresponding to this graphical object.
* @param textGenerator The tool tip text generator.
* @param modelManager The model manager.
* @param applicationState The application's current state.
*/
@Inject
public VehicleFigure(VehicleTheme vehicleTheme,
MenuFactory menuFactory,
PlantOverviewApplicationConfiguration appConfig,
@Assisted VehicleModel model,
ToolTipTextGenerator textGenerator,
ModelManager modelManager,
ApplicationState applicationState) {
super(model);
this.vehicleTheme = requireNonNull(vehicleTheme, "vehicleTheme");
this.menuFactory = requireNonNull(menuFactory, "menuFactory");
this.textGenerator = requireNonNull(textGenerator, "textGenerator");
this.modelManager = requireNonNull(modelManager, "modelManager");
this.applicationState = requireNonNull(applicationState, "applicationState");
fDisplayBox = new Rectangle((int) LENGTH, (int) WIDTH);
fZoomPoint = new ZoomPoint(0.5 * LENGTH, 0.5 * WIDTH);
setIgnorePrecisePosition(appConfig.ignoreVehiclePrecisePosition());
setIgnoreOrientationAngle(appConfig.ignoreVehicleOrientationAngle());
fImage = vehicleTheme.statelessImage(model.getVehicle());
}
/**
* Creates a new instance associated with the given vehicle.
*
* @param vehicle The vehicle this vehicle controller will be associated with.
* @param adapter The communication adapter of the associated vehicle.
* @param kernel The kernel instance maintaining the model.
* @param vehicleService The kernel's vehicle service.
* @param notificationService The kernel's notification service.
* @param dispatcherService The kernel's dispatcher service.
* @param scheduler The scheduler managing resource allocations.
* @param eventBus The event bus this instance should register with and send events to.
*/
@Inject
public DefaultVehicleController(@Assisted @Nonnull Vehicle vehicle,
@Assisted @Nonnull VehicleCommAdapter adapter,
@Nonnull LocalKernel kernel,
@Nonnull InternalVehicleService vehicleService,
@Nonnull NotificationService notificationService,
@Nonnull DispatcherService dispatcherService,
@Nonnull Scheduler scheduler,
@Nonnull @ApplicationEventBus EventBus eventBus) {
this.vehicle = requireNonNull(vehicle, "vehicle");
this.commAdapter = requireNonNull(adapter, "adapter");
this.localKernel = requireNonNull(kernel, "kernel");
this.vehicleService = requireNonNull(vehicleService, "vehicleService");
this.notificationService = requireNonNull(notificationService, "notificationService");
this.dispatcherService = requireNonNull(dispatcherService, "dispatcherService");
this.scheduler = requireNonNull(scheduler, "scheduler");
this.eventBus = requireNonNull(eventBus, "eventBus");
}
@Inject
public RobotCommAdapterPanel(@Assisted RobotVehicleModelTO robotVehicleModelTO,
@Assisted VehicleService vehicleService,
@ServiceCallWrapper CallWrapper callWrapper) {
this.robotVehicleModelTO = requireNonNull(robotVehicleModelTO, "robotVehicleModelTO");
this.vehicleService = requireNonNull(vehicleService, "vehicleService");
this.callWrapper = requireNonNull(callWrapper, "callWrapper");
initComponents();
initGuiContent();
}
@Inject
public RobotCommAdapter(AdapterComponentsFactory componentsFactory,
RobotConfiguration configuration,
StandardVehicleService vehicleService,
StandardTransportOrderService transportOrderService,
StandardPlantModelService plantModelService,
StandardDispatcherService dispatcherService,
DefaultRouter router,
VehicleControllerPool vehicleControllerPool,
@Assisted Vehicle vehicle,
@KernelExecutor ExecutorService kernelExecutor) {
super(new RobotProcessModel(vehicle),
configuration.commandQueueCapacity(),
configuration.sentQueueCapacity(),
configuration.rechargeOperation());
this.vehicle = requireNonNull(vehicle, "vehicle");
this.configuration = requireNonNull(configuration, "configuration");
this.componentsFactory = requireNonNull(componentsFactory, "componentsFactory");
this.kernelExecutor = requireNonNull(kernelExecutor, "kernelExecutor");
this.vehicleService = vehicleService;
this.transportOrderService = transportOrderService;
this.dispatcherService = dispatcherService;
this.plantModelService = plantModelService;
this.router = router;
this.vehicleControllerPool = vehicleControllerPool;
/**移动命令队列*/
this.tempCommandQueue = new LinkedBlockingQueue<>();
this.movementCommandQueue = new LinkedBlockingQueue<>();
}
/**
* Creates a new instance.
*
* @param vehicle The selected vehicle.
* @param drawingEditor The application's drawing editor.
*/
@Inject
public FollowVehicleAction(@Assisted VehicleModel vehicle,
OpenTCSDrawingEditor drawingEditor) {
this.vehicleModel = requireNonNull(vehicle, "vehicle");
this.drawingEditor = requireNonNull(drawingEditor, "drawingEditor");
putValue(NAME, BUNDLE.getString("followVehicleAction.name"));
}
/**
* Creates a new instance.
*
* @param vehicle The selected vehicle.
* @param drawingEditor The application's drawing editor.
* @param modelManager The model manager.
*/
@Inject
public ScrollToVehicleAction(@Assisted VehicleModel vehicle,
OpenTCSDrawingEditor drawingEditor,
ModelManager modelManager) {
this.vehicleModel = requireNonNull(vehicle, "vehicle");
this.drawingEditor = requireNonNull(drawingEditor, "drawingEditor");
this.modelManager = requireNonNull(modelManager, "modelManager");
putValue(NAME, BUNDLE.getString("scrollToVehicleAction.name"));
}
/**
* Creates a new instance.
*
* @param vehicle The selected vehicle.
* @param applicationFrame The application's main view.
* @param modelManager Provides the current system model.
* @param orderUtil A helper for creating transport orders with the kernel.
*/
@Inject
public SendVehicleToPointAction(@Assisted VehicleModel vehicle,
@ApplicationFrame JFrame applicationFrame,
ModelManager modelManager,
TransportOrderUtil orderUtil) {
this.vehicleModel = requireNonNull(vehicle, "vehicle");
this.applicationFrame = requireNonNull(applicationFrame, "applicationFrame");
this.modelManager = requireNonNull(modelManager, "modelManager");
this.orderUtil = requireNonNull(orderUtil, "orderUtil");
putValue(NAME, BUNDLE.getString("sendVehicleToPointAction.name"));
}
/**
* Creates a new instance.
*
* @param vehicle The selected vehicle.
* @param applicationFrame The application's main view.
* @param modelManager Provides the current system model.
* @param orderUtil A helper for creating transport orders with the kernel.
*/
@Inject
public SendVehicleToLocationAction(@Assisted VehicleModel vehicle,
@ApplicationFrame JFrame applicationFrame,
ModelManager modelManager,
TransportOrderUtil orderUtil) {
this.fVehicle = requireNonNull(vehicle, "vehicle");
this.applicationFrame = requireNonNull(applicationFrame, "applicationFrame");
this.modelManager = requireNonNull(modelManager, "modelManager");
this.orderUtil = requireNonNull(orderUtil, "orderUtil");
putValue(NAME, BUNDLE.getString("sendVehicleToLocationAction.name"));
}
/**
* Creates new instance.
*
* @param sequence The order sequence.
* @param portalProvider Provides access to a portal.
*/
@Inject
public OrderSequenceView(@Assisted OrderSequence sequence,
SharedKernelServicePortalProvider portalProvider) {
this.fOrderSequence = requireNonNull(sequence, "sequence");
this.portalProvider = requireNonNull(portalProvider, "portalProvider");
initComponents();
initFields();
}
/**
* Creates new instance.
*
* @param order The transport order.
* @param historyEntryFormatter A formatter for history entries.
*/
@Inject
public TransportOrderView(@Assisted TransportOrder order,
CompositeObjectHistoryEntryFormatter historyEntryFormatter) {
this.fTransportOrder = requireNonNull(order, "order");
this.historyEntryFormatter = requireNonNull(historyEntryFormatter, "historyEntryFormatter");
initComponents();
setDialogTitle(ResourceBundleUtil.getBundle(I18nPlantOverview.TODETAIL_PATH)
.getString("transportOrderView.title"));
}
/**
* Creates a new instance.
*
* @param model The corresponding vehicle object.
* @param appState Stores the application's current state.
* @param view The application's main view.
* @param editor The drawing editor.
* @param modelManager Provides the current system model.
* @param menuFactory A factory for popup menus.
*/
@Inject
public VehicleUserObject(@Assisted VehicleModel model,
ApplicationState appState,
OpenTCSView view,
OpenTCSDrawingEditor editor,
ModelManager modelManager,
MenuFactory menuFactory) {
super(model, view, editor, modelManager);
this.appState = requireNonNull(appState, "appState");
this.menuFactory = requireNonNull(menuFactory, "menuFactory");
}
/**
* Creates a new instance.
*
* @param dataObject The corresponding model component
* @param context The user object context
* @param view The openTCS view
* @param editor The drawing editor
* @param modelManager The model manager
* @param blockSelector A helper for selecting blocks/block elements.
*/
@Inject
public BlockUserObject(@Assisted BlockModel dataObject,
@Assisted UserObjectContext context,
OpenTCSView view,
OpenTCSDrawingEditor editor,
ModelManager modelManager,
BlockSelector blockSelector) {
super(dataObject, view, editor, modelManager);
this.context = requireNonNull(context, "context");
this.blockSelector = requireNonNull(blockSelector, "blockSelector");
}
/**
* Creates a new instance.
*
* @param model The corresponding model object
* @param context The user object context
* @param view The openTCS view
* @param editor The drawing editor
* @param modelManager The model manager
*/
@Inject
public LocationUserObject(@Assisted LocationModel model,
@Assisted UserObjectContext context,
OpenTCSView view,
OpenTCSDrawingEditor editor,
ModelManager modelManager) {
super(model, view, editor, modelManager);
this.context = Objects.requireNonNull(context, "context");
}
/**
* Creates a new instance.
*
* @param model The corresponding model object
* @param context The user object context
* @param view The openTCS view
* @param editor The drawing editor
* @param modelManager The model manager
*/
@Inject
public PathUserObject(@Assisted PathModel model,
@Assisted UserObjectContext context,
OpenTCSView view,
OpenTCSDrawingEditor editor,
ModelManager modelManager) {
super(model, view, editor, modelManager);
this.context = context;
}
/**
* Creates a new instance.
*
* @param model The corresponding model object
* @param context The user object context
* @param view The openTCS view
* @param editor The drawing editor
* @param modelManager The model manager
*/
@Inject
public PointUserObject(@Assisted PointModel model,
@Assisted UserObjectContext context,
OpenTCSView view,
OpenTCSDrawingEditor editor,
ModelManager modelManager) {
super(model, view, editor, modelManager);
this.context = Objects.requireNonNull(context, "context");
}
/**
* Creates a new instance.
*
* @param dockable The dockable.
* @param viewManager Manages the application's views.
* @param dockingManager Manages the application's dockables.
*/
@Inject
public DockableClosingHandler(@Assisted DefaultSingleCDockable dockable,
ViewManager viewManager,
DockingManager dockingManager) {
this.dockable = requireNonNull(dockable, "dockable");
this.viewManager = requireNonNull(viewManager, "viewManager");
this.dockingManager = requireNonNull(dockingManager, "dockingManager");
}
/**
* Creates new instance.
*
* @param vehicle The vehicle to be displayed.
* @param treeViewManager The tree view's manager (for selecting the vehicle
* when it's clicked on).
* @param propertiesComponent The properties component (for displaying
* properties of the vehicle when it's clicked on).
* @param drawingEditor The drawing editor (for accessing the currently active
* drawing view).
* @param crsObjFactory A factory to create vehicle figures.
* @param menuFactory A factory for popup menus.
*/
@Inject
public SingleVehicleView(@Assisted VehicleModel vehicle,
ComponentsTreeViewManager treeViewManager,
SelectionPropertiesComponent propertiesComponent,
OpenTCSDrawingEditor drawingEditor,
CourseObjectFactory crsObjFactory,
MenuFactory menuFactory,
ModelManager modelManager) {
this.fVehicleModel = requireNonNull(vehicle, "vehicle");
this.treeViewManager = requireNonNull(treeViewManager, "treeViewManager");
this.propertiesComponent = requireNonNull(propertiesComponent,
"propertiesComponent");
this.drawingEditor = requireNonNull(drawingEditor, "drawingEditor");
this.crsObjFactory = requireNonNull(crsObjFactory, "crsObjFactory");
this.menuFactory = requireNonNull(menuFactory, "menuFactory");
this.modelManager = requireNonNull(modelManager, "modelManager");
this.fVehicleView = new VehicleView(fVehicleModel);
initComponents();
vehiclePanel.add(fVehicleView, BorderLayout.CENTER);
vehicle.addAttributesChangeListener(this);
vehicleLabel.setText(vehicle.getName());
updateVehicle();
}
/**
* Creates a new instance.
*
* @param vehicles A list of existing vehicles.
* @param drawingView The view to show the found vehicle in.
* @param modelManager The model manager.
*/
@Inject
public FindVehiclePanel(@Assisted Collection<VehicleModel> vehicles,
@Assisted OpenTCSDrawingView drawingView,
ModelManager modelManager) {
fVehicles = new ArrayList<>(requireNonNull(vehicles, "vehicles"));
fDrawingView = requireNonNull(drawingView, "drawingView");
this.modelManager = requireNonNull(modelManager, "modelManager");
initComponents();
for (VehicleModel vehicle : vehicles) {
comboBoxVehicles.addItem(vehicle.getName());
}
}
/**
* Creates a new instance.
*
* @param property The affected property.
* @param modelManager The model manager to be used.
*/
public CoordinateUndoActivity(@Assisted CoordinateProperty property,
ModelManager modelManager) {
this.property = requireNonNull(property, "property");
ModelComponent model = property.getModel();
pxModel = (CoordinateProperty) model.getProperty(PositionableModelComponent.MODEL_X_POSITION);
pyModel = (CoordinateProperty) model.getProperty(PositionableModelComponent.MODEL_Y_POSITION);
bufferedFigure = (LabeledFigure) modelManager.getModel().getFigure(model);
}
/**
* Creates a new instance.
*
* @param textField
*/
@Inject
public CoordinateCellEditor(@Assisted JTextField textField,
@Assisted UserMessageHelper umh,
PropertiesComponentsFactory componentsFactory) {
super(textField, umh);
this.componentsFactory = requireNonNull(componentsFactory, "componentsFactory");
}
/**
* Creates a new instance.
*
* @param figure The presentation figure.
* @param textGenerator The tool tip text generator.
*/
@Inject
public LabeledPointFigure(@Assisted PointFigure figure,
ToolTipTextGenerator textGenerator) {
requireNonNull(figure, "figure");
this.textGenerator = requireNonNull(textGenerator, "textGenerator");
setPresentationFigure(figure);
}