Problem For/Each statement (or the problem is the MouseListener...)
Hi guys,
I'm making a program in java for school.
Now I have this:
for(Stap2TrampolineModel trampoline : lijstTrampolines)
trampoline = new Stap2TrampolineModel(0,215,100,"Poing",lijstKinderen); //model
trampolineView = new Stap2TrampolineView(trampoline); //view
trampolineController = new Stap2TrampolineController(trampoline, trampolineView); //controller
trampolineView.setBounds(trampoline.getXInvoer(),trampoline.getYInvoer(),trampoline.getFormaat()+1,20);
add(trampolineView);
repaint();
and in the mouselistener this:
public void mouseClicked( MouseEvent e )
System.out.println(lijstTrampolines.size());
// Onderzoek of met de rechterknop is geklikt
if( e.isMetaDown() )
// x = e.getX(); (for later needs)
//y = e.getY(); (for later needs)
lijstTrampolines.add(trampoline);
repaint();
The program should display a "trampoline" when I click...but it doesnt. It is added to the list, because I can see that in the console because of the System.out.println
But it doesn't show the display I want. When I delete the for each statement, it does show the "trampoline". So the mouselistener works (it gets added when I click) and the arraylist works (it shows that in the console), but the for each statement doesnt work...
Anyone knows how to solve this problem?
Where is this foreach loop located? In inialisation presumably. But that's over and done with when your mouseListener is called. I'd guess your list is empty when the loop is called, and it does nothing.
Your mouse listener, when it adds a trampoline must also add a trampoline view object. And the repaints don't do you any good, use revalidate() after adding a trampoline view to recalculate the layout.
Similar Messages
-
Set height size for each state enabling browser scrollbar if needed..
I'm working on a flex project, completely new to it. I'm trying to resize my application based on the set height size for each state. I'd like the wrapper to resize in the browser so that the browser's scroll bar appears if needed. hope this makes sense....
My enitial opening page I've set the height to 1000. now when I click on a link to another state from this page, we'll call it 'home' which i have set to 2000
The page opens in its 2000 height but no scroll bar appears to scroll down in the browser...
If anyone's done this or knows how to, I'd really appreciate your input.I've done something similar with a few of my apps, you have to use a little javascript on the html page and the ExternalInterface class in your app. Basically, you need to resize the "browser's" height based on your flash file. So here's quick example:
In your html template page (which you can edit in your flashbuilder project panel ->html-template->indext.template.html)
in your html add the jscript function:
<script type="text/javascript">
function setWindowHeight(heightVal){
document.getElementById('theWindow').style.height=heightVal; // make sure to give the body tag an id of 'theWindow' or whatever
</script>
In your flashbuilder app you need to call the javascript fx, you can use the ExternalInterface class for this:
ExternalInterface.call('setWindowHeight',val+'px');
you need to send the jscript fx the height of your container or whatever you want it resized to.... -
I can use my appleID without any problems for using to download new apps in the app-store or Itunes - Problem: I can´t use my ID at facetime and Imessage -
I´d like to add an EMail account on top to my mobile number to use more this services. My password will not be accepted!!!??? I try it and i try it and i try ist, throughout the same problem. Whats on? The user help desk said, i´ve to reset and use the WLAN key new as well as possible - no way!Contact the App store for Apple ID help. Their support link is on the right of the App store window
LN -
GROUP BY - Is there a way to have some sort of for-each statement?
Hi there,
This discussion is a branch from https://forums.oracle.com/thread/2614679
I data mart I created for a chain of theatres. The fact table contain information about ticket sales, and I have a some dimensions including DimClient and DimTime.
Here is an example of each table:
FactTicketPurchase
TICKETPURCHASEID
CLIENTID
PRODUCTIONID
THEATREID
TIMEID
TROWID
SUMTOTALAMOUNT
60006
2527
66
21
942
40
7
60007
2527
72
21
988
36
6
60008
2527
74
21
1001
40
6
60009
2527
76
21
1015
37
6
60010
2527
79
21
1037
39
6
DDL for FactTicketPurchase
CREATE TABLE FactTicketPurchase(
TicketPurchaseID NUMBER(10) PRIMARY KEY,
ClientID NUMBER(5) CONSTRAINT fk_client REFERENCES DimClient,
-- ProductionID NUMBER(5) CONSTRAINT fk_prod REFERENCES DimProduction,
-- TheatreID NUMBER(5) CONSTRAINT fk_theatre REFERENCES DimTheatre,
TimeID NUMBER(6) CONSTRAINT fk_time REFERENCES DimTime,
-- TRowID NUMBER(5) CONSTRAINT fk_trow REFERENCES DimTRow,
SumTotalAmount NUMBER(22) NOT NULL);
DimClient
CLIENTID
CLIENT#
NAME
TOWN
COUNTY
2503
1
LEE M1
West Bridgford
Nottingham
2504
2
HELEN W2
Hyson Green
Nottingham
2505
3
LEE M3
Lenton Abbey
Nottingham
2506
4
LORA W4
Beeston
Nottingham
2507
5
SCOTT M5
Radford
Nottingham
2508
6
MINA W6
Hyson Green
Nottingham
..cff.
DDL for DimClient
CREATE TABLE DimClient(
ClientID NUMBER(5) PRIMARY KEY,
Name VARCHAR2(30) NOT NULL);
DimTime
TIMEID
FULLDATE
YEAR
SEASON
MONTH
MONTHDAY
WEEK
WEEKDAY
817
02-MAR-10
2010
Spring
3
2
9
3
818
03-MAR-10
2010
Spring
3
3
9
4
819
04-MAR-10
2010
Spring
3
4
9
5
820
05-MAR-10
2010
Spring
3
5
9
6
821
06-MAR-10
2010
Spring
3
6
9
7
822
07-MAR-10
2010
Spring
3
7
9
1
DDL for DimTime
CREATE TABLE DimTime(
TimeID NUMBER(6) PRIMARY KEY,
Year NUMBER(4) NOT NULL,
Season VARCHAR2(20));
I have the following analysis request to perform on this data mart:
Top 5 clients by value of ticket sale for each season
For this requirement I came up with the following query:
SELECT * FROM
(SELECT FacTIC.ClientID, DimCLI.Name, SUM(SumtotalAmount) SumTotalAmount, DimTIM.Season
FROM FactTicketPurchase FacTIC, DimClient DimCLI, DimTime DimTIM
WHERE FacTIC.ClientID = DimCLI.ClientID
AND FacTIC.TimeID = DimTIM.TimeID
AND Season = 'Spring' AND Year = 2010
GROUP BY Season, FacTIC.ClientID, DimCLI.Name
ORDER BY Season ASC, SumTotalAmount DESC)
WHERE rownum <=5;
As you can see, in line 06 of the above query, I am explicitly specifying the season for the query to return.
However what I would like to do is just one query that could autocratically go through the seasons and years available in the time dimension in a fashion similar to a FOR-EACH statement. This way, if we get more years added to the time dimension, we wouldn't have to amend the query.
Is this possible?
Regards,
P.I think I fixed it!
The trick was to look into the r_num value. As soon as I added it to my query I started to see how r_num was being calculated and I realised that I had to add Season to my partition, right after Year.
SELECT Year, Season, TotalAmount, Name
FROM (
SELECT DimCLI.Name
, DimTIM.Year
, DIMTIM.Season
, SUM(FacTIC.SumTotalAmount) TotalAmount
, RANK() OVER (PARTITION BY Year, Season
ORDER BY SUM(FacTIC.SumTotalAmount) DESC
) AS r_num
FROM FactTicketPurchase FacTIC
, DimClient DimCLI
, DimTime DimTIM
WHERE FacTIC.ClientID = DimCLI.ClientID
AND FacTIC.TimeID = DimTIM.TimeID
GROUP BY DimTIM.Year
, DimTIM.Season
, DimCLI.Name
WHERE r_num <= 5 -- Need to amend this line on my data sample to show 2 rows.
ORDER BY Year, Season, TotalAmount DESC;
Looking at my data sample, I got the following:
YEAR
SEASON
TOTALAMOUNT
CLIENTID
2010
Autumn
29
2504
2010
Autumn
26
2503
2010
Spring
25
2503
2010
Spring
14
2506
2010
Summer
26
2506
2010
Summer
26
2504
2010
Winter
28
2503
2010
Winter
26
2506
2011
Autumn
23
2506
2011
Autumn
14
2503
2011
Spring
25
2505
2011
Spring
13
2503
2011
Summer
21
2505
2011
Summer
14
2503
2011
Winter
19
2505
Now, looking at my real data, (considering the top 5 rows, not the top 2), I got:
YEAR
SEASON
TOTALAMOUNT
NAME
2010
Autumn
141
BUSH M225
2010
Autumn
140
DIANA W66
2010
Autumn
136
HANA W232
2010
Autumn
120
DIANA W220
2010
Autumn
120
WILSON M459
2010
Spring
137
DAVID M469
2010
Spring
125
ALEX M125
2010
Spring
124
PETER M269
2010
Spring
115
ZHOU M463
2010
Spring
114
TANIA W304
2010
Summer
138
JANE W404
2010
Summer
105
MINA W8
2010
Summer
97
DAVID M275
2010
Summer
96
CLINTON M483
2010
Summer
93
ANNA W288
2011
Spring
12
LUISE W20
2011
Spring
7
ANNA W432
2011
Spring
7
LEE M409
2011
Spring
7
CHRIS W274
2011
Spring
7
HELEN W136
2011
Spring
7
LILY W114
2011
Spring
7
LUISE W348
2011
Spring
7
LIU M107
2011
Spring
7
VICTORY W194
2011
Spring
7
DIANA W240
2011
Spring
7
HELEN W120
2011
Spring
7
LILY W296
2011
Spring
7
MATTHEW M389
2011
Spring
7
PACO M343
2011
Spring
7
YANG M411
2011
Spring
7
ERIC M101
2011
Spring
7
ALEX M181
2011
Spring
7
SMITH M289
2011
Spring
7
DIANA W360
2011
Spring
7
MATTHEW M63
2011
Spring
7
SALLY W170
2011
Spring
7
JENNY W258
2011
Spring
7 -
Variable Use in For-Each statement
Hello Gurus-
I am having an issue using a variable i've created in a for each statement. Here is the code i'm using
My objective is to create a variable based on the kind of invoice. If the invoice is a proof or reprint, one copy should be printed. If it's a final invoice, I need two copies.
<?xdoxslt:set_variable($_XDOCTX, 'x', 0)?>
for-each<?if: Print_Additional_Header_Text_ID238='PROOF'?><?xdoxslt:set_variable($_XDOCTX, 'x', 1)?><?end if?>
<?if: Print_Additional_Header_Text_ID238='REPRINT'?><?xdoxslt:set_variable($_XDOCTX, 'x', 1)?><?end if?>
<?if:not ( Print_Additional_Header_Text_ID238)?><?xdoxslt:set_variable($_XDOCTX, 'x',2)?><?end if?>
<?xdoxslt:get_variable($_XDOCTX,'x')?><?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
for-each is the loop i'm using to repeat sections of the invoice.
When I run the preview with the last for-each print, i get an error that says "variable not defined:'x' "
But when i remove the last for each the correct variable, 1 or 2, will show in the invoice.
My question is: How can I use the variable 'x' in <?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,$x,1)?>
TIA
Darius
Edited by: 852460 on May 24, 2011 8:31 AM
Edited by: DEK17 on Jul 20, 2011 1:15 PMProbably, this will help
http://winrichman.blogspot.com/search/label/multiple%20copy
Try
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,get_variable($_XDOCTX, 'x'),1)?>
or
<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,xdoxslt:get_variable($_XDOCTX, 'x'),1)?> -
Is there a for-each statement in XSQL like the one in XSL?
I'm trying to do the following:
<?xml version="1.0" ?>
- <!-- <?xml-stylesheet type="text/xsl" href="/dvd/xsl/admin/listuser.xsl"?>
-->
- <database>
- <request>
- <parameters>
- <row>
<checkboxuser>jonathan</checkboxuser>
</row>
- <row>
<checkboxuser>james</checkboxuser>
</row>
- <row>
<checkboxuser>steve</checkboxuser>
</row>
- <row>
<checkboxuser>richard</checkboxuser>
</row>
</parameters>
- <session>
<access>0</access>
<user>malik</user>
<adminfirstname>Malik</adminfirstname>
<adminlastname>Graves-Pryor</adminlastname>
</session>
- <cookies>
<JServSessionIdroot>v647ogyd8n</JServSessionIdroot>
</cookies>
</request>
- <allusers>
- <userinfo>
<first-name>Jonathan</first-name>
<last-name>Terry</last-name>
<email>[email protected]</email>
<user-name>jonathan</user-name>
<password>terry</password>
<access-level>1</access-level>
</userinfo>
</allusers>
</database>Now as you can see, I have 4 instances of <checkboxuser> in my XSQL page. These values are being passed in from checkboxes on the previous page. Is there an XSQL command that will say something like <xsql:for-each select="/database/request/parameters/checkboxuser"> ?
So that it'd look something like this in the original code:
<?xml version="1.0"?>
<!--<?xml-stylesheet type="text/xsl" href="/dvd/xsl/admin/listuser.xsl"?>-->
<database connection="dvddb" xmlns:xsql="urn:oracle-xsql">
<xsql:include-request-params/>
<xsql:query id-attribute="" tag-case="lower" rowset-element="allusers" row-element="userinfo">
SELECT FIRSTNAME AS "FIRST-NAME",
LASTNAME AS "LAST-NAME",
EMAIL AS "EMAIL",
USERNAME AS "USER-NAME",
PASSWORD AS "PASSWORD",
ACCESSLEVEL AS "ACCESS-LEVEL"
FROM LKUP_USER
WHERE USERNAME = '<xsql:for-each select="/database/request/parameters/checkboxuser">'
ORDER BY ACCESSLEVEL
</xsql:query>
</database>Or something like that... The XSL works fine, but not when I want to pull info from the DB.. :)
Malik Graves-PryorOk I got a friend of mine to load everything up for me using 'javac' on he command line with -verbose and he got this back:
C:\oracle\ora81>javac -verbose MultiValuedParam.java
[parsed MultiValuedParam.java in 453 ms]
[loaded C:\Oracle\ora81\lib\oraclexsql.jar(oracle/xml/xsql/XSQLActionHandlerImpl
.class) in 62 ms]
[loaded C:\jdk1.2.2\jre\lib\rt.jar(java/lang/Object.class) in 0 ms]
[loaded C:\Oracle\ora81\lib\oraclexsql.jar(oracle/xml/xsql/XSQLActionHandler.cla
ss) in 0 ms]
[loaded C:\jdk1.2.2\jre\lib\rt.jar(java/sql/SQLException.class) in 15 ms]
[loaded C:\jdk1.2.2\jre\lib\rt.jar(java/lang/Exception.class) in 0 ms]
[loaded C:\jdk1.2.2\jre\lib\rt.jar(java/lang/Throwable.class) in 0 ms]
[loaded C:\jdk1.2.2\jre\lib\rt.jar(java/io/Serializable.class) in 0 ms]
MultiValuedParam.java:10: Package javax.servlet.http not found in import.
import javax.servlet.http.*;
^
MultiValuedParam.java:11: Package org.w3c.dom not found in import.
import org.w3c.dom.*;
^
[checking class MultiValuedParam]
2 errors
[done in 1266 ms]Any clues on what needs to be done to get those last two working? He has the oraclexsql.jar file listed in the system environment variable section of win2k.
Thanks!
Malik Graves-Pryor -
Jdbc driver creates new thread for each statement with a query timeout set
I am profiling a web application that is using the Microsoft JDBC driver, version 1.1 to connect to a sql server 2005 database. Each java.sql.Statement that is created, within the application, gets a query timeout value set on it ( statement.setQueryTimeout(...) ).
I have discovered that the JDBC driver creates a new thread to monitor each Statement and the query timeout value. When the application is under load these threads are getting created faster then they are being destroyed and I am concerned that this will cause a performance problem in production.
One option I have is to remove the query timeout value and the monitor threads will not be created, another is to change JDBC drivers.
I'm curious is there any way to control this behavior so that these threads are not created or are managed more efficiently. Is there a workaround that anyone is aware of? Is this considered a bug?
I have found a similar bug here for the 2000 driver:
http://support.microsoft.com/default.aspx/kb/894552
CheersHi,
Thank you for using the Microsoft SQL Server JDBC driver. You are correct that a new thread is started to monitor the query timeout when a statement is executed. This is a potential performance issue that we may look at addressing in the upcoming v1.2 release. The current behavior is not configurable. The only workaround with the v1.1 driver is to limit your use of query timeouts to only those statements which you reasonably might expect to actually time out.
We do take customer feedback very seriously, so if anyone else is concerned about this particular issue, please chime in and we will be able to give it appropriate weight.
--David Olix [MSFT] -
Tax Accounts - Is it necessary to have separate tax acct. for each state
I am new at this:
Is it necessary to have separate AR/AP/ account for each tax jurisdiction like state county etc?\
Or do the sales tax reports for payments in SAP produce outstanding taxes per jurisdiction.
I would prefer only one Sales Tax account and hope to have SAP produce the taxes due per jurisdiction.
MikeThanks Suda.
So I only need to setup two tax accounts:
1. One tax account for tracking the AR taxes
2. One tax account for tracking the AP taxes
So, to report the taxes to the different tax jurisdictions, SAP should be able to break then down individually for us to pay them.
I am new at this ... so please be patient.
Mike -
How to get Runtime for each statement in abap program
Is there any tool which tells the runtime of each statement in our program..apart from sto5 and se30
Thanks in advance
PRASANNADetermining the calculation time for calculating the tangent of 1. Since the runtime of the statement is less than a microsecond, the runtime of several executions in an inner loop is measured. The exection time for the loop itself is also measured in order to deduct it as an offset. These measurements are executed several times in an outer loop and the mean value is created using division by n0. Through division by ni, the runtime of an individual statement is determined.
DATA: t0 TYPE i,
t1 TYPE i,
t2 TYPE i,
t3 TYPE i,
t4 TYPE i,
tm TYPE f,
no TYPE i VALUE 100,
ni TYPE i VALUE 1000,
res TYPE f.
DO no TIMES.
GET RUN TIME FIELD t1.
DO ni TIMES.
res = TAN( 1 ).
ENDDO.
GET RUN TIME FIELD t2.
GET RUN TIME FIELD t3.
DO ni TIMES.
ENDDO.
GET RUN TIME FIELD t4.
t0 = t0 + ( ( t2 - t1 ) - ( t4 - t3 ) ).
ENDDO.
tm = t0 / ni / no.
Source: SAP Help.
Regards,
Santosh -
When will Apple come up with a fix for Lion OSX v10.7 from freezing after Lion is put to sleep? My 27"Mac freezes after being put to sleep and a hrad boot is required to be able to use the system. I have complained to the local Apples store numerous times. The Genious Bar re-installed the OS and it crashed the very next day and continues to crash two or three times per week. I am amazed that Apples would relase a product, any product before it has been proven to be solid, then again, look at the release of the newest IPhone 4-S.
Neil from Oz wrote:
So do you have a question about how to fix your system?
The question/problem is "My 27"Mac freezes after being put to sleep."
Gabor, I can't help, except to report that I, too, experience very frequent unexplained crashes and freezes in Lion. However (so far) not when I put it to sleep.
There are a lot of reports about freezes. Here's one. Maybe you should join that thread. Someone there is also reporting that "Lion has a bug that freezes the system when waking the system from sleep."
Are you getting freezes/crashes at other times or only when sleeping the computer?
And does it successfully go to sleep?
Does it freeze when you wake it, or at the point where you're putting it to sleep? -
I recently purchased the most recent iPad. I bought the one with the most storage available, wifi only. I'm unable to download any iTunes purchases as they just disappear during the "Processing" portion of the download. I've tried this with the Star Trek Into Darkness soundtrack and the Star Trek (2009) film. All files behave the same way. Restrictions are currently not enabled. I can't figure out why it's doing this. Please help?
I have seen this on my iPad but it is usually with synced music. I know I have songs on the iPad but when I start tapping on the various tabs at the bottom of the app, I get the no Music message. Really quite annoying.
If I quit the Music app from the recents tray and restart the music usually shows up - because it's really ther and should show up! Not to be redundant, but did you try doing a spotlight search! Swipe to the right from your first home screen to get to the search feature. Or do you look in Settings>General>Storage>Usage and check to see if music is accounted for in there?
The only other thing that I can think of to try would be to reboot your router and see if that helps. Unplug it for about 30 seconds. -
Report exection problem for one user - not able to see the data.
Hello Friends ,
Need some help . I have got the one ticket from bussniess side about the report execution .
Unfortunately , I am also not having authorisation of that report due to sensible data.
Problem - User is executing the report but some how he is not ABLE TO see the data for one company code Hierachy .
I executed the same report through RSSMQ via his user id , and I got the below message.
All value were selected . Hierachy Authorisation cannot be used.
A displayed hierachy requier a hierachy authorisation .
But when i checked his authorisation , I am able to see that he should have authorisation to all the hireachy .
could you please let me know , how can I check more ?
Regards,after accessing the report , u go to su53 tcode and check the authorization and u can see what is problem in authorization for the that user and u can send the details to secuity team to rectify the issue ,
-
Hello ?????
hi i had the same problem today when i updated my itunes to latest version. however, i have just found my songs in the 'itunes media' folder. this was accessed through 'my music' then keep clicking through until you find itunes media and all my library songs were in there and i then just added these files to my library and all were restored however, i have lost all my playlists but at least my 700 songs are back. very dissapointed with apple that they have let this happen with their latest update, the previous version was miles better than this one . hope you find them. stevo
-
The index tabs were on some kind of toolbar just below the bookmark toolbar and you could see what was open in multiple tabs. I'm not referring to rolling over the Firefox icon for the Windows 7 thing, that's a pain. These index tabs were in plain sight. No matter what I try in Firefox 8, they won't appear.
the tabs were move to above the navigation bar, where the menu bar was. They hardly look like tabs there, but you may have turned off the tabs bars. View (Alt>V) > Toolbars > Tabs Bar
I think the solutions would really prefer though would be
You can make '''Firefox 8.0''' look like Firefox 3.6.*, see numbered '''items 1-10''' in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 8.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
* http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface
<p>There is a lot more beyond those first 10 steps listed, if you want to make Firefox more functional.</p>
<p><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small></p> -
When I sync my nano, each artist that plaed on the album is got an album created in his name. As for result I got 12 album of 1 songs each . What can I do ?
Take a look at this page.
http://samsoft.org.uk/iTunes/grouping.asp
B-rock
Maybe you are looking for
-
I am hoping for a quick way of converting images (jpeg etc) into a vector. Is this possible? Thanks Eddie
-
ITunes apps up to date but...
My iPhone and iPad say there are updates to be downloaded, but my iTunes (to which the iDevices are linked) reckons there are no update to be had. Why?
-
Hi, please tell me how to test a form and printing a form , Thanks & Regards Ramprasad
-
I made a video in imovie and saved it, now i want to carry on making it from where i left but every time i try to add an image onto the end it just goes tot he wrong part of the movie, how do i just add it onto the end?
-
IMovie'09 can't see iPhoto'09 videos
I have a bunch of videos in my iPhoto'09 library that I took with my digital camera. I wanted to organize and edit the videos with iMovie but almost 1/2 of the videos I have in iPhoto'09 do not appear in iMovie'09. Any suggestions?