Search in sources :

Example 31 with Tag

use of com.biglybt.core.tag.Tag in project BiglyBT by BiglySoftware.

the class ColumnTagMoveOnComp method refresh.

@Override
public void refresh(TableCell cell) {
    Tag tag = (Tag) cell.getDataSource();
    if (tag instanceof TagFeatureFileLocation) {
        TagFeatureFileLocation fl = (TagFeatureFileLocation) tag;
        if (fl.supportsTagMoveOnComplete()) {
            File target_file = fl.getTagMoveOnCompleteFolder();
            String target;
            if (target_file == null) {
                target = "";
            } else {
                target = target_file.getAbsolutePath();
            }
            if (!cell.setSortValue(target) && cell.isValid()) {
                return;
            }
            if (!cell.isShown()) {
                return;
            }
            cell.setText(target);
        }
    }
}
Also used : Tag(com.biglybt.core.tag.Tag) TagFeatureFileLocation(com.biglybt.core.tag.TagFeatureFileLocation) File(java.io.File)

Example 32 with Tag

use of com.biglybt.core.tag.Tag in project BiglyBT by BiglySoftware.

the class ColumnTagName method refresh.

@Override
public void refresh(TableCell cell) {
    Tag tag = (Tag) cell.getDataSource();
    String tagName = null;
    if (tag != null) {
        tagName = tag.getTagName(true);
    }
    if (tagName == null) {
        tagName = "";
    }
    String desc = tag == null ? null : tag.getDescription();
    if (desc != null) {
        cell.setToolTip(desc);
    }
    if (!cell.setSortValue(tagName) && cell.isValid()) {
        return;
    }
    if (!cell.isShown()) {
        return;
    }
    cell.setText(tagName);
}
Also used : Tag(com.biglybt.core.tag.Tag)

Example 33 with Tag

use of com.biglybt.core.tag.Tag in project BiglyBT by BiglySoftware.

the class ColumnSubscriptionTag method refresh.

@Override
public void refresh(TableCell cell) {
    Subscription sub = (Subscription) cell.getDataSource();
    Tag tag = tag_manager.lookupTagByUID(sub.getTagID());
    String tag_str = tag == null ? "" : tag.getTagName(true);
    if (!cell.setSortValue(tag_str) && cell.isValid()) {
        return;
    }
    if (!cell.isShown()) {
        return;
    }
    cell.setText(tag_str);
    return;
}
Also used : Tag(com.biglybt.core.tag.Tag) Subscription(com.biglybt.core.subs.Subscription)

Example 34 with Tag

use of com.biglybt.core.tag.Tag in project BiglyBT by BiglySoftware.

the class ColumnTagCount method refresh.

@Override
public void refresh(TableCell cell) {
    Tag tag = (Tag) cell.getDataSource();
    int sortVal = 0;
    if (tag != null) {
        sortVal = tag.getTaggedCount();
    }
    if (!cell.setSortValue(sortVal) && cell.isValid()) {
        return;
    }
    if (!cell.isShown()) {
        return;
    }
    cell.setText("" + sortVal);
}
Also used : Tag(com.biglybt.core.tag.Tag)

Example 35 with Tag

use of com.biglybt.core.tag.Tag in project BiglyBT by BiglySoftware.

the class ColumnTagProperties method refresh.

@Override
public void refresh(TableCell cell) {
    Tag tag = (Tag) cell.getDataSource();
    String text = "";
    if (tag instanceof TagFeatureProperties) {
        TagFeatureProperties tp = (TagFeatureProperties) tag;
        TagFeatureProperties.TagProperty[] props = tp.getSupportedProperties();
        if (props.length > 0) {
            for (TagFeatureProperties.TagProperty prop : props) {
                String prop_str = prop.getString();
                if (prop_str.length() > 0) {
                    text += (text.length() == 0 ? "" : "; ") + prop_str;
                }
            }
        }
    }
    if (tag instanceof TagFeatureExecOnAssign) {
        TagFeatureExecOnAssign eoa = (TagFeatureExecOnAssign) tag;
        int actions = eoa.getSupportedActions();
        if (actions != TagFeatureExecOnAssign.ACTION_NONE) {
            String actions_str = "";
            int[] action_ids = { TagFeatureExecOnAssign.ACTION_APPLY_OPTIONS_TEMPLATE, TagFeatureExecOnAssign.ACTION_DESTROY, TagFeatureExecOnAssign.ACTION_START, TagFeatureExecOnAssign.ACTION_FORCE_START, TagFeatureExecOnAssign.ACTION_NOT_FORCE_START, TagFeatureExecOnAssign.ACTION_STOP, TagFeatureExecOnAssign.ACTION_SCRIPT, TagFeatureExecOnAssign.ACTION_PAUSE, TagFeatureExecOnAssign.ACTION_RESUME };
            String[] action_keys = { "label.apply.options.template", "v3.MainWindow.button.delete", "v3.MainWindow.button.start", "v3.MainWindow.button.forcestart", "v3.MainWindow.button.notforcestart", "v3.MainWindow.button.stop", "label.script", "v3.MainWindow.button.pause", "v3.MainWindow.button.resume" };
            for (int i = 0; i < action_ids.length; i++) {
                int action_id = action_ids[i];
                if (eoa.supportsAction(action_id)) {
                    boolean enabled = eoa.isActionEnabled(action_id);
                    if (enabled) {
                        if (action_id == TagFeatureExecOnAssign.ACTION_SCRIPT) {
                            String script = eoa.getActionScript();
                            if (script.length() > 63) {
                                script = script.substring(0, 60) + "...";
                            }
                            actions_str += (actions_str.length() == 0 ? "" : ",") + MessageText.getString(action_keys[i]) + "=" + script;
                        } else {
                            actions_str += (actions_str.length() == 0 ? "" : ",") + MessageText.getString(action_keys[i]) + "=Y";
                        }
                    }
                }
            }
            if (actions_str.length() > 0) {
                text += (text.length() == 0 ? "" : "; ") + MessageText.getString("label.exec.on.assign") + ": ";
                text += actions_str;
            }
        }
    }
    if (!cell.setSortValue(text) && cell.isValid()) {
        return;
    }
    if (!cell.isShown()) {
        return;
    }
    cell.setText(text);
}
Also used : Tag(com.biglybt.core.tag.Tag) TagFeatureProperties(com.biglybt.core.tag.TagFeatureProperties) TagFeatureExecOnAssign(com.biglybt.core.tag.TagFeatureExecOnAssign)

Aggregations

Tag (com.biglybt.core.tag.Tag)55 DownloadManager (com.biglybt.core.download.DownloadManager)15 TagFeatureRateLimit (com.biglybt.core.tag.TagFeatureRateLimit)12 File (java.io.File)9 TagManager (com.biglybt.core.tag.TagManager)8 TagType (com.biglybt.core.tag.TagType)8 ArrayList (java.util.ArrayList)8 List (java.util.List)5 Core (com.biglybt.core.Core)4 CoreRunningListener (com.biglybt.core.CoreRunningListener)4 PEPeerManager (com.biglybt.core.peer.PEPeerManager)4 TagFeatureFileLocation (com.biglybt.core.tag.TagFeatureFileLocation)4 Point (org.eclipse.swt.graphics.Point)4 Category (com.biglybt.core.category.Category)3 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)3 DownloadManagerInitialisationAdapter (com.biglybt.core.download.DownloadManagerInitialisationAdapter)3 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)3 TOTorrent (com.biglybt.core.torrent.TOTorrent)3 Download (com.biglybt.pif.download.Download)3 GlobalManager (com.biglybt.core.global.GlobalManager)2