BrightSide Workbench Full Report + Source Code
org.turro.wd.desktop.WorkingDesktop Class Reference
Inheritance diagram for org.turro.wd.desktop.WorkingDesktop:
Collaboration diagram for org.turro.wd.desktop.WorkingDesktop:

Public Member Functions

void startup (Display display, Map< String, String > properties) throws Exception
 
boolean shutdown (boolean optional) throws Exception
 
void suspend ()
 
void resume ()
 
int getSelection (ButtonGroup group)
 

Static Public Member Functions

static void main (String[] args)
 

Detailed Description

Definition at line 55 of file WorkingDesktop.java.

Member Function Documentation

◆ getSelection()

int org.turro.wd.desktop.WorkingDesktop.getSelection ( ButtonGroup  group)

Definition at line 253 of file WorkingDesktop.java.

253  {
254  Button b = group.getSelection();
255  if(b != null) {
256  return new Integer((String) b.getUserData().get("value"));
257  }
258  return -1;
259  }
Here is the caller graph for this function:

◆ main()

static void org.turro.wd.desktop.WorkingDesktop.main ( String[]  args)
static

Definition at line 249 of file WorkingDesktop.java.

249  {
250  DesktopApplicationContext.main(WorkingDesktop.class, args);
251  }

◆ resume()

void org.turro.wd.desktop.WorkingDesktop.resume ( )

Definition at line 246 of file WorkingDesktop.java.

246  {
247  }

◆ shutdown()

boolean org.turro.wd.desktop.WorkingDesktop.shutdown ( boolean  optional) throws Exception

Definition at line 234 of file WorkingDesktop.java.

234  {
235  if (window != null) {
236  window.close();
237  }
238  return false;
239  }

◆ startup()

void org.turro.wd.desktop.WorkingDesktop.startup ( Display  display,
Map< String, String >  properties 
) throws Exception

Definition at line 67 of file WorkingDesktop.java.

68  {
69 
70  final String bbUser = properties.get("bbUser");
71  final String bbHost = properties.get("bbHost");
72  final String bbPort = properties.get("bbPort");
73  final String bbContext = properties.get("bbContext");
74  final String bbCreateDir = URLDecoder.decode(properties.get("bbCreateDir"), "UTF-8");
75  final String bbCreatePath = URLDecoder.decode(properties.get("bbCreatePath"), "UTF-8");
76 
77 // final String bbUser = "llturro";
78 // final String bbHost = "localhost";
79 // final String bbPort = "8084";
80 // final String bbContext = "/portal30";
81 // final String bbCreateDir = "Lluis TurrĂ³ Cutiller";
82 // final String bbCreatePath = "/contact/5525d41a1b548b47011b548c98b00001";
83 
84  final Resources resources = new Resources(getClass().getName());
85 
86  WTKXSerializer wtkxSerializer = new WTKXSerializer(resources);
87  window = (Window) wtkxSerializer.readObject(this, "working_desktop.wtkx");
88  wtkxSerializer.bind(this, WorkingDesktop.class);
89 
90  commit = (Dialog) wtkxSerializer.readObject(this, "commit_dialog.wtkx");
91  wtkxSerializer.bind(this, WorkingDesktop.class);
92 
93  ProgressSheet.getInstance(window);
94 
95  syncButton.getButtonPressListeners().add(new ButtonPressListener() {
96  @Override
97  public void buttonPressed(Button button) {
98  commit.setModal(true);
99  commit.open(window);
100  }
101  });
102 
103  doSyncButton.getButtonPressListeners().add(new ButtonPressListener() {
104  public void buttonPressed(Button button) {
105  commit.close();
106 
107  SyncTask syncTask = new SyncTask(workingTreeView, resources.getString("synchronize"),
108  commentCommitInput.getText(), getSelection(commitAction),
109  commentUpdateInput.getText(), getSelection(updateAction));
110  TaskListener<String> taskListener = new TaskListener<String>() {
111 
112  @Override
113  public void taskExecuted(Task<String> task) {
114  try {
115  workingDirectory.reload();
116  workingTreeView.setTreeData(new WorkingTreeModel(workingDirectory));
117  TreeUtil.expandRootBranches(workingTreeView);
118  System.out.println("Synchronous task execution complete: \"" + task.getResult() + "\"");
119  } catch (ParseException ex) {
120  Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
121  }
122  }
123 
124  @Override
125  public void executeFailed(Task<String> task) {
126  try {
127  workingDirectory.reload();
128  workingTreeView.setTreeData(new WorkingTreeModel(workingDirectory));
129  TreeUtil.expandRootBranches(workingTreeView);
130  System.err.println(task.getFault());
131  } catch (ParseException ex) {
132  Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
133  }
134  }
135  };
136 
137  syncTask.execute(new TaskAdapter<String>(taskListener));
138  }
139  });
140 
141  openButton.getButtonPressListeners().add(new ButtonPressListener() {
142  @Override
143  public void buttonPressed(Button button) {
144  TreeNode tn = (TreeNode) workingTreeView.getSelectedNode();
145  if(tn instanceof TreeDirectory) {
146  WdRuntime.launch(((TreeDirectory) tn).getDirectory().getSystemFile().getAbsolutePath());
147  } else if(tn instanceof TreeWorkFile) {
148  WdRuntime.launch(((TreeWorkFile) tn).getWorkFile().getSystemFile().getAbsolutePath());
149  }
150  }
151  });
152 
153  refreshButton.getButtonPressListeners().add(new ButtonPressListener() {
154  @Override
155  public void buttonPressed(Button button) {
156  new RefreshTask() {
157 
158  @Override
159  public Object execute() throws TaskExecutionException {
160  try {
161  workingDirectory.reload();
162  workingTreeView.setTreeData(new WorkingTreeModel(workingDirectory));
163  TreeUtil.expandRootBranches(workingTreeView);
164  } catch (Exception ex) {
165  Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
166 // } catch (ParseException ex) {
167 // Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
168  }
169  return null;
170  }
171  }.refreshData();
172  }
173  });
174 
175  deleteButton.getButtonPressListeners().add(new ButtonPressListener() {
176  @Override
177  public void buttonPressed(Button button) {
178  DelTask delTask = new DelTask(workingTreeView, resources.getString("deleteLocally"));
179  TaskListener<String> taskListener = new TaskListener<String>() {
180 
181  @Override
182  public void taskExecuted(Task<String> task) {
183  try {
184  workingDirectory.reload();
185  workingTreeView.setTreeData(new WorkingTreeModel(workingDirectory));
186  TreeUtil.expandRootBranches(workingTreeView);
187  System.out.println("Deletion task execution complete: \"" + task.getResult() + "\"");
188  } catch (ParseException ex) {
189  Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
190  }
191  }
192 
193  @Override
194  public void executeFailed(Task<String> task) {
195  try {
196  workingDirectory.reload();
197  workingTreeView.setTreeData(new WorkingTreeModel(workingDirectory));
198  TreeUtil.expandRootBranches(workingTreeView);
199  System.err.println(task.getFault());
200  } catch (ParseException ex) {
201  Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
202  }
203  }
204  };
205 
206  delTask.execute(new TaskAdapter<String>(taskListener));
207  }
208  });
209 
210  window.open(display);
211 
212  new RefreshTask() {
213 
214  @Override
215  public Object execute() throws TaskExecutionException {
216  try {
217  workingDirectory = new WorkingDirectory(bbUser, bbHost, bbPort, bbContext);
218  workingDirectory.initialize(bbCreateDir, bbCreatePath);
219  workingTreeView.setCheckmarksEnabled(true);
220  workingTreeView.setSelectMode(TreeView.SelectMode.SINGLE);
221  workingTreeView.setShowMixedCheckmarkState(true);
222  workingTreeView.setTreeData(new WorkingTreeModel(workingDirectory));
223  TreeUtil.expandRootBranches(workingTreeView);
224  } catch (ParseException ex) {
225  Logger.getLogger(WorkingDesktop.class.getName()).log(Level.SEVERE, null, ex);
226  }
227  return null;
228  }
229  }.refreshData();
230 
231  }
void initialize(String bbCreateDir, String bbCreatePath)
Here is the call graph for this function:

◆ suspend()

void org.turro.wd.desktop.WorkingDesktop.suspend ( )

Definition at line 242 of file WorkingDesktop.java.

242  {
243  }

The documentation for this class was generated from the following file: