Object Creation Of One class into another and vice versa
Hello Everyone,
My name is Prashant Sharma from Jaipur [Rajasthan]
Can u people help me
How to create of one class into another and vice versa
Eg,
I am having class A and class B
I want to create object of class A into class B and vice versa
Plz help me out of this problem as soon as possible....
Read this: [Creating Objects|http://java.sun.com/docs/books/tutorial/java/javaOO/objectcreation.html]
Then, do one of these three:
1. Create an instance of the class
2. Extend the class
3. Access methods within the class
Try it out. Post the problem code if you're having trouble.
Similar Messages
-
MFP Anomaly Detected Access Points are moving from one wlc to another and vice versa
Hi together,
a customer has lost some Access Points to another WLC with 7.2 and then they come back after 15 minutes to the origin WLC with 7.5
Attached the messages
MFP Protection is configured as optional
152
Wed Nov 27 05:33:26 2013
MFP Anomaly Detected - 1 Not encrypted event(s) found as violated by the radio 58:bf:ea:0f:67:4a and detected by the dot11 interface at slot 1 of AP 58:bf:ea:0f:67:40 in 300 seconds when observing . Client's last source mac 70:11:24:e4:43:0f
153
Wed Nov 27 05:31:40 2013
AP Disassociated. Base Radio MAC:88:43:e1:56:91:d0
154
Wed Nov 27 05:31:40 2013
AP's Interface:0(802.11b) Operation State Down: Base Radio MAC:88:43:e1:56:91:d0 Cause=New Discovery Status:NA
155
Wed Nov 27 05:31:33 2013
AP Disassociated. Base Radio MAC:58:bf:ea:0f:73:d0
156
Wed Nov 27 05:31:33 2013
AP's Interface:1(802.11a) Operation State Down: Base Radio MAC:58:bf:ea:0f:73:d0 Cause=New Discovery Status:NA
157
Wed Nov 27 05:31:33 2013
AP's Interface:0(802.11b) Operation State Down: Base Radio MAC:58:bf:ea:0f:73:d0 Cause=New Discovery Status:NA
158
Wed Nov 27 05:31:28 2013
AP Disassociated. Base Radio MAC:58:bf:ea:0f:fc:20
159
Wed Nov 27 05:31:28 2013
AP's Interface:1(802.11a) Operation State Down: Base Radio MAC:58:bf:ea:0f:fc:20 Cause=New Discovery Status:NA
160
Wed Nov 27 05:31:28 2013
AP's Interface:0(802.11b) Operation State Down: Base Radio MAC:58:bf:ea:0f:fc:20 Cause=New Discovery Status:NA
161
Wed Nov 27 05:31:17 2013
AP Disassociated. Base Radio MAC:b4:e9:b0:e4:02:20
162
Wed Nov 27 05:31:17 2013
AP's Interface:1(802.11a) Operation State Down: Base Radio MAC:b4:e9:b0:e4:02:20 Cause=New Discovery Status:NA
163
Wed Nov 27 05:31:17 2013
AP's Interface:0(802.11b) Operation State Down: Base Radio MAC:b4:e9:b0:e4:02:20 Cause=New Discovery Status:NA
164
Wed Nov 27 05:31:15 2013
AP Disassociated. Base Radio MAC:a4:18:75:eb:da:b0
165
Wed Nov 27 05:31:15 2013
AP's Interface:1(802.11a) Operation State Down: Base Radio MAC:a4:18:75:eb:da:b0 Cause=New Discovery Status:NA
166
Wed Nov 27 05:31:15 2013
AP's Interface:0(802.11b) Operation State Down: Base Radio MAC:a4:18:75:eb:da:b0 Cause=New Discovery Status:NA
167
Wed Nov 27 05:28:26 2013
MFP Anomaly Detected - 35 Not encrypted event(s) found as violated by the radio d8:24:bd:2f:df:6f and detected by the dot11 interface at slot 1 of AP d8:24:bd:2f:df:60 in 300 seconds when observing Deauth. Client's last source mac 00:23:14:a7:e3:54
168
Wed Nov 27 05:23:26 2013
MFP Anomaly Detected - 23 Not encrypted event(s) found as violated by the radio f8:4f:57:a5:40:b2 and detected by the dot11 interface at slot 0 of AP f8:4f:57:a5:40:b0 in 300 seconds when observing . Client's last source mac 44:4c:0c:ba:27:77
Don´t know at the moment how to handle it.
Regards
AlexHi lAlex,
Disable Client MFP under WLAN advanced tab & see if this still occur
Regards
Rasika
**** Pls rate all useful responses ***** -
How do i Drag and drop From one tree to another and vise versa?
I have two tree structures and i'm trying to drag a leaf of a branch from one tree to another and vise versa. i'm using flex 3 to code it. I'm also trying to put a prevention on dropping a leaf of one tree from being dropped inside a branch of another tree. Anything that is dragged over to another tree should be placed as a dangling node in that tree. Please share this code and help me find a solution.
<?xml version="1.0" encoding="utf-8"?><mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml" xmlns:comp="
com.adobe.flex.extras.controls.*" initialize="data2
new
ArrayCollection(countries);"layout="
absolute"verticalAlign="
middle" backgroundColor="white" height="
551">
<mx:Script>
<![CDATA[
importmx.events.FlexEvent;
importmx.collections.ArrayCollection;
importmx.controls.Alert;
importmx.events.DragEvent;
importmx.managers.DragManager;
importmx.core.DragSource;
importmx.core.UIComponent;
importmx.controls.Tree;
// data provider for role name[
Bindable] private vardata2: ArrayCollection;
// variable to store the node that is dragged from a tree
private var draggedItemOfAccessTree:XML = null;
private var draggedItemOfExclusionTree:XML = null;
private var dragItemAccess:DisplayObject =null;
private var dragItemExclusion:DisplayObject =null;
// Array to store the Role list[
Bindable]public varcountries: Array = [{id: 0, name:
"Role 1"},{id: 1, name:
"Role 2"},{id: 2, name:
"Role 3"},{id: 3, name:
"Role 4"},{id: 4, name:
"Role 5"},{id: 5, name:
"Role 6"},{id: 6, name:
"Role 7"},{id: 7, name:
"Role 8"},{id: 8, name:
"Role 9"},{id: 9, name:
"Role 10"},{id: 10,name:
"Role 11"}
// this event is called when we begin dragging a node in a tree
private function onAccessListDragEnter( event:DragEvent ) : void{
event.preventDefault();
vards1:DragSource = event.dragSource;
var items1:Array = ds1.dataForFormat("treeItems") asArray;
if (items1 != null && items1.length > 0 && (items1[0] isXML)){
draggedItemOfAccessTree = items1[0];
dragItemAccess = items1[0]
asDisplayObject;}
DragManager.acceptDragDrop(UIComponent(event.currentTarget));
private function onExclusionListDragEnter( event:DragEvent ) : void{
event.preventDefault();
vards2:DragSource = event.dragSource;
var items2:Array = ds2.dataForFormat("treeItems") asArray;
if (items2 != null && items2.length > 0 && (items2[0] isXML)){
draggedItemOfExclusionTree = items2[0];
dragItemExclusion =items2[0]
asDisplayObject;}
DragManager.acceptDragDrop(UIComponent(event.currentTarget));
private function onAccessListDragOver( event:DragEvent ) : void{
event.preventDefault();
varvar1:Number = AccessTree.selectedIndex;
varvar2:Number = ExclusionTree.calculateDropIndex(event);
var node1:XML = AccessTree.selectedItem asXML;
var node2:XML = ExclusionTree.calculateDropIndex(event) asXML;
//restrict drag & drop to nodes within same parent
if(draggedItemOfAccessTree.parent() == node1.parent() || draggedItemOfAccessTree.parent() != node1.parent()){
DragManager.showFeedback(DragManager.NONE);
//return; }
elseDragManager.showFeedback(DragManager.MOVE);
private function onExclusionListDragOver( event:DragEvent ) : void{
event.preventDefault();
varvar1:Number = ExclusionTree.selectedIndex;
varvar2:Number = AccessTree.calculateDropIndex(event);
var node1:XML = AccessTree.calculateDropIndex(event) asXML;
var node2:XML = ExclusionTree.selectedItem asXML;
//restrict drag & drop to nodes within same parent
if( draggedItemOfExclusionTree.parent() == node2.parent() || draggedItemOfExclusionTree.parent() != node2.parent()){
DragManager.showFeedback(DragManager.NONE);
// return; }
elseDragManager.showFeedback(DragManager.MOVE);
private function onAccessListDragDrop( event:DragEvent ) : void{
event.preventDefault();
varSindex:Number = AccessTree.selectedIndex;
varEindex:Number= ExclusionTree.calculateDropIndex(event);
var Enode:XML = ExclusionTree.selectedItem asXML;
var Anode:XML = AccessTree.selectedItem asXML;
if((draggedItemOfAccessTree.parent() != Anode.parent()) ){
AccessTree.removeChildAt(Sindex);
ExclusionTree.addChildAt(dragItemAccess , Eindex);
// AccessTree.rdataDescriptor.removeChildAt(Anode.parent(),draggedItemOfAccessTree,Sindex);
//ExclusionTree.dataDescriptor.addChildAt(Enode.parent(),draggedItemOfAccessTree,Eindex); }
private function onExclusionListDragDrop( event:DragEvent ) : void{
event.preventDefault();
varEindex:Number = ExclusionTree.selectedIndex;
varSindex:Number = AccessTree.calculateDropIndex(event);
var Anode:XML = AccessTree.selectedItem asXML;
var Enode:XML = ExclusionTree.selectedItem asXML;
if((draggedItemOfExclusionTree.parent() != Enode.parent()) ){
ExclusionTree.removeChildAt(Eindex);
AccessTree.addChildAt(dragItemExclusion, Sindex);
// ExclusionTree.dataDescriptor.removeChildAt(Enode.parent(),draggedItemOfExclusionTree,Eind ex);
// AccessTree.dataDescriptor.addChildAt(Anode.parent(),draggedItemOfExclusionTree,Eindex); }
private function onDragComplete( event:DragEvent ) : voidYes, I have set dragEnabled and dropEnabled to true. I trying to put restriction on dropping the node(aka leaf) of 1st free tree inside the branch(aka folder) of the 2nd tree. If something is dragged from tree1, it should be dropped only on tree2 i.e., dragged node should be appended at the end of tree2 and not inside nay of the branches of tree2. This functionality should work on both the trees. I'll be glad if u can provide the solution.
-
How to convert ascii value into character and vice versa
Hello the java world people,
I want to convert each characters from my array into their corespondent ascii value and vice versa, how can I do that ?The term "ASCII" is often used very loosely.
Java char values are UNICODE and the ASCII codes are indentical to UNICODE characters in the range 0 .. 127. UNICODE values 128 and above don't have coresponding ASCII values, though 128-255 corespond to ISO-8859-1 which is one of the encodings often called "extended ASCII".
As shown above you can covert between chars and coresponding int value simply with a cast, but you should be aware that the more exotic characters will not give you sensible values. -
Connecting multiple CRM systems to one backend R/3 and vice versa
Hello experts
Can you tell me whether it is advisable to connect 2 CRM systems to a single backend R/3 and vice versa? Is it recommended by SAP? I require some notes or docs on this. I got some notes on this forum but they are all Internal ones which I am unable to see.
Please help!
Warm Regards
DebolinaHi,
Though SAP does not recommend connecting multiple systems to one ECC backend. But still it has designed a procedure to achieve this.
Here is the excerpts of the steps required.
1. Execute report MCRM_SETTINGS for each CRM system connected to the ERP
system.
2. Check the entries of the table CRMRFCPAR of the connected ERP system:
The field REM_LOGSYS should be filled for every entry marked with
u2018Created by the MCRM reportu2019.
3. Activate the corresponding consumers in the table CRMCONSUM
(transaction SM30).
4. Internal and external number ranges for Business Partners have to be aligned
manually.
Hope it helps you!!!!
Good Luck.
Pardeep -
How to override attributes of one class into another class in OOPS ABAP
I was trying to override attribute(data memeber) defined in super class into subclass ,
but I didnt find any solution to that.
Please tell me ho to do that?
Ex
Class ABC definition
Public section
data : x type i.
end class
Calss XYZ definition inheriting from ABC.
Publec section.
data : x type i. <<----
here is the problem
endclass.when you define a subclass all the properties of superclass are inherited into class.
You dont need to define it again.
data : x type i " delete this line.
Object of your subclass will be able to recognize x.
Regards,
Lalit Mohan Gupta. -
I have been using folders to organize all my pictures and I will copy photos from folder to folder, often having them in 2 or 3 folders based on use. I tried to copy a photo in Organizer PSE12 from one folder to another and you can only move it, that means I can only have one copy of the photo. That is fine if I am using tags and want to search for it, but I want to have mult copies in mult folders. Organizer will recognize that it is there but it won't import it into the new folder. Until I move it, it stays in the original folder. I can drag it out of Organizer and drop (copy) it into a new folder fine, but it won't show in organizer in the new folder. Is there any way to copy and have multiple copies show up in multiple folders?
Hi,
The organizer works on the principle of not having multiple copies of the same photo.
If you have multiple copies spread in different folders, then making changes to one doesn't affect the others. The use of tags and albums are there to give different views of your photos.
You can't have multiple copies with exactly the same name even if they are in different folders. You could select a photo and duplicate it (File -> Duplicate) and then move the copy into a different folder but the name will be different.
If you want different folders for a specific reason, it is possible to use albums to collect the group of photos and then export them to a new folder outside of the organizer. You can also rename on export which is useful if you want to arrange the photos in a specific order.
Hope that helps a bit.
Brian -
How do I move an object from one photo to another and then change the scene, i.e. winter to summer?
OK.
Open the picture with the new scene. This will be your canvas.
Open the picture with object A, select it with one of the selection tools, go to Edit>copy
Go back to the new scene/canvas, Go to Edit>paste
Repeat for object B
Use the move tool to position A & B, each on its own layer. Use the corner handles of the bounding box to resize, if necessary
You should have 3 layers: Background layer, and the 2 layers with A & B
Note: It's best if the resolution of the 3 picture files is the same value. -
Hello everybody,
I would like to copy all the songs from one Ipod into another. All the songs are into my Itunes account, I tried to drag and drop the songs from the old Ipod to the new one but it doesn't work. Is there a way to do it ?
I share one Itunes account with other people from my family and one person would like to keep the same songs on the new Ipod as the ones which were on the old one.
Thanks in advance for your answer.
YanHello Chris,
Thanks for your answer. I was hoping for an easier answer. Too bad there is no drag and drop solution, it would have been much easier.
Thanks for answering so fast.
Bye.
Yan -
Images I move from one folder into another are disappearing, at first it was occurring immediately and only if I did not copy and paste the images. Today however I found out that images I had been using for days just up and vanished from their new location. A few of these images had copies in another folder that remained and the ones I couldn't find may or may not have ever had copies. I had backed up my system with time machine recently as well, so I went into the backup to retreive the lost images. When I searched and found the backup copies I got the error "the file alias cannot be opened because the original cannot be located". The crazy thing is that the images that remained on my computer did not give me the same error and opened like they should.
In short images that I am creating, saving, and using are disapearing so epically that even time machine versions are affected when retrieval is attempted. Any suggestions as to what I could be doing wrong without realizing it? Or perhaps other people have had similar bugs that are software related and have a solution?Hi Kevin,
I understand what you tried to do but it doesn't work that way. Swapping drive names will just mess things up.
You should be able to reconnect the files though: in the Locate Referenced Files dialog make sure you click the Show Reconnect Options button — this will give you access to all the connected drives. Locate one of the files and hit Reconnect All. Should do the trick.
Best -
I dragged a cut out image from one photoshop document into another and now it is blurry. What can I do to prevent this?
What is the resolution of the image that you "dragged"? The resolution is the number in pixels per inch (ppi). If you dragged a significantly lower resolution file into a higher resolution file, it could result in a blurry image.
see below:
For further reading of Key Concepts:
http://www.adobe.com/designcenter-archive/keyconcepts/articles/concept_resolution.html
You can determine the image size by choosing Image > Image Size
below you can see the pixel dimensions of my example image.
Resolution Basics:
Adobe TV- http://tv.adobe.com/watch/creative-sweet-tv/photoshop-resolution-basics/
http://tv.adobe.com/watch/visual-design/getting-started-09-resizing-an-image/
Adobe Help:
http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-7945a.h tml
-janelle -
How to transter contents of itab from one class to another...
Hello experts,
I am currently having problems on how to transfer the contents of an itab or even
the value of a variable from one class to another. For example, I have 10 records
in it_spfli in class 1 and when I loop at it_spfli in the method of class 2 it has no records!
This is an example:
class lcl_one definition.
public section.
data: gt_spfli type table of spfli.
methods get_data.
endclass.
class lcl_one implementation.
method get_data.
select * from spfli
into table gt_spfli.
endmethod.
endclass.
class lcl_two definition inheriting from lcl_one.
public section.
methods loop_at_itab.
endclass.
class lcl_two implementation.
method loop_at_itab.
field-symbols: <fs_spfli> like line of gt_spfli.
loop at gt_spfli assigning <fs_spfli>.
write: / <fs_spfli>-carrid.
endloop.
endmethod.
endclass.
start-of-selection.
data: one type ref to lcl_one,
two type ref to lcl_two.
create object: one, two.
call method one->get_data.
call method two->loop_at_itab.
In the example above, the contents of gt_spfli in class lcl_two is empty
even though it has records in class lcl_one. Help would be appreciated.
Thanks a lot guys and take care!Hi Uwe,
It is still the same. Here is my code:
REPORT zfi_ors_sms
NO STANDARD PAGE HEADING
LINE-SIZE 255
LINE-COUNT 65
MESSAGE-ID zz.
Include program/s *
INCLUDE zun_standard_routine. " Standard Routines
INCLUDE zun_header. " Interface Header Record
INCLUDE zun_footer. " Interface Footer Record
INCLUDE zun_interface_control. " Interface Control
INCLUDE zun_external_routine. " External Routines
INCLUDE zun_globe_header. " Report header
INCLUDE zun_bdc_routine. " BDC Routine
Data dictionary table/s *
TABLES: bkpf,
rf05a,
sxpgcolist.
Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file TYPE sxpgcolist-parameters.
SELECTION-SCREEN END OF BLOCK b1.
*/ CLASS DEFINITIONS
CLASS lcl_main DEFINITION
CLASS lcl_main DEFINITION ABSTRACT.
PUBLIC SECTION.
Structure/s *
TYPES: BEGIN OF t_itab,
rec_content(100) TYPE c,
END OF t_itab.
TYPES: BEGIN OF t_upfile,
record_id(2) TYPE c, " Record ID
rec_date(10) TYPE c, " Record Date MM/DD/YYYY
prod_line(10) TYPE c, " Product Line
acc_code(40) TYPE c, " Acc Code
description(50) TYPE c, " Description
hits(13) TYPE c, " Hits
amount(15) TYPE c, " Amount
END OF t_upfile.
Internal table/s *
DATA: gt_bdcdata TYPE STANDARD TABLE OF bdcdata,
gt_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll,
gt_itab TYPE STANDARD TABLE OF t_itab,
gt_header LIKE TABLE OF interface_header,
gt_footer LIKE TABLE OF interface_footer,
gt_upfile TYPE STANDARD TABLE OF t_upfile.
Global variable/s *
DATA: gv_target TYPE rfcdisplay-rfchost,
gv_err_flag(1) TYPE n VALUE 0,
gv_input_dir(100) TYPE c
VALUE '/gt/interface/FI/ORS/inbound/',
gv_inputfile_dir(255) TYPE c,
gv_eof_flag TYPE c VALUE 'N',
gv_string TYPE string,
gv_delimiter TYPE x VALUE '09',
gv_input_records(3) TYPE n,
gv_input_file_ctr(6) TYPE n,
gv_proc_tot_amt(14) TYPE p DECIMALS 2,
gv_prg_message TYPE string,
gv_gjahr TYPE bkpf-gjahr,
gv_monat TYPE bsis-monat.
Work area/s *
DATA: wa_itab LIKE LINE OF gt_itab,
wa_upfile LIKE LINE OF gt_upfile,
wa_footer LIKE LINE OF gt_footer,
wa_header LIKE LINE OF gt_header.
ENDCLASS.
CLASS lcl_read_app_server_file DEFINITION
CLASS lcl_read_app_server_file DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: read_app_server_file,
read_input_file,
split_header,
process_upload_file,
split_string,
conv_num CHANGING value(amount) TYPE t_upfile-amount,
split_footer,
update_batch_control,
process_data.
ENDCLASS.
CLASS lcl_process_data DEFINITION
CLASS lcl_process_data DEFINITION INHERITING FROM
lcl_read_app_server_file.
PUBLIC SECTION.
METHODS process_data REDEFINITION.
ENDCLASS.
*/ CLASS IMPLEMENTATIONS
CLASS lcl_read_app_server_file IMPLEMENTATION
CLASS lcl_read_app_server_file IMPLEMENTATION.
*/ METHOD read_app_server_file - MAIN METHOD
METHOD read_app_server_file.
gv_target = sy-host.
PERFORM file_copy USING 'ZPPDCP' p_file 'HP-UX'
gv_target CHANGING gv_err_flag.
CONCATENATE gv_input_dir p_file INTO gv_inputfile_dir.
open application server file
PERFORM open_file USING gv_inputfile_dir 'INPUT'
CHANGING gv_err_flag.
WHILE gv_eof_flag = 'N'.
READ DATASET gv_inputfile_dir INTO wa_itab.
APPEND wa_itab TO gt_itab.
IF sy-subrc <> 0.
gv_eof_flag = 'Y'.
EXIT.
ENDIF.
CALL METHOD me->read_input_file.
ENDWHILE.
close application file server
PERFORM close_file USING gv_inputfile_dir.
IF wa_footer-total_no_rec <> gv_input_file_ctr.
MOVE 'Header Control on Number of Records is Invalid' TO
gv_prg_message.
PERFORM call_ws_message USING 'E' gv_prg_message 'Error'.
gv_err_flag = 1.
ELSEIF wa_footer-total_no_rec EQ 0 AND gv_input_file_ctr EQ 0.
MOVE 'Input File is Empty. Batch Control will be Updated' TO
gv_prg_message.
PERFORM call_ws_message USING 'I' gv_prg_message 'Information'.
CALL METHOD me->update_batch_control.
gv_err_flag = 1.
ENDIF.
IF gv_err_flag <> 1.
IF wa_footer-total_amount <> gv_proc_tot_amt.
MOVE 'Header Control on Amount is Invalid' TO gv_prg_message.
PERFORM call_ws_message USING 'E' gv_prg_message 'Error'.
gv_err_flag = 1.
ENDIF.
ENDIF.
ENDMETHOD.
*/ METHOD read_input_file
METHOD read_input_file.
CASE wa_itab-rec_content+0(2).
WHEN '00'.
CALL METHOD me->split_header.
WHEN '01'.
CALL METHOD me->process_upload_file.
ADD 1 TO gv_input_file_ctr.
ADD wa_upfile-amount TO gv_proc_tot_amt.
WHEN '99'.
CALL METHOD me->split_footer.
WHEN OTHERS.
gv_err_flag = 1.
ENDCASE.
ENDMETHOD.
*/ METHOD split_header
METHOD split_header.
CLEAR: wa_header,
gv_string.
MOVE wa_itab TO gv_string.
SPLIT gv_string AT gv_delimiter INTO
wa_header-record_id
wa_header-from_system
wa_header-to_system
wa_header-event
wa_header-batch_no
wa_header-date
wa_header-time.
APPEND wa_header TO gt_header.
ENDMETHOD.
*/ METHOD process_upload_file
METHOD process_upload_file.
CLEAR gv_string.
ADD 1 TO gv_input_records.
MOVE wa_itab-rec_content TO gv_string.
CALL METHOD me->split_string.
CALL METHOD me->conv_num CHANGING amount = wa_upfile-amount.
APPEND wa_upfile TO gt_upfile.
ENDMETHOD.
*/ METHOD split_string
METHOD split_string.
CLEAR wa_upfile.
SPLIT gv_string AT gv_delimiter INTO
wa_upfile-record_id
wa_upfile-rec_date
wa_upfile-prod_line
wa_upfile-acc_code
wa_upfile-description
wa_upfile-hits
wa_upfile-amount.
ENDMETHOD.
*/ METHOD conv_num
METHOD conv_num.
DO.
REPLACE gv_delimiter WITH ' ' INTO amount.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
ENDMETHOD.
*/ METHOD split_footer
METHOD split_footer.
CLEAR: wa_footer,
gv_string.
MOVE wa_itab TO gv_string.
SPLIT gv_string AT gv_delimiter INTO
wa_footer-record_id
wa_footer-total_no_rec
wa_footer-total_amount.
CALL METHOD me->conv_num CHANGING amount = wa_footer-total_amount.
APPEND wa_footer TO gt_footer.
ENDMETHOD.
*/ METHOD update_batch_control
METHOD update_batch_control.
DATA: lv_sys_date TYPE sy-datum,
lv_sys_time TYPE sy-uzeit,
lv_temp_date(10) TYPE c.
CONCATENATE wa_header-date4(4) wa_header-date2(2)
wa_header-date+0(2)
INTO lv_temp_date.
MOVE lv_temp_date TO wa_header-date.
APPEND wa_header-date TO gt_header.
Update ZTF0001 Table
PERFORM check_interface_header USING wa_header 'U' 'GLOB'
CHANGING gv_err_flag.
Archive files
PERFORM archive_files USING 'ZPPDARC' gv_inputfile_dir 'HP-UX'
gv_target CHANGING gv_err_flag.
ENDMETHOD.
METHOD process_data.
SORT gt_upfile ASCENDING.
CLEAR wa_upfile.
READ TABLE gt_upfile INDEX 1 INTO wa_upfile.
IF sy-subrc = 0.
MOVE: wa_upfile-rec_date+6(4) TO gv_gjahr,
wa_upfile-rec_date+0(2) TO gv_monat.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_process_data IMPLEMENTATION
CLASS lcl_process_data IMPLEMENTATION.
METHOD process_data.
CALL METHOD super->process_data.
IF NOT gt_upfile[] IS INITIAL.
ENDIF.
ENDMETHOD.
ENDCLASS.
Start of selection *
START-OF-SELECTION.
DATA: read TYPE REF TO lcl_read_app_server_file,
process TYPE REF TO lcl_process_data.
CREATE OBJECT: read, process.
CALL METHOD read->read_app_server_file.
CALL METHOD process->process_data. -
Passing Variables from One Class to Another
Hello, I am new to Java Programming and I'm currently starting off by trying to build a simple application.
I need help to pass variables created in one class to another.
In my source package, I created 2 java classes.
1. Main.java
2. InputFileDeclared.java
InputFileDeclared reads numerical data from an external text file and store them as string variables within the main method while Main converts a text string into a number.
Hence, I would like to pass these strings variables from the InputFileDeclared class to the Main class so that they can be converted into numbers.
I hope somebody out there may enlighten me on this.
Thank you very much in advance!Values are passed from method to method, rather than from class to class. In a case such as you describe the code of a method in Main will probably call a method in InputFileDeclared which will return the String you want. The method in Main stores that in a local variable and processes it. It really doesn't matter here which class the method is in.
You InputFileDeclared object probably contains "state" information in its fields such as the details of the file it's reading and how far it's got, but generally the calling method in Main won't need to know about this state, just the last data read.
So the sequence in the method in Main will be:
1) Create an new instance of InputFileDeclared, probably passing it the file path etc..
2) Repeatedly call a method on that instance to return data values, until the method signals that it's reached the end of file, e.g. by returning a null String.
3) Probably call a "close()" method on the instance, which you should have written to close the file. -
Calling a drawLine() from one class to another from an ActionEvent
I have several JPanel objects called and placed on a JFrame. The JFrame has a RadioButton group with radio buttons. If I select a radio button and call a drawLine() method from a JPanel, I receive a "NullPointerException". Is it not possible to call this graphic method from one class to another?
Thanks for any input you can provide.
JohnRemember that each panel draws it's own current state. So you need the ActionPerformed to change the state in your target panel.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
public class PanelComm extends JPanel {
private SubPanelOne subPanelOne = new SubPanelOne();
private SubPanelTwo subPanelTwo = new SubPanelTwo();
public class SubPanelOne extends JPanel {
public SubPanelOne () {
setLayout ( new BorderLayout() );
setBorder ( BorderFactory.createTitledBorder ( "SubPanel One" ) );
Reactor reactor = new Reactor();
ButtonGroup group = new ButtonGroup();
JPanel radioPanel = new JPanel(new GridLayout(0, 1));
JRadioButton buttonOne = new JRadioButton ( "One" );
buttonOne.addActionListener ( reactor );
group.add ( buttonOne );
radioPanel.add ( buttonOne );
JRadioButton buttonTwo = new JRadioButton ( "Two" );
buttonTwo.addActionListener ( reactor );
group.add ( buttonTwo );
radioPanel.add ( buttonTwo );
JRadioButton buttonThree = new JRadioButton ( "Three" );
buttonThree.addActionListener ( reactor );
group.add ( buttonThree );
radioPanel.add ( buttonThree );
add ( radioPanel ,BorderLayout.LINE_START );
protected void paintComponent ( Graphics _g ) {
super.paintComponent ( _g );
Graphics2D g = (Graphics2D)_g;
g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
public class SubPanelTwo extends JPanel {
private JLabel text = new JLabel();
public SubPanelTwo () {
setLayout ( new BorderLayout() );
setBorder ( BorderFactory.createTitledBorder ( "SubPanel Two" ) );
text.setFont ( new Font ( "Verdana" ,Font.PLAIN ,30 ) );
text.setHorizontalAlignment ( JLabel.CENTER );
add ( text ,BorderLayout.CENTER );
protected void paintComponent ( Graphics _g ) {
super.paintComponent ( _g );
Graphics2D g = (Graphics2D)_g;
g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
public void setChoice ( String cmd ) {
text.setText ( cmd );
public class Reactor implements ActionListener {
public void actionPerformed ( ActionEvent e ) {
subPanelTwo.setChoice ( e.getActionCommand() );
public PanelComm () {
setLayout ( new GridLayout ( 1 ,2 ) );
add ( subPanelOne );
add ( subPanelTwo );
// main
public static void main ( String[] args ) {
JFrame f = new JFrame ( "Panel Communication" );
f.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
f.getContentPane().add ( new PanelComm() ,BorderLayout.CENTER );
f.setSize ( 320 ,120 );
f.setVisible ( true );
} // main
} -
Passing a parameter from one class to another class in the same package
Hi.
I am trying to pass a parameter from one class to another class with in a package.And i am Getting the variable as null every time.In the code there is two classes.
i. BugWatcherAction.java
ii.BugWatcherRefreshAction.Java.
We have implemented caching in the front-end level.But according to the business logic we need to clear the cache and again have to access the database after some actions are happened.There are another class file called BugwatcherPortletContent.java.
So, we are dealing with three java files.The database interaction is taken care by the portletContent.java file.Below I am giving the code for the perticular function in the bugwatcherPortletContent.java:
==============================================================
public Object loadContent() throws Exception {
Hashtable htStore = new Hashtable();
JetspeedRunData rundata = this.getInputData();
String pId = this.getPorletId();
PortalLogger.logDebug(" in the portlet content: "+pId);
pId1=pId;//done by sraha
htStore.put("PortletId", pId);
htStore.put("BW_HOME_URL",CommonUtil.getMessage("BW.Home.Url"));
htStore.put("BW_BUGVIEW_URL",CommonUtil.getMessage("BW.BugView.Url"));
HttpServletRequest request = rundata.getRequest();
PortalLogger.logDebug(
"BugWatcherPortletContent:: build normal context");
HttpSession session = null;
int bugProfileId = 0;
Hashtable bugProfiles = null;
Hashtable bugData = null;
boolean fetchProfiles = false;
try {
session = request.getSession(true);
// Attempting to get the profiles from the session.
//If the profiles are not present in the session, then they would have to be
// obtained from the database.
bugProfiles = (Hashtable) session.getAttribute("Profiles");
//Getting the selected bug profile id.
String bugProfileIdObj = request.getParameter("bugProfile" + pId);
// Getting the logged in user
String userId = request.getRemoteUser();
if (bugProfiles == null) {
fetchProfiles = true;
if (bugProfileIdObj == null) {
// setting the bugprofile id as -1 indicates "all profiles" is selected
bugProfileIdObj =(String) session.getAttribute("bugProfileId" + pId);
if (bugProfileIdObj == null) {
bugProfileId = -1;
else {
bugProfileId = Integer.parseInt(bugProfileIdObj);
else {
bugProfileId = Integer.parseInt(bugProfileIdObj);
session.setAttribute(
("bugProfileId" + pId),
Integer.toString(bugProfileId));
//fetching the bug list
bugData =BugWatcherAPI.getbugList(userId, bugProfileId, fetchProfiles);
PortalLogger.logDebug("BugWatcherPortletContent:: got bug data");
if (bugData != null) {
Hashtable htProfiles = (Hashtable) bugData.get("Profiles");
} else {
htStore.put("NoProfiles", "Y");
} catch (CodedPortalException e) {
htStore.put("Error", CommonUtil.getErrMessage(e.getMessage()));
PortalLogger.logException
("BugWatcherPortletContent:: CodedPortalException!!",e);
} catch (Exception e) {
PortalLogger.logException(
"BugWatcherPortletContent::Generic Exception!!",e);
htStore.put( "Error",CommonUtil.getErrMessage(ErrorConstantsI.GET_BUGLIST_FAILED));
if (fetchProfiles) {
bugProfiles = (Hashtable) bugData.get("Profiles");
session.setAttribute("Profiles", bugProfiles);
// putting the stuff in the context
htStore.put("Profiles", bugProfiles);
htStore.put("SelectedProfile", new Integer(bugProfileId));
htStore.put("bugs", (ArrayList) bugData.get("Bugs"));
return htStore;
=============================================================
And I am trying to call this function as it can capable of fetching the data from the database by "getbugProfiles".
In the new class bugWatcherRefreshAction.java I have coded a part of code which actually clears the caching.Below I am giving the required part of the code:
=============================================================
public void doPerform(RunData rundata, Context context,String str) throws Exception {
JetspeedRunData data = (JetspeedRunData) rundata;
HttpServletRequest request = null;
//PortletConfig pc = portlet.getPortletConfig();
//String userId = request.getRemoteUser();
/*String userId = ((JetspeedUser)rundata.getUser()).getUserName();//sraha on 1/4/05
String pId = request.getParameter("PortletId");
PortalLogger.logDebug("just after pId " +pId); */
//Calling the variable holding the value of portlet id from BugWatcherAction.java
//We are getting the portlet id here , through a variable from BugWatcherAction.java
/*BugWatcherPortletContent bgAct = new BugWatcherPortletContent();
String portletID = bgAct.pId1;
PortalLogger.logDebug("got the portlet ID in bugwatcherRefreshAction:---sraha"+portletID);*/
// updating the bug groups
Hashtable result = new Hashtable();
try {
request = data.getRequest();
String userId = ((JetspeedUser)data.getUser()).getUserName();//sraha on 1/4/05
//String pId = (String)request.getParameter("portletId");
//String pId = pc.getPorletId();
PortalLogger.logDebug("just after pId " +pId);
PortalLogger.logDebug("after getting the pId-----sraha");
result =BugWatcherAPI.getbugList(profileId, userId);
PortalLogger.logDebug("select the new bug groups:: select is done ");
context.put("SelectedbugGroups", profileId);
//start clearing the cache
ContentCacheContext cacheContext = getCacheContext(rundata);
PortalLogger.logDebug("listBugWatcher Caching - removing markup content - before removecontent");
// remove the markup content from cache.
PortletContentCache.removeContent(cacheContext);
PortalLogger.logDebug("listBugWatcher Caching-removing markup content - after removecontent");
//remove the backend content from cache
CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(((JetspeedUser)data.getUser()).getUserName()));
PortalLogger.logDebug("listBugWatcher Caching User: " +((JetspeedUser)data.getUser()).getUserName());
PortalLogger.logDebug("listBugWatcher Caching pId: " +pId);
if (pdata != null)
// User's data found in cache!
PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null");
pdata.removeObject(PortletCacheHelper.getUserPortletHandle(((JetspeedUser)data.getUser()).getUserName(),pId));
PortalLogger.logDebug("listBugWatcher Caching -inside pdata!=null- after removeObject");
PortalLogger.logDebug("listBugWatcher Caching -finish calling the remove content code");
//end clearing the cache
// after clearing the caching calling the data from the database taking a fn from the portletContent.java
PortalLogger.logDebug("after clearing cache---sraha");
BugWatcherPortletContent bugwatchportcont = new BugWatcherPortletContent();
Hashtable httable= new Hashtable();
httable=(Hashtable)bugwatchportcont.loadContent();
PortalLogger.logDebug("after making the type casting-----sraha");
Set storeKeySet = httable.keySet();
Iterator itr = storeKeySet.iterator();
while (itr.hasNext()) {
String paramName = (String) itr.next();
context.put(paramName, httable.get(paramName));
PortalLogger.logDebug("after calling the databs data from hashtable---sraha");
} catch (CodedPortalException e) {
PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
context.put("Error", CommonUtil.getErrMessage(e.getMessage()));
catch (Exception e) {
PortalLogger.logException("bugwatcherRefreshAction:: Exception- ",e);
context.put( "Error",CommonUtil.getErrMessage(ErrorConstantsI.EXCEPTION_CODE));
try {
((JetspeedRunData) data).setCustomized(null);
if (((JetspeedRunData) data).getCustomized() == null)
ActionLoader.getInstance().exec(data,"controls.EndCustomize");
catch (Exception e)
PortalLogger.logException("bugwatcherRefreshAction", e);
===============================================================
In the bugwatcher Action there is another function called PostLoadContent.java
here though i have found the portlet Id but unable to fetch that in the bugWatcherRefreshAction.java . I am also giving the code of that function under the bugWatcherAction.Java
================================================
// Get the PortletData object from intermediate store.
CacheablePortletData pdata =(CacheablePortletData) PortletCache.getCacheable(PortletCacheHelper.getUserHandle(
//rundata.getRequest().getRemoteUser()));
((JetspeedUser)rundata.getUser()).getUserName()));
pId1 = (String)portlet.getID();
PortalLogger.logDebug("in the bugwatcher action:"+pId1);
try {
Hashtable htStore = null;
// if PortletData is available in store, get current portlet's data from it.
if (pdata != null) {
htStore =(Hashtable) pdata.getObject( PortletCacheHelper.getUserPortletHandle(
((JetspeedUser)rundata.getUser()).getUserName(),portlet.getID()));
//Loop through the hashtable and put its elements in context
Set storeKeySet = htStore.keySet();
Iterator itr = storeKeySet.iterator();
while (itr.hasNext()) {
String paramName = (String) itr.next();
context.put(paramName, htStore.get(paramName));
bugwatcherRefreshAction bRefAc = new bugwatcherRefreshAction();
bRefAc.doPerform(pdata,context,pId1);
=============================================================
So this is the total scenario for the fetching the data , after clearing the cache and display that in the portal.I am unable to do that.Presently it is still fetching the data from the cache and it is not going to the database.Even the portlet Id is returning as null.
I am unable to implement that thing.
If you have any insight about this thing, that would be great .As it is very urgent a promt response will highly appreciated.Please send me any pointers or any issues for this I am unable to do that.
Please let me know as early as possible.
Thanks and regards,
Santanu Raha.Have you run it in a debugger? That will show you exactly what is happening and why.
Maybe you are looking for
-
Pages 2.0 for ios 7 query
Have just upgraded to Pages 2.0 and ios 7.03 and haven't experienced any of the problems some people have. However, I cannot copy a document to Pages from another app as it is not showing as an option in "Open in another app". Any suggestions as to w
-
Using Adobe Lightroom CC, do I still need Adobe Bridge CC?
I have both Adobe Lightroom CC and Bridge CC applications. Is there something Bridge can do the Lightroom can't...if so what?
-
Hi Users, I have a pl/sql block say "create-table-interface.sql" which will query and insert records into another table. The requirement is to run the above .sql file every SATURDAY at 8 AM. In Oracle 10g, there are many DBMS_job functions and I am c
-
On 2/15, I upgraded the Desktop Software to V7.0.0.43, then attempted to synchronize my Curve 8530. All appeared to be going well until the "preparing synchronization preview" phase, which went on for more than 30 minutes without competing. I stopped
-
HT3964 MBP SMC reset not working
The built in- camera on my MBP is not working. I've identified the problem and it lies in the SMC, following this guide: http://support.apple.com/kb/ht3964 told me to press the ctrl + option + shift + power button simultaniously as well as releasing