Notes Window Patch

The re-size behavior of the Notes window was driving me nuts (see attached image), so here’s a fix. Would you mind putting this in Joel?

Cheers!

Ben

Index: NotesWindow.java
===================================================================
--- NotesWindow.java	(revision 5934)
+++ NotesWindow.java	(working copy)
@@ -18,6 +18,7 @@
  */
 package VASSAL.build.module;
 
+import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.WindowAdapter;
@@ -168,6 +169,7 @@
       tab.addTab(Resources.getString("Notes.delayed"), secretNotes.getControls()); //$NON-NLS-1$
 
       JPanel p = new JPanel();
+      p.setMaximumSize(new Dimension( 300,0 ) );
       JButton saveButton = new JButton(Resources.getString(Resources.SAVE));
       p.add(saveButton);
       saveButton.addActionListener(new ActionListener() {

Thus spake “bsmith”:

If the screenshot is illustrating the problem, then I see three things which
are wrong: (1) There is stretch in the dialog below the buttons. (2) The
tab pane doesn’t suck up all extra available height. (3) The buttons are
centered instead of being right-justified.

I think a better fix would be to change this dialog over to use MigLayout.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Ben, if I gave you a quick tutorial on how to use MigLayout, would you be interested in fixing more of our dialogs?

No worries Joel; I just googled MigLayout, it looks like a piece of cake. I’ll start with the Notes window and go from there. No need for personal tutelage, plenty of resources and examples floating around!

Cheers.

Thus spake “bsmith”:

If you’d like an example, have a look at VASSAL.tools.swing.DetailsDialog
and VASSAL.preferences.PrefsDialog.

DetailsDialog is a very complex one because it has to accomodate a
component which is sometimes hidden. I used explicit cell references
for DetailsDialog because in this case that made it easier to see
where things would go.

PrefsDialog has basically what you need for a simple dialog:

dialog.setLayout(new MigLayout(“insets dialog”));
dialog.add(optionsTab, “push, grow, wrap unrelated”);
dialog.add(ok, “tag ok, split”);
dialog.add(cancel, “tag cancel”);

The option given to the layout ctor ensures that we get the right insets
around the dialog contents. The options for the contents (in this case,
a JTabbedPane) ensure that they take up the right amount of space, grow
appropriately as the dialog is resized, and that there’s the right amount
of gap between the row it’s in and the next row. The buttons should be
tagged so that they’re laid out in platform-specific order.

If you have any questions about this, don’t hesitate to ask. The more
dialogs which get converted this way, the better VASSAL looks.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

OK; I made some changes to the Notes dialog Joel, you’ll find them in rev. 5952. Let me know if you find any well written code. haha

I also re-sized a couple of task bar icons which have been bugging me forever (the globe and camera) in rev. 5951

Is there any reason I can’t make the Notes window a JFrame? That way it’ll have min/max buttons etc. In the games I’m playing (CWB), the notes are used often enough that it warrants having the window always open.

Also, is there any reason Charts can’t be a JFrame? Of course, unlike Notes, it’ll need the always-on-top attribute so people can drag pieces to it. (ideally a Pin/Unpin icon would be nice)

Ben

Since we’re talking about mods to Notes dialog, can someone make it so if you click the “x” button, it reminds you with a dialog to SAVE if you’ve made changes?

I just “lost” a bunch of notes while playtesting a module because I exited the [edit] Notes dialog this way.

My request is to either put up a dialog to remind the user, or make the default behavior to save the notes - the other option is to remove the “x”.

Yep, I’m right onto that Fuhr. My modifications look for changes in Notes and pop-up a warning dialog if you close it without saving. Been there and been burned by that myself. :slight_smile:

Thus spake “bsmith”:

Wouldn’t it be better to have changes apply immediately, so that you don’t
have to save them at all?


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Yeah, my head is hurting thinking about it; There would still need to be a way to intuitively undo changes, which may bring us back to square one.

My problem with only having a Close button is it’s not obvious what’s going to happen when you do close the window. With separate Save & Close, Save, Cancel buttons, the user knows exactly what’s happening. They know nothing will be saved until they tell it, they know they may lose their work if they blow away the window; There’s no guess work. You’re right that not having Save is probably better logically (for us), but it’s not necessarily as comfortable for users.

On Sat, Aug 22, 2009 at 8:44 PM, Joel Uckelman <uckelman@nomic.net (uckelman@nomic.net)> wrote:

Post generated using Mail2Forum (mail2forum.com)

This makes sense to me. Notes could be treated like a Property Sheet of a figure, for example.

If “save” is not an explicit step, then is “undo” tricky?

The obvious use-case is a text-editing undo (CTRL-Z) in the notes. This is straightforward to support.

But, and I’m not a VASSAL expert, I am imagining another use-case where a player accomplishes a goal in the game, makes a private note of some treasure he obtained, then all the players as a whole decide for a reason to “undo” the actions of round. Should the notes (including the hidden one) revert as well? Maybe that already is sorted out and works well.

It’s just the Notes window. I started out fixing a bug, but now we’re moving full-steam ahead into enhancements! hehe

It’s not worth any further development, there are other interface issues to sort out first. Just a simple fix is fine. Unless someone else wants to take it on?

:smiley: The “feature creep” (Dilbert reference) popped up here.

I like the simple solution with a JOptionsPane warning about losing changes. The other things can go as bugs/feature-requests/whatever.

Dilbert: “Your requirements call for 4000 features! You realize that no Human would be able to operate a product with this level of complexity?”

Customer: “Good point. I’d better add ‘easy to use’ to the list.”

I had more of a think about this.
Right now there are two buttons, Save and Cancel. What if I change the first button text to read “Save & Close” and keep the Cancel button. When the window is closed for whatever reason, it detects any unsaved changes and pops up a Warning.

Does this sound like a simple solution?

Here’s a screen grab:

Joel could you please merge bsmith/Aug20 if you’re happy with these changes? I’ve also added a Close button to the Chart window. Image attached.

Thus spake “bsmith”:

I’ll try to have a look at these by the weekend. I’m presently doing the
last work on my dissertation before it goes to the committee on Tuesday
or Wednesday; thinking about these changes requires more brain power than
I can spare at the moment.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Hey Joel, I’m responding in the old thread to keep the topic relevant.

In short, it’s bad UI design to force users to use the Close “X” decoration at the top right of windows.

  1. The usual area of a user’s mouse is center, bottom, left. Going to top-right is much further to travel.
  2. The Charts window is used a lot, the normal close button is small and hard to navigate to.
  3. It’s non-standard UI behavior.
  4. It’s possible a user may think the “X” will close all of VASSAL. Or they may think they need to click the chart to close it. In short “How am I supposed to close only this dialog? I can’t be 100% certain.”

The interface should be self-documenting.

Keep firing the questions!