use of com.biglybt.ui.swt.widgets.TagPainter in project BiglyBT by BiglySoftware.
the class TagButtonsUI method updateTag.
public int updateTag(Tag tag, List<Taggable> taggables) {
if (cMainComposite == null || cMainComposite.isDisposed()) {
return UPDATETAG_NOCHANGE;
}
for (TagCanvas tagWidget : tagWidgets) {
TagPainter painter = tagWidget.getTagPainter();
if (tag.equals(painter.getTag())) {
Composite parent = tagWidget.getParent();
String oldGroup = (parent instanceof Group) ? ((Group) parent).getText() : "";
String newGroup = painter.getTag().getGroup();
if (newGroup == null) {
newGroup = "";
}
if (!oldGroup.equals(newGroup)) {
return UPDATETAG_REQUIRES_REBUILD;
}
painter.updateState(taggables);
return UPDATETAG_SUCCESS;
}
}
return UPDATETAG_SUCCESS;
}
use of com.biglybt.ui.swt.widgets.TagPainter in project BiglyBT by BiglySoftware.
the class TagButtonsUI method setSelectedTags.
public void setSelectedTags(List<Tag> tags) {
Set<Tag> tag_set = new HashSet<>(tags);
for (TagCanvas widget : tagWidgets) {
TagPainter painter = widget.getTagPainter();
Tag tag = painter.getTag();
if (tag == null) {
continue;
}
boolean select = tag_set.contains(tag);
painter.setSelected(select);
}
}
Aggregations