use of com.ldtteam.blockout.views.SwitchView in project minecolonies by ldtteam.
the class WindowPermissionsPage method togglePermMode.
/**
* Switch the view on the rank view (between permissions and settings)
*
* @param button the button clicked
*/
private void togglePermMode(Button button) {
SwitchView permSwitch = findPaneOfTypeByID(TOWNHALL_PERM_MANAGEMENT, SwitchView.class);
permSwitch.setView(permSwitch.getCurrentView() != null && permSwitch.getCurrentView().getID().equals(TOWNHALL_PERM_LIST) ? TOWNHALL_PERM_SETTINGS : TOWNHALL_PERM_LIST);
if (permSwitch.getCurrentView().getID().equals(TOWNHALL_PERM_SETTINGS)) {
DropDownList dropdown = findPaneOfTypeByID(TOWNHALL_RANK_TYPE_PICKER, DropDownList.class);
dropdown.setDataProvider(new DropDownList.DataProvider() {
@Override
public int getElementCount() {
return rankTypes.size();
}
@Override
public String getLabel(final int i) {
return LanguageHandler.format(rankTypes.get(i));
}
});
dropdown.setHandler(this::changeRankMode);
dropdown.setSelectedIndex(actionsRank.isColonyManager() ? 0 : (actionsRank.isHostile() ? 1 : 2));
findPaneOfTypeByID(TOWNHALL_BUTTON_SUBSCRIBER, Button.class).setText(new TranslationTextComponent(actionsRank.isSubscriber() ? COM_MINECOLONIES_COREMOD_GUI_WORKERHUTS_RETRIEVE_ON : COM_MINECOLONIES_COREMOD_GUI_WORKERHUTS_RETRIEVE_OFF));
}
}
use of com.ldtteam.blockout.views.SwitchView in project minecolonies by Minecolonies.
the class WindowPermissionsPage method togglePermMode.
/**
* Switch the view on the rank view (between permissions and settings)
*
* @param button the button clicked
*/
private void togglePermMode(Button button) {
SwitchView permSwitch = findPaneOfTypeByID(TOWNHALL_PERM_MANAGEMENT, SwitchView.class);
permSwitch.setView(permSwitch.getCurrentView() != null && permSwitch.getCurrentView().getID().equals(TOWNHALL_PERM_LIST) ? TOWNHALL_PERM_SETTINGS : TOWNHALL_PERM_LIST);
if (permSwitch.getCurrentView().getID().equals(TOWNHALL_PERM_SETTINGS)) {
DropDownList dropdown = findPaneOfTypeByID(TOWNHALL_RANK_TYPE_PICKER, DropDownList.class);
dropdown.setDataProvider(new DropDownList.DataProvider() {
@Override
public int getElementCount() {
return rankTypes.size();
}
@Override
public String getLabel(final int i) {
return LanguageHandler.format(rankTypes.get(i));
}
});
dropdown.setHandler(this::changeRankMode);
dropdown.setSelectedIndex(actionsRank.isColonyManager() ? 0 : (actionsRank.isHostile() ? 1 : 2));
findPaneOfTypeByID(TOWNHALL_BUTTON_SUBSCRIBER, Button.class).setText(new TranslationTextComponent(actionsRank.isSubscriber() ? COM_MINECOLONIES_COREMOD_GUI_WORKERHUTS_RETRIEVE_ON : COM_MINECOLONIES_COREMOD_GUI_WORKERHUTS_RETRIEVE_OFF));
}
}
Aggregations