Skip to content

Commit

Permalink
Solving #592 - there is only one button for creating DPU templates
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-knap committed Oct 13, 2016
1 parent 4060633 commit d51786b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ public class DPUTree extends CustomComponent {

private boolean isValid = true;

public boolean isShowButtonCreateTemplate() {
return showButtonCreateTemplate;
}

public void setShowButtonCreateTemplate(boolean showButtonCreateTemplate) {
this.showButtonCreateTemplate = showButtonCreateTemplate;
}

private boolean showButtonCreateTemplate = true;

/**
* Creates new DPUTree.
*/
Expand Down Expand Up @@ -185,28 +195,30 @@ public void buttonClick(Button.ClickEvent event) {
topLine.setVisible(isExpandable);
mainLayout.addComponent(topLine);

buttonCreateDPU = new Button();
buttonCreateDPU.setCaption(Messages.getString("DPUTree.create.dpu"));
buttonCreateDPU.setHeight("25px");
buttonCreateDPU.setWidth("180px");
buttonCreateDPU
.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;

@Override
public void buttonClick(Button.ClickEvent event) {
//Open the dialog for DPU Template creation
if (!UI.getCurrent().getWindows().contains(createDPU)) {
createDPU.initClean();
UI.getCurrent().addWindow(createDPU);
createDPU.removeCloseListener(createDPUCloseListener);
createDPU.addCloseListener(createDPUCloseListener);
} else {
createDPU.bringToFront();
}
if (showButtonCreateTemplate) {
buttonCreateDPU = new Button();
buttonCreateDPU.setCaption(Messages.getString("DPUTree.create.dpu"));
buttonCreateDPU.setHeight("25px");
buttonCreateDPU.setWidth("180px");
buttonCreateDPU
.addClickListener(new Button.ClickListener() {
private static final long serialVersionUID = 1L;

@Override
public void buttonClick(Button.ClickEvent event) {
//Open the dialog for DPU Template creation
if (!UI.getCurrent().getWindows().contains(createDPU)) {
createDPU.initClean();
UI.getCurrent().addWindow(createDPU);
createDPU.removeCloseListener(createDPUCloseListener);
createDPU.addCloseListener(createDPUCloseListener);
} else {
createDPU.bringToFront();
}

}
});
}
});
}

exportButton = new Button(Messages.getString("DPUTree.export.dpu"));
exportButton.setHeight("25px");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ private HorizontalLayout buildDpuLayout() {

//DPU Template Tree
dpuTree.setExpandable(false);
dpuTree.setShowButtonCreateTemplate(false);
dpuTree.fillTree();
if (dpuTree.getListeners(ItemClickEvent.class).isEmpty()) {
dpuTree.addItemClickListener(new ItemClickEvent.ItemClickListener() {
Expand Down

0 comments on commit d51786b

Please sign in to comment.