Package org.openquark.gems.client.DisplayedGem

Examples of org.openquark.gems.client.DisplayedGem.DisplayedPart


     * @param xy Point the coordinate to look under
     * @return DisplayedPart the part of the Gem under coord xy, or null if none are hit
     */
    DisplayedPart getGemPartUnder(Point xy) {
        // Hit test for each Gem. 
        DisplayedPart hitPart = null;

        for (final Gem gem : gemDisplayMap.keySet()) {
            DisplayedGem thisGem = gemDisplayMap.get(gem);

            // Ask the gem what part of it has been hit
            DisplayedPart thisGemHitPart = thisGem.whatHit(xy);
            if (thisGemHitPart != null) {
                hitPart = thisGemHitPart;
            }  
        }   
        return hitPart;
View Full Code Here


       
        @Override
        public void mouseMoved(MouseEvent evt) {       
   
            // Determine if we are over an unconnected (and unburnt) source/sink part.
            DisplayedPart partOver = gemCutter.getTableTop().getGemPartUnder(evt.getPoint());
                   
            if (partOver instanceof DisplayedPartOutput ||
                (partOver instanceof DisplayedPartInput && !((DisplayedPartInput)partOver).getPartInput().isBurnt())) {
   
                DisplayedPartConnectable dPartConnectable = (DisplayedPartConnectable)partOver;
View Full Code Here

                undoableEditSupport.endUpdate();
               
            } else if (dragMode == TableTopDragMode.CONNECTING || dragMode == TableTopDragMode.DISCONNECTING) {

                // see if we can connect anything
                DisplayedPart partUnder = tableTop.getGemPartUnder(where);

                boolean connected = false;
                if (partUnder != null) {
                   
                    Connection newConnection = null;
View Full Code Here

         * @return DragMode the drag mode appropriate to the origin of the current drag.
         */
        private DragMode getDragModeForDragOrigin() {

            // Get the part which the user pressed 
            DisplayedPart partPressed = null;
            if (pressedAt != null) {
                partPressed = tableTop.getGemPartUnder(pressedAt);
            }

            // default is selecting (if not dragging or composing)
View Full Code Here

                DisplayedGem addingGem = gemCutter.getAddingDisplayedGem();
                if (addingGem != null) {
                    tableTop.doAddGemUserAction(addingGem, pressedAt);
                   
                } else {
                    DisplayedPart part = tableTop.getGemPartUnder(pressedAt);
                    boolean showedIntellicutForPart = false;
                   
                    // Check if the user clicked on a part and if we should start Intellicut for that.
                    if (part instanceof DisplayedPartConnectable) {
                        showedIntellicutForPart = tableTop.maybeStartIntellicutMode(part);
                    }
                   
                    // Just show Intellicut for the table top if we didn't show it for a part
                    if (!showedIntellicutForPart) {
                       
                        // If there was a part use it's bounds as the display rect. That way if the user clicks on
                        // a gem body part, the list wont obscure the part.
                        Rectangle displayRect = part != null ? part.getBounds() : new Rectangle(pressedAt);
                       
                        // Use the lower-right of the display rect as the drop point. That way if the user clicks
                        // a gem body part the new gem will appear next to the old one, not over it.
                        Point dropPoint = new Point(displayRect.x + displayRect.width, displayRect.y + displayRect.height);
                       
View Full Code Here

         * (with no buttons no down).
         */
        public void mouseMoved(MouseEvent e) {
           
            // Test if we are over a gem part
            DisplayedPart partUnder = tableTop.getGemPartUnder(e.getPoint());
           
            // If we are dragging over a VEP make sure to display the correct cursor.
            if (valueEntryPanelHit(e.getPoint())) {
                ValueEntryPanel vep = getValueEntryPanel((ValueGem)partUnder.getGem());
                Point vepPoint = SwingUtilities.convertPoint(TableTopPanel.this, e.getPoint(), vep);
                setCursor(vep.getCursor(vepPoint));
               
            } else {
                setCursor(Cursor.getDefaultCursor());
            }
           
            // display some help maybe
            if (gemCutter.getGUIState() == GemCutter.GUIState.EDIT) {

                // unconnected connectable parts of a non-broken gem
                if (partUnder instanceof DisplayedPartConnectable &&                                // connectable
                    !((DisplayedPartConnectable)partUnder).getPartConnectable().isConnected() &&    // not connected
                    !((partUnder.getGem().getRootGem() != null) &&                                  // not ancestor of a broken forest
                      GemGraph.isAncestorOfBrokenGemForest(partUnder.getGem().getRootGem()))) {
                   
                    if (partUnder instanceof DisplayedPartInput) {
                        // double click to burn/unburn an unconnected input
                        gemCutter.getStatusMessageDisplayer().setMessageFromResource(TableTopPanel.this, "SM_DblClickBurn", StatusMessageDisplayer.MessageType.PERSISTENT);
                       
View Full Code Here

                // add a gem if appropriate
                if (maybeAddGem()) {
                    return;
                }
               
                DisplayedPart partPressed = tableTop.getGemPartUnder(pressedAt);
               
                // Now do whatever based on what was pressed on
                mousePressedOn(e, partPressed, prevIntellicutMode);
               
                // Added for Linux compatibility (KDE popups are shown on mouse down)
View Full Code Here

                forwardMouseEvent (getValueEntryPanel((ValueGem)clickGem.getGem()), e);
                return doubleClicked;
            }
           
            // Test if we hit any part of the gem
            DisplayedPart partClicked = tableTop.getGemPartUnder(e.getPoint());
            if (partClicked != null) {
               
                // if the user double left clicks on an input part, burn if appropriate
                if (SwingUtilities.isLeftMouseButton(e) && doubleClicked) {
                    tableTop.getBurnManager().handleBurnInputGesture(partClicked);
View Full Code Here

               
                // update the tabletop state to take into account the present drag position while connecting
                changeStateForConnecting(where);

                // undo autoburns if we're dragging away from an output
                DisplayedPart displayedPartUnder = tableTop.getGemPartUnder(where);
                Gem autoBurnLastGem = tableTop.getBurnManager().getAutoburnLastGem();
                if (dragMode == TableTopDragMode.DISCONNECTING &&
                        connectionDragAnchorPart instanceof DisplayedPartInput &&
                        autoBurnLastGem != null &&
                        (displayedPartUnder == null || displayedPartUnder.getGem() != autoBurnLastGem) &&
                        tableTop.getBurnManager().getAutoburnLastResult() == AutoburnLogic.AutoburnAction.BURNED) {
                    tableTop.getBurnManager().doUnburnAutomaticallyBurnedInputsUserAction(autoBurnLastGem);
                }

                // clear the status message
View Full Code Here

        }

        currentPopupLocation = e.getPoint();
       
        DisplayedGem gem = tableTop.getGemUnder(currentPopupLocation);
        DisplayedPart part = tableTop.getGemPartUnder(currentPopupLocation);
       
        if (part instanceof DisplayedPartBody) {
           
            currentPopupMenu = getGemPopupMenu(gem, true);
           
View Full Code Here

TOP

Related Classes of org.openquark.gems.client.DisplayedGem.DisplayedPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.