Closed GoogleCodeExporter closed 9 years ago
If I get this right, in GWT config file of ModuleA, you need to add ModuleB and
in
GWT config file of ModuleB, you need to add ModuleA, which leads to a circular
dependency, right?
If it's your problem, the only way I see to solve your issue it's to put your
Mvp4g
module interface for ModuleB (I'm guessing it's the parent) inside another GWT
module. Then in GWT config file of ModuleA, you will have the ModuleC and in
GWT
config file of ModuleB, you need to add ModuleA and ModuleC. You will then have
no
more circular dependency. I know it's not perfect because that's the only
solution I
see.
But maybe you were talking about another type of dependency?
Original comment by plcoir...@gmail.com
on 18 Feb 2010 at 3:24
Let me explain the problem in a bit more detail.
There are 2 GWT projects:
1. Company (Company.gwt.xml)
2. Department (Department.gwt.xml)
Both these projects uses mvp4g to make 2 modules - Comp inside 'Company' & Dept
inside 'Department'.
Company wide functionality in kept in 'Company' project. 'Department' project
includes 'Company' project in its gwt xml file and uses its classes also. So
this
result in java dependency of 'Company' on 'Department'.
Now, in the application, there is menu (painted by 'Company') which contains
link to
the department. So, when the user clicks on that link, the event bus of
'Company'
sends event to the presenter (say DeptPresenter) of the Department. The
configuration
of 'Company' event bus looks like:
public interface CompanyEventBus extends EventBus{
@Event(handlers = DeptPresenter.class)
void salesLinkClicked();
}
The above configuration requires a java dependency of 'Department' on 'Company'
causing the circular dependency.
I hope the above example explains the problem.
Is there any way to get rid of this circular dependency?
Original comment by agg.mo...@gmail.com
on 24 Feb 2010 at 8:57
So your RootModule (Top Module) is 'Department' and one of its child is
'Company'.
To actually forward event from child to parent, you need to do this:
public interface CompanyEventBus extends EventBus{
@Event(forwardToParent = true)
void salesLinkClicked();
}
and then
public interface CompanyModule extends Mvp4gModule{
//since the Department is the RootModule,
//then it's associated module is Mvp4gModule
public void setParentModule(Mvp4gModule module)
}
With this configuration, there is no circular dependency since CompanyModule
doesn't
know any class of Department module.
Also be careful, by doing this:
public interface CompanyEventBus extends EventBus{
@Event(handlers = DeptPresenter.class)
void salesLinkClicked();
}
You actually create its own instance of DeptPresenter for the CompanyModule.
Modules
don't share presenters.
Original comment by plcoir...@gmail.com
on 25 Feb 2010 at 12:45
With the new way parent/child configuration has been set, the child module
doesn't have to know the parent module so there is no more circular dependency.
Original comment by plcoir...@gmail.com
on 13 Sep 2010 at 5:18
Original comment by plcoir...@gmail.com
on 13 Sep 2010 at 5:18
Original issue reported on code.google.com by
agg.mo...@gmail.com
on 17 Feb 2010 at 11:30