Search in sources :

Example 6 with AbstractHtmlAction

use of org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction in project scout.rt by eclipse.

the class GeneralView method createMonitoringQuickLink.

private String createMonitoringQuickLink(HtmlComponent p) {
    if (!ACCESS.check(new UpdateServiceConfigurationPermission())) {
        return null;
    }
    final ProcessInspector inst = ProcessInspector.instance();
    if (inst.isEnabled()) {
        p.print("Monitor is active with maximum caching of " + (inst.getTimeout() / 1000 / 60) + " minutes [ ");
        p.linkAction("cache 2 min", new P_SetTimeoutAction(2));
        p.print(" | ");
        p.linkAction("cache 15 min", new P_SetTimeoutAction(15));
        p.print(" | ");
        p.linkAction("cache 60 min", new P_SetTimeoutAction(60));
        p.print(" | ");
        p.linkAction("deactivate", new P_EnableAction(false));
        p.print(" ]");
        p.br();
        if (inst.acceptCall(IPingService.class.getName(), "ping")) {
            p.linkAction("IPingService.ping (click to toggle)", new AbstractHtmlAction("IPingService.ignore") {

                @Override
                public void run() {
                    inst.getIgnoredCallSet().clear();
                    inst.getIgnoredCallSet().add(".*\\.IPingService\\.ping");
                }
            });
        } else {
            p.startLinkAction(new AbstractHtmlAction("IPingService.accept") {

                @Override
                public void run() {
                    inst.getIgnoredCallSet().clear();
                }
            });
            p.raw("<s>");
            p.printNoBreak("IPingService.ping");
            p.raw("</s>");
            p.printNoBreak(" (click to toggle)");
            p.endLinkAction();
        }
    } else {
        p.print("Monitor is inactive [ ");
        p.linkAction("activate", new P_EnableAction(true));
        p.print(" ]");
    }
    p.p();
    if (inst.isEnabled()) {
        return "<p><b>Note: Session Activity Monitor is enabled; this might affect performance and memory due to higher resource consumption during analysis.</b><p>";
    }
    return null;
}
Also used : UpdateServiceConfigurationPermission(org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission) AbstractHtmlAction(org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction) IPingService(org.eclipse.scout.rt.shared.services.common.ping.IPingService) ProcessInspector(org.eclipse.scout.rt.server.admin.inspector.ProcessInspector)

Example 7 with AbstractHtmlAction

use of org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction in project scout.rt by eclipse.

the class ServicesView method renderServiceTable.

private void renderServiceTable(HtmlComponent p, String sectionName, Collection<ServiceInspector> serviceInspectors) {
    // sort
    TreeMap<String, ServiceInspector> sortMap = new TreeMap<String, ServiceInspector>();
    for (ServiceInspector inspector : serviceInspectors) {
        String s = inspector.getService().getClass().getName();
        sortMap.put(s, inspector);
    }
    p.p(sectionName);
    p.startListBox("listBox", 1, true);
    p.listBoxOption(" ", new AbstractHtmlAction("selectService.choose") {

        @Override
        public void run() {
        // do nothing
        }
    }, false);
    for (ServiceInspector serviceInspector : sortMap.values()) {
        boolean selected = m_selectedService != null && (m_selectedService.getService() == serviceInspector.getService());
        final ServiceInspector finalServiceInspector = serviceInspector;
        p.listBoxOption(serviceInspector.getService().getClass().getName(), new AbstractHtmlAction("selectService2." + serviceInspector.getService().getClass().getName()) {

            @Override
            public void run() {
                m_selectedService = finalServiceInspector;
            }
        }, selected);
    }
    p.endListBox();
}
Also used : AbstractHtmlAction(org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction) ServiceInspector(org.eclipse.scout.rt.server.admin.inspector.ServiceInspector) TreeMap(java.util.TreeMap)

Example 8 with AbstractHtmlAction

use of org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction in project scout.rt by eclipse.

the class ServicesView method renderProperties.

private void renderProperties(HtmlComponent p, final ServiceInspector service, ReflectServiceInventory inv) {
    PropertyDescriptor[] properties = inv.getProperties();
    if (properties.length > 0) {
        p.pBold("Properties (" + properties.length + ")");
        p.startTable(1, 0, 4);
        p.startTableRow();
        p.tableHeaderCell("Property name");
        p.tableHeaderCell("Value");
        p.endTableRow();
        for (PropertyDescriptor desc : properties) {
            String propName = desc.getName();
            String propValue = "[value not available]";
            if (desc.getReadMethod() != null) {
                try {
                    propValue = formatPropertyValue(desc, desc.getReadMethod().invoke(service.getService(), (Object[]) null));
                } catch (Exception e) {
                // NOSONAR
                // nop
                }
            }
            boolean editable = desc.getWriteMethod() != null;
            // 
            if (editable) {
                final PropertyDescriptor finalDesc = desc;
                p.startForm(new AbstractHtmlAction("changeProp." + service.getService().getClass().getName() + "." + desc.getName()) {

                    @Override
                    public void run() {
                        String propText = getFormParameter("value", "");
                        if (propText.length() == 0) {
                            propText = null;
                        }
                        try {
                            service.changeProperty(finalDesc, propText);
                        } catch (Exception e) {
                            LOG.error("setting {}={}", finalDesc.getName(), propText, e);
                        }
                    }
                });
            }
            p.startTableRow();
            p.tableCell(propName);
            p.startTableCell();
            if (editable) {
                p.formTextArea("value", getPropertyDisplayValue(propName, propValue));
                p.formSubmit("Change");
            } else {
                p.print(getPropertyDisplayValue(propName, propValue));
            }
            p.endTableCell();
            p.endTableRow();
            if (editable) {
                p.endForm();
            }
        }
        p.endTable();
    }
}
Also used : AbstractHtmlAction(org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction) PropertyDescriptor(java.beans.PropertyDescriptor) CompositeObject(org.eclipse.scout.rt.platform.util.CompositeObject)

Example 9 with AbstractHtmlAction

use of org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction in project scout.rt by eclipse.

the class SessionsView method renderSessionIdCell.

protected void renderSessionIdCell(HtmlComponent p, final SessionInspector session) {
    p.startTableCell();
    if (isSelectedSession(session)) {
        p.focusAnchor();
    }
    p.startLinkAction(new AbstractHtmlAction("selectSession" + session.getInfo().getSessionId()) {

        @Override
        public void run() {
            m_selectedSession = session;
        }
    });
    p.print(session.getInfo().getSessionId());
    p.endLinkAction();
    p.endTableCell();
}
Also used : AbstractHtmlAction(org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction)

Example 10 with AbstractHtmlAction

use of org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction in project scout.rt by eclipse.

the class TopView method produceBody.

@Override
public void produceBody(HtmlComponent p) {
    m_messagesView.produceBody(p);
    p.raw("[ ");
    for (IView v : new IView[] { m_generalView, m_servicesView, m_sessionsView, m_callsView }) {
        if (v.isVisible()) {
            p.raw("&nbsp;");
            if (v == m_activeView) {
                p.raw("<b>");
                v.produceTitle(p);
                p.raw("</b>");
            } else {
                final IView finalV = v;
                p.startLinkAction(new AbstractHtmlAction("tab." + v.getClass().getSimpleName()) {

                    @Override
                    public void run() {
                        m_activeView = finalV;
                        if (m_activeView != null) {
                            m_activeView.activated();
                        }
                    }
                });
                v.produceTitle(p);
                p.endLinkAction();
            }
            p.raw("&nbsp;");
            p.raw("&nbsp;");
        }
    }
    p.raw(" ]");
    p.p();
    if (m_activeView != null) {
        m_activeView.produceBody(p);
    }
}
Also used : AbstractHtmlAction(org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction) IView(org.eclipse.scout.rt.server.admin.html.IView)

Aggregations

AbstractHtmlAction (org.eclipse.scout.rt.server.admin.html.AbstractHtmlAction)11 PropertyDescriptor (java.beans.PropertyDescriptor)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 TreeMap (java.util.TreeMap)1 CompositeObject (org.eclipse.scout.rt.platform.util.CompositeObject)1 IView (org.eclipse.scout.rt.server.admin.html.IView)1 ProcessInspector (org.eclipse.scout.rt.server.admin.inspector.ProcessInspector)1 ServiceInspector (org.eclipse.scout.rt.server.admin.inspector.ServiceInspector)1 SessionInspector (org.eclipse.scout.rt.server.admin.inspector.SessionInspector)1 CallInfo (org.eclipse.scout.rt.server.admin.inspector.info.CallInfo)1 UpdateServiceConfigurationPermission (org.eclipse.scout.rt.shared.security.UpdateServiceConfigurationPermission)1 IPingService (org.eclipse.scout.rt.shared.services.common.ping.IPingService)1