public CombinedDialsSectionPart()

in application/org.openjdk.jmc.rjmx.ui/src/main/java/org/openjdk/jmc/rjmx/ui/internal/CombinedDialsSectionPart.java [185:265]


	public CombinedDialsSectionPart(Composite parent, FormToolkit toolkit, int style, IConnectionHandle ch,
			IMemento state) {
		super(parent, toolkit, style);
		m_refreshController = RefreshController.createGroup(parent.getDisplay());
		this.toolkit = toolkit;
		m_connection = ch;
		m_subscriptionService = m_connection.getServiceOrNull(ISubscriptionService.class);
		m_mds = m_connection.getServiceOrNull(IMRIMetadataService.class);
		m_mriService = m_connection.getServiceOrNull(IMRIService.class);
		rateCoordinator = new RateCoordinator();
		m_refreshController.add(rateCoordinator);
		statisticsRefresher = new RateLimitedRefresher(rateCoordinator, 500) {
			@Override
			protected void doRefresh() {
				TableViewer viewer = m_statisticsTable.getViewer();
				Control control = viewer.getControl();
				if ((control != null) && !control.isDisposed()) {
					boolean visible = control.isVisible();
					if (visible) {
						control.setRedraw(false);
					}
					// Unfortunately we have to do this even if not visible, until we reliably can detect when the viewer becomes visible
					// (Ideally, the super class or rate coordinator would handle this transparently for us.)
					viewer.refresh();
					if (visible) {
						control.setRedraw(true);
						control.update();
					}
				}
			}
		};
		m_freezeModel.addObserver(new Observer() {
			@Override
			public void update(Observable o, Object arg) {
				if (m_freezeModel.isFreezed()) {
					m_refreshController.remove(rateCoordinator);
				} else {
					m_refreshController.add(rateCoordinator);
				}
			}
		});

		final StackLayout stackLayout = new StackLayout();
		Composite stackContainer = createSectionBody(stackLayout);

		m_dialsHolder = toolkit.createComposite(stackContainer);
		m_dialsHolder.addDisposeListener(new DisposeListener() {

			@Override
			public void widgetDisposed(DisposeEvent e) {
				m_orderedDials = m_dialsHolder.getChildren();
			}
		});
		m_dialsHolderLayout = new GridLayout(0, true);
		m_dialsHolderLayout.horizontalSpacing = 0;
		m_dialsHolder.setLayout(m_dialsHolderLayout);
		final Composite tableContainer = toolkit.createComposite(stackContainer);
		tableContainer.setLayout(MCLayoutFactory.createMarginFreeFormPageLayout());
		IMemento tableState = state == null ? null : state.getChild(TABLE_TAG);
		m_statisticsTable = new StatisticsTable(tableContainer, new AttributeLabelProvider(m_mds, m_mriService), this,
				true, tableState);
		m_statisticsTable.getViewer().getControl().setLayoutData(MCLayoutFactory.createFormPageLayoutData());
		m_statisticsTable.getViewer().setInput(m_model.values());

		getMCToolBarManager().add(new AddAttibutesAction(m_mds, m_mriService, this), MCToolBarManager.ALIGN_LEFT);
		getMCToolBarManager().add(new ToggleFreezeAction(getMCToolBarManager(), m_freezeModel));
		accessibleControlAction = new AccessibleControlAction() {
			@Override
			public void run() {
				stackLayout.topControl = isChecked() ? tableContainer : m_dialsHolder;
				tableContainer.setVisible(isChecked());
				m_dialsHolder.setVisible(!isChecked());
				updateStructure();
			}
		};
		getMCToolBarManager().add(accessibleControlAction);
		m_mds.addObserver(metadataObserver);
		if (state != null) {
			restoreState(state);
		}
	}