Model view presenter
Hi,
Does anyone have any examples of the use of the model view presenter design pattern within Swing. I am attempting to refactor a number of Swing classes based around JDialogs, JTables etc. Your help would be greatly appreciated.
Many thanks,
dude
Thanks I have this example, I would like to see some other swing examples if anyone has them...
Similar Messages
-
Hi,
I recently read about Model-View-Presenter on Martin Fowler's website, and elsewhere. I think I understand the idea...
The view just displays the GUI components..events fired from the View are delegated to a Presenter. The presenter then deals with the model and updates the View accordingly. Sound about right?
Ok, so I learn best by example..and I haven't found any code samples yet, so I thought I'd give it a shot. Below is my code...
Model
* the model to be displayed in a View
public class Album {
private boolean isClassical;
private String composer;
public String getComposer() {
return composer;
public void setComposer(String composer) {
this.composer = composer;
public boolean isClassical() {
return isClassical;
public void setClassical(boolean isClassical) {
this.isClassical = isClassical;
View - interface
import java.awt.event.ActionListener;
* An interface which defines the methods needed by a presenter
public interface View {
public boolean isClassical();
public void setClassical(boolean b);
public boolean isComposerEnabled();
public void setComposerEnabled(boolean b);
public void addClassicalChangeListener(ActionListener al);
public void showView();
View - implementation
import java.awt.Dimension;
import java.awt.event.ActionListener;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
* A an implementation of the View interface. It shows a checkbox
* and a textfield.
public class MyView extends JFrame implements View {
private JCheckBox checkboxClassical;
private JTextField textfieldComposer;
private MyPresenter mp;
public MyView() {
checkboxClassical = new JCheckBox("Classical");
textfieldComposer = new JTextField();
textfieldComposer.setPreferredSize(new Dimension(100, 20));
textfieldComposer.setEnabled(false);
JPanel p = new JPanel();
p.add(checkboxClassical);
p.add(textfieldComposer);
add(p);
setSize(600, 400);
public void addClassicalChangeListener(ActionListener al) {
checkboxClassical.addActionListener(al);
public void setPresenter(MyPresenter mp) {
this.mp = mp;
public void setClassical(boolean b) {
checkboxClassical.setSelected(b);
public boolean isClassical() {
return checkboxClassical.isSelected();
public void setComposerEnabled(boolean b) {
textfieldComposer.setEnabled(b);
public boolean isComposerEnabled() {
return textfieldComposer.isEnabled();
public void showView() {
setVisible(true);
Presenter
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
* A presenter for a View. When the "classical" fires
* an ActionEvent, the "composer" component is enabled or disabled.
public class MyPresenter {
private Album album;
private View view;
public MyPresenter(Album album, View viewVal) {
this.album = album;
this.view = viewVal;
view.addClassicalChangeListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
view.setClassical(view.isClassical());
view.setComposerEnabled(view.isClassical());
view.showView();
}and here is a simple Main to tie it togehter.
* Ties together the M-V-P
public class Main {
public static void main(String[] args) {
Album al = new Album();
al.setClassical(false);
MyView myView = new MyView();
MyPresenter mp = new MyPresenter(al, myView);
myView.setPresenter(mp);
}Ok, the idea is this. The GUI shows a checkbox and a textfield. basically, if the checkbox is selected the textfield is enabled and can be typed into. If the checkbox is not selected, the textfield is disabled. From the model point of view, if isClassical is false, then no composer can be defined.
So, is my code following the pattern? Does anyone have any simple code to contribute as an example? For some reason is just seems weird to me that I would have an interface define a bunch of methods that the Presenter can call. And I have to create the Model and View which get passed to the presenter, and then I have to set the presenter on the view....it just seems weird to me.
Any comments, suggestions, examples??
Thanks for your time and contributions.The other information didnt answer my questions. The response was mixing the idea of MVC instead of MVP, and then the response discussed what they thought was wrong with MVP and why they use a different model. I am looking for help on understanding the pattern more, also for someoen (who knows about MVP) to look at my sample code and help me understand what I did right/wrong.
Thanks. -
Mapping Variables(Object View) to Measures(Model View)
Hi,
In my AW, I have created a cube, And then I have created a new variable in the object view and populated it using load programs. Now. when I try to create a measure in the model view of the same cube based on this variable, I cannot see any option for assigning a variable to a measure. Can someone please help me out in doing this?
I need the measure in the model view, because it looks like, when I create a relational view, only the measures that are defined in the model are added to the view and not the variables available in the object model.
Thanks,
BharatHi Bharat,
The mapping editor is used to map a measure to a relational data source. Therefore, unless you convert your data source used by your DML program to a relational table/view (if it is a text file you can use an external table to present the data to AWM as a relational table, or if it is an Excel spreadsheet and your database is on Windows you can use the heterogenous gateway service to load directly from Excel by exposing the Excel worksheet as a relational table) you will not be able to use the mapping editor.
To assign an OLAP variable to an measure within a cube you will need to create a custom calculated measure. This will allow you to create a measure that "maps" to your OLAP DML program. There is an Excel utility on the OLAP OTN home page that allows you to create custom calculated measures (at the moment this feature is not AWM10gR2 - but is available within AWM 11g). Click here for more information:
http://download.oracle.com/otn/java/olap/SpreadsheetCalcs_10203.zip
My advice would be to try and convert your data source to a relational table/view and using the mapping editor. This will allow you to benefit from the many new features within OLAP cube storage such as compressed composites, data compression, paralled processing, partitioning and aggregation maps. Of course you can code all this manually but it is much easier to let AWM do all this for you via a few mouse clicks. Please note - that everything you build outside of the AWM model view has to be managed (defined, updated, backed up etc) by you rather AWM. So while there are lots of advantages of using OLAP DML, I personally always try to load data into my OLAP cubes using AWM mappings and save OLAP DML for providing the advanced types of analysis that make OLAP such an excellent calculation engine.
Hope this helps
Keith Laker
Oracle Data Warehouse Product Management
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
Unable to Distribute Model View in BD64
Hi Gurus,
Model View - SR2CLNT251
Receiver of Model View - EA1CLNT251
i went to txcode bd64 > i clicked on model view SR2CLNT251 then went to edit > model view > distribute and clicking the logical system of EA1CLNT251. then error will be encountered.
Model view SR2CLNT251 has not been updated
Reason: No authorization to change model view SR2CLNT251
.....authorization object B_ALE_MODL
.....Parameter: activity 02, model view SR2CLNT251
i already given correct authorization to my ID, but still the error persists.
Please help. Thanks!
Regards,
TonyHi Tony,
You need authorization for authorization object 'B_ALE_MODL' in system I guess either in system SR2CLNT251 or in EA1CLNT251.
Best Regards,
Tushar -
Possible to view presentations with embedded clips on the ipad from an external wifi drive?
Hello,
first of all I am happy to have joined this community, my name is Chris from Germany.
I am wondering if this setting is possible:
I have bought an external wifi drive (Seagate Satellite Goflex) as well as the iPad4.
I am giving lectures (powerpoint and keynote presentations containing lots of embedded video clips).
Now I would like to show these presentations with my iPad connected to the Wifi drive.
You have to download a special Seagate App on the iPad to be able to see the data on the external wifi drive - I have managed to open the powerpoint files in the App (unfortunately keynote files are not supported by the Seagate App) but when I open them with keynote or goodreader the embedded media will always be removed.
Is this the end of the story or are there any solutions (i.e. with other hardware devices or software)?
Have a nice New Years Eve and thanks in advance,
Chrisyes and no ...
I have figured that out:
First of all: you can`t just view presentations on an external device without importing them into your iPad (at least when you plan to show slides with embedded clips) - goodreader, filebrowser, dropbox ... just show you "static" slides.
When you import a ppt-presentation into keynote all the hyperlinks, embedded clips ... are gone - no chance.
But ... in keynote you are able to "embed" video clips when you drag and drop them directly into the slide alowing "copy video into the document" as well (that is "vital") - the files are getting larger but you don`t have to add a clip when you transfer it to another device (i.e. the iPad) - they are "fixed" in the document..
Now seagate goflex has the problem that you just can`t open/view keynote presentations - but there is a solution:
hacksatellite firmware. When you install that you can go into keynote, activate WebDav, import a keynote file from the external drive, edit it and send it back to the external drive - so: import (can`t live without that), show or edit the presentation, copy it again to the external device and delete the presentation in the iPad (to save storage) is the way you can get the optimum from the iPad at the moment.
Correct me if there is any other more comfortable solution.
Thanks for your reply Daniel,
Christian -
Error in distribution of model view
I created a modelview for distribution of CLFMAS types IDOCS from DEV to PRD.
Created ports,RFC destination etc.
I was able to generate partner profile in the sending system.When I try to distribute the model view in BD64,
I get this error . Initially, I thought it was because I did not have authorization for BD64 in PRD. Now that I have, I still get this error.. Any advice ?
Distribution of model view CHARS2PRD
Target system PRD100 Communication error occurred
Process request without transaction. TID is empty.I see the message did not post properly..THis is the message..
Distribution of model view CHARS2PRD
Target system PRD100 Communication error occurred
Process request without transaction. TID is empty. -
Is model view(BD64) necessary for EDI
is model view created using BD64 necessary for a EDI transactions? I have created a logical system, a RFC destination and a EDI File Port.
After all this i am trying to push a material master data using BD10 to the file port. When i do that the system gives me a message saying that master idoc created but it does not create a communication idoc. Only if i have a Model view set up in BD64 it creates a communication idoc. So my question is do we need a model view for EDI configuration?
~SureshHi,
BD64 is required for master data distribution..
If you are having a interface that sends IDOCs to the customer or receive IDOCs from the vendor..You don't require BD64 setup..
Thanks,
Naren -
Tcode PFAL there is no model view for the distribution of HR Data.
Hi friends ,
i am facing new problem,i want to send iDOC to other system.
previeous its working fine.
but to day when i open tcode PFAL.
it give me Error:"There is no model view for the distribution of HR master data"
what is the solution for that.
i want to send HR Data.
its urgent please give me any solution ithat will help me alot.
thanks in advanceThere is already Distributed Model Created.
can u give me annother tcode so i can send Metarial data, by IDOC.
please help me.
Thanks -
Hi,
I have created a model view and generated the partner profiles. when i am distibuting the model view, I am getting an error " Model View XXXX has not been updated" "Reason: Maintenance systems for model view XXXX are not identical".
could anybody tell me , how to resolve this issue.
Thanks & Regards,Any luck with the resolution to this error?
Thanks,
John -
Problem in Disrtibuting Model View
Dear Geeks,
I have a problem in distributing the model view.
I have created a new Model view & added message type DESADV to it along with the SENDER & RECEIVER system.
Sender System: ECC 6.0
Receiver System: PI 7.0
Error Message:
ModelView PI-TRAN has not been updated.
Reason Distribution model is currently being processed.
How to resolve it or what could be pssible cause?Hi Yogesh,
Yes other systems are using the Sender logical
system but not the Receiver logical system defined/used by me.
Yes some other models are active with Sender
logical system that i have used as their Receiver
logical system but with some other Message types.
Will the above settings conflict with that of my Distribution model?
Thanks,
Rajendra. -
hi friends,
i am working with ALE to transfer data across two clients.
i had created two logical system EDI900, EDI950 and model view MODEL_VIEW
but when i am distribute this model view i am getting error as
model view MODEL_VIEW has not been updated
reason:maintance system in sending system EDI900
maintance system in receiving system EDI950
i had searched in SDN with this keyword i got lot of links but i can't find proper solution.
so please give me the correct solution.
thanks in advance.
Regards,
Karunakarhi jurgen,
thanks for your reply.
here i am distributing model view with message type.
and i am transferring data across two clients in one SAP system.
here i am ligin in target system and delete the model view which previouslly assigned.
now i am distributed successfully.
Regards,
karunakar -
IDOC Model View Generation Issue
Hi all,
I am working on IDOCS and I am facing the follwing error when I try to distribute the Model View in IDOC--
"the following ALE connection already exists in model view HR_TO_PI"
I had deleted the above "HR_TO_PI" model view and I created a new one with new name.
But I still get the same message.
I don't think this is an issue with configuration.
I am assuming it's an issue with table entries. Does this-"HR_TO_PI" value get stored in any table in the back end ?
Kindly help. I had a look at SDN and other places but they all ask to check for partner profiles and logical systems which I believe I have configured right.
Warm regards,
Hari Kiran
Edited by: HARI KIRAN REDDY on Feb 23, 2012 11:24 AMHi Sravan,
I had a look at TBD00. It shows all my current distribution models but not the one mentioned in the error.
I had a look at some other tables in the TBD series but of no help.
I don't know in which table that entry has ended up.
It's frustrating.
Thanks for the input once again.
Warmr egards,
Hari Kiran -
IDoc to IDoc scenario: distribute the model view
Hi!
I try currently to configure a IDoc to IDoc scenario for SAP ECC 6.0 system with following business 2 systems:
ERP:100 (Sender)
ERP:200 (Receiver)
and XIB:100 (XI system)
I successfuly created a message type and generated the model view in tcode BD64.
Question:
When I try to distribute the model view which system should I choose?
a) XI System or
b) Receiver system ERP:200
When I choose the receiver system ERP:200 and get the following error
Target system: ERP:200
Model view ECCCLNT100 has not been updated
Reason: Distribution model is currently being processed
When I try to choose my XI system I get the following error:
Target system: XIB:100
RFC destination for synchronous communication (message type SYNCH)
Partner profile LS PIBCLNT100 SYNCH does not exist
Generate partner profile
or specify outbound partner profiles for message type SYNCH
Is that an error? If yes, how can I fix them?
Thank you very much
ThomHi
Look my reply on this thread regarding SYNC Message Type.
Re: problem while distribute model view
When I try to distribute the model view which system should I choose?
a) XI System or
b) Receiver system ERP:200
You are sending IDoc to XI then R/3 so select XI system. because receiver of IDoc is XI then IDoc would be send from XI. -
IDOC to IDCO scenario: Distribution of model view
Hi!
I try currently to configure a IDoc to IDoc scenario for SAP ECC 6.0 system with following business 2 systems:
ERP:100 (Sender)
ERP:200 (Receiver)
and PIB:100 (XI system)
I successfully created a message type u201CZCREMRu201D and generated the model view PIMODEL in tcode BD64.
Sender: ERP:100
Receiver: PIB:100
I assigned 3 partner profiles ERPCLNT100, ERPCLNT200, PIBCLNT100 and assigned a message type SYNCH with IDOC type SYNCHRON as outbound parameter.
Unfortunately when I try to distribute the model u201CZCREMRu201D and choose my XI system I get the following error:
Distribution of model view PIMODEL
Target system PIBCLNT100
Model view PIMODEL has not been updated
Reason: Distribution model is currently being processed
Question:
Do I miss some other inbound and outbound parameters?
IF yes, which and on which systems?
Thank you very much!
regards
ThomHi Rob
Y're right i made mistake when i was creating in SRM RFC destination puting host name of SRM system not ERP.
Thanx
Marcin -
How to do outer join in data model view?
Hi,
I have 2 queries are needed to be joined in Oracle Report 6i Data Model View. What I want to do is below:
where table1.receipt_no(+)=table2.receipt_no
How do I use the 'Data Link' to do this in Data Model view?
Thanks.
JunHi
You need to use data links. Refer data link section in BUilding Reports manual at http://otn.oracle.com/products/reports/htdocs/getstart/docs/B10310_01/orbr_concepts1.htm#1013156.
Thanks
Rohit
Maybe you are looking for
-
Finally made the switch from PC to Mac, after my PC crashed and burned. I Do not have a backup on an external drive, and I was unable to recover any data from the trashed PC hard drive. Can I download my library, or is there a way to get my itunes co
-
Why is my phone telling me I cannot update (it requires 4.6 GB storage), when it shows that I have 19.2 GB storage available?
-
Javax.mail.NoSuchProviderException: No provider for Address type: rfc822
Use JavaMail 1.2 send Mail Errors: "javax.mail.NoSuchProviderException: No provider for Address type: rfc822" Why? Can you supply a stmp server name? Thanks.
-
How to check for Optional Oracle 10gR2 components installed?
Hi How can I get a list of all optional oracle database components/features installed (some of them may require additional license)? I was going through list of directory objects in a database and I spotted "ORACLE_OCM_CONFIG_DIR" in one of the datab
-
Solaris 10 x86 5/08 : Boot from DVD gives 'grub ' and no menu
Hi All, I just spent a good deal of time downloading the Solaris 10 5/08 x86 DVD images. When I try to boot from disc 'A', I merely get a 'grub>' prompt. From all I can tell due to searching, this is not right. Any advice? :(