View unanswered posts | View active topics It is currently Thu Mar 23, 2017 11:03 pm



This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
 Popup menu at a new created activity 
Author Message

Joined: Fri Apr 23, 2010 2:33 pm
Posts: 3
Post Popup menu at a new created activity
Hi,

I want to create a popup menu beside a new created Activity. This Activity was created via dragging the mouse on my DateAreaBean like in bean demo:

Code:
weekDateAreaBean.addDateChangeListener(new DateChangeListener()
{
        @Override
        public void dateRangeChanged(DateChangeEvent evt)
        {
                dayDateAreaDateRangeChanged(evt);
        }
});


The Activity gets created, but I want to choose which kind of activity, I have three different ones, should be created and added to the ActivityDepository. So I decided to create a popup menu beside the Activity. The popup menu shows up, but not beside the activity as expected. First it has also been outside the main frame of my application, but now its half way in and half way out of the frame.

My code how I make the popup menu visible:

Code:
private void dayDateAreaDateRangeChanged(DateChangeEvent evt)
{
        if (evt.getType() == DateChangeEvent.PRESSED)
        {
                if (newCreatedAct == null && evt.getNewRange().getMillisSpanned(false, false) > 45*60*1000)
                {
                        newCreatedAct = new DefaultActivity(evt.getNewRange(), new Long(new Random().nextLong()));
                        newCreatedAct.setSummary("New Event");
                        try
                        {
                                newCreatedAct.setProperty(PropertyKey.getKey("wholeday"), false, Boolean.FALSE);
                                newCreatedAct.setProperty(PropertyKey.getKey("color"), "#D3D3D3", Boolean.TRUE);
                        }
                        catch (PropertyVetoException e)
                        {
                                e.printStackTrace();
                        }
                        ActivityDepository.getInstance(weekDateAreaBean.getActivityDepositoryContext()).addBrokedActivity(newCreatedAct, this, TimeSpanListEvent.ADDED_CREATED);
                }
                else
                {
                        try
                        {
                                newCreatedAct.setBaseDateRange(evt.getNewRange());
                        }
                        catch (Exception ex) {}
                }
        }
        else if (evt.getType() == DateChangeEvent.SELECTED)
        {
                if (newCreatedAct != null)
                {
                        newCreatedAct.getStates().setStates(GenericStates.SELECTED_BIT, true);
                        MutableDateRange test = newCreatedAct.getDateRangeClone();
                        DateRangeI dr = ((DefaultDateArea)evt.getSource()).getSelectedRange();
                        Point p = ((DefaultDateArea)evt.getSource()).getDateGrid().getCell(dr.getEndMillis(), TimeZone.getDefault(), true);
                        Rectangle r = ((DefaultDateArea)evt.getSource()).getGrid().getBoundsOfCell((int)p.getY(), (int)p.getX(), Grid.SIZE_MODE_MIDDLE, false);
                        popupMenu.setLocation(r.x + (int)r.getWidth(), r.y + (int)r.getHeight());
popupMenu.setVisible(true);
                        newCreatedAct = null;
                }
        }
}


I hope that someone can help me to bring my popup menu in the right place. Thanks in advance.


Wed Sep 01, 2010 10:25 am
Profile
Site Admin

Joined: Mon Dec 06, 2004 4:24 pm
Posts: 2485
Location: Sweden
Post Re: Popup menu at a new created activity
Hello,

If you want support please submit a support ticket from our site.

Thanks,


Wed Sep 01, 2010 1:36 pm
Profile WWW

Joined: Fri Apr 23, 2010 2:33 pm
Posts: 3
Post Re: Popup menu at a new created activity
This is the answer I did NOT want to read. Maybe some other board users can help me?

I solved it on my own... so don't mind any longer.


Fri Sep 03, 2010 9:06 am
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 3 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.