Enhacement of FM -- Problem
Hi,
I am enhancing standard FM, as it is having implicit enhancements one at the top and one at the end, the problem here is i have one table in the FM which i need to fill which is later used by FM to INsert entries into standard table, that table is getting refreshed at the begin of FM, so even if i insert entries at the initial enhancement it is of no use nor at the last enhancement
enhancement 1
fill itab here --- no use
refresh itab
FM
enhancement 2
fill itab here --- no use
i have no option of changing in the middle i mean in the FM itself, is there any way even though i fill the entries at top enhancement and still can retain values what i filled? May look big question.
please give me solution
Try to find explicit enhancement.
Also , you can revert the update to the database table in enhancement 2 and can code your own logic with desired entries and update the database table as per your requirement.
Hope this helps you.
Edited by: Harsh Bhalla on Mar 9, 2010 10:05 AM
Similar Messages
-
Problem In Enhacing field EKPO - BRTWR and EKPO-MWSKZ
Hello SAP Experts ,
I want to enhace two fields ekpo-brtwr and ekpo-mwskz for Purchasing data source 2lis_02_itm .BUt Datasource dosnt contain field value not even as hidden filed.
I tried to direct entry by structure maintain for that two fields but its not allowing me ...
give any solution to Enhace these fields .Hi
It will not allow to enter this fields directly
Do following steps
double click the data source in Rsa6
double click the extractstructure name
this will open Extractstructure in Data Dictionary
Click on append structure button
Give a name to append structure
This will create a new struture
Enter the New fields u want to Append
like ZZBRTWR give reference of ZZWAERS in currency/quantity fields tab
ZZWAERS
ZZMWSKZ
Now you need to Code in exit to populate fields using CMOD or BADI
Hope this helps.. ask if you have further query
Sonal... -
Extractor enhacement problem - 0WBS_ELEMT_ATTR
Datasource 0WBS_ELEMT_ATTR
First 100 records from extraction test.
We enhanced the extractor (via RSU5_SAPI_BADI) to include the following fields:
Field Name Field Type
ZZTERRIT01 Calculated Field
ZZTERRIT02 Calculated Field
ZZTERRIT03 Calculated Field
ZZTERRIT04 Calculated Field
ZZTERRIT05 Calculated Field
ZZTERRIT06 Calculated Field
ZZTERRIT7 Calculated Field
Z_C_EXEC Table Field
Z_ECONOMIC Table Field
Z_FUNCIONAL Table Field
ZTERRITORIS Table Field
Our BAdi implementation name is ZZRSU5_SAPI_BADI.
As you can see in the images below all fields are populated in test mode (transaction RSA6).
The problem arises when we execute the Datasource in BI.
Weu2019re not getting calculated fields populated in BI.
I have a detailed document explaining the enhancement we made, but can't attach it here.
Thanks!Hi Oscar
Did you replicate the datasource....the fields appear there?
The fields appear. Datasource extraction in test mode brings all fields but the ZZT* came up empty.
Did you load to PSA in BI....are the fields there?...
Fields are in PSA.
Did you change the transfer rules in order to add the new fields in the structure??
Datasource as been migrated to new concept. No transfer rules apply.
I don't know what else to check -
Enhacer ant task license key problem
Hi,
I'am developing web applicaiton with workshop studio 3.0 and I use It's
ejb3(kodo 4 EA4) mapping generator.I try to use ant task for
enhancement,here is my build.xml file's kodoc task
<target name="enhance">
<echo>
================================================================
Running the enhancer
================================================================
</echo>
<taskdef name="kodoc" classname="kodo.ant.PCEnhancerTask">
<classpath refid="cp"/>
</taskdef>
<kodoc>
<fileset dir="${basedir}">
<include name="**/com/demo/model/*.java" />
</fileset>
<classpath>
<pathelement location="${basedir}/classes"/>
<pathelement location="${basedir}/src"/>
<pathelement path="${java.class.path}"/>
</classpath>
</kodoc>
</target>
ant task starts enhancer,finds my domain classes but gives the following
expcetion during enhancement of first class
[echo] ================================================================
[echo] Running the enhancer
[echo]
================================================================
[kodoc] 611 INFO [main] kodo.Tool - Enhancer running on type "class
com.demo.model.MyClass".
[kodoc] com.solarmetric.license.LicenseException: No product license
key was found. Please ensure that your license key is specified in your
configuration file (or in the "General" tab of your IDE''s configuration
dialog), that the key has not expired, and that it is the correct key for
the version of the product that you are running...
build.xml is in WEB_INF directory and my source are in src directory
compiled classes are in classes directory,I place persistence.xml file in
the directiory WEB-INF/META-INF/
my license key is in persistence.xml file and it will expire 3-4 weeks
later.Here my persistencex.xml file
<persistence>
<persistence-unit name="kodo">
<provider>kodo.persistence.PersistenceProviderImpl</provider>
<class>com.demo.model.MyClass</class>
<properties>
<property name="kodo.LicenseKey" value="xxxxxx"/>
<property name="kodo.ConnectionDriverName"
value="org.apache.derby.jdbc.ClientDriver"/>
<property name="kodo.ConnectionURL"
value="jdbc:derby://localhost:1527/xxxDB"/>
<property name="kodo.ConnectionUserName" value="xxx"/>
<property name="kodo.ConnectionPassword" value="xxxx"/>
<property name="kodo.jdbc.Schema" value="xxxx"/>
<property name="kodo.Log" value="DefaultLevel=WARN, Tool=INFO"/>
</properties>
</persistence-unit>
</persistence>
where should I pu my license key or persistence.xml file.
Not:I was using previsous release of kodo (EA3),for ejb3 I set access
property of Entity annotaion to access=AccessType.FIELD so I did not need
to enhance and It does works but this version we do not have this
option,Am I right.Do we always have to enhance our ejb3 entities in EA4
releasemurat wrote:
Hi,
I'am developing web applicaiton with workshop studio 3.0 and I use It's
ejb3(kodo 4 EA4) mapping generator.I try to use ant task for
enhancement,here is my build.xml file's kodoc task
<target name="enhance">
<echo>
================================================================
Running the enhancer
================================================================
</echo>
<taskdef name="kodoc" classname="kodo.ant.PCEnhancerTask">
<classpath refid="cp"/>
</taskdef>
<kodoc>
<fileset dir="$">
<include name="**/com/demo/model/*.java" />
</fileset>
<classpath>
<pathelement location="$/classes"/>
<pathelement location="$/src"/>
<pathelement path="$"/>
</classpath>
</kodoc>
</target>
ant task starts enhancer,finds my domain classes but gives the following
expcetion during enhancement of first class
[echo] ================================================================
[echo] Running the enhancer
[echo]
================================================================
[kodoc] 611 INFO [main] kodo.Tool - Enhancer running on type "class
com.demo.model.MyClass".
[kodoc] com.solarmetric.license.LicenseException: No product license
key was found. Please ensure that your license key is specified in your
configuration file (or in the "General" tab of your IDE''s configuration
dialog), that the key has not expired, and that it is the correct key for
the version of the product that you are running...
build.xml is in WEB_INF directory and my source are in src directory
compiled classes are in classes directory,I place persistence.xml file in
the directiory WEB-INF/META-INF/
my license key is in persistence.xml file and it will expire 3-4 weeks
later.Here my persistencex.xml file
<persistence>
<persistence-unit name="kodo">
<provider>kodo.persistence.PersistenceProviderImpl</provider>
<class>com.demo.model.MyClass</class>
<properties>
<property name="kodo.LicenseKey" value="xxxxxx"/>
<property name="kodo.ConnectionDriverName"
value="org.apache.derby.jdbc.ClientDriver"/>
<property name="kodo.ConnectionURL"
value="jdbc:derby://localhost:1527/xxxDB"/>
<property name="kodo.ConnectionUserName" value="xxx"/>
<property name="kodo.ConnectionPassword" value="xxxx"/>
<property name="kodo.jdbc.Schema" value="xxxx"/>
<property name="kodo.Log" value="DefaultLevel=WARN, Tool=INFO"/>
</properties>
</persistence-unit>
</persistence>
where should I pu my license key or persistence.xml file.
Not:I was using previsous release of kodo (EA3),for ejb3 I set access
property of Entity annotaion to access=AccessType.FIELD so I did not need
to enhance and It does works but this version we do not have this
option,Am I right.Do we always have to enhance our ejb3 entities in EA4
release -
How to find an enhacement point in a standard FM.
Hi All,
I have to find an enhacement point in a standard FM.Please guide me on how to do this?
Also what all things should i take care of while adding code at the enhancement spot as I
know sometimes a dump comes in such scenarios.
Please advice,
Saket.Hi Saket,
Do you want to find an Enhancement Point or an Implicit Enhancement Point?
If you want to find an Enhancement Point, then the string ENHANCEMENT-POINT. Enhacement Points are marked as ENHANCEMENT-POINT <enhancement Point> SPOTS <enhancement spots> STATIC. or ENHANCEMENT-POINT <enhancement Point> SPOTS <enhancement spots>.
If you want to find an Implicit Enhancement Point, then press SHIFT + F4 and then Edit -> Enhancement Operations -> Show Implicit Enhancement Options. This will show you the Implicit Enhancement Points in yellow color (if you are using the Old Front-End-Editor).
You might get dumps for a number of reasons. In that case go to the dump analysis and sort the problem. Moreover you might even get Short Dump while creating implementations of Implicit Enhancement. This generally occurs because of certain missing patches/upadtes. In such a situation ask the BASIS or admin team to upload all the necessary patches or updates.
Hope this helps.
Regards,
Abhisek. -
Problems with translated text in captivate 7
I want to create a multilingual e-learning version. I can translate all texts. Unfortunately I can not change the selected text in the pop up window. I have no idea how I can change this text. Can someone give me a tip.
Hellou guys, Somethink similar: After installing 7.0.1 patch the project created 7.0, lose translated text inside Succes/Failure etc. captions and show default English texts, for example in quizes captions. Hmmm... In preferences dialog default labels are still translated, but after publishing project, the captions are English. So I used trick - Find/Replace dialog - and change manually all text captions with translated version. After publishing works fine. When I create new project directly in 7.0.1, there are no problem Perhapse, small bug. Can live with it because the new enhacements inside 7.0.1 is much important.:)
best regards
Yarik -
BTCUSTOMERH fields in Problem (SM 7.1 SP10)
Hello experts!
I have SM 7.1 SP10. I created Z fields in BTCUSTOMERH of Incident using AET.
I want to add created BTCUSTOMERH fields in Problem document, but this BTCUSTOMERH fields are not present in Context:
How to add BTCUSTOMERH to AIC_PROBLEM_H?Hello Dmitry,
Go to BSP_WD_CMPWB transaction, on field Component write "AIC_IM_REQ_H" and select display.
Once the next screen is open, on the left side you can see a tree with all reference object related to that component, search and open "Views" -> "AIC_IM_REQ_H/IncidentOV" .
on the right side you can see 3 tabs, "View Structure" / "RT Rep Details of View" / "Configuration"
On "Configuration" Tab you can see the current configuration for your view, using an Enhacement I think that you can edit that view as your need.
I never edit that view so i don't kno how to delete "title 2" block as you need, but maybe if you ask some developer he can do it for you using some code Enhacement .
Regards,
Luis -
Hi people,
I implemented a enhacement on MIRO and tested on DEV, it was ok, but when I test on QA, the enhacement is on SE38, but its like it does'nt exist on debug...
someone know what can it be?HI,
"First Check whether it is transported to QA
"then go to SE20 and display. then find it in Where used List. then go there and activate the Main program where it is being used.
"also check whether it is activated or not
"This is a common problem with Enhancements
Cheerz
Ram -
Hi all.
We are enhacing the tcode vfx3 report adding new fields. At this point we have added 2 fields (netwr and mwsbk) by the use of a user exit. Everything is ok.
Now we want to add a new field(mrnkz 'char 1'), the steps we follow are the same as we followed before, but now it is not working properly.
CODE:
"loop sobre la tabla
LOOP AT c_vmcfa.
READ TABLE it_struct INTO lwa_struct WITH KEY vbeln = c_vmcfa-vbeln.
c_vmcfa-netwr = lwa_struct-netwr.
c_vmcfa-mwsbk = lwa_struct-mwsbk.
c_vmcfa-mrnkz = lwa_struct-mrnkz.
MODIFY TABLE c_vmcfa." TRANSPORTING netwr mwsbk mrnkz.
CLEAR c_vmcfa.
ENDLOOP.
We are having problems when the value of lwa_struct-mrnkz contains a 'X'. In this case, the modify throws an exception. When the value of lwa_struct-mrnkz isn't a 'X', the line is modified properly. The exception thrown is:
"Object SDBLBDDL of class RE and language EN does not exist. "
How can i solve this problem? Is this a documentation problem?.Hi
use index for modifyin the table.
like;
LOOP AT c_vmcfa.
data; lv_index type sy-tabix.
lv_index = sy-tabix.
READ TABLE it_struct INTO lwa_struct WITH KEY vbeln = c_vmcfa-vbeln.
c_vmcfa-netwr = lwa_struct-netwr.
c_vmcfa-mwsbk = lwa_struct-mwsbk.
c_vmcfa-mrnkz = lwa_struct-mrnkz.
MODIFY TABLE c_vmcfa index lv_index." TRANSPORTING netwr mwsbk mrnkz.
clear lv_index.
ENDLOOP.
Thanks
Lalit -
Problem when saving an order after using userexit_save_document
Hi
We are doing an enhacement in sales order capture, and we have next problem, after saving the order, the change of adding the new order is not saved in CDHDR table with the I (of Insert), that's only one problem, but I have another worst , after I use exit save_document, I'm saving data in a Z table, and debugging the program, when I finish the exit save_document the Z table is Ok saved, with the correct data saved, but when I pulse F8 to make the order being complete saved, something is happening because the Z table changes its values as if I run the VA02 , but I'm still in VA01 finishing the saving of the new order, It's very weird, and I don't know if somebody has experimented something like this, please let me know, because its very Urgent!!
Thanks
Regards
SorayaHi,
To have the changed values being reflected in CDHDR, for the fields you wanted to track the changes- In Ztable, AT Dataelement level, In FURTHER CHARACTIRSTICS tab check the box CHANGES DOCUMENT, if you check this checkbox then this becomes the pre requisite for the CDHDR entires. Then in SCDO trnsaction try to cretae a Change document object for this table.
I think the table is not locked for entires. For this table provide the authorization checks then we can restirct others to enter the value into the table.
Try to use Authorization objects or LOCK related Function modules like ENQUEUE and DEQUEQUE.
Reward if helpful.
Best Wishes,
Chandralekha -
Website problems :( Please help!
Hi all
Just joined on here, hoping you guys can give me some help with my website.
I know my way around flash, I used it in my last job to create assets for NATO CBT, but have little experience with actionscript and creating flash content for web.
Thought I'd have a go creating my new website in flash rather than html, how hard could it be right?!
After putting together the pages in FL and publishing them, I used dreamweaver to embed the swf's into html pages, at which point DW created the necessary scripts for the swfobject thingy. I found a host and uploaded em.
All the pages work when viewing them locally from my HD, but they wont play from remote server in IE, Chrome or safari. For some reason they do work in Firefox though...
It's quite strange, because if you right click over where the flash content should be and hit play in the sub menu... it works! So possibly an 'autoplay' problem???
Any help would be much appreciated
site: http://www.beniddon.co.uk/
BenGetting very mixed results when viewing the page. In IE with Flash 10.3.181.34 yet in IE with Flash 10.0.32.18 it does display but because the .swf is larger than the screen and the "flashcontent" <div> does not have overflow:auto, no scroll bars... so I can't scroll down and access the menu.
Page loads in FF & Chrome for me but not Safari.
While I'm a great advocate of swfobject it is not at all necessary to use it to display Flash content. Using it as you are simply provides Flash detection and a wimpy little message the viewer would see if they don't have Flash already installed.... which most people will ignore by the why... if they don't already have it, and it's their first visit to your site.... they ain't gonna install just because you tell them to.
So unless you plan to use swfobject to deliver alternate content, why not use a different method of placing Flash on the page.
Here is the simplest, least code method:
<object data="path_to_file/file.swf" type="application/x-shockwave-flash" width="insert_width_of_movie" height="insert_height_of_movie">
<param name="movie" value="path_to_file/file.swf">
<param name="SomeOtherParam" value="ParamValue">
</object>
Also the swfobject code looks like a very unusual version, and I know there are many flavors.... looks like you got one that is not working very well. Just because something is supposed to be the latest and greatest... doesn't always mean that it is. I began using swfobject version 1.5 and am still using it...NEVER had any problems and I've used it hundreds of time. If fact its so reliable and saves me so much hassle that I have extra time to answer questions like "why doesn't my Flash display" posted on various Web Developer site by developers using the "latest and greatest".
So really, if all you are going to do with swfobject is tell visitors to install Flash... I would not recommend using it. If however you want to tap into the real strength and value of swfobject, use it to enhace the SEO of your Flash content. For review:
If you think that Flash is somehow bad for SEO, it's time to dispell that MYTH!
If fact, in some circumstances I'll use Flash INSTEAD of just HTML because then I'll have better SEO than with just HTML alone.
http://www.worldbarefootcenter.com/
The link to World Barefoot Center in the above post is just one example. View the source code and you see a couple paragraphs of text along with regular HTML links.... but what displays is the Flash version of the image and Flash links.
The client provided the artwork for the page... and that's what they wanted to use a .jpg image. Well yes, that could be done in HTML but it would be virtually invisible to Google. So Instead I converted the image into a Flash .swf and used swfobject to display the Flash. swfobject allows you to create alternate content inside the <div> which also holds the Flash .swf, then when the page is loaded it detects if the browser has the Flash pluggin. If it does, it displays just the Flash content, if not, it displays the alternate content. Since almost everyone has the Flash pluggin, for most people the Flash version of the <div> will display.
The alternate content for that <div> can be any regular HTML text, images, media player, links, etc., anything that you would use if you were not using the Flash. Now the best part is that the alternate content can be "over the top" as far as optimizing for SEO, since it will not be seen by most viewers.
Here's another example of SEO with Flash.. again, the page is just a single image provided by the client:
http://www.ksowetsuits.com/
View the source code. The alt content is paragraph after paragraph of information about the site, including lists and links. If it was just the HTML, it might be kind of a boring Home page. But for SEO I can go "over the top" in promoting the site, since most viewers will never see that part... but it's all indexed by search engines. The end result is BETTER SEO using Flash than just HTML.
On another Web site, a Flash video is displayed, the alt content is the complete text narration of the video. Now how many people would take the time to read that if they could just watch the video instead?? again, better SEO with Flash than without. In fact in one case we had first page search result from that video narration within 4 hours of posting the page.
On still another site with a Flash video, the alt content is another video, but a .mov version, which will, in effect play Flash video on the iPhone (not possible you say??). Well since the iPhone does not have Flash pluggin, it simply displays the .mov version of the video, while everyione else sees the Flash version.
So anyway, if Flash is a part of your Web development, you should look into using swfobject and alternate content.
http://code.google.com/p/swfobject/
Best wishes,
Eye for Video
www.cidigitalmedia.com
Best wishes,
Adninjastrator -
I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
Thank you in advance,
LeftyThis was one solution from the socket programming forum, have you tried this??
public Thread MyThread extends Thread{
boolean active = true;
public void run(){
ss.setSoTimeout(90);
while (active){
try{
serverSocket = ss.accept();
catch (SocketTimeoutException ste){
// do nothing
// interrupt thread
public void deactivate(){
active = false;
// you gotta sleep for a time longer than the
// accept() timeout to make sure that timeout is finished.
try{
sleep(91);
}catch (InterruptedException ie){
interrupt();
} -
A problem with Threads and MMapi
I am tring to execute a class based on Game canvas.
The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
The MIDI tone "Stammers".
How to over come the problem?
Thanks in advance
Kobi
See Code example below:
import java.io.IOException;
import java.io.InputStream;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
public class MainScreenCanvas extends GameCanvas implements Runnable {
private MainMIDlet parent;
private boolean mTrucking = false;
Image imgBackgound = null;
int imgBackgoundX = 0, imgBackgoundY = 0;
Player player;
public MainScreenCanvas(MainMIDlet parent)
super(true);
this.parent = parent;
try
imgBackgound = Image.createImage("/images/area03_bkg0.png");
imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
catch(Exception e)
System.out.println(e.getMessage());
* starts thread
public void start()
mTrucking = true;
Thread t = new Thread(this);
t.start();
* stops thread
public void stop()
mTrucking = false;
public void play()
try
InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
player = Manager.createPlayer(is, "audio/midi");
player.setLoopCount(-1);
player.prefetch();
player.start();
catch(Exception e)
System.out.println(e.getMessage());
public void run()
Graphics g = getGraphics();
play();
while (true)
tick();
input();
render(g);
* responsible for object movements
private void tick()
* response to key input
private void input()
int keyStates = getKeyStates();
if ((keyStates & LEFT_PRESSED) != 0)
imgBackgoundX++;
if (imgBackgoundX > 0)
imgBackgoundX = 0;
if ((keyStates & RIGHT_PRESSED) != 0)
imgBackgoundX--;
if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
* Responsible for the drawing
* @param g
private void render(Graphics g)
g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
this.flushGraphics();
}You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
Regds,
SD
N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM -
Hi all,
I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
Below you can find the code
import java.lang.*;
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class intervals extends MIDlet implements CommandListener
public Display ekran;
private SweepCanvas sweeper;
private Form rundy;
private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
private long czas,x;
private Command exitCommand;
private Command addRound;
private Command delRound;
private Command start;
private TextField repeat;
private Form odliczanie;
private Alert ostrz;
Licznik thread;
String test;
StringItem test1;
int parz,i,j,k;
static int l;
int ilrund;
int ilpowt;
Item sec;
long sec1;
public intervals()
rundy = new Form("Interwały sportowe");
exitCommand = new Command("Wyjście", Command.EXIT, 2);
addRound = new Command("Dodaj","Dodaj rundę", Command.ITEM,1);
delRound = new Command("Usuń","Usuń ostatnią rundę", Command.ITEM,1);
start = new Command("Start", Command.ITEM,1);
odliczanie = new Form("Odliczanie");
TextField dodaj(TextField kolej)
kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
if(rundy.size()==0)
rundy.insert(rundy.size(),kolej);
else
rundy.insert(rundy.size()-1, kolej);
return kolej;
void odliczanie(TextField round)
monitor m=new monitor();
k=Integer.parseInt(round.getString());
ekran.setCurrent(odliczanie);
thread=new Licznik(k,odliczanie);
thread.start();
ekran.setCurrent(rundy);
public void startApp()// throws MIDletStateChangeException
rundy.deleteAll();
repeat = new TextField("Podaj ilość powtórzeń",null,1,TextField.NUMERIC);
rundy.addCommand(addRound);
rundy.addCommand(exitCommand);
rundy.setCommandListener(this);
Canvas obrazek = new MyCanvas();
ekran = Display.getDisplay(this);
ekran.setCurrent(obrazek);
czas=System.currentTimeMillis();
while (System.currentTimeMillis()<czas+1000)
continue;
ekran.setCurrent(rundy);
public void pauseApp()
public void destroyApp(boolean unconditional)
notifyDestroyed();
public void commandAction(Command c, Displayable s)
if (c == exitCommand)
destroyApp(false);
notifyDestroyed();
else if(c==addRound)
if(rundy.size()==0)//Sprawdzenie ilości elementów w celu poprawnego wyświetlania liczby rund w formie
parz=1;
else
parz=rundy.size();
switch(parz)
case 1:
round0=dodaj(round0);break;
case 2:
round1=dodaj(round1);break;
case 3:
round2= dodaj(round2);break;
case 4:
round3=dodaj(round3);break;
case 5:
round4=dodaj(round4);break;
default:
ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
ostrz.setTimeout(3000);
ekran.setCurrent(ostrz);
if(rundy.size()==1)
rundy.append(repeat);
rundy.addCommand(start);
rundy.addCommand(delRound);
else if(c==delRound)
if(rundy.size()!=0)
rundy.delete(rundy.size()-2);
if (rundy.size()==1)
rundy.deleteAll();
if(rundy.size()==0)
rundy.removeCommand(delRound);
rundy.removeCommand(start);
else if(c==start)
ilrund=rundy.size()-1;
if(this.repeat.size()>0)
ilpowt=Integer.parseInt(this.repeat.getString());
ekran = Display.getDisplay(this);
for (i=1; i<=ilpowt;i++)
odliczanie= new Form("Odliczanie");
for (j=0;j<ilrund;j++)
switch(j)
case 0:
odliczanie(round0);
break;
case 1:
odliczanie(round1);
break;
case 2:
odliczanie(round2);
break;
case 3:
odliczanie(round3);
break;
case 4:
odliczanie(round4);
break;
case 5:
odliczanie(round5);
break;
case 6:
odliczanie(round6);
break;
case 7:
odliczanie(round7);
break;
case 8:
odliczanie(round8);
break;
class Licznik extends Thread
int czas1,k;
Form forma;
monitor m;
public Licznik(int k,Form formap)
czas1=k;
forma=formap;
public synchronized void run()
while(czas1>0)
forma.deleteAll();
forma.append("Czas pozostały (s): "+czas1);
try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
czas1--;
if(czas1<=0)
m.put();
}and monitor class
public class monitor
boolean busy=false;
synchronized void get()
if(!busy)
try
wait();
}catch(InterruptedException e){e.printStackTrace();}
notify();
synchronized void put()
if(busy)
try
wait();
}catch(InterruptedException e){e.printStackTrace();}
busy=true;
notify();
}Can anybody help me with this?Groovemaker,
Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
Daniel -
Problem with threads within applet
Hello,
I got an applet, inside this applet I have a singleton, inside this singleton I have a thread.
this thread is running in endless loop.
he is doing something and go to sleep on and on.
the problem is,
when I refresh my IE6 browser I see more than 1 thread.
for debug matter, I did the following things:
inside the thread, sysout every time he goes to sleep.
sysout in the singleton constructor.
sysout in the singleton destructor.
the output goes like this:
when refresh the page, the singleton constructor loading but not every refresh, sometimes I see the constructor output and sometimes I dont.
The thread inside the singleton is giving me the same output, sometime I see more than one thread at a time and sometimes I dont.
The destructor never works (no output there).
I don't understand what is going on.
someone can please shed some light?
thanks.
btw. I am working with JRE 1.1
this is very old and big applet and I can't convert it to something new.Ooops. sorry!
I did.
public void start() {
public void stop() {
public void destroy() {
try {
resetAll();
Configuration.closeConnection();
QuoteItem.closeConnection();
} finally {
try {
super.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
Maybe you are looking for
-
I have been unable to use the copy and past command while using mozilla. the fucntion does work in windows IE, but I don't want to use windows. How do I restore or fix this function? I varies, works some days and not others.
-
PSC 2175 not printing with Windows XP
Hello, This printer has worked great since the first day with the setup below, but I cant figure this out. Setup Connection using USB O/S windows XP sp3 System is connect to ATEn KVM Switch USB. windows share with other windows machines. Issue The p
-
Oracle VM for EBS 12.1.3
Quick question I think. When I tried configuring my EBS 12.1.3 DB and APPS servers I followed the README files included in the respective folders but I think I may have misconfigured them now that I look at the "Oracle VM Templates for E-Business Sui
-
Trace to know the server name or server's IP
Hi, Given one domain name like NTNET11 how can I trace which server name or IP, is inside having all the AD details? Many Thanks & Best Regards, Hua Min
-
Return code in trace file from ST01
Hello All, Does anybody know what are the values for the return code (0,4,8,12,16) in an trace file from ST01 ? Thanks you All !