Widgets: add setItemId

This commit is contained in:
raiyni
2018-09-04 11:45:21 -05:00
parent 84700125cd
commit cbbae60079
3 changed files with 19 additions and 8 deletions

View File

@@ -36,9 +36,9 @@ import net.runelite.api.Point;
* <p> * <p>
* Examples of Widgets include: * Examples of Widgets include:
* <ul> * <ul>
* <li>The fairy ring configuration selector</li> * <li>The fairy ring configuration selector</li>
* <li>The mini-map</li> * <li>The mini-map</li>
* <li>The bank inventory</li> * <li>The bank inventory</li>
* </ul> * </ul>
* <p> * <p>
* For a more complete idea of what is classified as a widget, see {@link WidgetID}. * For a more complete idea of what is classified as a widget, see {@link WidgetID}.
@@ -332,7 +332,7 @@ public interface Widget
* *
* @param index index of the item * @param index index of the item
* @return the widget item at index, or null if an item at index * @return the widget item at index, or null if an item at index
* does not exist * does not exist
*/ */
WidgetItem getWidgetItem(int index); WidgetItem getWidgetItem(int index);
@@ -343,6 +343,13 @@ public interface Widget
*/ */
int getItemId(); int getItemId();
/**
* Sets the item ID displayed by the widget.
*
* @param itemId the item ID
*/
void setItemId(int itemId);
/** /**
* Gets the quantity of the item displayed by the widget. * Gets the quantity of the item displayed by the widget.
* *
@@ -501,7 +508,7 @@ public interface Widget
/** /**
* Creates a menu action on the widget * Creates a menu action on the widget
* *
* @param index The index of the menu * @param index The index of the menu
* @param action The string to be displayed next to the widget's name in the context menu * @param action The string to be displayed next to the widget's name in the context menu
*/ */
void setAction(int index, String action); void setAction(int index, String action);
@@ -512,7 +519,7 @@ public interface Widget
* *
* @param args A ScriptID, then the args for the script * @param args A ScriptID, then the args for the script
*/ */
void setOnOpListener(Object ...args); void setOnOpListener(Object... args);
/** /**
* If this widget has any listeners on it * If this widget has any listeners on it

View File

@@ -124,7 +124,7 @@ public class WidgetInfoTableModel extends AbstractTableModel
String.class String.class
)); ));
out.add(new WidgetField<>("Name", w -> w.getName().trim(), Widget::setName, String.class)); out.add(new WidgetField<>("Name", w -> w.getName().trim(), Widget::setName, String.class));
out.add(new WidgetField<>("ItemId", Widget::getItemId)); out.add(new WidgetField<>("ItemId", Widget::getItemId, Widget::setItemId, Integer.class));
out.add(new WidgetField<>("ItemQuantity", Widget::getItemQuantity)); out.add(new WidgetField<>("ItemQuantity", Widget::getItemQuantity));
out.add(new WidgetField<>("ModelId", Widget::getModelId)); out.add(new WidgetField<>("ModelId", Widget::getModelId));
out.add(new WidgetField<>("SpriteId", Widget::getSpriteId, Widget::setSpriteId, Integer.class)); out.add(new WidgetField<>("SpriteId", Widget::getSpriteId, Widget::setSpriteId, Integer.class));

View File

@@ -225,6 +225,10 @@ public interface RSWidget extends Widget
@Override @Override
int getItemId(); int getItemId();
@Import("itemId")
@Override
void setItemId(int itemId);
@Import("itemQuantity") @Import("itemQuantity")
@Override @Override
int getItemQuantity(); int getItemQuantity();
@@ -281,7 +285,7 @@ public interface RSWidget extends Widget
@Import("onOpListener") @Import("onOpListener")
@Override @Override
void setOnOpListener(Object ...args); void setOnOpListener(Object... args);
@Import("setAction") @Import("setAction")
@Override @Override