diff --git a/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/components/DPUTree.java b/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/components/DPUTree.java index 66397098ba..983657b432 100644 --- a/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/components/DPUTree.java +++ b/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/components/DPUTree.java @@ -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. */ @@ -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"); diff --git a/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/views/dpu/DPUViewImpl.java b/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/views/dpu/DPUViewImpl.java index 1f4e019ed8..e161a27446 100644 --- a/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/views/dpu/DPUViewImpl.java +++ b/frontend/src/main/java/cz/cuni/mff/xrg/odcs/frontend/gui/views/dpu/DPUViewImpl.java @@ -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() {