pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Camilo Casadiego <Camilo.Casadi...@adv.co>
Subject RE: Process meter presentation problem
Date Tue, 11 Sep 2012 13:54:25 GMT
I was checking my code, and I was wondering why I have to remove and re-add the component?
shouldn't it be enougth to just activate or desactivate? is it a bug? if it is how can I work
on it? (I already have the pivot sources)

De: Camilo Casadiego [mailto:Camilo.Casadiego@adv.co]
Enviado el: Thursday, September 06, 2012 7:38 PM
Para: user@pivot.apache.org
Asunto: RE: Process meter presentation problem

I'm really sorry please ignore my last email, It was just a overwork error (just missed something
really simple)

De: Camilo Casadiego [mailto:Camilo.Casadiego@adv.co]
Enviado el: Thursday, September 06, 2012 7:21 PM
Para: user@pivot.apache.org<mailto:user@pivot.apache.org>
Asunto: RE: Process meter presentation problem

Hi there Roger...thank you very much for your answer, actually after I got some success, I
started checking some options and tried the one you are just telling me, and now my code looks
like this:

<StackPane bxml:id="stackPane" styles="{backgroundColor:null, padding:2}">
              <ActivityIndicator bxml:id="activityIndicator"/>
              <TabPane bxml:id="contents"/>
   </StackPane>

The contents are loaded programmatically, but the stackpane stills the parent object, the
code to show or hide the activity is this one...

public void activateWaitAction(){
              System.out.println(baseFrame.getActivityIndicator().isShowing());
              baseFrame.getActivityIndicator().repaint();
              baseFrame.getActivityIndicator().requestFocus();
              baseFrame.getActivityIndicator().setActive(true);
              baseFrame.setEnabled(false);

       }

       public void releaseWaitAction(){
              baseFrame.getActivityIndicator().setActive(false);
              baseFrame.setEnabled(true);
       }

and I keep a reference to the baseframe through a singleton, the first time I call the activateWaitAction,
it works like a charm, but in the subsequent calls, it never shows the indicator again ;(

the print for isShowing sais true all the time, I also checked the index of the activityIndicator
into the stack and is always zero.

The contents is a panel that is build according to which company is selected.

My first attemp was without the repaint and stuff, but no differences any ideas?

De: Roger L. Whitcomb [mailto:Roger.Whitcomb@actian.com]
Enviado el: Thursday, September 06, 2012 7:00 PM
Para: user@pivot.apache.org<mailto:user@pivot.apache.org>
Asunto: RE: Process meter presentation problem

So, we do something similar.  What works is to have a StackPane that is the parent of your
workspace.  Then you can add a new component that has the ActivityIndication as a child of
the StackPane, then remove that child when you're done (revealing the original component).
 Here's what our code looks like:
              <StackPane bxml:id="textAreaStack">
                <ScrollPane horizontalScrollBarPolicy="fill" verticalScrollBarPolicy="fill_to_capacity">
                  <TextArea bxml:id="editArea" styles="{tabWidth:8}"/>
                </ScrollPane>
              </StackPane>


To start the "working" indicator we do this (using a GridPane just so the activity indicator
isn't so big):
                    final ActivityIndicator indicator = new ActivityIndicator();
                    GridPane grid = new GridPane(5);
                    GridPane.Row row1 = new GridPane.Row();
                    GridPane.Row row2 = new GridPane.Row();
                    GridPane.Row row3 = new GridPane.Row();
                    for (int i = 0; i < 5; i++) {
                                row1.add(new GridPane.Filler());
                                if (i == 2)
                                    row2.add(indicator);
                                else
                                    row2.add(new GridPane.Filler());
                                row3.add(new GridPane.Filler());
                    }
                    grid.getRows().add(row1);
                    grid.getRows().add(row2);
                    grid.getRows().add(row3);
                    textAreaStack.add(grid);
                    indicator.setActive(true);

Then when we're done:
                    indicator.setActive(false);
                    textAreaStack.remove(textAreaStack.getLength() - 1, 1);

I think the "trick" is to make sure that the StackPane is the parent of all your workspace
so that the new component that has the activity indicator on it is at the same level (child
of StackPane) as your whole workspace.  So, you could use a GridPane, TablePane, FillPane,
or CardPane as the parent of your workspace.

~Roger Whitcomb

From: Camilo Casadiego [mailto:Camilo.Casadiego@adv.co]
Sent: Thursday, September 06, 2012 4:37 PM
To: user@pivot.apache.org<mailto:user@pivot.apache.org>
Subject: RE: Process meter presentation problem

Hi there finally I managed to make somethng...but still looks horrible....so here is the sequence...

first i select a company to work with

[cid:image001.jpg@01CD8FFB.0B592FD0]

the the ActivityIndicator is shown as expected
[cid:image002.jpg@01CD8FFB.0B592FD0]
the when the process finishes it shows the neede screen
[cid:image003.jpg@01CD8FFB.0B592FD0]
but when i get back to select another company it removes the works space (It does because
I remove it manually)
[cid:image004.jpg@01CD8FFB.0B592FD0][cid:image002.jpg@01CD8FFB.0B592FD0][cid:image005.jpg@01CD8FFB.0B592FD0]
What I really want to do is to see the ActivityIndicator OVER the workspace...Some knows which
component should I use???

If someone has a similar requirement I can send my code for that part of the application ;)

De: Camilo Casadiego
Enviado el: Thursday, September 06, 2012 5:11 PM
Para: user@pivot.apache.org<mailto:user@pivot.apache.org>
Asunto: RE: Process meter presentation problem

I think the info regarding the threads isn't necesary because it works as expected any wai
I have a base class tha implements the TaskListener<String> and another one that extends
Task<String> and the threads run as I want to...

The BaseFrameController.bxml is managed by the class BaseFrameController which definitio si
this one:

public class BaseFrameController extends Frame implements GenericViewController

and

public abstract interface GenericViewController extends Bindable{

So al least I have:

<?xml version="1.0" encoding="UTF-8"?>
<menus:BaseFrameController title="ADV. Salarix Modulo de Operaciones" maximized="true"
    styles="{padding:{top:0, left:4, bottom:4, right:4}, showWindowControls:false}"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns:content="org.apache.pivot.wtk.content"
    xmlns:menus="co.com.adv.salarix.operations.module.controller.base"
    xmlns="org.apache.pivot.wtk">
    <bxml:define>
        <FileBrowserSheet bxml:id="fileBrowserSheet"/>
    </bxml:define>


    <!-- <actionMappings>
        <Window.ActionMapping action="new" keyStroke="CMD-N"/>
    </actionMappings>
  -->
    <menuBar>
        <MenuBar>
            <MenuBar.Item buttonData="Main">
                <Menu>
                    <Menu.Section>
                        <Menu.Item action="choseCompany">
                            <buttonData>
                                <content:MenuItemData text="Seleccionar empresa" keyboardShortcut="CMD-N"/>
                            </buttonData>
                        </Menu.Item>
                                 </Menu.Section>
                </Menu>
            </MenuBar.Item>

           <MenuBar.Item buttonData="Configuracion">
                <Menu>
                    <Menu.Section>
                        <Menu.Item action="config">
                            <buttonData>
                                <content:MenuItemData text="Configurar opciones"/>
                            </buttonData>
                        </Menu.Item>
                    </Menu.Section>
                </Menu>
            </MenuBar.Item>

            <MenuBar.Item buttonData="Herramientas">
                <Menu>
                    <Menu.Section>
                        <Menu.Item action="genDataBase">
                            <buttonData>
                                <content:MenuItemData text="Exportar base de datos local"/>
                            </buttonData>
                        </Menu.Item>
                    </Menu.Section>
                </Menu>
            </MenuBar.Item>

            <MenuBar.Item buttonData="Ayuda">
                <Menu>
                    <Menu.Section>
                        <Menu.Item action="help">
                            <buttonData>
                                <content:MenuItemData text="Ver ayuda"/>
                            </buttonData>
                        </Menu.Item>
                    </Menu.Section>

                    <Menu.Section>
                        <Menu.Item action="about">
                            <buttonData>
                                <content:MenuItemData text="Acerca de"/>
                            </buttonData>
                        </Menu.Item>
                    </Menu.Section>
                </Menu>
            </MenuBar.Item>
        </MenuBar>
    </menuBar>
<Border bxml:id="borderB" styles="{backgroundColor:null, padding:2}">
       <ActivityIndicator bxml:id="activityIndicator"/>
    </Border>
    <Border bxml:id="borderA" styles="{backgroundColor:null, padding:2}">
       <TabPane bxml:id="contents"/>
    </Border>

</menus:BaseFrameController>

On one of my las attemps i changed the las lines to this

<Border styles="{backgroundColor:null, padding:2}">
           <BoxPane orientation="horizontal"  styles="{fill:true}">
                           <ActivityIndicator bxml:id="activityIndicator"/>
                     <TabPane bxml:id="contents"/>
           </BoxPane>
    </Border>
Bu the this is te secuence I got (the seleccition on the first box launches the background
process) ;(

[cid:image006.jpg@01CD8FFB.0B592FD0][cid:image007.jpg@01CD8FFB.0B592FD0][cid:image008.jpg@01CD8FFB.0B592FD0]

As you can see here It shows first the process monitor the the part it hsould show...but all
the marings...and presentation itself is mess up :s

I just want that it only shows the process monitor and then show the workspace

De: Roger L. Whitcomb [mailto:Roger.Whitcomb@actian.com]
Enviado el: Thursday, September 06, 2012 4:37 PM
Para: user@pivot.apache.org<mailto:user@pivot.apache.org>
Asunto: RE: Process meter presentation problem

Which thread are these methods running in?  And what is the parent container of these two
<Border...> components?  Maybe you could supply a little more context from your main
bxml file ....

~Roger Whitcomb

From: Camilo Casadiego [mailto:Camilo.Casadiego@adv.co]
Sent: Thursday, September 06, 2012 1:58 PM
To: user@pivot.apache.org<mailto:user@pivot.apache.org>
Subject: Process meter presentation problem

Hi there, I used the process indicator example showed in the example in http://pivot.apache.org/tutorials/background-tasks.html
and everything is working as expected...but at the end I want to show the process logo and
when the task finishes I want to show the normal working page...What I want to achieve is
something like this..

when the process is running should look like this..
[cid:image009.jpg@01CD8FFB.0B592FD0]
and when the process is finished i want it to show the actual real window
[cid:image010.jpg@01CD8FFB.0B592FD0]

To try to achieve this I have placed components like this

<Border bxml:id="borderB" styles="{backgroundColor:null, padding:2}">
       <ActivityIndicator bxml:id="activityIndicator"/>
    </Border>
    <Border bxml:id="borderA" styles="{backgroundColor:null, padding:2}">
       <TabPane bxml:id="contents"/>
    </Border>

Where this componets are contained into a big Frame class

ublic class BaseFrameController extends Frame implements GenericViewController

In order to show one or another this is what im trying to do

public void activateWaitAction(){
              baseFrame.getBorderA().setVisible(true);
              baseFrame.getContents().setEnabled(false);
              baseFrame.setEnabled(false);
              baseFrame.getActivityIndicator().setActive(true);
       }

       public void releaseWaitAction(){
              baseFrame.getBorderA().setVisible(false);
              baseFrame.getBorderA().setEnabled(false);
              baseFrame.getContents().setEnabled(true);
              baseFrame.setEnabled(true);
              baseFrame.getActivityIndicator().setActive(false);
       }

when the process startarts I call the first method and when finished I call the second one...but
nothing happens...I can show one or another window acording on the order I place the in the
bxml file...I know this should be a simple rendering problem bur rigth now Im really stuck..Any
help'll be really apreciated (The code regarding the task and task monitors works perfect
;) )

Mime
View raw message