So, what i am trying to do is to move ProjectNameLabel, Screen Menu, addScreen, removeScreen, Designer and Blocks from DesignToolbar to TopPanel and TopToolbar respectively.
To merge ProjectNameLabel, i tried to do it like this, but the text is not showing.
TopPanel.java :
public Label projectNameLabel;
projectNameLabel = new Label();
projectNameLabel.setStyleName("ya-ProjectName");
panel.add(projectNameLabel);
panel.setCellWidth(logo, "60px");
panel.setCellWidth(projectNameLabel, "200px");
public void updateProjectName(String projectName) {
projectNameLabel.setText(projectName);
}
DesignToolbar.java
TopPanel toppanelt = new TopPanel();
toppanelt.updateProjectName(projectName);
Then i added the SwitchToBlockButton to TopPanel,
I did a few trial, so using DesignToolbar var = new DesignToolbar() then call out the function does not do anything.
By reading Ode,getInstance(), i found out the method below :
So, in DesignToolbar.java :
private static DesignToolbar instance;
public static DesignToolbar getInstance() {
return instance;
}
Then i added a public function :
public void switchToBlockEdit() {
new SwitchToBlocksEditorAction();
}
Now back to TopPanel.java :
final DesignToolbar designtoolbar = DesignToolbar.getInstance();
TextButton blocksButton = new TextButton(assetsButtonLogo);
blocksButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
designtoolbar.switchToBlockEdit();
}
});
Now the onClick respond " a bug occured "
The error is
faultData = com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) : Cannot read property '$_nullMethod' of null
Could anyone kindly help with this issue ?
Is there a good way to achieve that ?
Thank you !