Changeset 3933
- Timestamp:
- Nov 1, 2010, 1:42:25 PM (13 years ago)
- Location:
- trunk/client/servlet/src
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/locale/en/dictionary
r3924 r3933 149 149 Download=Download 150 150 Edit=Edit 151 EllipsisMenuItem=… 151 152 email=email 152 153 Email=E-mail … … 410 411 Model=Model 411 412 Modifications=Modifications 413 MoreProjectsMenuItem=more 412 414 Move=Move 413 415 MsFile=MS File -
trunk/client/servlet/src/org/proteios/gui/MainMenu.java
r3725 r3933 17 17 import org.proteios.action.ActionFactory; 18 18 import org.proteios.action.ConfigureTableFactory2; 19 import org.proteios.action.DummyAction; 19 20 import org.proteios.action.ProteiosAction; 20 21 import org.proteios.action.ShowTable; … … 132 133 private static final Node separator = new Node().setActionLink(empty); 133 134 private SessionControl sc; 135 private final int MAX_NUM_PROJECT_ITEMS = 20; 134 136 135 137 … … 249 251 { 250 252 // Define 251 Node rootN, noActiveProjectN ;252 List<Node> projectNodeList; 253 Node rootN, noActiveProjectN, ellipsisN, moreProjectsN; 254 List<Node> projectNodeList; 253 255 String label; 254 256 ActionLink actionLink; 255 257 boolean selected; 256 258 ItemQuery<Project> query; 259 int maxNumProjectItems = MAX_NUM_PROJECT_ITEMS; 257 260 // Create 258 261 rootN = new Node().setLabel("SelectProject"); 259 262 projectNodeList = new ArrayList<Node>(0); 260 263 selected = false; 264 // 261 265 label = "NoActiveProjectMenuItem"; 262 266 actionLink = actionFactory 263 267 .getActionLink(DeactivateProject.class, label); 264 268 noActiveProjectN = new Node(actionLink, label + "id"); 269 // 270 label = "EllipsisMenuItem"; 271 actionLink = actionFactory 272 .getActionLink(DummyAction.class, label); 273 ellipsisN = new Node(actionLink, label + "id"); 274 // 265 275 // Use 266 276 // Set selection flag … … 283 293 .parameter("closed"))); 284 294 query.setParameter("closed", true, null); 295 int numProjects = query.count(dc); 296 int numAddedProjectItems = 0; 297 boolean selectedFound = false; 298 boolean ellipsisItemAdded = false; 285 299 for (Project project : query.list(dc)) 286 300 { … … 290 304 { 291 305 selected = true; 306 selectedFound = true; 292 307 } 293 308 label = project.getName(); … … 301 316 projectN.setLocalizationUsed(false); 302 317 // Add project node to list 303 projectNodeList.add(projectN); 304 } 318 // Restrict number of added project items; always add selected project 319 if (numAddedProjectItems < (maxNumProjectItems - 1)) 320 { 321 // Place for more than one more project item 322 projectNodeList.add(projectN); 323 numAddedProjectItems++; 324 } 325 else if (numAddedProjectItems == (maxNumProjectItems - 1)) 326 { 327 // Place for one more project item 328 if (selectedFound) 329 { 330 // Add last project item, selected project in list 331 projectNodeList.add(projectN); 332 numAddedProjectItems++; 333 } 334 else if (activeProject == null) 335 { 336 // No project selected, add last project item 337 projectNodeList.add(projectN); 338 numAddedProjectItems++; 339 } 340 else 341 { 342 // Selected project item exists, but is not current item 343 // Add ellipsis item once, waiting for the selected item 344 if (!ellipsisItemAdded) 345 { 346 // Add "..." ellipsis item 347 projectNodeList.add(ellipsisN); 348 ellipsisItemAdded = true; 349 } 350 } 351 } 352 } 353 // Check if not all projects in menu 354 if (numProjects > maxNumProjectItems) 355 { 356 // Add "..." ellipsis item, if not already added 357 if (!ellipsisItemAdded) 358 { 359 // Add "..." ellipsis item 360 projectNodeList.add(ellipsisN); 361 ellipsisItemAdded = true; 362 } 363 // Add separator item 364 projectNodeList.add(separator); 365 // Add "<number of unlisted projects> more" node 366 String moreLabel = locale.get("MoreProjectsMenuItem"); 367 int numMoreProjects = numProjects - numAddedProjectItems; 368 label = new String(numMoreProjects + " " + moreLabel); 369 actionLink = actionFactory 370 .getActionLink(ListMyProjects.class, label); 371 moreProjectsN = new Node(actionLink, label + "id"); 372 projectNodeList.add(moreProjectsN); 373 } 374 // Add menu items to hierarchical menu 305 375 for (int i = 0; i < projectNodeList.size(); i++) 306 376 {
Note: See TracChangeset
for help on using the changeset viewer.