Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import com.vaadin.ui.BrowserFrame
import com.vaadin.ui.TabSheet
import com.xetics.mes.core.util.isReachable
import com.xetics.mes.ui.common.util.TabsDispatcher
class EquipmentGroupTabSheet(private val equipmentGroupVM: EquipmentGroupVM)
: TabSheet() {
private val tabsDispatcher = TabsDispatcher(this)
privatel val equipmentGroupUserStationAssignment = BrowserFrame(Messages.getString(
"EquipmentView.group.userStationAssignment")).apply {
id = userStationAssignmentId
this.setSizeFull()
}
init {
addSelectedTabChangeListener { event: SelectedTabChangeEvent ->
tabsDispatcher.dispatchComponentTabSelectionToRunnable(event.tabSheet.selectedTab)
}
this.equipmentGroupVM.userStationAssignmentUrl.observe {
if (!isReachable(it)) {
Notification(Messages.getString("Global.service.notReachable"), Notification.Type.ERROR_MESSAGE)
.show(Page.getCurrent())
}
equipmentGroupUserStationAssignment.source = ExternalResource(it)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment