Example usage for com.google.gwt.user.client.ui HorizontalPanel setCellWidth

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setCellWidth.

Prototype

public void setCellWidth(IsWidget w, String width) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:org.pepstock.jem.gwt.client.panels.administration.SecretUtilityPanel.java

License:Open Source License

/**
 * Creates the UI by the argument (the table)
 *  /*from w w  w  .  j a  v  a 2 s .  c om*/
 * @param nodes table of nodes 
 */
public SecretUtilityPanel() {
    VerticalPanel container = new VerticalPanel();
    setSize(Sizes.HUNDRED_PERCENT, Sizes.HUNDRED_PERCENT);

    secretBox.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if ((secretBox.getText().length() > 0) && (secretBox2.getText().length() > 0)
                    && secretBox.getText().equals(secretBox2.getText())) {

                execButton.setEnabled(true);
            } else {
                execButton.setEnabled(false);
            }

        }
    });

    secretBox2.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if ((secretBox.getText().length() > 0) && (secretBox2.getText().length() > 0)
                    && secretBox.getText().equals(secretBox2.getText())) {
                execButton.setEnabled(true);
            } else {
                execButton.setEnabled(false);
            }

        }
    });

    execButton = new Button("Crypt", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            getEncryptedSecret(secretBox.getText());
        }
    });
    execButton.setEnabled(false);
    execButton.addStyleName(Styles.INSTANCE.common().bigButtonPadding());
    new Tooltip(execButton, "Encrypt your secret text");

    // this size!
    container.setSpacing(10);

    // title
    container.add(new HTML("<h2>Secret utility</h2>"));

    // image and description
    HorizontalPanel imageAndDescription = new HorizontalPanel();
    imageAndDescription.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    Image image = new Image(Images.INSTANCE.keys());
    HTML description = new HTML(
            "This utility allows you to have got an encrypted secret text (password and others) that you could use in your JCL.<br>"
                    + "This function must be use when you define a Common Resource and you want to hide the password value.<br>"
                    + "Calulate the value and copy & paste in your JCL.</p>");
    imageAndDescription.add(image);
    imageAndDescription.add(description);
    imageAndDescription.setCellWidth(description, Sizes.HUNDRED_PERCENT);

    container.add(imageAndDescription);

    FlexTable form = new FlexTable();
    form.setCellPadding(10);

    // Add some standard form options
    form.setHTML(0, 0, "Secret");
    form.setWidget(0, 1, secretBox);
    form.setHTML(1, 0, "Secret (twice to check)");
    form.setWidget(1, 1, secretBox2);

    form.setHTML(2, 0, "");
    form.setWidget(2, 1, execButton);

    form.setHTML(3, 0, "Encrypted secret");
    form.setWidget(3, 1, encrypt);

    form.setHTML(4, 0, "Hash secret");
    form.setWidget(4, 1, hash);

    container.add(form);

    scrollPanel = new ScrollPanel(container);
    add(scrollPanel);

}

From source file:org.pepstock.jem.gwt.client.panels.administration.TreeOptions.java

License:Open Source License

/**
 * /*  w  w w  .  j a  v  a2  s  . co  m*/
 * @param description
 * @param option
 * @return
 */
private final CellPanel createItem(String description, final String option, ImageResource icon,
        String permission) {
    if (!ClientPermissions.isAuthorized(Permissions.ADMINISTRATION, permission)) {
        return null;
    }

    /*-------------------------+
     | Node inspect            |
     +-------------------------*/

    // this is the inside panel
    final HorizontalPanel options = new HorizontalPanel();
    options.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    options.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    options.setSpacing(8);
    options.setWidth(Sizes.HUNDRED_PERCENT);

    final Anchor anchor = new Anchor(description);
    anchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (listener != null) {
                listener.inspect(option);
                selectPanel(options);
            }
        }
    });

    // add the icon if present
    if (icon != null) {
        options.add(new Image(icon));
    }

    options.add(anchor);
    options.setCellWidth(anchor, Sizes.HUNDRED_PERCENT);
    return options;
}

From source file:org.pepstock.jem.gwt.client.panels.jobs.commons.inspector.General.java

License:Open Source License

/**
 * Builds the component, using the job instance as argument
 * //from  ww  w  . ja v a  2s.  c  o  m
 * @param job job instance in inspect mode
 * 
 */
public General(final Job job) {
    setJob(job);

    // MAIN PANEL
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.setHeight(Sizes.HUNDRED_PERCENT);
    hp.setSpacing(10);

    /*
     * JOB
     */
    VerticalPanel jobVp = new VerticalPanel();
    jobVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(jobVp);
    hp.setCellWidth(jobVp, "50%");

    Label jobLabel = new Label("Job information");
    jobLabel.setWidth(Sizes.HUNDRED_PERCENT);
    jobLabel.setStyleName(Styles.INSTANCE.inspector().title());
    jobLabel.addStyleName(Styles.INSTANCE.common().bold());
    jobVp.add(jobLabel);

    FlexTable layoutJob = new FlexTable();
    layoutJob.setCellPadding(10);
    layoutJob.setWidth(Sizes.HUNDRED_PERCENT);

    layoutJob.setHTML(0, 0, "Name");
    layoutJob.setWidget(0, 1, new HTML(job.getName()));

    layoutJob.setHTML(1, 0, "ID");
    layoutJob.setWidget(1, 1, new HTML(job.getId()));

    layoutJob.setHTML(2, 0, "User");
    layoutJob.setWidget(2, 1, new HTML(job.getUser()));

    layoutJob.setHTML(3, 0, "Process ID");
    if (job.getProcessId() == null) {
        layoutJob.setHTML(3, 1, "");
    } else {
        layoutJob.setWidget(3, 1, new HTML(job.getProcessId()));
    }

    layoutJob.setHTML(4, 0, "Submitted");
    layoutJob.setWidget(4, 1, new HTML(JemConstants.DATE_TIME_FULL.format(job.getSubmittedTime())));

    layoutJob.setHTML(5, 0, "Started");
    if (job.getStartedTime() == null) {
        layoutJob.setHTML(5, 0, "");
    } else {
        layoutJob.setWidget(5, 1, new HTML(JemConstants.DATE_TIME_FULL.format(job.getStartedTime())));
    }

    layoutJob.setHTML(6, 0, "Ended");
    if (job.getEndedTime() == null) {
        layoutJob.setHTML(6, 1, "");
    } else {
        layoutJob.setWidget(6, 1, new HTML(JemConstants.DATE_TIME_FULL.format(job.getEndedTime())));
    }

    layoutJob.setHTML(7, 0, "Current Step");
    if ((job.getCurrentStep() == null) || (job.getEndedTime() != null)) {
        layoutJob.setHTML(7, 1, "");
    } else {
        layoutJob.setWidget(7, 1, new HTML(job.getCurrentStep().getName()));
    }

    layoutJob.setHTML(8, 0, "Result");
    if (job.getResult() == null) {
        layoutJob.setHTML(8, 1, "");
    } else {
        layoutJob.setWidget(8, 1, new HTML(String.valueOf(job.getResult().getReturnCode())));
        if (job.getResult().getExceptionMessage() != null) {
            layoutJob.setHTML(9, 0, "Exception");
            String fullMessage = job.getResult().getExceptionMessage();

            // extract the main exception, otherwise the message is too long
            int indexFirstRow = fullMessage.indexOf('\n');
            int indexFirstException = fullMessage.indexOf("nested exception");
            String message = null;
            if (indexFirstException == -1) {
                if (indexFirstRow == -1) {

                    message = fullMessage;
                } else {
                    message = fullMessage.substring(0, indexFirstRow);
                }
            } else {
                message = fullMessage.substring(0, indexFirstException);
            }
            layoutJob.setHTML(9, 1, message);
        }
    }

    UITools.setFlexTableStyles(layoutJob, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    jobVp.add(layoutJob);

    /*
     * JCL
     */
    VerticalPanel jclVp = new VerticalPanel();
    jclVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(jclVp);
    hp.setCellWidth(jclVp, "50%");

    Label jclLabel = new Label("Jcl information");
    jclLabel.setWidth(Sizes.HUNDRED_PERCENT);
    jclLabel.setStyleName(Styles.INSTANCE.inspector().title());
    jclLabel.addStyleName(Styles.INSTANCE.common().bold());
    jclVp.add(jclLabel);

    FlexTable layoutJcl = new FlexTable();
    layoutJcl.setCellPadding(10);
    layoutJcl.setWidth(Sizes.HUNDRED_PERCENT);

    // Add some standard form options
    layoutJcl.setHTML(0, 0, "Environment");
    layoutJcl.setWidget(0, 1, new HTML(job.getJcl().getEnvironment()));
    layoutJcl.setHTML(1, 0, "Domain");
    layoutJcl.setWidget(1, 1, new HTML(job.getJcl().getDomain()));
    layoutJcl.setHTML(2, 0, "Affinities");
    layoutJcl.setWidget(2, 1, new HTML(job.getJcl().getAffinity()));

    layoutJcl.setHTML(3, 0, "Memory");
    layoutJcl.setWidget(3, 1, new HTML(String.valueOf(job.getJcl().getMemory())));

    layoutJcl.setHTML(4, 0, "Priority");
    layoutJcl.setWidget(4, 1, new HTML(String.valueOf(job.getJcl().getPriority())));

    layoutJcl.setHTML(5, 0, "Hold");
    layoutJcl.setWidget(5, 1, new HTML(job.getJcl().isHold() ? JemConstants.YES : JemConstants.NO));

    layoutJcl.setHTML(6, 0, "Node");
    if (job.getMemberLabel() == null) {
        layoutJcl.setHTML(6, 1, "");
    } else {
        layoutJcl.setWidget(6, 1, new HTML(job.getMemberLabel()));
    }

    UITools.setFlexTableStyles(layoutJcl, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    jclVp.add(layoutJcl);

    // main
    add(hp);
}

From source file:org.pepstock.jem.gwt.client.panels.jobs.commons.inspector.Output.java

License:Open Source License

/**
 * Constructs UI using the job that is in inspect mode, and the tree of produced output 
 * //from w  ww .j  av  a2s . c  om
 * @param job job instance in inspect mode 
 * @param outputTree the tree of produced output
 * 
 */
public Output(Job job, OutputTree outputTree) {
    final Job thisJob = job;

    // Root of output tree
    DisclosurePanel root = new DisclosurePanel(job.getName());
    root.setAnimationEnabled(true);

    // this is the inside panel
    VerticalPanel firstLevelPanel = new VerticalPanel();
    firstLevelPanel.setSpacing(1);
    // scans first level
    for (OutputListItem item : outputTree.getFirstLevelItems()) {

        final HorizontalPanel options = new HorizontalPanel();
        options.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        options.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        options.setSpacing(8);
        options.setWidth(Sizes.HUNDRED_PERCENT);

        // create a item anchor for all elements of tree
        final ItemAnchor anchor = new ItemAnchor(item);

        anchor.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                // asks to load and show the output
                output(thisJob, anchor.getItem());
                selectPanel(options);
            }
        });
        options.add(anchor);
        options.setCellWidth(anchor, Sizes.HUNDRED_PERCENT);
        firstLevelPanel.add(options);
    }

    root.setOpen(true);

    // subpanel
    VerticalPanel secondAndFirstLevelPanel = new VerticalPanel();
    secondAndFirstLevelPanel.add(firstLevelPanel);

    for (List<OutputListItem> items : outputTree.getSecondLevelItems()) {
        if (!items.isEmpty()) {
            String key = items.get(0).getParent();
            // for every step creates a disclosure panel
            DisclosurePanel secondPanel = new DisclosurePanel(key);
            secondPanel.setAnimationEnabled(true);

            // lists of anchor with produced output 
            VerticalPanel secondLevelPanel = new VerticalPanel();
            secondLevelPanel.setSpacing(1);
            // scans items
            for (OutputListItem item : items) {
                final HorizontalPanel options = new HorizontalPanel();
                options.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
                options.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
                options.setSpacing(8);
                options.setWidth(Sizes.HUNDRED_PERCENT);

                // create a item anchor for all elements of tree
                final ItemAnchor anchor = new ItemAnchor(item);
                anchor.addClickHandler(new ClickHandler() {
                    @Override
                    public void onClick(ClickEvent event) {
                        // asks to load and show the output
                        output(thisJob, anchor.getItem());
                        selectPanel(options);
                    }
                });

                options.add(anchor);
                options.setCellWidth(anchor, Sizes.HUNDRED_PERCENT);

                secondLevelPanel.add(options);
            }
            secondPanel.setContent(secondLevelPanel);
            secondAndFirstLevelPanel.add(secondPanel);
        }
    }
    root.setContent(secondAndFirstLevelPanel);

    // west panel with a disclosure
    scrollerFiles.add(root);
    scrollerFiles.setWidth(Sizes.toString(Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE));

    log.add(viewOutput);
    log.setVisible(false);

    addWest(scrollerFiles, Sizes.SPLIT_PANEL_WEST_DEFAULT_SIZE);
    add(log);
}

From source file:org.pepstock.jem.gwt.client.panels.jobs.commons.inspector.RouteInfo.java

License:Open Source License

/**
 * Build the component//from   ww w  .java  2  s . com
 * @param job the job instance
 */
public RouteInfo(Job job) {
    this.job = job;

    // MAIN PANEL
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.setHeight(Sizes.HUNDRED_PERCENT);
    hp.setSpacing(10);

    /*
     * ROUTE
     */
    VerticalPanel routeVp = new VerticalPanel();
    routeVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(routeVp);
    hp.setCellWidth(routeVp, "50%");

    Label routeLabel = new Label("Job routing information");
    routeLabel.setWidth(Sizes.HUNDRED_PERCENT);
    routeLabel.setStyleName(Styles.INSTANCE.inspector().title());
    routeLabel.addStyleName(Styles.INSTANCE.common().bold());
    routeVp.add(routeLabel);

    FlexTable layoutRouteInfo = new FlexTable();
    layoutRouteInfo.getColumnFormatter().setWidth(0, "50%");
    layoutRouteInfo.getColumnFormatter().setWidth(1, "50%");
    layoutRouteInfo.setCellPadding(10);
    layoutRouteInfo.setWidth(Sizes.HUNDRED_PERCENT);
    RoutingInfo routingInfo = job.getRoutingInfo();

    layoutRouteInfo.setHTML(0, 0, "Route ID");
    layoutRouteInfo.setWidget(0, 1, new HTML(routingInfo.getId()));

    layoutRouteInfo.setHTML(1, 0, "Routed time");
    layoutRouteInfo.setWidget(1, 1, new HTML(JemConstants.DATE_TIME_FULL.format(routingInfo.getRoutedTime())));

    layoutRouteInfo.setHTML(2, 0, "Submitted time");
    layoutRouteInfo.setWidget(2, 1,
            new HTML(JemConstants.DATE_TIME_FULL.format(routingInfo.getSubmittedTime())));

    layoutRouteInfo.setHTML(3, 0, "Submission environment");
    layoutRouteInfo.setWidget(3, 1, new HTML(routingInfo.getEnvironment()));

    layoutRouteInfo.setHTML(4, 0, "Committed output");
    Boolean isOutputCommitted = job.getRoutingInfo().isOutputCommitted();
    layoutRouteInfo.setWidget(4, 1,
            new HTML(isOutputCommitted != null && isOutputCommitted ? JemConstants.YES : JemConstants.NO));

    UITools.setFlexTableStyles(layoutRouteInfo, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    routeVp.add(layoutRouteInfo);

    // main
    add(hp);
}

From source file:org.pepstock.jem.gwt.client.panels.nodes.commons.inspector.General.java

License:Open Source License

/**
 * Builds the component, using the node instance as argument
 * //  w  w w . j  a  v a  2 s.  co  m
 * @param node node instance in inspect mode
 * 
 */
public General(final NodeInfoBean node) {
    this.node = node;

    // MAIN PANEL
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.setHeight(Sizes.HUNDRED_PERCENT);
    hp.setSpacing(10);

    /*
     * NODE INFO
     */
    VerticalPanel nodeVp = new VerticalPanel();
    nodeVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(nodeVp);
    hp.setCellWidth(nodeVp, "50%");

    Label nodeLabel = new Label("Node information");
    nodeLabel.setWidth(Sizes.HUNDRED_PERCENT);
    nodeLabel.setStyleName(Styles.INSTANCE.inspector().title());
    nodeLabel.addStyleName(Styles.INSTANCE.common().bold());
    nodeVp.add(nodeLabel);

    final FlexTable layoutNode = new FlexTable();
    layoutNode.setCellPadding(10);
    layoutNode.setWidth(Sizes.HUNDRED_PERCENT);

    layoutNode.setHTML(0, 0, "Label");
    layoutNode.setWidget(0, 1, new HTML(node.getLabel()));
    layoutNode.setHTML(1, 0, "Status");
    layoutNode.setWidget(1, 1, new HTML(node.getStatus()));

    layoutNode.setHTML(2, 0, "Host");
    layoutNode.setWidget(2, 1, new HTML(node.getHostname()));
    layoutNode.setHTML(3, 0, "IP:Port");
    layoutNode.setWidget(3, 1, new HTML(node.getIpaddress() + ":" + node.getPort()));

    // running time

    layoutNode.setHTML(4, 0, "Running time");
    layoutNode.setWidget(4, 1, new HTML(JemConstants.UPDATING_BRACKETS));
    elapsedTimer = new Timer() {
        @Override
        public void run() {
            layoutNode.setWidget(4, 1, new HTML(JemConstants.UPDATING_BRACKETS));
            String displayed;
            try {
                displayed = TimeDisplayUtils.getReadableTimeDiff(node.getStartedTime(),
                        TimeDisplayUtils.VERBOSE);
            } catch (Exception e) {
                LogClient.getInstance().warning(e.getMessage(), e);
                displayed = JemConstants.UNAVAILABLE_BRACKETS;
            }
            layoutNode.setWidget(4, 1, new HTML(displayed));
        }
    };
    elapsedTimer.run();
    elapsedTimer.scheduleRepeating(RUNNING_TIME_REFRESH_INTERVAL);

    layoutNode.setHTML(5, 0, "Key");
    layoutNode.setWidget(5, 1, new HTML(node.getKey()));

    layoutNode.setHTML(6, 0, "RMI Port");
    layoutNode.setWidget(6, 1, new HTML(String.valueOf(node.getRmiPort())));

    layoutNode.setHTML(7, 0, "Jem Version");
    layoutNode.setWidget(7, 1, new HTML(node.getJemVersion()));

    UITools.setFlexTableStyles(layoutNode, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    nodeVp.add(layoutNode);

    /*
     * EXECUTION ENVIRONMENT
     */
    VerticalPanel envVp = new VerticalPanel();
    envVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(envVp);
    hp.setCellWidth(envVp, "50%");

    Label envLabel = new Label("Execution environment");
    envLabel.setWidth(Sizes.HUNDRED_PERCENT);
    envLabel.setStyleName(Styles.INSTANCE.inspector().title());
    envLabel.addStyleName(Styles.INSTANCE.common().bold());
    envVp.add(envLabel);

    FlexTable layoutEnvironment = new FlexTable();
    layoutEnvironment.setCellPadding(10);
    layoutEnvironment.setWidth(Sizes.HUNDRED_PERCENT);
    ExecutionEnvironment env = node.getExecutionEnvironment();

    layoutEnvironment.setHTML(0, 0, "Name");
    layoutEnvironment.setWidget(0, 1, new HTML(env.getEnvironment()));
    layoutEnvironment.setHTML(1, 0, "Domain");
    layoutEnvironment.setWidget(1, 1, new HTML(env.getDomain()));
    layoutEnvironment.setHTML(2, 0, "Static Affinities");
    layoutEnvironment.setWidget(2, 1, new HTML(env.getStaticAffinities().toString()));
    layoutEnvironment.setHTML(3, 0, "Dynamic Affinities");
    layoutEnvironment.setWidget(3, 1, new HTML(env.getDynamicAffinities().toString()));
    layoutEnvironment.setHTML(4, 0, "Parallel jobs");
    layoutEnvironment.setWidget(4, 1, new HTML(String.valueOf(env.getParallelJobs())));
    layoutEnvironment.setHTML(5, 0, "Node type");
    layoutEnvironment.setWidget(5, 1, new HTML(String.valueOf(node.getType())));

    UITools.setFlexTableStyles(layoutEnvironment, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    envVp.add(layoutEnvironment);

    // main
    add(hp);
}

From source file:org.pepstock.jem.gwt.client.panels.nodes.commons.inspector.System.java

License:Open Source License

/**
 * Builds the component, using the node instance as argument
 * //from w w w .  ja  v  a 2 s.co m
 * @param node node instance in inspect mode
 * 
 */
public System(final NodeInfoBean node) {
    this.node = node;

    // MAIN PANEL
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.setHeight(Sizes.HUNDRED_PERCENT);
    hp.setSpacing(10);

    /*
     * NODE INFO
     */
    VerticalPanel sysInfoVp = new VerticalPanel();
    sysInfoVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(sysInfoVp);
    hp.setCellWidth(sysInfoVp, "50%");

    Label sysInfoLabel = new Label("System information");
    sysInfoLabel.setWidth(Sizes.HUNDRED_PERCENT);
    sysInfoLabel.setStyleName(Styles.INSTANCE.inspector().title());
    sysInfoLabel.addStyleName(Styles.INSTANCE.common().bold());
    sysInfoVp.add(sysInfoLabel);

    FlexTable layoutSysInfo = new FlexTable();
    layoutSysInfo.getColumnFormatter().setWidth(0, "50%");
    layoutSysInfo.getColumnFormatter().setWidth(1, "50%");
    layoutSysInfo.setCellPadding(10);
    layoutSysInfo.setWidth(Sizes.HUNDRED_PERCENT);
    ExecutionEnvironment env = node.getExecutionEnvironment();

    layoutSysInfo.setHTML(0, 0, "Memory (MB)");
    layoutSysInfo.setWidget(0, 1, new HTML(String.valueOf(node.getTotalMemory() / 1024L / 1024L)));

    layoutSysInfo.setHTML(1, 0, "Available processors");
    layoutSysInfo.setWidget(1, 1, new HTML(String.valueOf(node.getAvailableProcessors())));

    layoutSysInfo.setHTML(2, 0, "PID");
    layoutSysInfo.setWidget(2, 1, new HTML(String.valueOf(node.getProcessId())));

    layoutSysInfo.setHTML(3, 0, "System architecture");
    layoutSysInfo.setWidget(3, 1, new HTML(node.getSystemArchitecture()));

    layoutSysInfo.setHTML(4, 0, "System name");
    layoutSysInfo.setWidget(4, 1, new HTML(node.getSystemName()));

    layoutSysInfo.setHTML(5, 0, "Maximum heap size used for jobs (MB)");
    layoutSysInfo.setWidget(5, 1, new HTML(String.valueOf(env.getMemory())));

    UITools.setFlexTableStyles(layoutSysInfo, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    sysInfoVp.add(layoutSysInfo);

    // main
    add(hp);
}

From source file:org.pepstock.jem.gwt.client.panels.swarm.commons.inspector.node.General.java

License:Open Source License

/**
 * Builds the component, using the node instance as argument
 * /*from  w ww. ja v a 2s.c om*/
 * @param node node instance in inspect mode
 * 
 */
public General(final NodeInfoBean node) {
    this.node = node;

    // MAIN PANEL
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.setHeight(Sizes.HUNDRED_PERCENT);
    hp.setSpacing(10);

    /*
     * NODE INFO
     */
    VerticalPanel nodeVp = new VerticalPanel();
    nodeVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(nodeVp);
    hp.setCellWidth(nodeVp, "50%");

    Label nodeLabel = new Label("Node information");
    nodeLabel.setWidth(Sizes.HUNDRED_PERCENT);
    nodeLabel.setStyleName(Styles.INSTANCE.inspector().title());
    nodeLabel.addStyleName(Styles.INSTANCE.common().bold());
    nodeVp.add(nodeLabel);

    final FlexTable layoutNode = new FlexTable();
    layoutNode.setCellPadding(10);
    layoutNode.setWidth(Sizes.HUNDRED_PERCENT);

    layoutNode.setHTML(0, 0, "Label");
    layoutNode.setWidget(0, 1, new HTML(node.getLabel()));
    layoutNode.setHTML(1, 0, "Status");
    layoutNode.setWidget(1, 1, new HTML(node.getStatus()));

    layoutNode.setHTML(2, 0, "Host");
    layoutNode.setWidget(2, 1, new HTML(node.getHostname()));
    layoutNode.setHTML(3, 0, "Address");
    layoutNode.setWidget(3, 1, new HTML(node.getIpaddress() + ":" + node.getPort()));

    // running time JODA

    layoutNode.setHTML(4, 0, "Running time");
    layoutNode.setWidget(4, 1, new HTML(JemConstants.UPDATING_BRACKETS));
    elapsedTimer = new Timer() {
        @Override
        public void run() {
            layoutNode.setWidget(4, 1, new HTML(JemConstants.UPDATING_BRACKETS));
            String displayed;
            try {
                displayed = TimeDisplayUtils.getReadableTimeDiff(node.getStartedTime());
            } catch (Exception e) {
                LogClient.getInstance().warning(e.getMessage(), e);
                displayed = JemConstants.UNAVAILABLE_BRACKETS;
            }
            layoutNode.setWidget(4, 1, new HTML(displayed));
        }
    };
    elapsedTimer.run();
    elapsedTimer.scheduleRepeating(RUNNING_TIME_REFRESH_INTERVAL);

    layoutNode.setHTML(5, 0, "Key");
    layoutNode.setWidget(5, 1, new HTML(node.getKey()));

    layoutNode.setHTML(6, 0, "Jem release version");
    layoutNode.setWidget(6, 1, new HTML(node.getJemVersion()));

    UITools.setFlexTableStyles(layoutNode, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    nodeVp.add(layoutNode);

    /*
     * EXECUTION ENVIRONMENT
     */
    VerticalPanel envVp = new VerticalPanel();
    envVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(envVp);
    hp.setCellWidth(envVp, "50%");

    Label envLabel = new Label("Execution environment");
    envLabel.setWidth(Sizes.HUNDRED_PERCENT);
    envLabel.setStyleName(Styles.INSTANCE.inspector().title());
    envLabel.addStyleName(Styles.INSTANCE.common().bold());
    envVp.add(envLabel);

    FlexTable layoutEnvironment = new FlexTable();
    layoutEnvironment.setCellPadding(10);
    layoutEnvironment.setWidth(Sizes.HUNDRED_PERCENT);
    ExecutionEnvironment env = node.getExecutionEnvironment();

    layoutEnvironment.setHTML(0, 0, "Name");
    layoutEnvironment.setWidget(0, 1, new HTML(env.getEnvironment()));

    UITools.setFlexTableStyles(layoutEnvironment, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    envVp.add(layoutEnvironment);

    // main
    add(hp);
}

From source file:org.pepstock.jem.gwt.client.panels.swarm.commons.inspector.node.System.java

License:Open Source License

/**
 * Builds the component, using the node instance as argument
 * /*from  w  w w . ja  v a 2  s .  c om*/
 * @param node node instance in inspect mode
 * 
 */
public System(final NodeInfoBean node) {
    this.node = node;

    // MAIN PANEL
    HorizontalPanel hp = new HorizontalPanel();
    hp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.setHeight(Sizes.HUNDRED_PERCENT);
    hp.setSpacing(10);

    /*
     * NODE INFO
     */
    VerticalPanel sysInfoVp = new VerticalPanel();
    sysInfoVp.setWidth(Sizes.HUNDRED_PERCENT);
    hp.add(sysInfoVp);
    hp.setCellWidth(sysInfoVp, "50%");

    Label sysInfoLabel = new Label("System information");
    sysInfoLabel.setWidth(Sizes.HUNDRED_PERCENT);
    sysInfoLabel.setStyleName(Styles.INSTANCE.inspector().title());
    sysInfoLabel.addStyleName(Styles.INSTANCE.common().bold());
    sysInfoVp.add(sysInfoLabel);

    FlexTable layoutSysInfo = new FlexTable();
    layoutSysInfo.getColumnFormatter().setWidth(0, "50%");
    layoutSysInfo.getColumnFormatter().setWidth(1, "50%");
    layoutSysInfo.setCellPadding(10);
    layoutSysInfo.setWidth(Sizes.HUNDRED_PERCENT);

    layoutSysInfo.setHTML(0, 0, "PID");
    layoutSysInfo.setWidget(0, 1, new HTML(String.valueOf(node.getProcessId())));

    layoutSysInfo.setHTML(1, 0, "System architecture");
    layoutSysInfo.setWidget(1, 1, new HTML(node.getSystemArchitecture()));

    layoutSysInfo.setHTML(2, 0, "System name");
    layoutSysInfo.setWidget(2, 1, new HTML(node.getSystemName()));

    UITools.setFlexTableStyles(layoutSysInfo, Styles.INSTANCE.inspector().rowDark(),
            Styles.INSTANCE.inspector().rowLight(), Styles.INSTANCE.common().bold());
    sysInfoVp.add(layoutSysInfo);

    // main
    add(hp);
}

From source file:org.primaresearch.web.layouteditor.client.WebLayoutEditor.java

License:Apache License

/**
 * This is the entry point method.//from   www  . j  av  a 2 s. c o m
 */
public void onModuleLoad() {
    try {
        //Set the number formatter (had to be decoupled since GWT doesn't work with DecimalFormat)
        DoubleValue.setFormatter(new GwtDecimalFormatter(DoubleValue.defaultFormatPattern));

        resizeRequiredExtraHeight = Integer.parseInt(CONSTANTS.HeaderHeight());

        //Listen for page content object selection changes
        selectionManager.addListener(this);

        //Initialisations
        imageLoader = new DocumentImageLoader();
        pageLayout = new PageLayoutC();
        pageSync = new PageSyncManager(null, pageLayout);
        pageView = new PageScrollView(pageLayout, imageLoader, selectionManager, true, false);
        pageContentRendererPlugin = new PageContentRendererPlugin();
        pageView.getRenderer().addPlugin(pageContentRendererPlugin);
        pageContentRendererPlugin.setFill(false);
        pageView.getRenderer().addPlugin(selectionRendererPlugin = new ContentSelectionRendererPlugin());
        pageView.addZoomListener(this);
        pageView.setMinZoom(0.05);
        pageSync.addListener(pageView);
        pageSync.addListener(this);
        imageLoader.addListener(pageView);
        imageLoader.addListener(this);

        //Main panel (child panels vertically arranged)
        mainPanel = new VerticalPanel();
        mainPanel.setSize("99.8%", (Window.getClientHeight() - 1) + "px");

        //Focus panel (required for keyboard handler)
        focusPanel = new FocusPanel(mainPanel);
        focusPanel.setSize("99.8%", (Window.getClientHeight() - 1) + "px");
        focusPanel.addKeyPressHandler(this);
        focusPanel.addKeyDownHandler(this);
        focusPanel.getElement().getStyle().setOutlineWidth(0, Unit.PX);
        RootPanel.get().add(focusPanel);
        focusPanel.setFocus(true);

        //Header panel at the top
        FlexTable header = new FlexTable();
        header.addStyleName("headerPanel");
        mainPanel.add(header);

        documentTitle = new Label(CONSTANTS.LoadingDocument());
        header.setWidget(0, 0, documentTitle);
        documentTitle.addStyleName("documentTitle");

        //Centre panel (with toolbar, page view, and region labels)
        HorizontalPanel centerPanel = new HorizontalPanel();
        mainPanel.add(centerPanel);
        centerPanel.setSize("99.8%", (Window.getClientHeight() - resizeRequiredExtraHeight) + "px");

        //Toolbar panel at the left
        toolbar = createToolbar();
        centerPanel.add(toolbar);
        centerPanel.setCellWidth(toolbar, "1%");

        //Split panel with page view and region labels
        splitPanel = new SplitLayoutPanel();
        centerPanel.add(splitPanel);
        splitPanel.setSize("99.8%", (Window.getClientHeight() - resizeRequiredExtraHeight) + "px");
        splitPanel.addStyleName("contentPanel");

        //Region labels
        VerticalPanel rightPanel = new VerticalPanel();
        rightPanel.setWidth("100%");
        splitPanel.addEast(rightPanel, Integer.parseInt(CONSTANTS.IntitialRegionLabelPanelWidth())); //Right
        // Headline
        regionTypeEditorHeading = new Label(CONSTANTS.LabelEditorHeadingCreateRegion());
        regionTypeEditorHeading.addStyleName("regionTypeEditorHeading");
        rightPanel.add(regionTypeEditorHeading);
        // Editor
        regionTypeEditor = new SimpleRegionTypeEditor(selectionManager);
        regionTypeEditor.addRegionTypeSelectionListener(this);
        selectionManager.addListener(regionTypeEditor);
        regionTypeEditor.getWidget().addStyleName("regionTypeEditor");
        rightPanel.add(regionTypeEditor.getWidget());

        //Page view
        splitPanel.add(pageView); //Centre
        pageView.asWidget().addStyleName("pageView");

        //Text content dialogue
        createTextDialog();

        //Resize handler (browser window resize events)
        Window.addResizeHandler(this);

        //Add tool icons to page view
        addToolIconsToPageView();

        //Authenticate user
        userManager.addListener(this);
        userManager.logOn(Window.Location.getParameter("Appid"), Window.Location.getParameter("Did"),
                Window.Location.getParameter("Aid"), Window.Location.getParameter("a"));

        //Get the virtual keyboard layout from the server
        loadVirtualKeyboardLayout();

        logManager.logInfo(0, "onModuleLoad() finished");
    } catch (Exception exc) {
        logManager.logError(ERROR_ON_MODULE_LOAD, "Error in onModuleLoad()");
        exc.printStackTrace();
    }
}