Package javax.swing.undo

Examples of javax.swing.undo.StateEdit


    }
  }

  public void test(TestHarness harness)
  {
    StateEdit edit;
    Person p;

    // Check #1.
    p = new Person();
    p.setName("Daniel Dandelion");
    edit = new StateEdit(p, "Name Change");
    harness.check(p.getName(), "Daniel Dandelion");
   
    // Check #2.
    p.setName("Rose Rosenholz");
    edit.end();
    harness.check(p.getName(), "Rose Rosenholz");

    // Check #3.
    edit.undo();
    harness.check(p.getName(), "Daniel Dandelion");

    // Check #4.
    edit.redo();
    harness.check(p.getName(), "Rose Rosenholz");
  }
View Full Code Here


            // Get the pre-state of argument target-related changes.
            // Note that we have to keep track of targeting info for arguments which disappear
            //   (eg. a code gem input disappearing may cause emitter inputs to disappear as well!).
            // Get the emitter and collector argument state from before the disconnection.
            StateEdit collectorArgumentStateEdit = new StateEdit(collectorArgumentStateEditable);

            // The code gem has already updated, but arguments have not.
            getGemGraph().retargetArgumentsForDefinitionChange(codeGem, oldInputs);

            // Update the code gem editor state for connectivity.
View Full Code Here

            return;
        }                           
        Set<Connection> connectionSet = new LinkedHashSet<Connection>(displayedGemsConnectionPair.snd());

        // Get the pre-state of argument target-related changes.
        StateEdit collectorArgumentStateEdit = new StateEdit(collectorArgumentStateEditable);

        // Get the categories of gem to add to the gem graph.
        Set<Gem> rootsToAdd = new HashSet<Gem>();
        Set<DisplayedGem> displayedCollectorsToAdd = new HashSet<DisplayedGem>();
        Set<DisplayedGem> displayedNonCollectorsToAdd = new HashSet<DisplayedGem>();
View Full Code Here

        }

        undoableEditSupport.beginUpdate();

        // Get the emitter and collector argument state from before the disconnection.
        StateEdit collectorArgumentState = new StateEdit(collectorArgumentStateEditable);

        // Get value gem values before the connection, and connect.
        Map<ValueGem, ValueNode> valueGemToValueMap = getValueGemToValueMap();
        connect(connection);
View Full Code Here

        // Increment the update level to aggregate any disconnection edits.
        undoableEditSupport.beginUpdate();

        // Get the emitter and collector argument state from before the disconnection.
        StateEdit collectorArgumentState = new StateEdit(collectorArgumentStateEditable);

        // Now actually perform the disconnection
        disconnect(connection);       

        // Notify undo managers of the disconnection.
        undoableEditSupport.postEdit(new UndoableDisconnectGemsEdit(TableTop.this, connection, collectorArgumentState));

        // If the destination input is an unused code gem input, update its model, and post an edit for its state change.
        Gem destGem = connection.getDestination().getGem();
        if (destGem instanceof CodeGem) {
            CodeGemEditor destCodeGemEditor = getCodeGemEditor((CodeGem)destGem);

            if (destCodeGemEditor.isUnusedArg(connection.getDestination()) ||
                    destGem.isBroken() && ((CodeGem)destGem).getCodeResultType() != null) {   // check for incompatible connection.

                StateEdit stateEdit = new StateEdit(destCodeGemEditor, GemCutter.getResourceString("UndoText_DisconnectGems"));

                destCodeGemEditor.doSyntaxSmarts();
                updateForConnectivity(destCodeGemEditor);

                stateEdit.end();
                undoableEditSupport.postEdit(stateEdit);
            }
        }

        // Update code gem editors for connectivity.
View Full Code Here

       
        undoableEditSupport.beginUpdate();
        DisplayedGem newCollectorGem = createDisplayedCollectorGem(new Point(0, 0), targetForNewCollector);
        DisplayedGem newEmitterGem = createDisplayedReflectorGem(new Point(0, 0), (CollectorGem) newCollectorGem.getGem());
       
        StateEdit collectorArgumentState = new StateEdit(collectorArgumentStateEditable);
       
        // Do the actual split action with the new gems
        splitConnectionWith(connection, newCollectorGem, newEmitterGem);
       
        // Display the edit box for the collector name for user input
View Full Code Here

        gemCodePanel.getVariablesDisplay().addPanelEventListener(new VariablesDisplay.PanelEventListener() {

            public void panelShifted(int argIndex, int shiftAmount) {

                StateEdit stateEdit = null;
                PartInput[] oldInputs = null;
                if (recordingEditStates) {
                    stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_ReorderInputs"));
                    oldInputs = codeGem.getInputParts();
                }

                keepInputsInNaturalOrder = false;
                shiftInput(argIndex, shiftAmount);
                updateVariablesDisplay();

                if (recordingEditStates) {
                    stateEdit.end();
                    if (CodeGemEditor.this.editHandler != null) {
                        CodeGemEditor.this.editHandler.definitionEdited(CodeGemEditor.this, oldInputs, stateEdit);
                    }
                }
            }
View Full Code Here

     * To be called when the text of the code gem changes. Records the change, performs
     * syntax smarts, and posts the edit to the edit handler.
     */
    private void updateGemForTextChange() {
        // Get the code gem change.
        StateEdit stateEdit = null;
        PartInput[] oldInputs = null;
        if (recordingEditStates) {
            stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_CodeChange"));
            oldInputs = codeGem.getInputParts();
        }

        // Update the code gem.
        doSyntaxSmarts();

        // Post edit state.
        if (recordingEditStates) {
            stateEdit.end();

            // Post the edit to the edit handler.
            if (CodeGemEditor.this.editHandler != null) {
                CodeGemEditor.this.editHandler.definitionEdited(CodeGemEditor.this, oldInputs, stateEdit);
            }
View Full Code Here

     * @param moduleName
     */
    void changeArgumentToQualification(String argumentName,
            ModuleName moduleName) {

        StateEdit stateEdit = null;
        PartInput[] oldInputs = null;
        if (recordingEditStates) {
            stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_CodeGemArgFormChange"));
            oldInputs = codeGem.getInputParts();
        }

        if (moduleName.equals(perspective.getWorkingModuleName())) {
            // Remove argument from free variables, and add to map
            varNamesWhichAreArgs.remove(argumentName);
        }
        userQualifiedIdentifiers.putQualification(argumentName, moduleName, SourceIdentifier.Category.TOP_LEVEL_FUNCTION_OR_CLASS_METHOD);

        // re-evaluate the gem based on the new variable form
        doSyntaxSmarts();

        if (recordingEditStates) {
            stateEdit.end();
            if (editHandler != null) {
                editHandler.definitionEdited(this, oldInputs, stateEdit);
            }
        }
    }
View Full Code Here

     * @param type
     */
    void changeAmbiguityToQualification(String argumentName,
            ModuleName moduleName, SourceIdentifier.Category type) {

        StateEdit stateEdit = null;
        PartInput[] oldInputs = null;
        if (recordingEditStates) {
            stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_CodeGemArgFormChange"));
            oldInputs = codeGem.getInputParts();
        }

        userQualifiedIdentifiers.putQualification(argumentName, moduleName, type);

        // re-evaluate the gem based on the new variable form
        doSyntaxSmarts();

        if (recordingEditStates) {
            stateEdit.end();
            if (editHandler != null) {
                editHandler.definitionEdited(this, oldInputs, stateEdit);
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.undo.StateEdit

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.