Hi Janak,

there is still a bug concerning ULCCardPane and UBA-7135:

- when a card pane is removed it remains selected, i.e.
cards.getSelectedName() returns the name
  of the removed card
- see enclosed snippet 

Please fix that bug for the upcoming release 6.2

Thanks and regrards
Christoph 



>>> "Janak Mulani" <[EMAIL PROTECTED]> 28.03.2007 15:12 >>>
Hi Christoph,

The test snippet for UBA-7135 that you had sent works with 6.1.3 with
the
following workaround. You need to extend ULCCardPane as follows:

public static class ULCMyCardPane extends ULCCardPane {

    public void setSelectedName(String name) {
        super.setSelectedName(name);
        setStateUI("selectedName", name);
    }

  }

Please let me know if this works for you.

Thanks and regards,

Janak

>-----Original Message-----
>From: Christoph Bucher [mailto:[EMAIL PROTECTED] 
>Sent: Wednesday, March 28, 2007 12:43 PM
>To: [EMAIL PROTECTED] 
>Subject: RE: [ULC-developer] UBA-7135 / ulc 6.1.3
>
>
>Hi Janak,
>
>many thanks for your feedback. Unfortunately I can't make may code
run
>on ulc 6.1.3 anymore,
>(card pane switching does no more work in either way) I still need
more
>time to investigate whats the problem
>
>Kind regards
>Christoph
>
>>>> "Janak Mulani" <[EMAIL PROTECTED]> 09.03.2007 14:44 >>>
>Hi Cristophe,
>
>You are right. Thanks for pointing out the error.
>
>Please see the comment at:
https://www.canoo.com/jira/browse/UBA-7135.
>
>We will fix it in ULC 6.2.
>
>Thanks and regards,
>
>Janak
>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] Behalf Of Christoph
>>Bucher
>>Sent: Friday, March 02, 2007 9:02 PM
>>To: [EMAIL PROTECTED] 
>>Subject: [ULC-developer] UBA-7135 / ulc 6.1.3
>>
>>
>>Hi,
>>
>>According to the release notes UBA-7135 should be fixed in ulc
6.1.3.
>I
>>tested the ULCCardPaneSnippet.java
>>(cf. file attached to UBA-7135), but it seems to me that the issues
>>aren't solved yet. Am I overlooking
>>something ?
>>
>>Thanks for your support,
>>-- Christoph
>>_______________________________________________
>>ULC-developer mailing list
>>[email protected] 
>>http://lists.canoo.com/mailman/listinfo/ulc-developer 
>_______________________________________________
>ULC-developer mailing list
>[email protected] 
>http://lists.canoo.com/mailman/listinfo/ulc-developer 

_______________________________________________
ULC-developer mailing list
[email protected] 
http://lists.canoo.com/mailman/listinfo/ulc-developer
import com.ulcjava.base.application.*;
import com.ulcjava.base.application.util.*;
import com.ulcjava.base.application.event.*;
import com.ulcjava.base.development.DevelopmentRunner;

import javax.swing.UIManager;

/**
 * ULCCardPane: UBA-7135, ULC 6.2m4, java 1.5
 *
 * The following bug can be reproduced:
 * - when a card pane is removed it remains selected i.e. 
cards.getSelectedName() returns the name of the removed card
 * - select the button 'Add card with name = 1', the first time it works as 
expected
 * - then press button 'Backward'
 * - then press again 'Add card with name = 1', now it can be seen that the 
removed card '1' is still selected
 *
 * How to fix the bug:
 * - before removing a card store the selectedCard name in a variable, say 
'selectedCard'
 * - remove the card
 * - reselect the card with name 'selectedCard', but only if it still exists !
 *
 * Thanks for fixing the bug for the upcoming release ULC 6.2.
 * --Christoph  , 08.08.2007
 */
public class ULCCardPaneSnippet2 extends AbstractApplication {

  ULCFrame frame = new ULCFrame("ULCCardPane - replace active (selected) card");
  ULCBorderLayoutPane rootBox = new ULCBorderLayoutPane() ;

  ULCToolBar  toolbar  = new ULCToolBar();
  ULCBoxPane  card0    = new ULCBoxPane(true);
  ULCLabel    card1    = new ULCLabel("card with name = 1");

  ULCCardPane cards    = new ULCCardPane();

  ULCButton  button1   = new ULCButton("Backward");
  ULCButton  button2   = new ULCButton("Forward");
  ULCButton  button3   = new ULCButton("Add card with name = 1");

  int ncards=2; // number of cards

  public void start() {
    frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE);
    frame.setSize(new Dimension(900, 200));
    frame.add(rootBox);
    rootBox.add(toolbar, ULCBorderLayoutPane.NORTH);
    rootBox.add(cards, ULCBorderLayoutPane.CENTER);

    toolbar.setFloatable(false);
    toolbar.add(button1);
    toolbar.add(button2);

    card0.add(ULCBoxPane.BOX_EXPAND_CENTER, new ULCLabel("card with name = 0"));
    card0.add(ULCBoxPane.BOX_EXPAND_CENTER, button3);

    cards.addCard(String.valueOf(0), card0);

    button1.addActionListener(new IActionListener() {
      public void actionPerformed(ActionEvent e) {
        int i = Integer.parseInt(cards.getSelectedName()); i--;
        if (i<0) i=ncards-1;
        cards.setSelectedName(String.valueOf(i));
      }
    });

    button2.addActionListener(new IActionListener() {
      public void actionPerformed(ActionEvent e) {
        int i = Integer.parseInt(cards.getSelectedName()); i++;
        if (i>=ncards) i=0;
        cards.setSelectedName(String.valueOf(i));
      }
    });

    button3.addActionListener(new IActionListener() {
      public void actionPerformed(ActionEvent e) {
        if (cards.getNames().length > 1) {
          cards.removeCard(String.valueOf(1));
          System.out.print("Selected card after removal of card 1 = " + 
cards.getSelectedName());
          try {
            System.out.println(" - selected card = 
"+cards.getComponentAt(cards.getSelectedName()));
          }
          catch (Exception ex) {
            System.out.println(" - exception - selected card does not exist 
!!");
          }
        }
        cards.addCard( String.valueOf(1) , card1 );
        cards.setSelectedName(String.valueOf(1));
        System.out.println("Tried to select card with name = 
"+cards.getSelectedName());
      }
    });

    // 
------------------------------------------------------------------------------------------------------
    frame.setVisible(true);
  }

  public static final String METAL   = 
"javax.swing.plaf.metal.MetalLookAndFeel";
  public static final String MOTIF   = 
"com.sun.java.swing.plaf.motif.MotifLookAndFeel";
  public static final String WINDOWS = 
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel";

  public static void main(String[] args) {
    try {
      UIManager.setLookAndFeel(WINDOWS);
    }
    catch (Exception ex) {}
    DevelopmentRunner.setApplicationClass(ULCCardPaneSnippet2.class);
    DevelopmentRunner.main(args);
  }

}

Reply via email to