summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshawn.f.cook2011-10-28 13:33:41 (EDT)
committer Roberto E. Escobar2011-10-28 13:33:41 (EDT)
commita55deda33677c7fcbdba94166e732052343c4320 (patch)
tree884b7d3ad4f17b051642af48bd22931c1d445db6
parentf2157b6cdbec790feb6cf91e14961ae043a5815d (diff)
downloadorg.eclipse.osee-a55deda33677c7fcbdba94166e732052343c4320.zip
org.eclipse.osee-a55deda33677c7fcbdba94166e732052343c4320.tar.gz
org.eclipse.osee-a55deda33677c7fcbdba94166e732052343c4320.tar.bz2
feature[ats_18K4T]: Add thread synch on Vaadin objects
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java44
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseePagingComponent.java165
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java8
3 files changed, 113 insertions, 104 deletions
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java
index 5422dd0..9498f14 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java
@@ -78,34 +78,36 @@ public class OseeAttributeComponent extends VerticalLayout implements AttributeC
@Override
public void addAttribute(String type, String value) {
- if (type != null && !type.isEmpty() && value != null && !value.isEmpty()) {
+ synchronized (getApplication()) {
+ if (type != null && !type.isEmpty() && value != null && !value.isEmpty()) {
- if (type.contains("Word") && type.contains("Content") && type.contains("Template")) {
- Label attrLabel = new Label(String.format("%s:", type));
- attrLabel.setStyleName(CssConstants.OSEE_ATTRIBUTELABEL_LONG);
+ if (type.contains("Word") && type.contains("Content") && type.contains("Template")) {
+ Label attrLabel = new Label(String.format("%s:", type));
+ attrLabel.setStyleName(CssConstants.OSEE_ATTRIBUTELABEL_LONG);
- TextField attrValue = new TextField();
- attrValue.setValue(value);
- attrValue.setWidth(600, UNITS_PIXELS);
- attrValue.setHeight(300, UNITS_PIXELS);
+ TextField attrValue = new TextField();
+ attrValue.setValue(value);
+ attrValue.setWidth(600, UNITS_PIXELS);
+ attrValue.setHeight(300, UNITS_PIXELS);
- Label vSpacer_bottomAttr = new Label();
- vSpacer_bottomAttr.setHeight(15, UNITS_PIXELS);
+ Label vSpacer_bottomAttr = new Label();
+ vSpacer_bottomAttr.setHeight(15, UNITS_PIXELS);
- longAttrValuesLayout.addComponent(attrLabel);
- longAttrValuesLayout.addComponent(attrValue);
- longAttrValuesLayout.addComponent(vSpacer_bottomAttr);
+ longAttrValuesLayout.addComponent(attrLabel);
+ longAttrValuesLayout.addComponent(attrValue);
+ longAttrValuesLayout.addComponent(vSpacer_bottomAttr);
- longAttrValuesLayout.setComponentAlignment(attrLabel, Alignment.BOTTOM_LEFT);
- } else {
- Label attrLabel = new Label(String.format("%s:", type));
- attrLabel.setStyleName(CssConstants.OSEE_ATTRIBUTELABEL);
+ longAttrValuesLayout.setComponentAlignment(attrLabel, Alignment.BOTTOM_LEFT);
+ } else {
+ Label attrLabel = new Label(String.format("%s:", type));
+ attrLabel.setStyleName(CssConstants.OSEE_ATTRIBUTELABEL);
- Label attrValue = new Label(value);
- attrValue.setStyleName(CssConstants.OSEE_ATTRIBUTEVALUE);
+ Label attrValue = new Label(value);
+ attrValue.setStyleName(CssConstants.OSEE_ATTRIBUTEVALUE);
- attrLabelsLayout.addComponent(attrLabel);
- attrValuesLayout.addComponent(attrValue);
+ attrLabelsLayout.addComponent(attrLabel);
+ attrValuesLayout.addComponent(attrValue);
+ }
}
}
}
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseePagingComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseePagingComponent.java
index d74a11f..02cfca8 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseePagingComponent.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseePagingComponent.java
@@ -136,114 +136,117 @@ public class OseePagingComponent extends HorizontalLayout implements PagingCompo
addComponent(nextButton);
addComponent(spacer4);
addComponent(lastButton);
-
- updateLayout();
}
private void updateLayout() {
- if (allItemsPerPage) {
- firstButton.setEnabled(false);
- previousButton.setEnabled(false);
- nextButton.setEnabled(false);
- lastButton.setEnabled(false);
- } else {
- if (manyPages <= 0) {
+ if (getApplication() == null) {
+ return;
+ }
+ synchronized (getApplication()) {
+ if (allItemsPerPage) {
firstButton.setEnabled(false);
previousButton.setEnabled(false);
nextButton.setEnabled(false);
lastButton.setEnabled(false);
- }
-
- if (currentPage <= 0) {
- firstButton.setEnabled(false);
- previousButton.setEnabled(false);
} else {
- firstButton.setEnabled(true);
- previousButton.setEnabled(true);
- }
+ if (manyPages <= 0) {
+ firstButton.setEnabled(false);
+ previousButton.setEnabled(false);
+ nextButton.setEnabled(false);
+ lastButton.setEnabled(false);
+ }
- if (currentPage >= manyPages - 1) {
- nextButton.setEnabled(false);
- lastButton.setEnabled(false);
- } else {
- nextButton.setEnabled(true);
- lastButton.setEnabled(true);
- }
- }
+ if (currentPage <= 0) {
+ firstButton.setEnabled(false);
+ previousButton.setEnabled(false);
+ } else {
+ firstButton.setEnabled(true);
+ previousButton.setEnabled(true);
+ }
- //Update page numbers
- hLayout_PageNumbers.removeAllComponents();
- if (allItemsPerPage) {
- Label pageLabel = new Label(String.format("1"));
- pageLabel.setStyleName(CssConstants.OSEE_CURRENTPAGELABEL);
-
- Label spacer = new Label();
- spacer.setWidth(7, UNITS_PIXELS);
-
- hLayout_PageNumbers.addComponent(pageLabel);
- hLayout_PageNumbers.addComponent(spacer);
- } else {
- int startPage = 0;
- int endPage = manyPages - 1;
-
- //If there are more pages than MAX_PAGE_NUMBERS_SHOWN, then we need to reduce
- // the number of pages shown.
- // if (manyPages > 0 && manyPages > currentPage && MAX_PAGE_NUMBERS_SHOWN > (manyPages - currentPage)) {
- int pageSetIndex = currentPage / MAX_PAGE_NUMBERS_SHOWN;
- startPage = pageSetIndex * MAX_PAGE_NUMBERS_SHOWN;
- endPage = startPage + MAX_PAGE_NUMBERS_SHOWN;
- // }
-
- if (endPage >= manyPages) {
- endPage = manyPages - 1;
+ if (currentPage >= manyPages - 1) {
+ nextButton.setEnabled(false);
+ lastButton.setEnabled(false);
+ } else {
+ nextButton.setEnabled(true);
+ lastButton.setEnabled(true);
+ }
}
- if (startPage != 0) {
- Label pageLabel = new Label("...");
+ //Update page numbers
+ hLayout_PageNumbers.removeAllComponents();
+ if (allItemsPerPage) {
+ Label pageLabel = new Label(String.format("1"));
+ pageLabel.setStyleName(CssConstants.OSEE_CURRENTPAGELABEL);
Label spacer = new Label();
spacer.setWidth(7, UNITS_PIXELS);
hLayout_PageNumbers.addComponent(pageLabel);
hLayout_PageNumbers.addComponent(spacer);
- }
-
- for (int i = startPage; i <= endPage; i++) {
- if (i == currentPage) {
- Label pageLabel = new Label(String.format("%d", i + 1));
- pageLabel.setStyleName(CssConstants.OSEE_CURRENTPAGELABEL);
-
- hLayout_PageNumbers.addComponent(pageLabel);
- } else {
- Button pageButton = new Button(String.format("%d", i + 1));
- pageButton.setStyleName("link");
- final int index = i;//needs to be 'final' for use with listener below
- pageButton.addListener(new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- OseePagingComponent.this.setCurrentPage(index);
- fireEvent(new PageSelectedEvent(OseePagingComponent.this));
- }
- });
-
- hLayout_PageNumbers.addComponent(pageButton);
+ } else {
+ int startPage = 0;
+ int endPage = manyPages - 1;
+
+ //If there are more pages than MAX_PAGE_NUMBERS_SHOWN, then we need to reduce
+ // the number of pages shown.
+ // if (manyPages > 0 && manyPages > currentPage && MAX_PAGE_NUMBERS_SHOWN > (manyPages - currentPage)) {
+ int pageSetIndex = currentPage / MAX_PAGE_NUMBERS_SHOWN;
+ startPage = pageSetIndex * MAX_PAGE_NUMBERS_SHOWN;
+ endPage = startPage + MAX_PAGE_NUMBERS_SHOWN;
+ // }
+
+ if (endPage >= manyPages) {
+ endPage = manyPages - 1;
}
- if (i <= endPage) {
+ if (startPage != 0) {
+ Label pageLabel = new Label("...");
+
Label spacer = new Label();
spacer.setWidth(7, UNITS_PIXELS);
+
+ hLayout_PageNumbers.addComponent(pageLabel);
hLayout_PageNumbers.addComponent(spacer);
}
- }
- if (endPage != manyPages - 1) {
- Label pageLabel = new Label("...");
+ for (int i = startPage; i <= endPage; i++) {
+ if (i == currentPage) {
+ Label pageLabel = new Label(String.format("%d", i + 1));
+ pageLabel.setStyleName(CssConstants.OSEE_CURRENTPAGELABEL);
+
+ hLayout_PageNumbers.addComponent(pageLabel);
+ } else {
+ Button pageButton = new Button(String.format("%d", i + 1));
+ pageButton.setStyleName("link");
+ final int index = i;//needs to be 'final' for use with listener below
+ pageButton.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ OseePagingComponent.this.setCurrentPage(index);
+ fireEvent(new PageSelectedEvent(OseePagingComponent.this));
+ }
+ });
+
+ hLayout_PageNumbers.addComponent(pageButton);
+ }
+
+ if (i <= endPage) {
+ Label spacer = new Label();
+ spacer.setWidth(7, UNITS_PIXELS);
+ hLayout_PageNumbers.addComponent(spacer);
+ }
+ }
+
+ if (endPage != manyPages - 1) {
+ Label pageLabel = new Label("...");
- Label spacer = new Label();
- spacer.setWidth(7, UNITS_PIXELS);
+ Label spacer = new Label();
+ spacer.setWidth(7, UNITS_PIXELS);
- hLayout_PageNumbers.addComponent(pageLabel);
- hLayout_PageNumbers.addComponent(spacer);
+ hLayout_PageNumbers.addComponent(pageLabel);
+ hLayout_PageNumbers.addComponent(spacer);
+ }
}
}
}
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java
index bf532f9..d110172 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeSearchResultsListComponent.java
@@ -162,7 +162,9 @@ public class OseeSearchResultsListComponent extends VerticalLayout implements Se
private void updateManySearchResultsLabel() {
String manyResults = String.format("%d", resultList.size());
- manySearchResults.setCaption(manyResults);
+ synchronized (getApplication()) {
+ manySearchResults.setCaption(manyResults);
+ }
pagingComponent.setManyItemsTotal(resultList.size());
}
@@ -212,7 +214,9 @@ public class OseeSearchResultsListComponent extends VerticalLayout implements Se
updateManySearchResultsLabel();
int lastCompIndex = mainLayout.getComponentIndex(bottomSpacer);
- mainLayout.addComponent(searchResultComp, lastCompIndex);
+ synchronized (getApplication()) {
+ mainLayout.addComponent(searchResultComp, lastCompIndex);
+ }
//This call is needed in order to only show those results which are on the current page.
updateSearchResultsLayout();