]> git.argeo.org Git - gpl/argeo-slc.git/blob - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/model/WorkspaceElem.java
Prevent initalization of the UI to fail if a remote repo is not accessible.
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / model / WorkspaceElem.java
1 package org.argeo.slc.client.ui.dist.model;
2
3 /** Abstracts a workspace that contains a given distribution */
4 public class WorkspaceElem extends DistParentElem {
5 private final RepoElem repoElem;
6 private String workspaceName;
7 private String label;
8
9 /**
10 * Helper to display only version when the workspace name is well formatted
11 */
12 private static String formatName(String name) {
13 if (name != null && name.lastIndexOf('-') > 0)
14 return name.substring(name.lastIndexOf('-') + 1);
15 else
16 return name;
17 }
18
19 public WorkspaceElem(RepoElem repoElem, String workspaceName) {
20 this.repoElem = repoElem;
21 this.workspaceName = workspaceName;
22 this.label = formatName(workspaceName);
23 }
24
25 public String getWorkspaceName() {
26 return workspaceName;
27 }
28
29 public RepoElem getRepoElem() {
30 return repoElem;
31 }
32
33 public boolean isReadOnly() {
34 return repoElem.isReadOnly();
35 }
36
37 public boolean hasChildren() {
38 return false;
39 }
40
41 public Object[] getChildren() {
42 return null;
43 }
44
45 @Override
46 public String getLabel() {
47 return label;
48 }
49 }