本文整理汇总了Java中com.intellij.uiDesigner.FormEditingUtil.getRadComponentAt方法的典型用法代码示例。如果您正苦于以下问题:Java FormEditingUtil.getRadComponentAt方法的具体用法?Java FormEditingUtil.getRadComponentAt怎么用?Java FormEditingUtil.getRadComponentAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.uiDesigner.FormEditingUtil
的用法示例。
在下文中一共展示了FormEditingUtil.getRadComponentAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processMouseEvent
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
protected void processMouseEvent(final MouseEvent e) {
if (e.getID() == MouseEvent.MOUSE_PRESSED) {
myPressPoint = e.getPoint();
}
else if (e.getID() == MouseEvent.MOUSE_RELEASED) {
if (!myDragStarted) {
RadComponent component = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), e.getX(), e.getY());
if (component != null) {
if (UIUtil.isControlKeyDown(e)) {
component.setSelected(!component.isSelected());
}
}
}
}
else if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
if (!myDragStarted) {
if ((Math.abs(e.getX() - myPressPoint.getX()) > TREMOR || Math.abs(e.getY() - myPressPoint.getY()) > TREMOR)) {
ArrayList<InputEvent> eventList = new ArrayList<InputEvent>();
eventList.add(e);
myDragGestureRecognizer.setTriggerEvent(e);
DragGestureEvent dge = new DragGestureEvent(myDragGestureRecognizer,
UIUtil.isControlKeyDown(e) ? DnDConstants.ACTION_COPY : DnDConstants.ACTION_MOVE,
myPressPoint, eventList);
myDragStarted = true;
myEditor.getDropTargetListener().setUseDragDelta(true);
dge.startDrag(null,
DraggedComponentList.pickupSelection(myEditor, e.getPoint()),
myDragSourceListener);
}
}
}
}
示例2: startInplaceEditing
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
/**
* Starts editing of "inplace" property for the component at the
* specified point <code>(x, y)</code>.
*
* @param x x coordinate in the editor coordinate system
* @param y y coordinate in the editor coordinate system
*/
public void startInplaceEditing(final int x, final int y){
final RadComponent inplaceComponent = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), x, y);
if(inplaceComponent == null){ // nothing to edit
return;
}
// Try to find property with inplace editor
final Point p = SwingUtilities.convertPoint(this, x, y, inplaceComponent.getDelegee());
final Property inplaceProperty = inplaceComponent.getInplaceProperty(p.x, p.y);
if (inplaceProperty != null) {
final Rectangle bounds = inplaceComponent.getInplaceEditorBounds(inplaceProperty, p.x, p.y);
startInplaceEditing(inplaceComponent, inplaceProperty, bounds, new InplaceContext(true));
}
}
示例3: updateDragger
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
private void updateDragger(final MouseEvent e) {
final RadComponent component = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), e.getX(), e.getY());
LOG.assertTrue(component != null);
// Dragger
final RadComponent oldDraggerHost = FormEditingUtil.getDraggerHost(myEditor);
RadComponent newDraggerHost = null;
for (RadComponent c = component; c != null && !(c instanceof RadRootContainer); c = c.getParent()) {
if (c.isSelected()) {
newDraggerHost = c;
break;
}
}
boolean keepOldHost = false;
if (oldDraggerHost != null && oldDraggerHost.isSelected()) {
final Point p = SwingUtilities.convertPoint(oldDraggerHost.getDelegee(), 0, 0, e.getComponent());
final int deltaX = e.getX() - p.x;
final int deltaY = e.getY() - p.y;
if(
deltaX > -DRAGGER_SIZE && deltaX < oldDraggerHost.getWidth() &&
deltaY > -DRAGGER_SIZE && deltaY < oldDraggerHost.getHeight()
){
keepOldHost = true;
newDraggerHost = null;
}
}
boolean shouldRepaint = false;
if (oldDraggerHost != null && !keepOldHost && oldDraggerHost != newDraggerHost){
oldDraggerHost.setDragger(false);
shouldRepaint = true;
}
if (newDraggerHost != null){
newDraggerHost.setDragger(true);
shouldRepaint = true;
}
if (shouldRepaint) {
myEditor.repaintLayeredPane();
}
}
示例4: processMousePressed
import com.intellij.uiDesigner.FormEditingUtil; //导入方法依赖的package包/类
private void processMousePressed(final MouseEvent e){
if(myCurrentProcessor != null){
if (myCurrentProcessor.needMousePressed()) {
myCurrentProcessor.processMouseEvent(e);
return;
}
// Sun sometimes skips mouse released events...
myCurrentProcessor.cancelOperation();
myCurrentProcessor = null;
}
RadComponent component = null;
final RadComponent draggerHost = FormEditingUtil.getDraggerHost(myEditor);
// Try to understand whether we pressed inside dragger area
if(draggerHost != null){
final JComponent delegee = draggerHost.getDelegee();
final Point p = SwingUtilities.convertPoint(delegee, 0, 0, e.getComponent());
if(
p.x - MainProcessor.DRAGGER_SIZE <= e.getX() && e.getX() <= p.x &&
p.y - MainProcessor.DRAGGER_SIZE <= e.getY() && e.getY() <= p.y
){
component = draggerHost;
}
}
// If user clicked not inside dragger then we have find RadComponent at the click point
if(component == null){
component = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), e.getX(), e.getY());
}
if (component == null) {
return;
}
final ComponentItem selectedItem = PaletteToolWindowManager.getInstance(myEditor).getActiveItem(ComponentItem.class);
if (selectedItem != null) {
myInsertComponentProcessor.setSticky(UIUtil.isControlKeyDown(e));
myCurrentProcessor = myInsertComponentProcessor;
return;
}
if (!UIUtil.isControlKeyDown(e) && !e.isShiftDown()) {
if (!component.isSelected() || FormEditingUtil.getSelectedComponents(myEditor).size() != 1) {
FormEditingUtil.selectSingleComponent(myEditor, component);
}
}
final Point point = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), component.getDelegee());
final int resizeMask = Painter.getResizeMask(component, point.x, point.y);
LOG.debug("MainProcessor.processMousePressed: resizeMask at (" + point.x + "," + point.y + ") is " + resizeMask);
if (resizeMask != 0) {
if (component.getParent() != null) {
component = component.getParent().getActionTargetComponent(component);
}
myCurrentProcessor = new ResizeProcessor(myEditor, component, resizeMask);
}
else if (component instanceof RadRootContainer || e.isShiftDown()) {
myCurrentProcessor = new GroupSelectionProcessor(myEditor, component);
}
else if (!e.isShiftDown()) {
myCurrentProcessor = new DragSelectionProcessor(myEditor);
}
updateDragger(e);
}