michael@0: /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.home; michael@0: michael@0: import org.mozilla.gecko.home.HomePager.OnUrlOpenListener; michael@0: import org.mozilla.gecko.home.HomeConfig.PanelConfig; michael@0: import org.mozilla.gecko.home.HomeConfig.ViewConfig; michael@0: michael@0: import android.content.Context; michael@0: import android.util.Log; michael@0: import android.view.View; michael@0: michael@0: class FramePanelLayout extends PanelLayout { michael@0: private static final String LOGTAG = "GeckoFramePanelLayout"; michael@0: michael@0: private final View mChildView; michael@0: private final ViewConfig mChildConfig; michael@0: michael@0: public FramePanelLayout(Context context, PanelConfig panelConfig, DatasetHandler datasetHandler, michael@0: OnUrlOpenListener urlOpenListener, ContextMenuRegistry contextMenuRegistry) { michael@0: super(context, panelConfig, datasetHandler, urlOpenListener, contextMenuRegistry); michael@0: michael@0: // This layout can only hold one view so we simply michael@0: // take the first defined view from PanelConfig. michael@0: mChildConfig = panelConfig.getViewAt(0); michael@0: if (mChildConfig == null) { michael@0: throw new IllegalStateException("FramePanelLayout requires a view in PanelConfig"); michael@0: } michael@0: michael@0: mChildView = createPanelView(mChildConfig); michael@0: addView(mChildView); michael@0: } michael@0: michael@0: @Override michael@0: public void load() { michael@0: Log.d(LOGTAG, "Loading"); michael@0: michael@0: if (mChildView instanceof DatasetBacked) { michael@0: final FilterDetail filter = new FilterDetail(mChildConfig.getFilter(), null); michael@0: michael@0: final DatasetRequest request = new DatasetRequest(mChildConfig.getIndex(), michael@0: mChildConfig.getDatasetId(), michael@0: filter); michael@0: michael@0: Log.d(LOGTAG, "Requesting child request: " + request); michael@0: requestDataset(request); michael@0: } michael@0: } michael@0: }