Enhanced information passed when an item is selected, now passing more info such as if the item is a group or not and the item id

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/pickitem-widget@165227 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-03-18 16:17:06 +00:00
parent d7ae2098b4
commit 024e218872
6 changed files with 46 additions and 11 deletions

View File

@ -1,14 +1,22 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="portlets-widgets.pickitem-widget.1-2-0" <Changeset component="portlets-widgets.pickitem-widget.1-3-0"
date="2018-03-19">
<Change>Enhanced information passed when an item is selected, now passing more info such as if the item is a group or not and the item id
</Change>
</Changeset>
<Changeset component="portlets-widgets.pickitem-widget.1-2-0"
date="2016-06-30"> date="2016-06-30">
<Change>Fix for Incident #4246, in some cases notification email resulting from posts are "broken"</Change> <Change>Fix for Incident #4246, in some cases notification email
<Change>Fix for hashtags not allowing to use enter after picked one</Change> resulting from posts are "broken"</Change>
<Change>Fix for hashtags not allowing to use enter after picked one
</Change>
</Changeset> </Changeset>
<Changeset component="portlets-widgets.pickitem-widget.1-1-0" <Changeset component="portlets-widgets.pickitem-widget.1-1-0"
date="2015-07-14"> date="2015-07-14">
<Change>Ported to GWT 2.7.0</Change> <Change>Ported to GWT 2.7.0</Change>
<Change>Fix for Bug #320, Users tagging does not work if @ is in the <Change>Fix for Bug #320, Users tagging does not work if @ is in the
middle of already typed text</Change> middle of already typed text
</Change>
</Changeset> </Changeset>
<Changeset component="portlets-widgets.pickitem-widget.1-0-0" <Changeset component="portlets-widgets.pickitem-widget.1-0-0"
date="2013-10-21"> date="2013-10-21">

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>pickitem-widget</artifactId> <artifactId>pickitem-widget</artifactId>
<version>1.2.0-SNAPSHOT</version> <version>1.3.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>gCube Pick Item Widget</name> <name>gCube Pick Item Widget</name>
<description> <description>

View File

@ -157,7 +157,9 @@ public class PickItemsDialog extends PopupPanel {
private void handleMouseDown() { private void handleMouseDown() {
SelectableItem ut = (SelectableItem) mainPanel.getWidget(displayIndexSelected); SelectableItem ut = (SelectableItem) mainPanel.getWidget(displayIndexSelected);
eventBus.fireEvent(new PickedItemEvent(new ItemBean("id", "username", ut.getItemName(), "thumb"), this.triggerChar, itemCursorIndexStart, itemCursorIndexEnd)); ItemBean itemBean = new ItemBean(ut.getItemId(), "username", ut.getItemName(), "thumb");
itemBean.setItemGroup(ut.isGroup());
eventBus.fireEvent(new PickedItemEvent(itemBean, this.triggerChar, itemCursorIndexStart, itemCursorIndexEnd));
hide(); hide();
select(0); //RESET select(0); //RESET
} }
@ -251,7 +253,9 @@ public class PickItemsDialog extends PopupPanel {
ut = (SelectableItem) mainPanel.getWidget(0); ut = (SelectableItem) mainPanel.getWidget(0);
else else
ut = (SelectableItem) mainPanel.getWidget(displayIndexSelected); ut = (SelectableItem) mainPanel.getWidget(displayIndexSelected);
eventBus.fireEvent(new PickedItemEvent(new ItemBean("id", "username", ut.getItemName(), "thumb"), this.triggerChar, itemCursorIndexStart, itemCursorIndexEnd)); ItemBean itemBean = new ItemBean(ut.getItemId(), "username", ut.getItemName(), "thumb");
itemBean.setItemGroup(ut.isGroup());
eventBus.fireEvent(new PickedItemEvent(itemBean, this.triggerChar, itemCursorIndexStart, itemCursorIndexEnd));
hide(); hide();
select(0); //RESET select(0); //RESET
} }

View File

@ -28,14 +28,16 @@ public class NoPhotoTemplate extends Composite implements SelectableItem {
FocusPanel focusDiv; FocusPanel focusDiv;
@UiField @UiField
HTML contentArea; HTML contentArea;
private String id;
private boolean isGroup;
public NoPhotoTemplate(PickItemsDialog owner, ItemBean user, int displayIndex) { public NoPhotoTemplate(PickItemsDialog owner, ItemBean user, int displayIndex) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.owner = owner; this.owner = owner;
currDisplayIndex = displayIndex; currDisplayIndex = displayIndex;
contentArea.setHTML(user.getAlternativeName()); contentArea.setHTML(user.getAlternativeName());
this.id = user.getId();
this.isGroup = user.isItemGroup();
} }
@UiHandler("focusDiv") @UiHandler("focusDiv")
@ -47,6 +49,13 @@ public class NoPhotoTemplate extends Composite implements SelectableItem {
public String getItemName() { public String getItemName() {
return contentArea.getText(); return contentArea.getText();
} }
@Override
public String getItemId() {
return this.id;
}
@Override
public boolean isGroup() {
return this.isGroup;
}
} }

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.widgets.pickitem.client.uibinder; package org.gcube.portlets.widgets.pickitem.client.uibinder;
public interface SelectableItem { public interface SelectableItem {
String getItemId();
String getItemName(); String getItemName();
boolean isGroup();
} }

View File

@ -31,6 +31,9 @@ public class WithPhotoTemplate extends Composite implements SelectableItem {
@UiField @UiField
HTML contentArea; HTML contentArea;
private String id;
private boolean isGroup;
public WithPhotoTemplate(PickItemsDialog owner, ItemBean user, int displayIndex) { public WithPhotoTemplate(PickItemsDialog owner, ItemBean user, int displayIndex) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.owner = owner; this.owner = owner;
@ -40,7 +43,8 @@ public class WithPhotoTemplate extends Composite implements SelectableItem {
avatarImage.setPixelSize(30, 30); avatarImage.setPixelSize(30, 30);
contentArea.setHTML(user.getAlternativeName()); contentArea.setHTML(user.getAlternativeName());
this.id = user.getId();
this.isGroup = user.isItemGroup();
} }
@ -53,4 +57,12 @@ public class WithPhotoTemplate extends Composite implements SelectableItem {
public String getItemName() { public String getItemName() {
return contentArea.getText(); return contentArea.getText();
} }
@Override
public String getItemId() {
return this.id;
}
@Override
public boolean isGroup() {
return this.isGroup;
}
} }