summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn F. Cook2011-10-07 09:14:06 (EDT)
committer Roberto E. Escobar2011-10-07 09:14:06 (EDT)
commit1a9eac16e3521efc237e47047336acbfa336f5a7 (patch)
treeb912a797ca38e37b00cefc225556c3f6a3983546
parent0c1962a3c2f946e05668ac0aa090414a7dcb92b3 (diff)
downloadorg.eclipse.osee-1a9eac16e3521efc237e47047336acbfa336f5a7.zip
org.eclipse.osee-1a9eac16e3521efc237e47047336acbfa336f5a7.tar.gz
org.eclipse.osee-1a9eac16e3521efc237e47047336acbfa336f5a7.tar.bz2
feature[ats_Q9NLC]: Create ShowHideButton
-rw-r--r--plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeAttributeComponent.java16
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java19
-rw-r--r--plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeShowHideButton.java135
-rw-r--r--plugins/org.eclipse.osee.support.config/launchConfig/UI.launch6
5 files changed, 151 insertions, 26 deletions
diff --git a/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF
index 57d0873..9ee59c6 100644
--- a/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.presenter/META-INF/MANIFEST.MF
@@ -17,4 +17,3 @@ Import-Package: org.eclipse.osee.ats.api.components,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data
-Require-Bundle: org.eclipse.core.runtime
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 3709621..13b6287 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
@@ -19,8 +19,6 @@ import org.eclipse.osee.display.api.components.AttributeComponent;
import org.eclipse.osee.display.api.data.WebArtifact;
import org.eclipse.osee.display.view.web.CssConstants;
import com.vaadin.ui.Alignment;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.VerticalLayout;
@@ -38,18 +36,14 @@ public class OseeAttributeComponent extends VerticalLayout implements AttributeC
if (artifact != null) {
final HorizontalLayout attributesLayout = new HorizontalLayout();
- final Button showHideButton = new Button("- Attributes");
- showHideButton.addListener(new Button.ClickListener() {
+ final OseeShowHideButton showHideButton = new OseeShowHideButton("Attributes");
+ showHideButton.addListener(new OseeShowHideButton.ClickListener() {
@Override
- public void buttonClick(ClickEvent event) {
- attributesLayout.setVisible(!attributesLayout.isVisible());
- if (attributesLayout.isVisible()) {
- showHideButton.setCaption("- Attributes");
- } else {
- showHideButton.setCaption("+ Attributes");
- }
+ public void buttonClick(OseeShowHideButton.ClickEvent event) {
+ attributesLayout.setVisible(showHideButton.isStateShow());
}
});
+ attributesLayout.setVisible(showHideButton.isStateShow());
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("Category", artifact.getAttr_Category());
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java
index 8c2b5c1..9205362 100644
--- a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeRelationsComponent.java
@@ -18,8 +18,6 @@ import org.eclipse.osee.display.api.search.SearchPresenter;
import org.eclipse.osee.display.view.web.OseeAppData;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.ListSelect;
@@ -42,18 +40,17 @@ public class OseeRelationsComponent extends VerticalLayout implements RelationCo
removeAllComponents();
final HorizontalLayout listBoxesLayout = new HorizontalLayout();
- final Button showHideButton = new Button("- Relations");
- showHideButton.addListener(new Button.ClickListener() {
+
+ final OseeShowHideButton showHideButton = new OseeShowHideButton("Relations");
+ showHideButton.addListener(new OseeShowHideButton.ClickListener() {
+
@Override
- public void buttonClick(ClickEvent event) {
- listBoxesLayout.setVisible(!listBoxesLayout.isVisible());
- if (listBoxesLayout.isVisible()) {
- showHideButton.setCaption("- Relations");
- } else {
- showHideButton.setCaption("+ Relations");
- }
+ public void buttonClick(OseeShowHideButton.ClickEvent event) {
+ listBoxesLayout.setVisible(showHideButton.isStateShow());
}
});
+ //Initialize listBoxesLayout visibility
+ listBoxesLayout.setVisible(showHideButton.isStateShow());
relationTypesListSelect.setNullSelectionAllowed(false);
relationTypesListSelect.setImmediate(true);
diff --git a/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeShowHideButton.java b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeShowHideButton.java
new file mode 100644
index 0000000..bddbb17
--- /dev/null
+++ b/plugins/org.eclipse.osee.display.view.web/src/org/eclipse/osee/display/view/web/components/OseeShowHideButton.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.display.view.web.components;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+
+/**
+ * @author Shawn F. Cook
+ */
+@SuppressWarnings("serial")
+public class OseeShowHideButton extends HorizontalLayout {
+
+ private final Button plusMinusButton = new Button("-");
+ private boolean isStateShow = true;
+
+ public OseeShowHideButton(String caption) {
+ final Button showHideButton = new Button(caption);
+ showHideButton.setStyleName("link");
+ showHideButton.addListener(new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ toggleStateShow();
+ }
+ });
+
+ plusMinusButton.setStyleName("link");
+ plusMinusButton.addListener(new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ toggleStateShow();
+ }
+ });
+
+ this.addComponent(plusMinusButton);
+ this.addComponent(showHideButton);
+
+ this.setComponentAlignment(plusMinusButton, Alignment.MIDDLE_LEFT);
+ this.setComponentAlignment(showHideButton, Alignment.MIDDLE_RIGHT);
+ }
+
+ private void toggleStateShow() {
+ setStateShow(!isStateShow);
+ fireClick();
+ }
+
+ public void setStateShow(boolean isStateShow) {
+ this.isStateShow = isStateShow;
+ if (isStateShow) {
+ plusMinusButton.setCaption("-");
+ } else {
+ plusMinusButton.setCaption("+");
+ }
+ }
+
+ public boolean isStateShow() {
+ return isStateShow;
+ }
+
+ /**
+ * Fires a click event to all listeners without any event details.
+ */
+ protected void fireClick() {
+ fireEvent(new OseeShowHideButton.ClickEvent(this));
+ }
+
+ private static final Method SHOWHIDE_BUTTON_CLICK_METHOD;
+
+ static {
+ try {
+ SHOWHIDE_BUTTON_CLICK_METHOD =
+ ClickListener.class.getDeclaredMethod("buttonClick", new Class[] {ClickEvent.class});
+ } catch (final java.lang.NoSuchMethodException e) {
+ // This should never happen
+ throw new java.lang.RuntimeException("Internal error finding methods in Button");
+ }
+ }
+
+ /**
+ * Interface for listening for a {@link ClickEvent} fired by a {@link Component}.
+ */
+ public interface ClickListener extends Serializable {
+
+ /**
+ * Called when a {@link Button} has been clicked. A reference to the button is given by
+ * {@link ClickEvent#getButton()}.
+ *
+ * @param event An event containing information about the click.
+ */
+ public void buttonClick(ClickEvent event);
+
+ }
+
+ /**
+ * Adds the button click listener.
+ *
+ * @param listener the Listener to be added.
+ */
+ public void addListener(ClickListener listener) {
+ addListener(ClickEvent.class, listener, SHOWHIDE_BUTTON_CLICK_METHOD);
+ }
+
+ /**
+ * Removes the button click listener.
+ *
+ * @param listener the Listener to be removed.
+ */
+ public void removeListener(ClickListener listener) {
+ removeListener(ClickEvent.class, listener, SHOWHIDE_BUTTON_CLICK_METHOD);
+ }
+
+ /**
+ * Click event. This event is thrown, when the button is clicked.
+ */
+ public class ClickEvent extends Component.Event {
+
+ public ClickEvent(Component source) {
+ super(source);
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch
index 81c710d..2a93a42 100644
--- a/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch
+++ b/plugins/org.eclipse.osee.support.config/launchConfig/UI.launch
@@ -19,10 +19,10 @@
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dorg.osgi.service.http.port=8089"/>
<stringAttribute key="pde.version" value="3.3"/>
<booleanAttribute key="show_selected_only" value="false"/>
-<stringAttribute key="target_bundles" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.ibm.icu@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/>
-<stringAttribute key="timestamp" value="1317914806677"/>
+<stringAttribute key="target_bundles" value="ch.qos.logback.classic@default:default,ch.qos.logback.core@default:default,ch.qos.logback.slf4j@default:false,com.ibm.icu@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.lang@default:default,org.apache.commons.logging@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.win32.x86@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources.win32.x86@default:false,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86@default:false,org.eclipse.equinox.security@default:default,org.eclipse.equinox.servletbridge.extensionbundle@default:false,org.eclipse.equinox.transforms.hook@default:false,org.eclipse.equinox.util@default:default,org.eclipse.equinox.weaving.hook@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit*4.8.2.v4_8_2_v20110321-1705@default:default,org.mortbay.jetty.server@default:default,org.mortbay.jetty.util@default:default,org.objectweb.asm@default:default,org.slf4j.api@default:default,org.slf4j.jcl@default:default"/>
+<stringAttribute key="timestamp" value="1317992980396"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="com.vaadin@default:default,org.eclipse.osee.ats.api@default:default,org.eclipse.osee.ats.view.web@default:default,org.eclipse.osee.display.api@default:default,org.eclipse.osee.display.presenter.test@default:false,org.eclipse.osee.display.presenter@default:default,org.eclipse.osee.display.view.web@default:default,org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:default,org.eclipse.osee.vaadin.themes@default:false,org.eclipse.osee.vaadin.widgets@default:default,org.eclipse.osee.vaadin@default:default"/>
+<stringAttribute key="workspace_bundles" value="com.vaadin@default:default,org.eclipse.osee.ats.api@default:default,org.eclipse.osee.ats.view.web@default:default,org.eclipse.osee.display.api@default:default,org.eclipse.osee.display.presenter*0.9.9.qualifier@default:default,org.eclipse.osee.display.presenter.test@default:false,org.eclipse.osee.display.view.web*0.9.9.qualifier@default:default,org.eclipse.osee.event.osgi@default:default,org.eclipse.osee.event@default:default,org.eclipse.osee.framework.core.model.test@default:false,org.eclipse.osee.framework.core.model@default:default,org.eclipse.osee.framework.core.test@default:false,org.eclipse.osee.framework.core@default:default,org.eclipse.osee.framework.jdk.core.test@default:false,org.eclipse.osee.framework.jdk.core@default:default,org.eclipse.osee.framework.logging.test@default:false,org.eclipse.osee.framework.logging@default:default,org.eclipse.osee.logback.config@default:false,org.eclipse.osee.logger.slf4j@default:default,org.eclipse.osee.logger@default:default,org.eclipse.osee.orcs@default:default,org.eclipse.osee.vaadin.themes@default:false,org.eclipse.osee.vaadin.widgets@default:default,org.eclipse.osee.vaadin@default:default"/>
</launchConfiguration>