com.zh.snmp.snmpweb.monitoring.MonitorPopupPanel.java Source code

Java tutorial

Introduction

Here is the source code for com.zh.snmp.snmpweb.monitoring.MonitorPopupPanel.java

Source

/*
 *   Copyright (c) 2010 Sonrisa Informatikai Kft. All Rights Reserved.
 * 
 *  This software is the confidential and proprietary information of
 *  Sonrisa Informatikai Kft. ("Confidential Information").
 *  You shall not disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Sonrisa.
 * 
 *  SONRISA MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
 *  THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 *  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
 *  PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SONRISA SHALL NOT BE LIABLE FOR
 *  ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 *  DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 */
package com.zh.snmp.snmpweb.monitoring;

import com.zh.snmp.snmpcore.message.MessageAppender;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
 *
 * @author Golyo
 */
public class MonitorPopupPanel<T> extends Panel {
    private ModalWindow modal;
    private String titleKey;

    public MonitorPopupPanel(ModalWindow modal, IModel<T> model, MessageAppender appender, String titleKey) {
        super(modal.getContentId());
        this.modal = modal;
        this.titleKey = titleKey;
        add(new MonitorPanel("monitor", model, appender));
    }

    public void show(AjaxRequestTarget target) {
        if (modal.isShown()) {
            return;
        }
        modal.setContent(this);
        modal.setTitle(getString(titleKey, null, titleKey));
        modal.setInitialHeight(450);
        modal.setInitialWidth(650);
        modal.setContent(this);
        modal.show(target);
    }
}