All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jclarion.clarion.swing.ClarionStatusPane Maven / Gradle / Ivy

package org.jclarion.clarion.swing;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.util.List;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;

import org.jclarion.clarion.AbstractWindowTarget;
import org.jclarion.clarion.runtime.CWinImpl;


public class ClarionStatusPane extends JPanel
{
    private static final long serialVersionUID = -402058107201081579L;
    private Container statusBar;
    private AbstractWindowTarget _awt;
    private AbstractWindowTarget child;
    
    public ClarionStatusPane(AbstractWindowTarget awt,Component base)
    {
        setLayout(new BorderLayout(0,0));
        add(base,BorderLayout.CENTER);
        this._awt=awt;
        notifyStatusChange();
    }
    
    public AbstractWindowTarget getTarget()
    {
        AbstractWindowTarget consider;
        synchronized(this) {
            consider=child;
        }
        if (consider!=null) {
            synchronized(consider) {
                if (consider.getStatus()!=null) {
                    if (!consider.getStatus().isEmpty()) {
                        if (consider.getStatus().get(0).getWidth()!=0) return consider;
                    }
                }
            }
        }
        return _awt;
    }
    
    public void setChild(AbstractWindowTarget target)
    {
        synchronized(this) {
            child=target;
        }
        notifyStatusChange();
    }

    public void clearChild(AbstractWindowTarget target)
    {
        synchronized(this) {
            if (child==target) child=null;
        }
        notifyStatusChange();
    }
    
    public synchronized Container getStatusBar()
    {
        return statusBar;
    }

    public void notifyStatusChange() 
    {
        CWinImpl.run(new Runnable() {
            @Override
            public void run() {
                
                AbstractWindowTarget awt = getTarget();
                
                int[] sizes;
                String[] values;
                int size=0;
                
                synchronized(awt) {
                    List l = awt.getStatus();
                    if (l!=null) {
                        for (int scan=0;scan0) {
                    
                    for (int scan=0;scan




© 2015 - 2025 Weber Informatics LLC | Privacy Policy