Skip to main content

Additional Items in ColumnControlPopup

11 replies [Last post]
straps
Offline
Joined: 2004-02-08

Hi all, what is the simpliest method to add additional items on the existing implementation of ColumnControlPopup?

Isn't it a good idea to add the Print and Find functions to the ColumnControlPopup menù by default?

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Kleopatra

[att1.html]

osbald
Offline
Joined: 2003-06-13

>>
>> Obviously not 'as many actions as you like' I've got a table with 50+ columns and my
>> dropdown is starting to disappear off the end of my screen
>>

> show them a stop sign . You know that the incubator has a scrollable popup,
> don't you? (which has some issues plus might not be a pleasant user experience,
> personally I don't like so many items, but that's just me).

I've heard tell of such a beast, but like you say it only solves the symptom of the list dropping off the screen. Have given it some thought but the row object does have that many attributes - although depending on its type not all those attributes will have values.. hence my uncertainty. Have thought about offering a workspace/perspective choice to preconfigure common choices, having a summary column that details some of the optional parts of the object, introducing a column choice dialog (rather than menuitems) even decomposing the row object and having several tables.. as yet I'm still working on my own and haven't met a real user yet - I'm hoping to have some help and feedback to help me make the final choice.

> LOL! Only got it after looking into the forum directly, though, the mail didn't transport it

Forum wasnt keen on me making that bold, everybodies a critic Was having general problems with java.net yesterday, getting feeds garbled - like bindings users list being republished with old user list headings, but old cvs changes as their content.. made a royal mess of my local store.. but I still hate mailing lists more - the java.net ones always seem painfully slow to me..

- Richard

Kleopatra

jdnc-interest@javadesktop.org schrieb:
> Hi all, what is the simpliest method to add additional items on the existing implementation of ColumnControlPopup?
>
> Isn't it a good idea to add the Print and Find functions to the ColumnControlPopup menù by default?
>

you can as many actions as you like - the columnControl adds all whose
actionKey starts with

[code]
ColumnControlButton.OLUMN_CONTROL_MARKER
[/code]

have a look how JXTable does register the default entries.

Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

osbald
Offline
Joined: 2003-06-13

> you can as many actions as you like

Obviously not 'as many actions as you like' I've got a table with 50+ columns and my dropdown is starting to disappear off the end of my screen

[pre]

ColumnControlButton.GOLUMN_CONTROL_MARKER ?

'OLUMN 'OLUMN 'OLUMN

[/pre]

;)

- Richard

sbusch
Offline
Joined: 2004-10-05

It looks like "print" is setup in JXTable (little did I know ...), but there doesn't seem like there any way to get to it - there's no keystroke nor is there a ColumnControlPopup selection. Am I missing something?

And one extra note about offering find/print menu selections to to the popup - if column control is not visible then you lose access to the find/print. My point is that in many instances I hide column control (I only have a handful of columns, so why bother), so find/print don't really belong in column control.

Steve

kschaefe
Offline
Joined: 2006-06-08

The action is included in the ActionMap, but there is no binding in the InputMap. Simply get the InputMap for the JXTable and add a binding for the action. This allows SwingX to provide the necessary printing code and the developer to supply the correct binding. (Although, it *almost* seems appropriate to default that as Crtl+P.)

Karl

sbusch
Offline
Joined: 2004-10-05

Actually, I use ctrl+P for doing a print screen of the whole dialog (but, I digress). Using ctrl+P (or ctrl+F) for a table kinda falls apart if you happen to have two tables up at the same time. It's problematic explaining to users that they have to make sure the table is in focus first. Is there really any downside to having Find and Print to be part of the popup?

Kleopatra

jdnc-interest@javadesktop.org schrieb:
> Actually, I use ctrl+P for doing a print screen of the whole dialog (but, I digress). Using ctrl+P (or ctrl+F) for a table kinda falls apart if you happen to have two tables up at the same time. It's problematic explaining to users that they have to make sure the table is in focus first. Is there really any downside to having Find and Print to be part of the popup?
>
you mean another one (except that they don't belong there as you
mentioned in the earlier post)

Actually, the content of the columnControl was never ... ehem ...
reviewed by the ergonomics crowd. At first, I simply wanted to show
what's possible and then it stuck ;-). Developers are free to add or
remove actions. To make an existing action available in the columnControl:

[code]
Action action = table.getActionMap("print");
if (action != null) {
table.getActionMap().put(
ColumnControlButton.COLUMN_CONTROL_ MARKER + "print", action);
}
[/code]

HTH
Jeanette

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

jhi_ol
Offline
Joined: 2012-10-16

Kleopatra wrote:
jdnc-interest@javadesktop.org schrieb:
To make an existing action available in the columnControl:

<br />
Action action = table.getActionMap("print");<br />
if (action != null) {<br />
  table.getActionMap().put(<br />
     ColumnControlButton.COLUMN_CONTROL_ MARKER + "print",  action);<br />
}<br />

I've been looking for a solution to this problem.
I have now found a similar code in 2-3 threads like this cutout.
Like: SWINGX-968

Unfortunately this does not work for me!
I've tried it this way:

table.getActionMap().put(ColumnControlButton.COLUMN_CONTROL_MARKER + "Test", new AbstractAction("TEST") {

@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Test");

}
});

The Action-Object is set correct. (System.out.println)

In my popup no entries appear.
What I'm doing wrong?

*EDIT:

I found the bug. When I set a ColumnControl to the JXTable, all my added Actions in the ActionMap are ignored! (See TestingGUIApp)
First of all i think my own ColumnControl Component have a bug, but i tested also with the SwingX columnControlButton! What's going wrong here?

The testing code:

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import org.jdesktop.swingx.JXTable;

/**
* @author jhi_ol
* @date 17.10.2012
*
*       for testing Swing GUI objects/elements in real world ;)<br>
*/

public final class TestingSwingApplication {

/**
* Build GUI.
*/
public static void main(String... aArgs) {
TestingSwingApplication app = new TestingSwingApplication();
app.buildGUI();
}


private void buildGUI() {
JFrame frame = new JFrame("Testing Swing GUI");
buildGUIContent(frame);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}

private void buildGUIContent(JFrame aFrame) {

JXTable table = new JXTable(5, 5);
table.setColumnControlVisible(true);
table.setColumnControl(new org.jdesktop.swingx.table.ColumnControlButton(table));   //comment this line out and the Action is shown in the ColumnControl PopUp

table.getActionMap().put(org.jdesktop.swingx.table.ColumnControlButton.COLUMN_CONTROL_MARKER + "Test", new AbstractAction("TEST") {

@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Test1");

}
});

aFrame.getContentPane().add(new JScrollPane(table));
}

}
jhi_ol
Offline
Joined: 2012-10-16

Okey. Here is my solution for this problem:

All the actions must added to the ActionMap before the setColumnControl method is called!

kleopatra
Offline
Joined: 2003-06-11

good catch! Should document somewhere ..

As an afterthought: the popup is re-populated when columns are added/removed or a new ActionGrouper is set. That happens in populatePopup which is protected: so if you have a custom controlButton you might consider to expose to call that after you added action to the table's map. There is no way to doing so automatically, as there is no notification when the map is changed.

hmmm ... maybe add api to refresh the popup? If anybody thinks so, please file a feature request in the issuetracker, could be done without much pain (optimistic me thinks :-)

Thanks
Jeanette

straps
Offline
Joined: 2004-02-08

I was looking for this...thanks