Example usage for javax.management.openmbean TabularDataSupport getTabularType

List of usage examples for javax.management.openmbean TabularDataSupport getTabularType

Introduction

In this page you can find the example usage for javax.management.openmbean TabularDataSupport getTabularType.

Prototype

public TabularType getTabularType() 

Source Link

Document

Returns the tabular type describing this TabularData instance.

Usage

From source file:org.jolokia.converter.object.TabularDataConverter.java

private void putRowsToTabularData(TabularDataSupport pTabularData, JSONObject pValue, int pLevel) {
    TabularType type = pTabularData.getTabularType();
    for (Object value : pValue.values()) {
        if (!(value instanceof JSONObject)) {
            throw new IllegalArgumentException(
                    "Cannot convert " + pValue + " to type " + type + " because the object values provided ("
                            + value.getClass() + ") is not of the expected type JSONObject at level " + pLevel);
        }//from w w  w .  j av a 2  s .  com
        JSONObject jsonValue = (JSONObject) value;
        if (pLevel > 1) {
            putRowsToTabularData(pTabularData, jsonValue, pLevel - 1);
        } else {
            pTabularData.put((CompositeData) getDispatcher().convertToObject(type.getRowType(), jsonValue));
        }
    }
}

From source file:org.wso2.andes.management.ui.views.ViewUtility.java

@SuppressWarnings("unchecked")
private static void createTabularDataHolder(FormToolkit toolkit, Composite parent,
        TabularDataSupport tabularData) {
    Composite composite = toolkit.createComposite(parent, SWT.BORDER);
    GridLayout layout = new GridLayout(4, true);
    layout.horizontalSpacing = 0;/*w  ww .ja  v a2  s.  c om*/
    layout.marginWidth = 0;
    layout.marginHeight = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Set entrySet = tabularData.entrySet();
    ArrayList<Map.Entry> list = new ArrayList<Map.Entry>(entrySet);
    if (list.size() == 0) {
        Text text = toolkit.createText(composite, " No records ", SWT.CENTER | SWT.SINGLE | SWT.READ_ONLY);
        GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1);
        text.setLayoutData(layoutData);
        return;
    }

    Collections.sort(list, tabularDataComparator);

    // Attach the tabular record to be retrieved and shown later when record is traversed
    // using first/next/previous/last buttons
    composite.setData(list);

    // Create button and the composite for CompositeData
    Composite compositeDataHolder = createCompositeDataHolder(toolkit, composite,
            tabularData.getTabularType().getRowType());

    // display the first record
    CompositeData data = (CompositeData) (list.get(0)).getValue();
    composite.setData(INDEX, 0);
    populateCompositeWithCompositeData(toolkit, compositeDataHolder, data);
    enableOrDisableTraversalButtons(composite);
}