[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How to recursively disable Widgets?  XML
Forum Index -> Development
Author Message
fsteppich

Active

Joined: 22/09/2009 14:52:03
Messages: 5
Offline

Your client behaves a bit unexpected if you disable a row or another container widget. The row does not propagate its disable state onto sub widgets like frames or panes in most other common UI frameworks (e.g. Swing, SWT).

Here a snipped that demonstrates that Swing disables its sub widgets:

Code:
     private static void createAndShowGUI() { 
         JFrame frame = new JFrame("HelloWorldSwing"); 
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
 
         frame.setEnabled(false);    // <-------- Propagiert sich!! 
 
         JTextField label = new JTextField("Hello World"); 
         frame.getContentPane().add(label); 
 
         frame.pack(); 
         frame.setVisible(true); 
     } 
 
     public static void main(String[] args) { 
         javax.swing.SwingUtilities.invokeLater(new Runnable() { 
             public void run() { 
                 createAndShowGUI(); 
             } 
         }); 
     }
 


Could you please ensure that I get the same behavior with your framework?

Thanks and regards
-Florian Steppich
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5542
Offline

Hi,

we are just checking the way we will do this, but will provide this type of drilldown-enabled.

FYI: you currently cannot set "enabled" with row/container components - it's available on "end components" only. So there is no unexpceted behaviour ;.)

Regards, Björn

Björn Müller, CaptainCasa GmbH
levy

Power User

Joined: 12/03/2008 16:38:22
Messages: 308
Location: XpertCenter
Offline

Hi,

We are looking forward to this feature, too. It is surely not indispendable but very convenient.

Daniel
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5542
Offline

Hi,

just working on the recursive disabling...

FYI: Swing does not support this for containers (you do it on dialog level, then the whole dialog is blocked, but there's no recursuve popupluation to the components). If you enabled/disabled a container this has no implication to its sumcomponents.

The program to verify is listed below.

The more I think about it, the more unsure I get...: it is in CaptainCasa quite easy to disable all components of a certain area: the ENABLED attribute of the components just needs to bind to one and the same expression.
Adding some logic: "drill down enabled for container", would add something which only relies on the positioing of components and which always would need some extra logic "do not drill down if component already has an own management of enabled/disabled".

The "dialog control" of CaptainCasa is clearly on backend side, and now this would be a frontend side control of enabled-status...

Hmm... - maybe I am too driven by "concepts" in this respect...?

Björn

Code:
 package org.eclnt.client.ztest;
 
 import java.awt.Color;
 import java.awt.event.ActionEvent;
 import java.awt.event.WindowEvent;
 
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
 import javax.swing.JFrame;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 import javax.swing.UIManager;
 
 import org.eclnt.client.controls.util.DefaultActionListener;
 import org.eclnt.client.controls.util.DefaultWindowListener;
 
 
 public class TestContainerEnabled extends javax.swing.JDialog 
 {
     static class MyWindowListener extends DefaultWindowListener
     {
         public void windowClosing(WindowEvent e) { System.exit(1); }
     }
     
 	public static void main(String[] args) 
 	{
 		JFrame frame = new JFrame();
 		TestContainerEnabled inst = new TestContainerEnabled(frame);
 		inst.addWindowListener(new MyWindowListener());
 		inst.setVisible(true);
 	}
 	
 	JTextField m_field1;
 	JTextField m_field2;
 	JButton m_button1;
     JButton m_button2;
 	JPanel m_panel;
 	
 	public TestContainerEnabled(JFrame frame) 
 	{
 		super(frame);
 		initGUI();
 	}
 	
 	private void initGUI() 
 	{
 		try 
 		{
             setLayout(null);
             m_panel = new JPanel();
             m_panel.setLayout(null);
             m_field1 = new JTextField();
             m_field1.setBounds(10,10,200,20);
             m_panel.add(m_field1);
             m_field2 = new JTextField();
             m_field2.setBounds(10,30,200,20);
             m_panel.add(m_field2);
             m_panel.setBackground(Color.red);
             m_panel.setBounds(0,0,300,80);
             add(m_panel);
             m_button1 = new JButton("Toggle Container");
             m_button1.setBounds(10,100,200,20);
             m_button1.addActionListener(new DefaultActionListener() 
             {
                 @Override
                 public void actionPerformed(ActionEvent e)
                 {
                     toggleContainer();
                 }
             });
             add(m_button1);
             m_button2 = new JButton("Toggle Dialog");
             m_button2.setBounds(10,120,200,20);
             m_button2.addActionListener(new DefaultActionListener() 
             {
                 @Override
                 public void actionPerformed(ActionEvent e)
                 {
                     toggleDialog();
                 }
             });
             add(m_button2);
             // ----------------------------------------------------------------
             setSize(1024,768);
 		} 
 		catch (Exception e) 
 		{
 			e.printStackTrace();
 		}
 	}
 	
 	private void toggleContainer()
 	{
 	    m_panel.setEnabled(false);
 	    System.out.println("Continer disabled!");
 	}
 
     private void toggleDialog()
     {
         setEnabled(false);
         System.out.println("Dialog disabled!");
     }
 
 }
 

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team