private void getDateAndTimeFrom(Calendar date) { Date dateFrom = fDateFrom.getValue(); Date timeFrom = fTimeFrom.getValue(); date.setTime(dateFrom); Calendar time = new GregorianCalendar(); time.setTime(timeFrom); date.set(Calendar.HOUR, time.get(Calendar.HOUR)); date.set(Calendar.MINUTE, time.get(Calendar.MINUTE)); }
/** Initialize component & values from m_mAssignment */ private void setDisplay() { m_setting = true; // Set Resource int S_Resource_ID = m_mAssignment.getS_Resource_ID(); KeyNamePair[] resources = new KeyNamePair[m_lookup.size()]; m_lookup.keySet().toArray(resources); for (int i = 0; i < resources.length; i++) { if (resources[i].getKey() == S_Resource_ID) { fResource.setSelectedIndex(i); break; } } ListItem listItem = fResource.getSelectedItem(); KeyNamePair check = new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel()); if (check == null || check.getKey() != S_Resource_ID) { if (m_mAssignment.getS_ResourceAssignment_ID() == 0) // new record select first fResource.setSelectedItem(fResource.getSelectedItem()); // initiates UOM display else log.log(Level.SEVERE, "Resource not found ID=" + S_Resource_ID); } // Set Date, Qty fDateFrom.setValue(m_mAssignment.getAssignDateFrom()); fTimeFrom.setValue(m_mAssignment.getAssignDateFrom()); fQty.setValue(m_mAssignment.getQty()); // Name, Description fName.setValue(m_mAssignment.getName()); fDescription.setValue(m_mAssignment.getDescription()); // Set Editor to R/O if confirmed boolean readWrite = true; if (m_mAssignment.isConfirmed()) readWrite = false; confirmPanel.getButton("Cancel").setVisible(readWrite); fResource.setEnabled(readWrite); fDateFrom.setReadonly(!readWrite); fQty.setEnabled(readWrite); m_setting = false; } // dynInit
/** * Static Init * * @throws Exception */ private void init() throws Exception { fResource.setMold("select"); fResource.addEventListener(Events.ON_SELECT, this); delete.addEventListener(Events.ON_CLICK, this); confirmPanel.addComponentsLeft(delete); confirmPanel.addActionListener(Events.ON_CLICK, this); // this.appendChild(mainPanel); mainPanel.makeNoStrip(); mainPanel.setStyle("background-color: transparent"); Rows rows = new Rows(); mainPanel.appendChild(rows); Row row = new Row(); row.appendChild(LayoutUtils.makeRightAlign(lResource)); row.appendChild(fResource); row.appendChild(new Label(" ")); rows.appendChild(row); row = new Row(); row.setSpans("1, 2"); row.appendChild(LayoutUtils.makeRightAlign(lDate)); Div div = new Div(); div.appendChild(fDateFrom); div.appendChild(fTimeFrom); fTimeFrom.setStyle("margin-left: 5px"); row.appendChild(div); rows.appendChild(row); row = new Row(); row.appendChild(LayoutUtils.makeRightAlign(lQty)); row.appendChild(fQty); row.appendChild(lUOM); rows.appendChild(row); row = new Row(); row.setSpans("1, 2"); row.appendChild(LayoutUtils.makeRightAlign(lName)); row.appendChild(fName); fName.setStyle("width: 100%"); rows.appendChild(row); row = new Row(); row.setSpans("1, 2"); row.appendChild(LayoutUtils.makeRightAlign(lDescription)); row.appendChild(fDescription); fDescription.setMultiline(true); fDescription.setRows(3); fDescription.setStyle("width: 100%"); rows.appendChild(row); row = new Row(); row.setSpans("3"); row.appendChild(new Label(" ")); rows.appendChild(row); row = new Row(); row.setSpans("3"); row.appendChild(confirmPanel); rows.appendChild(row); // } // jbInit