Use RemoteObject method defined in MXML from AS
I need to use a RemoteObject from a custom component written
as an ActionScript class. I can easily define the RemoteObject
service and it's methods in MXML, but I don't know how to acces
that definition from a class insite an ActionScript package. For
example imagine
this
example on Adobe's site on component creation using a RemoteObject
to do the calculations. I don't know how to define methods of a
remote service in AcionScript, only in MXML. Thanks.
It seems I don't have to defint the methods, just create a
RemoteObject, set it's dource and destination, and call the methods
on it. (services-config.xml is already set up.)
Still, any comments are welcome. Or tutorials on the web.
Like how to set per-method event handlers. Now I can only set it
globally on the RemoteObject.
Similar Messages
-
How to use a method in sequence diagram from a class diagram
Hello, can someone tell me how to use the method from class diagram in sequence diagram? so far i only can add a classifier to the object lifeline but i still cannot add the method from the class...
thxNow that Web Services is around, I'd look at possibly implement a Web Service call in your applet, which can then be given back any object(s) on return. Set up your server side to handle Web Service calls. In this way, you can break the applet out into an application should you want to (with very little work) and it will still function the same
-
<?xml version="1.0" standalone="yes"?>
<Student_Details>
<Student Id="1">
<Name>sandeep</Name>
<Age>12</Age>
<Mobile>123456789</Mobile>
</Student>
<Student Id="2">
<Name>ololjk</Name>
<Age>kjlokmo</Age>
<Mobile>njonojniohuj</Mobile>
</Student>
<hello Id="10">
</hello>
<Student Id="3">
<Name>Sandeep Pr</Name>
<Age>12</Age>
<Mobile>9865231870</Mobile>
</Student>
<Student Id="4">
<Name>ololjk</Name>
<Age>kjlokmo</Age>
<Mobile>njonojniohuj</Mobile>
</Student>
all i can fount in internet is which will not display the attributes so pls upload a proper code which also creates an attribute node???
Sandeep PuvvadiEnumerate your XML using
XDocument. For each element
Generate a new TreeNode with whatever text you want to show
Insert the node into your tree
Enumerate all the attributes of the element using the
Attributes() method
Insert a child node of the element node for each attribute with whatever text you want to show
Note that your XML is not valid. You have a <hello> element in the middle of it and the root element is not closed. You'll need to fix that before the XML can be parsed.
Michael Taylor
http://blogs.msmvps.com/p3net -
Smtp error using traditional methods for relaying emails from oracle
Can anybody please resolve these errors...
One of the methods told thru otn threads gives this error...
code given below-
CREATE OR REPLACE PROCEDURE "SEND_MAIL" (
p_sender IN VARCHAR2,
p_recipient IN VARCHAR2,
p_message IN VARCHAR2
AS
l_mailhost VARCHAR2 (255) := 'my host name';
l_mail_conn UTL_SMTP.connection;
BEGIN
l_mail_conn := UTL_SMTP.open_connection (l_mailhost, 25);
utl_smtp.command( l_mail_conn, 'prabhat');
utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( 'my mail address'))) );
utl_smtp.command( l_mail_conn, utl_raw.cast_to_varchar2( utl_encode.base64_encode( utl_raw.cast_to_raw( 'receivers mail address' ))) );
UTL_SMTP.helo (l_mail_conn, l_mailhost);
UTL_SMTP.mail (l_mail_conn, p_sender);
UTL_SMTP.rcpt (l_mail_conn, p_recipient);
UTL_SMTP.open_data (l_mail_conn);
utl_smtp.write_data(l_mail_conn, 'Subject: Your Subject Line Here');
UTL_SMTP.write_data (l_mail_conn, p_message);
UTL_SMTP.close_data (l_mail_conn);
UTL_SMTP.quit (l_mail_conn);
END;
Error-
ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 99
ORA-06512: at "SYS.UTL_SMTP", line 159
Thanks & Regards
SwatiOther threads on PLSQL forum where folk have hit this kind of problem....
Re: ORA-29279: SMTP permanent error: 500 5.3.3 Unrecognized command
Cheers
David -
How can i call method defined in the binding page from popup
I couldn't call method defined in pageDef from dialog exist in popup
while i can call it from button or link
how can I do thatHi,
my answer to this is : yes, this can be done. So next is that you explain what you've tried so we can share our view with you
Frank -
Referencing a method in one class from a constructor in another?
Hi,
I'm not sure whether this is a simple question or not, but instead of rewriting the method in another class, is there a way that I can reference that method, eg:
public int getTitleCode() {
return titleCode; }within the constructor of another class. I don't want to use inheritance with this because it would change all my existing contructors.
Any ideas how to do this, or is it just simpler to add the method to both classes?
Many thanks!Hi,
I'm trying to use a method, defined in Class A, within one of the constructors in Class B. Class B object represents a copy of the output of Class A, with the addition of a few extra methods.
Therefore to represent the details correctly in the saved text file for class B, I need to call a method from class A to save the text file for class B correctly.
Class B saves a file with a reference number unique to that class, plus a reference number that is also saved in the text file for class A.
I can achieve the correct result for the above by having the same method in both classes, but I just wondered whether instead of this I could in fact call the method from class A in the constructor for class B. With the following code,
referenceNumber = refNum;
titleReferenceNumber = titleRefNum;
titleRefNum = titles.getTitleCode();
}I just get a 'nullpointerexception' when I try to run this in the main class.
Any help or advice appreciated! -
Using inherited methods (Quick Question)
If I have a subclass that extends a parent class, do I have to use the methods that are inherited from the parent class or can they be ignored? For example, I inherit getArea and getVolume, but I am only interested in using getArea in my subclass, can I just ignore getVolume and not do anything with it? Or is there something I have to do to block its use? Also, does the same go for the attributes that are inherited via the constructor when autogenerate the inherited constructor? Thanks!
NPP83 wrote:
If I have a subclass that extends a parent class, do I have to use the methods that are inherited from the parent class or can they be ignored? For example, I inherit getArea and getVolume, but I am only interested in using getArea in my subclass, can I just ignore getVolume and not do anything with it?I think the more pertinent question is: are they correct? You might be able to subclass a cube with a square (they both only require a side length), but the getVolume method would be patently incorrect for a square.
Or is there something I have to do to block its use?UnsupportedOperationException is the most normal.
Also, does the same go for the attributes that are inherited via the constructor when autogenerate the inherited constructor?Erm....???? If you mean, do you inherit attributes, the answer is: yes(***), unless they're private.
Winston
(***) Actually 'maybe', if they're default-visibility. -
Not able to call Java from flex using RemoteObject
hi,
I am badly stuck in compiling my flex app to connect to Java code on the server side using LCDS remoteObject component.
My swf file wouldn't trigger a method on the Java class, below is the snippet of all relevant codes, i just don't know what to do.
Please help on what am i missing or what i am doing wrong in this.
------> 1. here is the ant target that uses mxmlc compiler option
<target name="flex-compile" depends="copy-all">
<mxmlc
file="${uisrc}/OnlineServicesPortal.mxml"
output="${prjdeploydir}/OnlineServicesPortal.swf"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="true"
incremental="true"
as3="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
</library-path>
<compiler.source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.include-libraries dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs/datavisualization.swc" />
<include name="libs/fds.swc" />
<include name="libs/player/10/playerfds.swc" />
<include name="locale/en_US/datavisualization_rb.swc" />
<include name="locale/en_US/fds_rb.swc" />
</compiler.include-libraries>
<!--compiler.services filename="${src}/flex/services-config.xml"/-->
<!--context-root context-path="portal"/-->
<default-size width="500" height="600" />
</mxmlc>
</target>
---------2. services-config.xml file
<channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties>
<polling-enabled>false</polling-enabled>
</properties>
</channel-definition>
<channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
</channel-definition>
----------3. remoting-config.xml file
<service id="remoting-service"
class="flex.messaging.services.RemotingService">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
<channel ref="my-http"/>
</default-channels>
<destination id="portal">
<properties>
<source>com.mssb.portal.impl.PortalService</source> <!---this class file is valid & exists-->
</properties>
</destination>
</service>
-----------4. mxml file
<mx:RemoteObject id="myRO" destination="portal" result="createFieldsResultHandler();" fault="createFieldsFaultHandler();">
</mx:RemoteObject>
myRO.persistServiceDefinition(serviceDef) //called from action script function invoked upon a click of a button.actually , I have laready given print stataement for the data in the context property file that you can see in the output. Today I am also able to call the bpel process using the same java program from my DOS command promt(cmd). Don't understand why the problem is occuring in unix.
please help. -
How can i use RemoteObject without mxml?
hi:
in my flex project , i use blazeds + puremvc , so i want to put my business code in actionscript as proxy to communicate with java code, the proxy code like :
public function requestServer(page:PageInfo):void{
userServiceRM = new RemoteObject();
userServiceRM.destination="userService";
userServiceRM.getsimpleList();
var pageResult :Object= userServiceRM.getsimpleList.lastResult;
sendNotification(UserStartupCommond.USERLIST_GOT,pageResult );
but i have a problem that pageResult is a null value .(the Configuring and the server side have no problem .)
how can i use RemoteObject without mxml?
thanks.Hi. Remote object calls are asynchronous so you can't access the result immediately after making the call. You need to wait until the server returns the result. There are a couple ways to set this up. Probably the easiest thing to do is to add an event listener that will be called when the result comes back from the server. Here is what that would look like.
public function requestServer(page:PageInfo):void {
userServiceRM = new RemoteObject();
userServiceRM.destination="userService";
userServiceRM.addEventListener("result", resultHandler);
userServiceRM.addEventListener("fault", faultHandler);
userServiceRM.getsimpleList();
public function resultHandler(event:ResultEvent) {
var pageResult :Object= userServiceRM.getsimpleList.lastResult;
sendNotification(UserStartupCommond.USERLIST_GOT,pageResult);
public function faultHandler(event:FaultEvent) {
//handle remote object fault
Look at the RPC Components section of the BlazeDS Developers guide for more information about using the RPC components. Hope that helps.
-Alex -
How to find BADI Defination and Implemantation from Method of BADI?
HI,
can anyone tell me that how to find BADI Defination and Implemantation from Method of BADI?& Report ZPJA_PM002 (V2) &
& Text Elements: &
& P_DEVC Show user-exits from development class &
& P_LIMIT Limit submit program selection &
& P_FUNC Show function modules &
& P_SUBM Show submit programs &
& S01 Selection data (TCode takes precedence over program name) &
report zpja_pm002
no standard page heading
line-size 158.
*tables: enlfdir. "Additional Attributes for Function Modules
data: tabix like sy-tabix,
w_linnum type i,
w_off type i,
w_index like sy-tabix,
w_include like trdir-name,
w_prog like trdir-name,
w_incl like trdir-name,
w_area like rs38l-area,
w_level,
w_str(50) type c,
w_funcname like tfdir-funcname.
constants: c_fmod(40) type c value 'Function modules selected: ',
c_subm(40) type c value 'Submit programs selected: ',
c_col1(12) type c value 'Enhanmt Type',
c_col2(40) type c value 'Enhancement',
c_col3(30) type c value 'Program/Include',
c_col4(20) type c value 'Enhancement Name',
c_col5(40) type c value 'Enhancement Description'.
Work Areas: ABAP Workbench
data: begin of wa_d010inc.
data: master type d010inc-master.
data: end of wa_d010inc.
data: begin of wa_tfdir.
data: funcname type tfdir-funcname,
pname type tfdir-pname,
include type tfdir-include.
data: end of wa_tfdir.
data: begin of wa_tadir.
data: devclass type tadir-devclass.
data: end of wa_tadir.
data: begin of wa_tstc.
data: pgmna type tstc-pgmna.
data: end of wa_tstc.
data: begin of wa_tstcp.
data: param type tstcp-param.
data: end of wa_tstcp.
data: begin of wa_enlfdir.
data: area type enlfdir-area.
data: end of wa_enlfdir.
Work Areas: BADIs
data: begin of wa_sxs_attr.
data: exit_name type sxs_attr-exit_name.
data: end of wa_sxs_attr.
data: begin of wa_sxs_attrt.
data: text type sxs_attrt-text.
data: end of wa_sxs_attrt.
Work Areas: Enhancements
data: begin of wa_modsap.
data: member type modsap-member.
data: end of wa_modsap.
data: begin of wa_modsapa.
data: name type modsapa-name.
data: end of wa_modsapa.
data: begin of wa_modsapt.
data: modtext type modsapt-modtext.
data: end of wa_modsapt.
Work Areas: Business Transaction Events
data: begin of wa_tbe01t.
data: text1 type tbe01t-text1.
data: end of wa_tbe01t.
data: begin of wa_tps01t.
data: text1 type tps01t-text1.
data: end of wa_tps01t.
user-exits
types: begin of t_userexit,
type(12) type c,
pname like trdir-name,
txt(300),
level type c,
modname(30) type c,
modtext(40) type c,
end of t_userexit.
data: i_userexit type standard table of t_userexit with header line.
Function module developmnet classes
types: begin of t_devclass,
clas like trdir-clas,
end of t_devclass.
data: i_devclass type standard table of t_devclass with header line.
Submit programs
types: begin of t_submit,
pname like trdir-name,
level,
done,
end of t_submit.
data: i_submit type standard table of t_submit with header line.
Source code
types: begin of t_sourcetab, "#EC * (SLIN lügt!)
line(200), "#EC * (SLIN lügt!)
end of t_sourcetab. "#EC * (SLIN lügt!)
data: sourcetab type standard table of t_sourcetab with header line.
data c_overflow(30000) type c.
Description of an ABAP/4 source analysis token
data: i_stoken type standard table of stokex with header line.
data wa_stoken like i_stoken.
Description of an ABAP/4 source analysis statement
data: i_sstmnt type standard table of sstmnt with header line."#EC
keywords for searching ABAP code
types: begin of t_keywords,
word(30),
end of t_keywords.
data: keywords type standard table of t_keywords with header line.
function modules within program
types: begin of t_fmodule,
name like rs38l-name,
pname like trdir-name,
pname2 like trdir-name,
level,
bapi,
done,
end of t_fmodule.
data: i_fmodule type standard table of t_fmodule with header line.
& Selection Options &
selection-screen begin of block selscr1 with frame title text-s01.
parameter: p_pname like trdir-name memory id rid,
p_tcode like syst-tcode,
p_limit(4) type n default 100,
p_devc like rihea-dy_ofn default ' ',
p_func like rihea-dy_ofn default ' ',
p_subm like rihea-dy_ofn default ' '.
selection-screen end of block selscr1.
& START-OF-SELECTION &
start-of-selection.
if p_pname is initial and p_tcode is initial.
message e008(hrfpm). "Make entry on the selection screen
stop.
endif.
ensure P_LIMIT is not zero.
if p_limit = 0.
p_limit = 1.
endif.
perform data_select.
perform get_submit_data.
perform get_fm_data.
perform get_additional_data.
perform data_display.
& Form DATA_SELECT &
form data_select.
data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
exporting
text = 'Get programs/includes' "#EC NOTEXT
exceptions
system_failure
communication_failure
. "#EC *
determine search words
keywords-word = 'CALL'.
append keywords.
keywords-word = 'FORM'.
append keywords.
keywords-word = 'PERFORM'.
append keywords.
keywords-word = 'SUBMIT'.
append keywords.
keywords-word = 'INCLUDE'.
append keywords.
if not p_tcode is initial.
get program name from TCode
select single pgmna from tstc into wa_tstc-pgmna
where tcode eq p_tcode.
if not wa_tstc-pgmna is initial.
p_pname = wa_tstc-pgmna.
TCode does not include program name, but does have refereve TCode
else.
select single param from tstcp into wa_tstcp-param
where tcode eq p_tcode.
if sy-subrc = 0.
check wa_tstcp-param(1) = '/'.
check wa_tstcp-param+1(1) = '*'.
if wa_tstcp-param ca ' '.
endif.
w_off = sy-fdpos + 1.
subtract 2 from sy-fdpos.
if sy-fdpos gt 0.
p_tcode = wa_tstcp-param+2(sy-fdpos).
endif.
select single pgmna from tstc into wa_tstc-pgmna
where tcode eq p_tcode.
p_pname = wa_tstc-pgmna.
if sy-subrc <> 0.
message e110(/saptrx/asc) with 'No program found for: '
p_tcode."#EC NOTEXT
stop.
endif.
else.
message e110(/saptrx/asc) with 'No program found for: ' p_tcode.
"#EC NOTEXT
stop.
endif.
endif.
endif.
Call customer-function aus Program coding
read report p_pname into sourcetab.
if sy-subrc > 0.
message e017(enhancement) with p_pname raising no_program."#EC *
endif.
scan abap-source sourcetab tokens into i_stoken
statements into i_sstmnt
keywords from keywords
overflow into c_overflow
with includes.
WITH ANALYSIS.
if sy-subrc > 0. "keine/syntakt. falsche Ablauflog./Fehler im Skanner
message e130(enhancement) raising syntax_error. "#EC *
endif.
check I_STOKEN for entries
clear w_linnum.
describe table i_stoken lines w_linnum.
if w_linnum gt 0.
w_level = '0'.
w_prog = ''.
w_incl = ''.
perform data_search tables i_stoken using w_level w_prog w_incl.
endif.
endform. "DATA_SELECT
& Form GET_FM_DATA &
form get_fm_data.
data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
exporting
text = 'Get function module data' "#EC NOTEXT
exceptions
system_failure
communication_failure
. "#EC *
Function module data
sort i_fmodule by name.
delete adjacent duplicates from i_fmodule comparing name.
loop at i_fmodule where done ne 'X'.
clear: i_stoken, i_sstmnt, sourcetab, wa_tfdir, w_include .
refresh: i_stoken, i_sstmnt, sourcetab.
clear wa_tfdir.
select single funcname pname include from tfdir into wa_tfdir
where funcname = i_fmodule-name.
check sy-subrc = 0.
call function 'FUNCTION_INCLUDE_SPLIT'
exporting
program = wa_tfdir-pname
importing
group = w_area.
concatenate 'L' w_area 'U' wa_tfdir-include into w_include.
i_fmodule-pname = w_include.
i_fmodule-pname2 = wa_tfdir-pname.
modify i_fmodule.
read report i_fmodule-pname into sourcetab.
if sy-subrc = 0.
scan abap-source sourcetab tokens into i_stoken
statements into i_sstmnt
keywords from keywords
with includes.
if sy-subrc > 0.
message e130(enhancement) raising syntax_error.
endif.
check i_stoken for entries
clear w_linnum.
describe table i_stoken lines w_linnum.
if w_linnum gt 0.
w_level = '1'.
w_prog = i_fmodule-pname2.
w_incl = i_fmodule-pname.
perform data_search tables i_stoken using w_level w_prog w_incl.
endif.
endif.
endloop.
if p_devc = 'X'.
loop at i_fmodule.
clear: wa_tadir, wa_enlfdir.
select single area from enlfdir into wa_enlfdir-area
where funcname = i_fmodule-name.
check not wa_enlfdir-area is initial.
select single devclass into wa_tadir-devclass
from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name = wa_enlfdir-area.
check not wa_tadir-devclass is initial.
move wa_tadir-devclass to i_devclass-clas.
append i_devclass.
i_fmodule-done = 'X'.
modify i_fmodule.
endloop.
sort i_devclass.
delete adjacent duplicates from i_devclass.
endif.
endform. "GET_FM_DATA
& Form GET_SUBMIT_DATA &
form get_submit_data.
data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
exporting
text = 'Get submit data' "#EC NOTEXT
exceptions
system_failure
communication_failure
. "#EC *
sort i_submit.
delete adjacent duplicates from i_submit comparing pname.
w_level = '0'.
loop at i_submit where done ne 'X'.
clear: i_stoken, i_sstmnt, sourcetab.
refresh: i_stoken, i_sstmnt, sourcetab.
read report i_submit-pname into sourcetab.
if sy-subrc = 0.
scan abap-source sourcetab tokens into i_stoken
statements into i_sstmnt
keywords from keywords
with includes.
if sy-subrc > 0.
message e130(enhancement) raising syntax_error.
continue.
endif.
check i_stoken for entries
clear w_linnum.
describe table i_stoken lines w_linnum.
if w_linnum gt 0.
w_prog = i_submit-pname.
w_incl = ''.
perform data_search tables i_stoken using w_level w_prog w_incl.
endif.
endif.
restrict number of submit program selected for processing
describe table i_submit lines w_linnum.
if w_linnum ge p_limit.
w_level = '1'.
endif.
i_submit-done = 'X'.
modify i_submit.
endloop.
endform. "GET_SUBMIT_DATA
& Form DATA_SEARCH &
form data_search tables p_stoken structure stoken
using p_level p_prog p_incl.
loop at p_stoken.
clear i_userexit.
tabix = sy-tabix + 1.
i_userexit-level = p_level.
if i_userexit-level = '0'.
if p_incl is initial.
i_userexit-pname = p_pname.
else.
concatenate p_pname '/' p_incl into i_userexit-pname.
endif.
else.
if p_incl is initial.
i_userexit-pname = p_prog.
else.
concatenate p_prog '/' p_incl into i_userexit-pname.
endif.
endif.
Include
if p_stoken-str eq 'INCLUDE'.
check p_level eq '0'. " do not perform for function modules
*(2nd pass)
w_index = sy-tabix + 1.
read table p_stoken index w_index into wa_stoken.
check not wa_stoken-str cs 'STRUCTURE'.
check not wa_stoken-str cs 'SYMBOL'.
read table i_submit with key pname = wa_stoken-str.
if sy-subrc <> 0.
i_submit-pname = wa_stoken-str.
i_submit-level = p_level.
append i_submit.
endif.
endif.
Enhancements
if p_stoken-str eq 'CUSTOMER-FUNCTION'.
clear w_funcname.
read table p_stoken index tabix.
translate p_stoken-str using ''' '.
condense p_stoken-str.
if p_prog is initial.
concatenate 'EXIT' p_pname p_stoken-str into w_funcname
separated by '_'.
else.
concatenate 'EXIT' p_prog p_stoken-str into w_funcname
separated by '_'.
endif.
select single member from modsap into wa_modsap-member
where member = w_funcname.
if sy-subrc = 0. " check for valid enhancement
i_userexit-type = 'Enhancement'.
i_userexit-txt = w_funcname.
append i_userexit.
else.
clear wa_d010inc.
select single master into wa_d010inc-master
from d010inc
where include = p_prog.
concatenate 'EXIT' wa_d010inc-master p_stoken-str into
w_funcname
separated by '_'.
i_userexit-type = 'Enhancement'.
i_userexit-txt = w_funcname.
endif.
endif.
BADIs
if p_stoken-str cs 'cl_exithandler='.
w_index = sy-tabix + 4.
read table p_stoken index w_index into wa_stoken.
i_userexit-txt = wa_stoken-str.
replace all occurrences of '''' in i_userexit-txt with space.
i_userexit-type = 'BADI'.
append i_userexit.
endif.
Business transaction events
if p_stoken-str cs 'OPEN_FI_PERFORM'.
i_userexit-type = 'BusTrEvent'.
i_userexit-txt = p_stoken-str.
replace all occurrences of '''' in i_userexit-txt with space.
i_userexit-modname = i_userexit-txt+16(8).
case i_userexit-txt+25(1).
when 'E'.
clear wa_tbe01t.
select single text1 into wa_tbe01t-text1 from tbe01t
where event = i_userexit-txt+16(8)
and spras = sy-langu.
if wa_tbe01t-text1 is initial.
i_userexit-modtext = ''. "#EC NOTEXT
else.
i_userexit-modtext = wa_tbe01t-text1.
endif.
i_userexit-modname+8 = '/P&S'. "#EC NOTEXT
when 'P'.
clear wa_tps01t.
select single text1 into wa_tps01t-text1 from tps01t
where procs = i_userexit-txt+16(8)
and spras = sy-langu.
i_userexit-modtext = wa_tps01t-text1.
i_userexit-modname+8 = '/Process'.
endcase.
append i_userexit.
endif.
Program exits
if p_stoken-str cs 'USEREXIT_'.
i_userexit-type = 'Program Exit'.
i_userexit-txt = p_stoken-str.
replace all occurrences of '''' in i_userexit-txt with space.
append i_userexit.
endif.
Submit programs
if p_stoken-str cs 'SUBMIT'.
check p_level eq '0'. " do not perform for function modules
*(2nd pass)
check not p_stoken-str cs '_'. " ensure not SUBMIT_XXX
w_index = sy-tabix + 1.
read table p_stoken index w_index into wa_stoken.
check not wa_stoken-str cs '_'. " ensure not SUBMIT_XXX
replace all occurrences of '''' in wa_stoken-str with space.
read table i_submit with key pname = wa_stoken-str.
if sy-subrc <> 0.
i_submit-pname = wa_stoken-str.
i_submit-level = p_level.
append i_submit.
endif.
endif.
Perform routines (which reference external programs)
if p_stoken-str cs 'PERFORM'.
check p_level eq '0'. " do not perform for function modules
*(2nd pass)
w_index = sy-tabix + 1.
read table p_stoken index w_index into wa_stoken.
if not wa_stoken-ovfl is initial.
w_off = wa_stoken-off1 + 10.
w_str = c_overflow+w_off(30).
find ')' in w_str match offset w_off.
w_off = w_off + 1.
wa_stoken-str = w_str(w_off).
endif.
check wa_stoken-str cs '('.
w_off = 0.
while sy-subrc = 0.
if wa_stoken-str+w_off(1) eq '('.
replace section offset w_off length 1 of wa_stoken-str with ''
replace all occurrences of ')' in wa_stoken-str with space.
read table i_submit with key pname = wa_stoken-str.
if sy-subrc <> 0.
i_submit-pname = wa_stoken-str.
append i_submit.
endif.
exit.
else.
replace section offset w_off length 1 of wa_stoken-str with ''
shift wa_stoken-str left deleting leading space.
endif.
endwhile.
endif.
Function modules
if p_stoken-str cs 'FUNCTION'.
clear i_fmodule.
check p_level eq '0'. " do not perform for function modules
*(2nd pass)
w_index = sy-tabix + 1.
read table p_stoken index w_index into wa_stoken.
if wa_stoken-str cs 'WF_'.
if wa_stoken-str cs 'IF_'.
break-point.
endif.
if wa_stoken-str cs 'BAPI'.
i_fmodule-bapi = 'X'.
endif.
replace first occurrence of '''' in wa_stoken-str with space.
replace first occurrence of '''' in wa_stoken-str with space.
if sy-subrc = 4. " didn't find 2nd quote (ie name truncated)
clear wa_tfdir.
concatenate wa_stoken-str '%' into wa_stoken-str.
select single funcname into wa_tfdir-funcname from tfdir
where funcname like wa_stoken-str.
if sy-subrc = 0.
i_fmodule-name = wa_tfdir-funcname.
else.
continue.
endif.
else.
i_fmodule-name = wa_stoken-str.
endif.
i_fmodule-level = p_level.
append i_fmodule.
endif.
endloop.
endform. "DATA_SEARCH
& Form GET_ADDITIONAL_DATA &
form get_additional_data.
data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
exporting
text = 'Get additional data' "#EC NOTEXT
exceptions
system_failure
communication_failure
. "#EC *
loop at i_userexit.
Enhancement data
if i_userexit-type cs 'Enh'.
clear: wa_modsapa.
select single name into wa_modsapa-name from modsap
where member = i_userexit-txt.
check sy-subrc = 0.
i_userexit-modname = wa_modsapa-name.
clear wa_modsapt.
select single modtext into wa_modsapt-modtext from modsapt
where name = wa_modsapa-name
and sprsl = sy-langu.
i_userexit-modtext = wa_modsapt-modtext.
endif.
BADI data
if i_userexit-type eq 'BADI'.
clear wa_sxs_attr.
select single exit_name into wa_sxs_attr-exit_name from sxs_attr
where exit_name = i_userexit-txt.
if sy-subrc = 0.
i_userexit-modname = i_userexit-txt.
else.
i_userexit-modname = 'Dynamic call'. "#EC NOTEXT
endif.
clear wa_sxs_attrt.
select single text into wa_sxs_attrt-text from sxs_attrt
where exit_name =
wa_sxs_attr-exit_name
and sprsl = sy-langu.
i_userexit-modtext = wa_sxs_attrt-text.
endif.
modify i_userexit.
endloop.
get enhancements via program package
clear wa_tadir.
select single devclass into wa_tadir-devclass from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = p_pname.
if sy-subrc = 0.
clear: wa_modsapa, wa_modsapt.
select name from modsapa into wa_modsapa-name
where devclass = wa_tadir-devclass.
select single modtext from modsapt into wa_modsapt-modtext
where name = wa_modsapa-name
and sprsl = sy-langu.
read table i_userexit with key modname = wa_modsapa-name.
if sy-subrc <> 0.
i_userexit-modtext = wa_modsapt-modtext.
i_userexit-type = 'Enhancement'. "#EC NOTEXT
i_userexit-modname = wa_modsapa-name.
i_userexit-txt = 'Determined from program DevClass'."#EC NOTEXT
i_userexit-pname = 'Unknown'. "#EC NOTEXT
append i_userexit.
endif.
endselect.
endif.
endform. "GET_ADDITIONAL_DATA
& Form DATA_DISPLAY &
form data_display.
data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
exporting
text = 'Prepare screen for display' "#EC NOTEXT
exceptions
system_failure
communication_failure
. "#EC *
sort i_userexit by type txt modname.
delete adjacent duplicates from i_userexit comparing txt modname.
format headings
write: 'Enhancements from main program'. "#EC NOTEXT
write: /.
uline.
format color col_heading.
write: / sy-vline,
(12) c_col1, "Enhanmt Type
sy-vline,
(40) c_col2, "Enhancement
sy-vline,
(30) c_col3, "Program/Include
sy-vline,
(20) c_col4, "Enhancement name
sy-vline,
(40) c_col5, "Enhancement description
sy-vline.
format reset.
uline.
format lines
loop at i_userexit.
set line colour
case i_userexit-type.
when 'Enhancement'.
format color 3 intensified off.
when 'BADI'.
format color 4 intensified off.
when 'BusTrEvent'.
format color 5 intensified off.
when 'Program Exit'.
format color 6 intensified off.
when others.
format reset.
endcase.
write: / sy-vline,
i_userexit-type,
sy-vline,
i_userexit-txt(40),
sy-vline,
i_userexit-pname(30),
sy-vline,
i_userexit-modname(20),
sy-vline,
i_userexit-modtext(40),
sy-vline.
endloop.
format reset.
uline.
user-exits from development class of function modules
if p_devc = 'X'.
write: /.
write: / 'User-exits from function module development class'."#EC
*NOTEXT
write: 157''.
uline (90).
write: 157''.
loop at i_devclass.
clear wa_modsapa.
select name from modsapa into wa_modsapa
where devclass = i_devclass-clas.
select single name modtext into corresponding fields of wa_modsapt
from modsapt
where name = wa_modsapa-name
and sprsl = sy-langu.
format color 3 intensified off.
write: / sy-vline,
(12) 'Enhancement',
sy-vline,
wa_modsapa-name,
sy-vline,
wa_modsapt-modtext,
sy-vline.
endselect.
endloop.
uline (90).
format reset.
endif.
describe table i_fmodule lines w_linnum.
write: / c_fmod , at 35 w_linnum. "#EC NOTEXT
write: 157''.
if p_func = 'X'.
display fuction modules used in program
uline (38).
write: 157''.
loop at i_fmodule.
write: sy-vline,
i_fmodule-name,
sy-vline,
i_fmodule-bapi,
sy-vline.
write: 157''.
endloop.
uline (38).
endif.
describe table i_submit lines w_linnum.
write: / c_subm , at 35 w_linnum. "#EC NOTEXT
write: 157''.
if p_subm = 'X'.
display submit programs used in program
uline (44).
write: 157''.
loop at i_submit.
write: sy-vline,
i_submit-pname,
sy-vline.
write: 157''.
endloop.
uline (44).
endif.
issue message with number of user-exits displayed
describe table i_userexit lines w_linnum.
message s697(56) with w_linnum.
endform. "DATA_DISPLAY
reward points if it helps
gunjan -
Not able to reload the data from DB using finder methods
Hi all,
<p>
I am facing a weird problem while using finder methods.
I am using weblogic 8.1 SP3 and entity beans are CMP with DB concurrency.DB is oracle
</p>
<h4>Problem Description</h4>
<p>
I am having one session bean which internally interacts with my entity beans,
Now say my transaction is getting initiated in one of the session bean and I use some finder in it.
</p>
<p>
To make the problem more clear lets say my entity bean is loanBean with loanId as primary key.
Now say method A of session bean initiates the transaction and I use something like
<br>
LoanLocal loanLocal =loanLocalHome.findByLoanId(loanId);
<br>
<b>Note that I am not using findByPrimaryKey method</b>
<br>
now this method A calls some other method B on some session bean which is having Required as its transaction attribute.
<br>
But before the call of B some other thread or background process updates the DB for this loanId and commits,
<br>
now when I fire the same finder in method B I am still getting the old data, ie I am not getting the data which has been modified in DB and committed by some other thread, I still get the old data and when I tried to generate the SQL queries which weblogic is firing, I see
it fires the SQL for every finder other that findByPrimaryKey.
<br>
<b>
Now my problem is I am getting the old data only and I need the new updated data of DB. isolation-level of DB and beans is READCOMMITTED.
Note:: I cant use new transaction to read the data.
</b>
<br>
And I couldn't understand that when weblogic is firing query for every finder then why it should not refresh the data in its cache. Is there any way to disable this kind of caching and say that everytime when i use finder just go to DB and get me the last committed data.
</p>
<br>
Any help in this regard would be very helpful to me.
<br>
Thanks and Regards
<br>
Manish Garg.
</p>Hi,
In my understanding, cache is not involved in this scenario. As you
observed, the container fires sql every time when you invoke this finder.
So, it should just give the result that it got from the DB. Is there a
possibility that the DB is using repeatable_read or serializable for
isolation level?
You can debug further by doing couple of things -
1. Instrument the code in the generated RDBMS java file for the entity bean
(if you use -keepgenerated option for weblogic.ejbc, u can get the source of
this file). This class will have the implementation for ejbFindByLoanId. You
can just print the result set data after the query is fired.
2. Try the same scenario without the ejb container. Like, write a jsp which
will start a user tx and fire the query twice such that there is an update
between the two queries. Note that, you need to use a TxDataSource to get
the JDBC connection so that it will be tx aware.
--Sathish
<Manish Garg> wrote in message news:[email protected]...
Hi all,
<p>
I am facing a weird problem while using finder methods.
I am using weblogic 8.1 SP3 and entity beans are CMP with DB
concurrency.DB is oracle
</p>
<h4>Problem Description</h4>
<p>
I am having one session bean which internally interacts with my entity
beans,
Now say my transaction is getting initiated in one of the session bean and
I use some finder in it.
</p>
<p>
To make the problem more clear lets say my entity bean is loanBean with
loanId as primary key.
Now say method A of session bean initiates the transaction and I use
something like
<br>
LoanLocal loanLocal =loanLocalHome.findByLoanId(loanId);
<br>
<b>Note that I am not using findByPrimaryKey method</b>
<br>
now this method A calls some other method B on some session bean which is
having Required as its transaction attribute.
<br>
But before the call of B some other thread or background process updates
the DB for this loanId and commits,
<br>
now when I fire the same finder in method B I am still getting the old
data, ie I am not getting the data which has been modified in DB and
committed by some other thread, I still get the old data and when I tried
to generate the SQL queries which weblogic is firing, I see
it fires the SQL for every finder other that findByPrimaryKey.
<br>
<b>
Now my problem is I am getting the old data only and I need the new
updated data of DB. isolation-level of DB and beans is READCOMMITTED.
Note:: I cant use new transaction to read the data.
</b>
<br>
And I couldn't understand that when weblogic is firing query for every
finder then why it should not refresh the data in its cache. Is there any
way to disable this kind of caching and say that everytime when i use
finder just go to DB and get me the last committed data.
</p>
<br>
Any help in this regard would be very helpful to me.
<br>
Thanks and Regards
<br>
Manish Garg.
</p> -
Passing values from applet using POST method to PHP page
Hello there ;)
I realy need a help here.. I`ve been working all day on sending mail from applet. I didn`t succeed bcs of the security restrictions.
So I decided just to pass arguments into PHP page, which process them and send e-mail to me.
So here is the problem.. I need to send String variables througth POST into my php page. Now I`m using GET method, but I need more than 4000 characters.
My actual solution is:
URL url = new URL("http://127.0.0.1/index.php?name=" + name + "&message=" + message);
this.getAppletContext().showDocument(url,"_self");I really need to rewrite it into POST. Would you be so kind and write few lines example [applet + php code]? I`ve already searched, googled, etc.. Pls don`t copy links to other forums here, probably I`ve read it.
Thanx in advance to all :)hi!
i`ve got some news about my applet.. so take this applet code:
public class Apletik extends JApplet {
public void init() { }
public void start()
try
String aLine; // only if reading response
String parametersAsString = "msg=ahoj&to=world";
byte[] parameterAsBytes = parametersAsString.getBytes();
// send parameters to server
URL url = this.getCodeBase();
url = new URL(url + "spracuj.php");
URLConnection con = url.openConnection();
con.setDoOutput(true);
con.setDoInput(true); // only if reading response
con.setUseCaches(false);
con.setRequestProperty("Content=length", String.valueOf(parameterAsBytes.length));
OutputStream oStream = con.getOutputStream();
oStream.write(parameterAsBytes);
oStream.flush();
String line="";
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
while ((aLine = in.readLine()) != null)
JOptionPane.showMessageDialog(null, aLine);
if(aLine.equals("")) break;
in.close();
oStream.close();
catch (Exception ex)
JOptionPane.showMessageDialog(null, ex.toString());
}here is code of spracuj.php which is on server:
<?php
if(isset($_POST['msg']))
echo('hurray!');
?>it has only 1 problem.. when i test it on my localhost, everything seems to be all right. but when i post it to my server, i got IOException HTTP 400 error code :( where is the problem? please help me, i`m so close :D thanx -
I feel like I should know the answer to this. I can't believe it is a hard question.
What is the direct connect method for transfering photos from my macbook pro to my iphone without using iTunes syncronization? (iow: a simple photo copy from mac to iphone?)
Easy? Right?
Just plug my iphone in to a mac and copy a photo from the mac to my iphone.
I don't have internet access - I can't email it, or mobileme it, or dropbox it.iTunes. Other than that there is no direct method. However, do try the iPhone forums.
-
Problem using repaint() method from another class
I am trying to make tower of hanoi...but unable to transfer rings from a tower to another...i had made three classes....layout21 where all componentents of frame assembled and provided suitable actionlistener.....second is mainPanel which is used to draw the rods n rings in paintComponent.....and third is tower in which code for hanoi is available...i had made an object of mainPanel at layoout21 n tower but i m not able to call repaint from tower..gives an error : cannot find the symbol....method repaint in tower.
code fragments od three classes are:
LAYOUT21
class layout21 extends JFrame implements ActionListener
{ private Vector rod1 = new Vector();
private Vector rod2 = new Vector();
private Vector rod3 = new Vector();
private String elem; //comment
public String r22;
public boolean in=false;
public int count=0; //no of times the transfer to other rods performed
private int r3,rings; // current no of rings
private JComboBox nor,col;
private JLabel no;
private JLabel moved;
private JLabel no1;
private JButton start;
private JButton ref;
private AboutDialog dialog;
private JMenuItem aboutItem;
private JMenuItem exitItem;
private tower t;
final mainPanel2 p =new mainPanel2();
public layout21()
{ t = new tower();
Toolkit kit =Toolkit.getDefaultToolkit();
Image img = kit.getImage("java.gif");
setIconImage(img);
setTitle("Tower Of Hanoi");
setSize(615,615);
setResizable(false);
setBackground(Color.CYAN);
JMenuBar mbar = new JMenuBar();
setJMenuBar(mbar);
JMenu fileMenu = new JMenu("File");
mbar.add(fileMenu);
aboutItem = new JMenuItem("About");
aboutItem.addActionListener(this);
fileMenu.add(aboutItem);
exitItem = new JMenuItem("Exit");
exitItem.addActionListener(this);
fileMenu.add(exitItem);
Container contentPane =getContentPane();
JPanel bspanel = new JPanel();
JPanel bnpanel = new JPanel();
setBackground(Color.CYAN);
//JComboBox
nor = new JComboBox();
nor.setEditable(false);
nor.addItem("3");
nor.addItem("4");
nor.addItem("5");
nor.addItem("6");
nor.addItem("7");
nor.addItem("8");
nor.addItem("9");
bspanel.add(nor);
col = new JComboBox();
col.setEditable(false);
col.addItem("BLACK");
col.addItem("GREEN");
col.addItem("CYAN");
bspanel.add(col);
JLabel tl = new JLabel("Time");
tl.setFont(new Font("Serif",Font.BOLD,12));
bspanel.add(tl);
JTextField tlag = new JTextField("0",4);
bspanel.add(tlag);
start =new JButton("Start");
bspanel.add(start);
ref =new JButton("Refresh");
bspanel.add(ref);
JButton end =new JButton("End");
bspanel.add(end);
start.addActionListener(this);
nor.addActionListener(this);
col.addActionListener(this);
ref.addActionListener(this);
end.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose(); // Closes the dialog
contentPane.add(bspanel,BorderLayout.SOUTH);
JLabel count = new JLabel("No of Transfer reguired:");
count.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(count);
no = new JLabel("7");
no.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(no);
JLabel moved = new JLabel("Moved:");
moved.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(moved);
no1 = new JLabel("0");
no1.setFont(new Font("Serif",Font.BOLD,16));
bnpanel.add(no1);
contentPane.add(bnpanel,BorderLayout.NORTH);
contentPane.add(p,BorderLayout.CENTER);
String r = (String)nor.getSelectedItem();
rings = Integer.valueOf(r).intValue();
p.draw(rings,1) ;
public void actionPerformed(ActionEvent evt)
{ Object source = evt.getSource();
if(source == start)
r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
p.transfer(false);
t.initialise(rod1,rod2,rod3,0);
t.towerOfHanoi(r3);
//repaint();
if(source == ref)
{ rod1.removeAllElements() ;
rod2.removeAllElements() ;
rod3.removeAllElements() ;
count=0;
r3 = Integer.valueOf((String)nor.getSelectedItem()).intValue();
p.draw(r3,1);
p.transfer(true);
no1.setText(""+0);
p.trans_vec(rod1,rod2,rod3);
t.initialise(rod1,rod2,rod3,0);
System.out.println("");
repaint();
if(source == nor)
{ JComboBox j = (JComboBox)source;
String item = (String)j.getSelectedItem();
int ring1 = Integer.valueOf(item).intValue();
int a=1;
for(int i=1;i<=ring1;i++)
{ a = a*2;
a=a-1;
no.setText(""+a);
p.draw(ring1,1);
repaint();
if(source == aboutItem)
{ if (dialog == null) // first time
dialog = new AboutDialog(this);
dialog.setVisible(true);
if(source == exitItem)
{ System.exit(0);
if (source==col)
{ JComboBox j = (JComboBox)source;
String item = (String)j.getSelectedItem();
repaint();
TOWER
class tower extends Thread
{ private Vector rod1 = new Vector();
private Vector rod2 = new Vector();
private Vector rod3 = new Vector();
private int count ;
private String elem;
final mainPanel2 z =new mainPanel2();
public void initialise(Vector r1,Vector r2,Vector r3,int c)
{ rod1 = r1;
rod2 = r2;
rod3 = r3;
count =c;
public void towerOfHanoi(int rings)
for(int i=0;i<rings;i++)
rod1.add(" "+(i+1));
System.out.println("rod1:"+rod1.toString());
hanoi(rings,1,2);
public void hanoi(int m,int i, int j)
if(m>0)
{ hanoi(m-1,i,6-i-j);
if(i==1 && j==2 && rod1.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod1.remove(0);
rod2.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint(); //NOT ABLE TO USE METHOD HERE...WHY??
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 2:"+rod2.toString());
if(i==1 && j==3 && rod1.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod1.remove(0);
rod3.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();//
// z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 3:"+rod3.toString());
if(i==2 && j==1 && rod2.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod2.remove(0);
rod1.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 1:"+rod1.toString());
if(i==2 && j==3 && rod2.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod2.remove(0);
rod3.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 3:"+rod3.toString());
if(i==3 && j==1 && rod3.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod3.remove(0);
rod1.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 1:"+rod1.toString());
if(i==3 && j==2 && rod3.isEmpty()==false)
{ count++;
//no1.setText(""+count);
elem = (String)rod3.remove(0);
rod2.add(0,elem);
//z.trans_vec(rod1,rod2,rod3);
repaint();
//z.hanoi_paint();
try
this.sleep(2000);
catch (Exception e) { e.printStackTrace() ; }
System.out.println(count+". ROD 2:"+rod2.toString());
hanoi(m-1,6-i-j,j);
MAINPANEL
class mainPanel2 extends JPanel //throws IOException
public Vector line = new Vector();
public Vector rod11= new Vector();
public Vector rod22= new Vector();
public Vector rod33= new Vector();
public int no_ring;
public int rod_no;
String pixel;
StringTokenizer st,st1;
int x,y;
public boolean initial =true;
public void paintComponent(Graphics g)
{ System.out.println("repaint test");
bresenham(100,60,100,360);
bresenham(101,60,101,360);
bresenham(102,60,102,360);
bresenham(103,60,103,360);
bresenham(104,60,104,360);
g.setColor(Color.BLUE);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
bresenham(300,60,300,360);
bresenham(301,60,301,360);
bresenham(302,60,302,360);
bresenham(303,60,303,360);
bresenham(304,60,304,360);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
bresenham(500,60,500,360);
bresenham(501,60,501,360);
bresenham(502,60,502,360);
bresenham(503,60,503,360);
bresenham(504,60,504,360);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
bresenham(0,361,615,361);//used to get a pixel according to algo.. . func not provided
bresenham(0,362,615,362);
bresenham(0,363,615,363);
bresenham(0,364,615,364);
bresenham(0,365,615,365);
while(line.size()>0)
{ pixel = (String)line.remove(0);
st = new StringTokenizer(pixel);
x = Integer.valueOf(st.nextToken()).intValue();
y = Integer.valueOf(st.nextToken()).intValue();
g.drawLine(x,y,x,y);
if(initial==true)
g.setColor(Color.RED);
for(int i = no_ring;i>0;i--)
{ g.drawLine(100-(i*8),360-(no_ring - i)*10,100+(i*8)+5,360-(no_ring - i)*10);
g.drawLine(100-(i*8),359-(no_ring - i)*10,100+(i*8)+5,359-(no_ring - i)*10);
g.drawLine(100-(i*8),358-(no_ring - i)*10,100+(i*8)+5,358-(no_ring - i)*10);
g.drawLine(100-(i*8),357-(no_ring - i)*10,100+(i*8)+5,357-(no_ring - i)*10);
g.drawLine(100-(i*8),356-(no_ring - i)*10,100+(i*8)+5,356-(no_ring - i)*10);
// draw for each rod
//System.out.println("rod11:"+rod11);
//System.out.println("rod22:"+rod22);
//System.out.println("rod33:"+rod33);
int r1 = rod11.size();
int r2 = rod22.size();
int r3 = rod33.size();
String rd1,rd2,rd3;
int r11,r12,r21,r22,r31,r32;
if(initial == false)
{ g.setColor(Color.RED);
while(rod11.size()>0)
{ r12 = rod11.size()-1;
rd1 = (String)rod11.remove(r12);
r11 = Integer.valueOf(rd1).intValue();
g.drawLine(100-((r11+1)*8),360-(r1 - (r11+1))*10,100+((r11+1)*8)+5,360-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),359-(r1 - (r11+1))*10,100+((r11+1)*8)+5,359-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),358-(r1 - (r11+1))*10,100+((r11+1)*8)+5,358-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),357-(r1 - (r11+1))*10,100+((r11+1)*8)+5,357-(r1 - (r11+1))*10);
g.drawLine(100-((r11+1)*8),356-(r1 - (r11+1))*10,100+((r11+1)*8)+5,356-(r1 - (r11+1))*10);
while(rod22.size()>0)
{ g.setColor(Color.RED);
r22 = rod22.size()-1;
System.out.println("TEST *************************:"+r22);
try
// e.printStackTrace();
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr) ;
br.readLine() ;
}catch(Exception f) {}
rd2 = ((String)rod22.remove(r22)).trim();
r21 = Integer.valueOf(rd2).intValue();
g.drawLine(300-((r22+1)*8),360-(r2 - (r22+1))*10,300+((r22+1)*8)+5,360-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),359-(r2 - (r22+1))*10,300+((r22+1)*8)+5,359-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),358-(r2 - (r22+1))*10,300+((r22+1)*8)+5,358-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),357-(r2 - (r22+1))*10,300+((r22+1)*8)+5,357-(r2 - (r22+1))*10);
g.drawLine(300-((r22+1)*8),356-(r2 - (r22+1))*10,300+((r22+1)*8)+5,356-(r2 - (r22+1))*10);
while(rod33.size()>0)
{ g.setColor(Color.RED);
r32 = rod33.size()-1;
rd3 = (String)rod33.remove(r32);
r31 = Integer.valueOf(rd3).intValue();
g.drawLine(500-((r32+1)*8),360-(r3 - (r32+1))*10,500+((r32+1)*8)+5,360-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),359-(r3 - (r32+1))*10,500+((r32+1)*8)+5,359-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),358-(r3 - (r32+1))*10,500+((r32+1)*8)+5,358-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),357-(r3 - (r32+1))*10,500+((r32+1)*8)+5,357-(r3 - (r32+1))*10);
g.drawLine(500-((r32+1)*8),356-(r3 - (r32+1))*10,500+((r32+1)*8)+5,356-(r3 - (r32+1))*10);
why i m not able to use repaint() method in tower class? from where i can use repaint() methodi can't read your code - not formatted with code tags
I have no chance of getting it to compile (AboutDialog class?? p.draw() ??)
here's a basic routine - add a couple of things to this to demonstrate what is not
being redrawn
(compare the readability of below code (using tags) to yours)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Testing extends JFrame
public Testing()
setSize(400,300);
setLocation(400,300);
setDefaultCloseOperation(EXIT_ON_CLOSE);
final DrawPanel dp = new DrawPanel();
JButton btn = new JButton("Change Text Location/Repaint");
getContentPane().add(dp,BorderLayout.CENTER);
getContentPane().add(btn,BorderLayout.SOUTH);
btn.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
dp.x = (int)(Math.random()*300);
dp.y = (int)(Math.random()*150)+50;
repaint();}});
public static void main(String[] args){new Testing().setVisible(true);}
class DrawPanel extends JPanel
int x = 50, y = 50;
public void paintComponent(Graphics g)
super.paintComponent(g);
g.drawString("Hello World",x,y);
} -
How to use the readLine() method when reading data from a URL?
Hello,
I have a URL which contains text input.
The only way to get the data from this URL is by opening a URL connection to it.
I would like to get the data from this URL but at the same time I would like to be able to use readLine() method of BufferedReader in order to read the data line by line.
My question is how do I combine between these two requirements in order to reed the data from the URL?
RoyHello Roy,
can you try out this code.
URL yahoo = new URL("http://www.yahoo.com/");
URLConnection yc = yahoo.openConnection();
BufferedReader in = new BufferedReader(
new InputStreamReader(
yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
Regards,
Mohan R
Maybe you are looking for
-
Adobe Media Encoder - Issue with exporting file
When I send a file to Adobe Media Encoder and I hit queue I get an error, "could not read from source file, please check if it has been moved or deleted". The source file location that the AME is trying to use is C:\Users\User Name\AppData\local\temp
-
How to include a structure in a method
Hi All, when i executed this statement in a method types : BEGIN OF TY_ITAB2. INCLUDE STRUCTURE LTAP_VB. types : END OF TY_ITAB2. Syntax Message: Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary types, not
-
Is possible to Convert a 1 bit B&W Tiff image to a 16 Bit Greyscale Tiff image?
Hi there, I am trying to convert a 1 bit Black & White Tiff image to a 16 Bit Greyscale Tiff image, Anyone out there know if it is possible and how it may be done? We are using Adobe Acrobat 9 Pro Extended. Any help would be appreciated. Cheers, Chri
-
AMDP exporting table with fields from various sources
I am writing an AMDP that has an output table a list of employees and attributes. These attributes have various sources with various keys. If I cannot with any practicality construct this table with a single select statement, which given my search
-
Unable to connect to database properly in eclipse ,jboss environment
hi guys .... i wrote on samll singleton class for db connection to connect to cloudscape database in my web application. iam able to insert records but when selecting records iam not able to create instance of Connection object and iam tried to displ