Examples of ExtendedUndoableEditSupport


Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            }
           
            // Where are we now? 
            // We use dragPos instead of e.getPoint() so that the gem drops where the drag ghost shows it.
            Point where = dragPos;
            ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();

            // Now do whatever based on the drag mode
            if (dragMode == TableTopDragMode.CTRLDRAGGING) {
               
                // Ctrl Drag is used as a clone function
                // We want to group this stuff as one single action
                undoableEditSupport.beginUpdate();
                undoableEditSupport.setEditName(GemCutter.getResourceString("UndoText_CopyDrag"));
                DisplayedGemSelection displayedGemSelection = new DisplayedGemSelection(dragList, gemCutter);
                Rectangle rect = dragList[0].getBounds();
                for (int i = 1; i < dragList.length; i++) {
                    rect.add(dragList[i].getBounds());
                }
                int x = where.x - (pressedAt.x - rect.x);
                int y = where.y - (pressedAt.y - rect.y);
               
                tableTop.doPasteUserAction(displayedGemSelection, new Point(x, y));
                undoableEditSupport.endUpdate();

            } else if (dragMode == TableTopDragMode.GEMDRAGGING) {
               
                // Increment the update level for the edit undo.  This will aggregate the gem translations.
                undoableEditSupport.beginUpdate();
                if (dragList.length > 0) {
                    undoableEditSupport.setEditName(dragList.length > 1 ? GemCutter.getResourceString("UndoText_MoveGems") :
                                                                          GemCutter.getResourceString("UndoText_MoveGem"));
                }

                // Do the move for each selected gem
                for (final DisplayedGem displayedGem : dragList) {
                    Point newGemLocation = displayedGem.getLocation();
                    newGemLocation.translate(where.x - pressedAt.x, where.y - pressedAt.y);
                   
                    // Perform the translation
                    tableTop.doChangeGemLocationUserAction(displayedGem, newGemLocation);
                }

                // Decrement the update level.  This will post the edit if the level is zero.
                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;
                    if (connectionDragAnchorPart instanceof DisplayedPartOutput && partUnder instanceof DisplayedPartInput) {
                        newConnection = tableTop.handleConnectGemPartsGesture(connectionDragAnchorPart.getPartConnectable(),
                                                                              ((DisplayedPartInput)partUnder).getPartInput());
                    } else if (partUnder instanceof DisplayedPartConnectable && connectionDragAnchorPart instanceof DisplayedPartInput) {
                        newConnection = tableTop.handleConnectGemPartsGesture(((DisplayedPartConnectable)partUnder).getPartConnectable(),
                                                                              ((DisplayedPartInput)connectionDragAnchorPart).getPartInput());
                    }
                   
                    connected = (newConnection != null);
                }

                // Undo any autoburns if we didn't connect anything
                if (!connected && connectionDragAnchorPart instanceof DisplayedPartOutput) {
                    DisplayedGem burnGem = connectionDragAnchorPart.getDisplayedGem();
                    tableTop.getBurnManager().doUnburnAutomaticallyBurnedInputsUserAction(burnGem.getGem());
                }

                if (!connected && dragMode == TableTopDragMode.CONNECTING) {
                    // Don't post the edit if connecting and nothing happened.
                    undoableEditSupport.endUpdateNoPost();

                } else if (connected && dragMode == TableTopDragMode.DISCONNECTING && disconnectedDisplayedPart == partUnder){
                    // Also don't post the edit if all we did was reconnect a part that we disconnected.
                    undoableEditSupport.endUpdateNoPost();

                } else {
                   
                    if (dragMode == TableTopDragMode.CONNECTING) {
                        undoableEditSupport.setEditName(GemCutter.getResourceString("UndoText_ConnectGems"));

                    } else {
                        undoableEditSupport.setEditName(GemCutter.getResourceString("UndoText_DisconnectGems"));
                    }

                    // Decrement the update level, possibly triggering the edit to be posted.
                    undoableEditSupport.endUpdate();
                }

            } else if (dragMode == TableTopDragMode.SELECTING && pressedAt != null) {

                // calculate the bounds of the select area     
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

           
            private static final long serialVersionUID = 6931521030141991559L;

            public void actionPerformed(ActionEvent evt) {
                DisplayedGem dGem = tableTop.createDisplayedValueGem(new Point());
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, partInput.getConnectionPoint());
                tidyAsConnected(dGem.getDisplayedOutputPart(), partInput, false);
               
                tableTop.handleConnectGemPartsGesture(dGem.getGem().getOutputPart(), partInput.getPartInput());

                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
            }                                             
        };

        // Check if a value gem can be connected here       
        DisplayedGem displayedValueGem = tableTop.createDisplayedValueGem(new Point());
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

                    }
                }
               
                // Now actually create, add, and connect the collector.
                DisplayedGem dGem = tableTop.createDisplayedCollectorGem(new Point(0, 0), collectorToTarget);
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, displayedPartOutput.getConnectionPoint());
                tidyAsConnected(displayedPartOutput, dGem.getDisplayedInputPart(0), true);

                tableTop.handleConnectGemPartsGesture(displayedPartOutput.getPartOutput(), dGem.getGem().getInputPart(0));

                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
               
                tableTop.displayLetNameEditor((CollectorGem)dGem.getGem());
            }                                             
        };
       
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            private static final long serialVersionUID = 6775526511235880852L;

            public void actionPerformed(ActionEvent evt) {
                TableTop tableTop = gemCutter.getTableTop();
                DisplayedGem dGem = tableTop.createDisplayedValueGem(currentPopupLocation);
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, currentPopupLocation);
                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
            }
        };
       
        addValueGemAction.putValue(Action.MNEMONIC_KEY, Integer.valueOf(GemCutterActionKeys.MNEMONIC_ADD_VALUE_GEM));
       
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            private static final long serialVersionUID = 9129526613956299918L;

            public void actionPerformed(ActionEvent evt) {
                TableTop tableTop = gemCutter.getTableTop();
                DisplayedGem dGem = tableTop.createDisplayedCodeGem(currentPopupLocation);
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, currentPopupLocation);
                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
            }
        };
       
        addCodeGemAction.putValue(Action.MNEMONIC_KEY, Integer.valueOf(GemCutterActionKeys.MNEMONIC_ADD_CODE_GEM));
       
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            private static final long serialVersionUID = 6261574181526925026L;

            public void actionPerformed(ActionEvent evt) {
                TableTop tableTop = gemCutter.getTableTop();
                DisplayedGem dGem = tableTop.createDisplayedCollectorGem(currentPopupLocation, tableTop.getTargetCollector());
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, currentPopupLocation);
                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
               
                tableTop.displayLetNameEditor((CollectorGem)dGem.getGem());
            }
        };
       
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            private static final long serialVersionUID = -642626553800845519L;

            public void actionPerformed(ActionEvent evt) {
                TableTop tableTop = gemCutter.getTableTop();
                DisplayedGem dGem = tableTop.createDisplayedRecordFieldSelectionGem(currentPopupLocation);
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, currentPopupLocation);
                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
            }
        };
       
        AddRecordFieldSelectionGemAction.putValue(Action.MNEMONIC_KEY, Integer.valueOf(GemCutterActionKeys.MNEMONIC_ADD_RECORD_FIELD_SELECTION_GEM));
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            private static final long serialVersionUID = -1527976012193744771L;

            public void actionPerformed(ActionEvent evt) {
                TableTop tableTop = gemCutter.getTableTop();
                DisplayedGem dGem = tableTop.createDisplayedRecordCreationGem(currentPopupLocation);
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();

                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, currentPopupLocation);
                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
            }
        };

        AddRecordCreationGemAction.putValue(Action.MNEMONIC_KEY, Integer.valueOf(GemCutterActionKeys.MNEMONIC_ADD_RECORD_CREATION_GEM));
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            private static final long serialVersionUID = -1527976012193744771L;

            public void actionPerformed(ActionEvent evt) {
                TableTop tableTop = gemCutter.getTableTop();
                DisplayedGem dGem = tableTop.createDisplayedReflectorGem(currentPopupLocation, gemCutter.getCollectorForAddingReflector());
                ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
               
                editSupport.beginUpdate();
                tableTop.doAddGemUserAction(dGem, currentPopupLocation);
                editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
                editSupport.endUpdate();
            }
        };
       
        addReflectorAction.putValue(Action.MNEMONIC_KEY, Integer.valueOf(GemCutterActionKeys.MNEMONIC_ADD_REFLECTOR_GEM));
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.