Example usage for java.awt.event ComponentEvent ComponentEvent

List of usage examples for java.awt.event ComponentEvent ComponentEvent

Introduction

In this page you can find the example usage for java.awt.event ComponentEvent ComponentEvent.

Prototype

public ComponentEvent(Component source, int id) 

Source Link

Document

Constructs a ComponentEvent object.

Usage

From source file:Main.java

@Override
public void componentShown(ComponentEvent evt) {
    System.out.println(evt.getID() == ComponentEvent.COMPONENT_FIRST);
    ComponentEvent event = new ComponentEvent((Component) evt.getSource(), ComponentEvent.COMPONENT_MOVED);

}

From source file:op.care.prescription.DlgRegular.java

private void reloadTable() {
    String zubereitung = "x";
    if (prescription.getTradeForm() != null) {
        zubereitung = prescription.getTradeForm().getDosageForm().getPreparation();
    }//from w w  w  . j a va 2s.c  o  m

    tblDosis.setModel(new TMDose(zubereitung, prescription));
    tblDosis.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    jspDosis.dispatchEvent(new ComponentEvent(jspDosis, ComponentEvent.COMPONENT_RESIZED));
    tblDosis.getColumnModel().getColumn(TMDose.COL_Dosis).setCellRenderer(new RNDHTML());
    tblDosis.getColumnModel().getColumn(TMDose.COL_Dosis).setHeaderValue(SYSTools.xx("misc.msg.usage"));
}

From source file:op.care.sysfiles.PnlFiles.java

void reloadTable() {
    HashSet<SYSFiles> filesSet = new HashSet<>();

    EntityManager em = OPDE.createEM();/*from www . jav a2  s . co m*/

    Query query0 = em.createQuery(
            "SELECT s FROM SYSFiles s JOIN s.residentAssignCollection res WHERE res.resident = :resident");
    query0.setParameter("resident", resident);
    filesSet.addAll(query0.getResultList());

    Query query1 = em.createQuery(
            "SELECT s FROM SYSFiles s JOIN s.nrAssignCollection nr WHERE nr.nReport.resident = :resident");
    query1.setParameter("resident", resident);
    filesSet.addAll(query1.getResultList());

    Query query2 = em.createQuery(
            "SELECT s FROM SYSFiles s JOIN s.bwiAssignCollection bwi WHERE bwi.bwinfo.resident = :resident");
    query2.setParameter("resident", resident);
    filesSet.addAll(query2.getResultList());

    Query query3 = em.createQuery(
            "SELECT s FROM SYSFiles s JOIN s.preAssignCollection pre WHERE pre.prescription.resident = :resident");
    query3.setParameter("resident", resident);
    filesSet.addAll(query3.getResultList());

    Query query4 = em.createQuery(
            "SELECT s FROM SYSFiles s JOIN s.valAssignCollection val WHERE val.value.resident = :resident");
    query4.setParameter("resident", resident);
    filesSet.addAll(query4.getResultList());

    Query query5 = em.createQuery(
            "SELECT s FROM SYSFiles s JOIN s.npAssignCollection np WHERE np.nursingProcess.resident = :resident");
    query5.setParameter("resident", resident);
    filesSet.addAll(query5.getResultList());

    em.close();

    ArrayList<SYSFiles> listFiles = new ArrayList<>(filesSet);

    Collections.sort(listFiles);

    //        createFilters();
    tmSYSFiles = new TMSYSFiles(listFiles);
    tblFiles.setModel(tmSYSFiles);

    sorter = new TableRowSorter(tmSYSFiles);
    sorter.setSortsOnUpdates(true);
    tblFiles.setRowSorter(sorter);

    //        sorter.setComparator(TMSYSFiles.COL_PIT, new Comparator<Date>() {
    //            @Override
    //            public int compare(Date o1, Date o2) {
    //                return o1.compareTo(o2);
    //            }
    //        });

    //        sorter.setRowFilter(textFilter);

    tblFiles.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer() {
        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd.MM.yyyy HH:mm");
            return super.getTableCellRendererComponent(table, sdf.format((Date) value), isSelected, hasFocus,
                    row, column);
        }
    });
    tblFiles.getColumnModel().getColumn(1).setCellRenderer(new RNDHTML());
    tblFiles.getColumnModel().getColumn(2).setCellRenderer(new RNDHTML());
    tblFiles.getColumnModel().getColumn(3).setCellRenderer(new RNDHTML());

    tblFiles.getColumnModel().getColumn(0).setHeaderValue(SYSTools.xx("nursingrecords.files.tabheader1"));
    tblFiles.getColumnModel().getColumn(1).setHeaderValue(SYSTools.xx("nursingrecords.files.tabheader2"));
    tblFiles.getColumnModel().getColumn(2).setHeaderValue(SYSTools.xx("nursingrecords.files.tabheader3"));
    tblFiles.getColumnModel().getColumn(3).setHeaderValue(SYSTools.xx("nursingrecords.files.tabheader4"));

    jspFiles.dispatchEvent(new ComponentEvent(jspFiles, ComponentEvent.COMPONENT_RESIZED));
}

From source file:org.jimcat.gui.wheellist.WheelList.java

/**
 * signal parent components that the size of this component has changed
 *///  w  ww  .j a  va2 s .c o  m
private void fireResizeEvent() {
    // inform listeners about resize event
    ComponentListener listener[] = getComponentListeners();
    // test if there are listeners
    if (listener.length == 0) {
        return;
    }

    // create event and send
    ComponentEvent event = new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
    for (ComponentListener l : listener) {
        l.componentResized(event);
    }
}