Skip to content

Instantly share code, notes, and snippets.

@fezu54
Created April 5, 2020 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fezu54/c077b516cec14b81b6ecb424ec6dce19 to your computer and use it in GitHub Desktop.
Save fezu54/c077b516cec14b81b6ecb424ec6dce19 to your computer and use it in GitHub Desktop.
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