Archive for July, 2007

Web host - Java Swing O Reilly This method is intended

Tuesday, July 31st, 2007

Java Swing O Reilly This method is intended to be used when the manager is limited to holding a single edit (limit == 1). If the edit has been undone, it calls redo(), otherwise, it calls undo(). 18.1.6.8 Protected Methods These methods are used internally by the UndoManager to manage its list of edits. They provide support for ignoring insignificant edits and removing edits that are no longer accessible. protected UndoableEdit editToBeRedone() Returns the next edit to be redone. This is simply the last significant edit that was undone. Any insignificant edits are skipped. If there are no significant redoable edits available, this method returns null. protected UndoableEdit editToBeUndone() Returns the next edit to be undone. This is the last significant edit that was either redone or added. Any insignificant edits are skipped. If there are no significant undoable edits available, this method returns null. protected void trimEdits(int from, int to) Removes the specified range of edits from the manager (if from is greater than to, it does nothing). The die() method is called on each removed edit in reverse order (to down to from). If the insertion point was within the trimmed range, it is reset to the value of from. protected void trimForLimit() Reduces the number of edits to fit within the set limit for this manager. If the number of edits is not greater than limit, it does nothing. Otherwise, it removes edits from either end of the list (or both), trying to end up with equal numbers of undoable and redoable edits (or as close as possible). For example, if there are 10 edits, half of which had been undone, and limit is reduced to six, the first two undone edits (those that were undone first) and the first two edits added (those that would be undone last) are removed. This leaves six edits (the new limit), three of which have been undone. protected void redoTo(UndoableEdit edit) throws CannotRedoException Starts with the last undone edit and calls redo() on each edit in the list, stopping after it has called redo() on the input edit. An ArrayIndex-OutOfBoundsException will be thrown if the input edit is not found before reaching the end of the edit list. protected void undoTo(UndoableEdit edit) throws CannotUndoException Starts with the last redone or added edit and calls undo() on each edit in the list, stopping after it has called undo() on the input edit. An ArrayIndexOutOfBoundsException will be thrown if the input edit is not found before reaching the beginning of the edit list. 18.1.6.9 Other Methods public String toString() - 555 -
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Java Swing O Reilly undone edits will still (Free web hosting music)

Tuesday, July 31st, 2007

Java Swing O Reilly undone edits will still be part of the edit after end() is called. public synchronized boolean canRedo() If the UndoManager is inProgress, this method uses editToBeRedone() (described later) to find the next significant redoable edit. If an edit is found, and it returns true when canRedo() is called on it, this method returns true. If the manager is not inProgress, super.canRedo() is called, making the manager act like a CompoundEdit. public synchronized boolean canUndo() If the UndoManager is inProgress, this method uses editToBeUndone() to find the next significant undoable edit. If an edit is found and it returns true when canUndo() is called on it, this method returns true. If the manager is not inProgress, super.canUndo() is called, making the manager act like a CompoundEdit. public synchronized void redo() throws CannotRedoException If the UndoManager is inProgress, this method uses editToBeRedone() to find the next significant redoable edit (the most recently undone edit). If an edit is found, redoTo() is called to redo all edits up to the next significant one. If no edit is found, an exception is thrown. If the manager is not inProgress, super.redo() is called, making the manager act like a CompoundEdit. public synchronized void undo() throws CannotUndoException If the UndoManager is inProgress, this method uses editToBeUndone() to find the next significant undoable edit. If an edit is found, undoTo() is called to undo all edits up to the next significant one. If no edit is found, an exception is thrown. If the manager is not inProgress, super.undo() is called, making the manager act like a CompoundEdit. Calling undo() and then calling redo() does not necessarily put you right back where you started. Any insignificant edits undone by the undo() call will not be redone by a subsequent redo() call. 18.1.6.7 New Public Methods The following are new methods introduced in the UndoManager class: public synchronized void discardAllEdits() Removes all edits from the UndoManager, calling die() on them in the order they were added. public synchronized boolean canUndoOrRedo() This method is intended to be used when the manager is limited to holding a single edit (limit == 1). If the edit has been undone, it returns the result of a call to canRedo(), otherwise it returns the result of a call to canUndo(). public synchronized void undoOrRedo() throws CannotRedoException, CannotUndoException - 554 -
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Web hosting provider - Java Swing O Reilly Table 18.6, UndoManager Properties

Monday, July 30th, 2007

Java Swing O Reilly Table 18.6, UndoManager Properties Property Data Type get is set bound Default Value limit int 100 redoPresentationName* String “Redo” undoOrRedoPresentationName String “Undo” undoPresentationName* String “Undo” See also properties from the CompoundEdit class (Table 18.4). The limit property represents the maximum number of edits the UndoManager will hold. Setting this value so that limit is less than the current number of edits in the manager causes the list of edits to be reduced to fit inside the new limit. The strategy for decreasing the list size is described in trimForLimit(), below. If the manager is inProgress, the redoPresentationName and undoPresentationName properties are set to the values returned by the next edit to be redone or undone, respectively. If redo or undo is not possible, AbstractUndoEdit.Redo or AbstractUndoableEdit.Undo is returned. If the manager is not inProgress, these values revert to the values defined by CompoundEdit. A new property, undoOrRedoPresentationName is defined in this class. This property is only intended for use when limit is set to 1. It returns the value of undoPresentationName if the single edit has not been undone, or the value of redoPresentationName if it has. 18.1.6.4 Constructor public UndoManager() Creates a new manager containing no edits, with a limit of 100. 18.1.6.5 UndoableEditListener Method This method is defined in the UndoableEditListener interface implemented by UndoManager: public void undoableEditHappened(UndoableEditEvent e) Calls addEdit(), passing in the UndoableEdit stored in the input event. 18.1.6.6 UndoableEdit Methods UndoManager overrides the following UndoableEdit methods: public synchronized boolean addEdit(UndoableEdit anEdit) If the manager is inProgress, this method adds anEdit at the current insertion point. Any undone edits are removed from the manager and die() is called on each of these in reverse order (the last edit added is killed first). If the manager is not inProgress, this method returns false. In versions of Swing prior to JDK 1.2, there are several problems with this method. The most notable is that it always returns true. Furthermore, any redoable edits are removed the first time addEdit()is called after an end() call. Starting with the JDK 1.2 release, end()will be implemented in this class to remove any redoable edits and addEdit() will be fixed to return falseonce end() has been called. If you are using an earlier release, be aware that this method always returns true and that - 553 -
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Java Swing O Reilly One more thing that (Web design tools)

Monday, July 30th, 2007

Java Swing O Reilly One more thing that adds to the complexity is that any time we add a new edit, we are no longer able to redo past undos, because the new edit takes the place of the last undone edit and all pending redoable edits are dropped. Therefore, any time we add an edit, we go to the undoable state. 18.1.6.1 A Codeless Example Figure 18.7 attempts to simplify the explanation of UndoManager state transitions by showing how the UndoManager handles additions, undos, and redos for a sample scenario. This example shows that the most typical use of UndoManager is straightforward, despite all its complexity. We add three edits to the UndoManager and then undo each of them. We then redo the first edit. At this point, we could redo the second edit or undo the first edit again. In the example, we instead add a new edit. Adding an edit causes any edits that appear later in the list (those edits which originated latest) to be lost. In this example, that causes our initial second and third edits to be dropped from the manager before the new edit is added. Finally, we undo this new edit. Figure 18.7. UndoManager example 18.1.6.2 Transformer? Probably the most nonintuitive things to understand about the design of UndoManager is its extension from CompoundEdit and the fact that after its end() method is called, an UndoManager is essentially transformed into a CompoundEdit. The idea here is to use an UndoManager in a temporary capacity during a specific editing task and then later be able to treat all of the edits given to the UndoManager as a single CompoundEdit. As an example, consider a spreadsheet application. The process of editing the formula for a single cell can be managed by an UndoManager, allowing small changes to be undone and redone. Once the formula has been committed, the UndoManager’s end() method can be called and the manager will begin to act like a CompoundEdit. This edit can then be handed off to a primary undo manager, allowing the entire formula change to be undone as a single edit. 18.1.6.3 Properties UndoManager defines the properties and default values shown in Table 18.6. - 552 -
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Java Swing O Reilly Another major difference between (Web server on xp)

Sunday, July 29th, 2007

Java Swing O Reilly Another major difference between UndoManager and its superclass is the semantics of the inProgress property. In CompoundEdit, we were only allowed to add new edits when we were inProgress, and only after calling end() could undo() or redo() be called. In contrast, UndoManager allows undo() and redo() to be called while it is inProgress. Furthermore, when end() is called, it stops supporting sequential undo/redo behavior and starts acting like a CompoundEdit (undo() and redo() call their superclass implementations when the UndoManager is not inProgress). For the strong-hearted,[3] Figure 18.6 shows a state chart for the UndoManager class.[4] For several reasons, this chart is considerably more complicated than the ones in the previous sections. First, as mentioned earlier, UndoManager has the curious behavior that once end() is called, it begins to act (for the most part) like a CompoundEdit. This is why we have the transition from the inProgress state to a new super-state (notInProgress, for lack of a better name), the contents of which look just like the CompoundEdit state chart (see Figure 18.4). [3] All others might want to skip ahead to the description of Figure 18.7. [4] This chart assumes all edits are significant. For details on why this is important, see the descriptions of the editToBeUndone() and editToBeRedone()methods later in this section. Figure 18.6. UndoManager state chart This state chart is also complicated because, within the inProgress state, whether we are undoable, redoable, or both (undoableOrRedoable) depends on whether or not all of the edits have been undone or redone. For example, if there are two edits in the UndoManager and we’ve undone one, we are undoableOrRedoable. We can undo the remaining edit, or redo the one we’ve undone. If we choose to undo the remaining edit, we go from undoableOrRedoable to redoable since there are no more edits to undo. However, if there had still been more undoable edits, we’d have stayed in the undoableOrRedoable state. Or, if we’d chosen to redo the undone edit, there would be no more redoable edits, so we’d go from undoableOrRedoable to undoable. - 551 -
We recommend high quality webhost to host and run your jsp application: christian web host services.

Java Swing O Reilly 18.1.4 The UndoableEditEvent Class (Make web site)

Sunday, July 29th, 2007

Java Swing O Reilly 18.1.4 The UndoableEditEvent Class UndoableEditEvent is an event class (it extends java.util.EventObject) defined in the javax.swing.event package. It is used by components that support undo to notify interested listeners (implementing UndoableEditListener) that an UndoableEdit has been performed. A little later in the chapter, we’ll see an example that uses the UndoableEditEvent class and the UndoableEditListener interface. 18.1.4.1 Property UndoableEditEvent defines the property shown in Table 18.5. The edit property contains the UndoableEdit that was generated, causing this event to be fired. Table 18.5, UndoableEditEvent Property Property Data Type get is set bound Default Value edit UndoableEdit See also the java.util.EventObject class. 18.1.4.2 Constructors public UndoableEditEvent(Object source, UndoableEdit edit) Creates a new event with the specified event source and UndoableEdit. 18.1.5 The UndoableEditListener Interface Classes that generate UndoableEditEvents fire these events to UndoableEditListeners. This is a simple interface (like UndoableEditEvent, it can be found in the javax.swing.event package), defining the single method described below. 18.1.5.1 Methods public abstract void undoableEditHappened(UndoableEditEvent e) Called when an undoable operation is performed on an object which supports undo. The event e can be used to obtain the new UndoableEdit. 18.1.6 The UndoManager Class UndoManager is an extension of CompoundEdit that can be used to track a history of edits, allowing them to be undone or redone one at time. Additionally, it implements UndoableEditListener by calling addEdit() each time an Undoable-EditEvent is fired. This allows a single UndoManagerto be added as a listener to many components that support undo, providing a single place where all edits can be tracked. This can then be used to populate an undo menu for the entire application. It may seem a bit strange that UndoManager extends CompoundEdit. We’ll explain why this was done shortly, but first it’s important to understand the important ways in which UndoManager acts differently than CompoundEdit. For starters, when you add an edit to an UndoManager, it is placed in a list of edits available for undo. When you call undo(), only the first (significant) edit is undone. This is different from the behavior of CompoundEdit, in which a call to undo() results in a call to undo() on all of the added edits. - 550 -
We recommend high quality webhost to host and run your jsp application: christian web host services.

Java Swing O Reilly endButton.setEnabled(false); undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } (Web domain)

Sunday, July 29th, 2007

Java Swing O Reilly endButton.setEnabled(false); undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } }); // Lay out the undo/redo/end buttons Box undoRedoEndBox = new Box(BoxLayout.X_AXIS); undoRedoEndBox.add(Box.createGlue()); undoRedoEndBox.add(undoButton); undoRedoEndBox.add(Box.createHorizontalStrut(2)); undoRedoEndBox.add(redoButton); undoRedoEndBox.add(Box.createHorizontalStrut(2)); undoRedoEndBox.add(endButton); undoRedoEndBox.add(Box.createGlue()); // Lay out the main frame Container content = getContentPane(); content.setLayout(new BorderLayout()); content.add(buttonBox, BorderLayout.CENTER); content.add(undoRedoEndBox, BorderLayout.SOUTH); setSize(400, 150); } // When any toggle button is clicked, we check to see if there is an inProgress// CompoundEdit. If there is not, we create a new one (replacing the old// CompoundEdit if there was one). We then create a new UndoableToggleEdit and// add it to the CompoundEdit. Next, the end button is enabled and we enable/ // disable the Undo/Redo buttons by asking the edit what we are allowed to do. public void actionPerformed(ActionEvent ev) { if (edit == null || edit.isInProgress() == false) edit = new CompoundEdit(); JToggleButton tb = (JToggleButton)ev.getSource(); UndoableEdit togEdit = new UndoableToggleEdit(tb); edit.addEdit(togEdit); endButton.setEnabled(true); undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } private CompoundEdit edit; private JButton undoButton; private JButton redoButton; private JButton endButton; // Main program just creates the frame and displays it. public static void main(String[] args) { JFrame f = new UndoableToggleApp2(); f.addWindowListener(new BasicWindowMonitor()); f.setVisible(true); } } - 549 -
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.

Java Swing O Reilly import java.awt.event.*; // A (Web hosting comparison)

Saturday, July 28th, 2007

Java Swing O Reilly import java.awt.event.*; // A sample app showing the use of UndoableToggleEdit and CompoundEditpublic class UndoableToggleApp2 extends JFrame implements ActionListener { // Create the main frame and everything in it. public UndoableToggleApp2() { // Create some toggle buttons (and subclasses) JToggleButton tog = new JToggleButton(”ToggleButton”); JCheckBox cb = new JCheckBox(”CompoundEdit ExampleCheckBox”); JRadioButton radio = new JRadioButton(”RadioButton”); // Add this object as a listener to each toggle button tog.addActionListener(this); cb.addActionListener(this); radio.addActionListener(this); // Lay out the buttons Box buttonBox = new Box(BoxLayout.Y_AXIS); buttonBox.add(tog); buttonBox.add(cb); buttonBox.add(radio); // Create undo and redo buttons (initially disabled) undoButton = new JButton(”Undo”); redoButton = new JButton(”Redo”); endButton = new JButton(”End”); undoButton.setEnabled(false); redoButton.setEnabled(false); endButton.setEnabled(false); // Add a listener to the undo button. It attempts to call undo() on the// current edit, then enables/disables the undo/redo buttons as appropriate. undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.undo(); } catch (CannotUndoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); // Add a redo listener: just like the undo listener, but for redo this time. redoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.redo(); } catch (CannotRedoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); // Add an end listener. This listener will call end() on the CompoundEdit and // update the undo/redo buttons. endButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { edit.end(); - 548 -
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Web site layout - Java Swing O Reilly public void redo() throws

Saturday, July 28th, 2007

Java Swing O Reilly public void redo() throws CannotRedoException Calls super.redo() to make sure redo is allowed. It then calls redo() on each of its children in the order they were added. public void undo() throws CannotUndoException Calls super.undo() to make sure undo is allowed. It then calls undo() on each of its children in the reverse of the order they were added. 18.1.3.5 Other Methods public void end() Indicates that no more edits will be added. After this method is called, the edit is no longer inProgress. protected UndoableEdit lastEdit() Returns the last edit added, or null is no edits have been added yet. public String toString() Returns a textual representation of the edit, including the value of super.toString(), plus the status of inProgress and the number of edits the CompoundEdit contains. 18.1.3.6 Using Compound Edits The following example is a modification of the UndoableToggleApp from the previous section. This version uses CompoundEdit to allow multiple button toggles to be undone at once. Each time one of the toggle buttons is pressed, a new UndoableToggleEdit is created and added to a CompoundEdit. Once you’ve toggled as many buttons as you want, you can press the end button, which causes end() to be called on the CompoundEdit and enables the undo button. Pressing this button causes undo() to be called on the CompoundEdit, which in turn calls undo() on each of the UndoableToggleEdits that were added to it. Pressing one of the toggle buttons again causes the CompoundEdit to be replaced with a new one, to which new edits will be added until the end button is pressed again. Here’s the source code for this example. Much of it is unchanged from the UndoableToggleAppexample, so we’ve highlighted the significant changes. // UndoableToggleApp2.java // import javax.swing.*; import javax.swing.event.*; import javax.swing.undo.*; import java.awt.*; - 547 -
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.

Java Swing O Reilly This constructor creates a (Free web design)

Friday, July 27th, 2007

Java Swing O Reilly This constructor creates a new edit with no children that is initially inProgress. The undo() and redo() methods will throw exceptions until end() is called. 18.1.3.4 UndoableEdit Methods The following methods override the implementations of the UndoableEdit methods defined in AbstractUndoableEdit. public boolean addEdit(UndoableEdit anEdit) This method returns false if the edit is not currently inProgress. Otherwise, the first time the method is called, the input edit is added as the first element of a list of child edits. Subsequent calls are given the opportunity to merge with the last edit in the list. This is done by calling addEdit(anEdit) on the last edit in the list. If this returns false (indicating that the last edit did not absorb the new edit), anEdit.replaceEdit(lastEdit) is called to see if the new edit can replace the last edit. If this returns true (indicating that the new edit can replace the last edit), the last edit is removed from the list and the new edit is added in its place. If not, the last edit is left in the list and the new edit is added to the end of the list. Figure 18.5 shows a sequence diagram for this method. In this example, the last edit does not absorb the new edit, but the new edit does replace the previous last edit. We show the last two operations in italics to indicate that these are not actual method calls on the compound edit. Figure 18.5. CompoundEdit.addEdit() sequence diagram public boolean canRedo() Returns true if the edit is inProgress and super.canRedo() returns true. public boolean canUndo() Returns true if the edit is inProgress and super.canUndo() returns true. public void die() Calls die() on each of its child edits in reverse order. It then calls super.die(). - 546 -
You need excellent and relaible webhost company to host your web applications? Then pay a visit to Inexpensive Web Hosting services.