Hi Roger,

On Fri, Jul 19, 2013 at 12:02 AM, Roger L. Whitcomb <
roger.whitc...@actian.com> wrote:

> Well, to change the text on a Label, you just have to call
"label.setText(...);".  The "business logic" in your first button just has
to keep track of how many times it has been pushed (i.e., which saying you
want to display next), and set the correct text each time.
>

Okay, got it.

>
> I'm not sure exactly what you're trying to do with the second button....
Do you just want it to make the label show up?  In order to do that, just
do:
>         BoxPane boxPane = ....  // Or could be set using a @BXML
annotation
>         Label label = new Label("initial saying");
>         boxPane.add(label);
>
> The repaint should be taken care of automatically by the skin(s).
>
> Alternatively, you could always have the Label be included in the
BoxPane, but just set it initially invisible ("visible='false'" in the
.bxml file), and then in response to your second button press, call
"label.setVisible(true);".
>
> Am I correct in thinking that's what you want to accomplish?
>
> HTH,
> ~Roger
>

I'm having a bit of trouble myself understanding the repaint() in my
context and whether I need it or not.

*Some background info:* I had attended the ASF ICFOSS Pilot programme in
India [1] conducted by Luciano Resende [2] and as part of the program we're
encouraged to contribute to the Apache community.

I decided to do a project in Lucene[3]. The goal is to port some GUI
features into the Luke application in the sandbox of Lucene [3] using
Pivot, since Luke currently uses Thinlet (an LGPL licensed) API. [5]

I studied some Pivot, did a proposal and used one of your earlier
suggestions in the proposal.

The proposal is here :
https://docs.google.com/document/d/18Vu5YB6C7WLDxnG01BnZXFEKUC3EQYb0Y5_tCJFb_sc/

Coming back to the problem :
I'm seeing repaint() being used in the Vocabulary plugin (see Page 5 of
above doc)

The repaint() method as in src of Luke is :
private void repaint(Object component, Object classname, Object part) {
        Rectangle b = getRectangle(component, "bounds");
        if (classname == "combobox") { // combobox down arrow
            repaint(component, b.x + b.width - block, b.y, block,
b.height); // icon?+
        } else if ((classname == "tabbedpane") || // tab
                (classname == "menubar") || (classname == ":popup")) { //
menuitem
            Rectangle r = getRectangle(part, "bounds");
            repaint(component, b.x + r.x, b.y + r.y, (classname ==
":popup") ? b.width : r.width, r.height);
        }
        /*Some more similar if statements*/
   }

It creates a rectangle object (from java Container class, IIRC) and sets
bounds by calling this function.

   private void repaint(Object component, int x, int y, int width, int
height) {
        while ((component = getParent(component)) != null) {
            Rectangle bounds = getRectangle(component, "bounds");
            if (bounds != null) {
              x += bounds.x;
              y += bounds.y;
            }
            Rectangle view = getRectangle(component, ":view");
            if (view != null) {
                Rectangle port = getRectangle(component, ":port");
                x += -view.x + port.x;
                y += -view.y + port.y; //+ clip :port
            }
        }
        repaint(x, y, width, height);
    }

I'm not seeing the point of creating bounds here. So I'm not sure why we
need to repaint any item in Pivot or if we need to repaint at all. Maybe
you could shed some light on this?

Please go over my proposal and feel free to make any comments for how I
could do the features.

[1] http://community.apache.org/mentoringprogramme-icfoss-pilot.html

[2] http://people.apache.org/~lresende

[3] https://issues.apache.org/jira/browse/LUCENE-2562

[4] https://svn.apache.org/repos/asf/lucene/sandbox/luke

[5] http://luke.googlecode.com/svn/trunk/

-- 
Thanks and regards,
Ajay Bhat

Reply via email to