use of org.compiere.swing.CCheckBox in project adempiere by adempiere.
the class PreviewPanel method setupPreview.
/**
* Create the preview UI components
*/
private void setupPreview() {
JRootPane rootPane = new JRootPane();
previewPanel.setLayout(new BorderLayout());
previewPanel.add(rootPane, BorderLayout.CENTER);
previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
GridLayout gridLayout = new GridLayout(1, 3);
gridLayout.setHgap(4);
rootPane.getContentPane().setLayout(gridLayout);
rootPane.setGlassPane(new GlassPane());
rootPane.getGlassPane().setVisible(true);
CPanel column1 = new CPanel();
rootPane.getContentPane().add(column1);
CPanel column2 = new CPanel();
rootPane.getContentPane().add(column2);
CPanel column3 = new CPanel();
rootPane.getContentPane().add(column3);
column1.setLayout(new GridBagLayout());
JTree jtree = new JTree();
jtree.setFocusable(false);
jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 2), 0, 0));
CTextField normal = new CTextField("Text Field");
normal.setFocusable(false);
column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 5, 2), 0, 0));
error.setBackground(true);
error.setFocusable(false);
column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column2.setLayout(new GridBagLayout());
JTable jtable = new JTable(s_data, s_columns);
JScrollPane scrollPane = new JScrollPane(jtable);
jtable.setFocusable(false);
scrollPane.setPreferredSize(jtable.getPreferredSize());
column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 2), 0, 0));
mandatory.setMandatory(true);
mandatory.setFocusable(false);
column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CTextField inactive = new CTextField(s_res.getString("Inactive"));
inactive.setEnabled(false);
column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column3.setLayout(new GridBagLayout());
CTabbedPane tab = new CTabbedPane();
column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 5), 0, 0));
CComboBox editable = new CComboBox(new Object[] { "Editable" });
editable.setEditable(true);
editable.setFocusable(false);
column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CComboBox choice = new CComboBox(new Object[] { "Choice" });
choice.setEditable(false);
choice.setFocusable(false);
column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 5), 0, 0));
tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
JRadioButton radio = new JRadioButton("Radio");
radio.setSelected(true);
radio.setMargin(new Insets(5, 5, 5, 5));
radio.setFocusable(false);
radio.setOpaque(false);
tabPage1.add(radio);
CCheckBox checkBox = new CCheckBox("Checkbox");
checkBox.setSelected(true);
checkBox.setMargin(new Insets(5, 5, 5, 5));
checkBox.setFocusable(false);
tabPage1.add(checkBox);
CLabel label = new CLabel("Label");
label.setHorizontalAlignment(JLabel.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tabPage1.add(label);
button.setMargin(new Insets(5, 5, 5, 5));
button.setFocusable(false);
tabPage1.add(button);
tab.add(tabPage1, "tab1");
tab.add(new CPanel(), "tab2");
}
use of org.compiere.swing.CCheckBox in project adempiere by adempiere.
the class MiniTable method setColumnClass.
/**
* Set Column Editor & Renderer to Class
* (after all columns were added)
* Layout of IDColumn depends on multiSelection
* @param index column index
* @param c class of column - determines renderer/editors supported:
* @param DisplayType define Type Value
* IDColumn, Boolean, Double (Quantity), BigDecimal (Amount), Integer, Timestamp, String (default)
* @param readOnly read only flag
* @param header optional header value
*/
public void setColumnClass(int index, @SuppressWarnings("rawtypes") Class c, int displayType, boolean readOnly, String header) {
// log.config( "MiniTable.setColumnClass - " + index, c.getName() + ", r/o=" + readOnly);
TableColumn tc = getColumnModel().getColumn(index);
if (tc == null)
return;
// Set R/O
setColumnReadOnly(index, readOnly);
// Header
if (header != null && header.length() > 0)
tc.setHeaderValue(Util.cleanAmp(header));
// ID Column & Selection
if (c == IDColumn.class) {
IDColumnRenderer idcr = new IDColumnRenderer(m_multiSelection);
tc.setCellRenderer(idcr);
if (m_multiSelection) {
VHeaderRenderer vhr = new VHeaderRenderer(m_multiSelection);
tc.setCellEditor(new IDColumnEditor());
tc.setHeaderRenderer(vhr);
// Connect the IDColumn with the header
idcr.addChangeListener(vhr);
setColumnReadOnly(index, false);
} else {
tc.setCellEditor(new ROCellEditor());
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
}
m_minWidth.add(new Integer(10));
tc.setMaxWidth(20);
tc.setPreferredWidth(20);
tc.setResizable(false);
} else // Boolean
if (DisplayType.YesNo == displayType || c == Boolean.class) {
CheckRenderer cr = new CheckRenderer();
tc.setCellRenderer(cr);
if (readOnly) {
tc.setCellEditor(new ROCellEditor());
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.YesNo));
} else {
if (m_multiSelection) {
VHeaderRenderer vhr = new VHeaderRenderer(m_multiSelection);
setColumnReadOnly(index, false);
CCheckBox check = new CCheckBox();
check.setMargin(new Insets(0, 0, 0, 0));
check.setHorizontalAlignment(SwingConstants.CENTER);
tc.setCellEditor(new DefaultCellEditor(check));
tc.setHeaderRenderer(vhr);
// Connect the check control with the header
cr.addChangeListener(vhr);
}
}
m_minWidth.add(new Integer(30));
} else // Date
if (DisplayType.Date == displayType || DisplayType.DateTime == displayType || c == Timestamp.class) {
if (DisplayType.DateTime == displayType)
tc.setCellRenderer(new VCellRenderer(DisplayType.DateTime));
else
tc.setCellRenderer(new VCellRenderer(DisplayType.Date));
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else if (DisplayType.Date == displayType || DisplayType.DateTime == displayType)
tc.setCellEditor(new MiniCellEditor(c, displayType));
else
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(30));
if (DisplayType.DateTime == displayType)
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.DateTime));
else
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Date));
} else // Amount
if (DisplayType.Amount == displayType || c == BigDecimal.class) {
tc.setCellRenderer(new VCellRenderer(DisplayType.Amount));
if (readOnly) {
tc.setCellEditor(new ROCellEditor());
m_minWidth.add(new Integer(70));
} else {
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(80));
}
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
} else // Number
if (DisplayType.Number == displayType || c == Double.class) {
tc.setCellRenderer(new VCellRenderer(DisplayType.Number));
if (readOnly) {
tc.setCellEditor(new ROCellEditor());
m_minWidth.add(new Integer(70));
} else {
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(80));
}
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
} else // Integer
if (DisplayType.Integer == displayType || c == Integer.class) {
tc.setCellRenderer(new VCellRenderer(DisplayType.Integer));
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else
tc.setCellEditor(new MiniCellEditor(c));
m_minWidth.add(new Integer(30));
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
} else // String
{
tc.setCellRenderer(new VCellRenderer(DisplayType.String));
if (readOnly)
tc.setCellEditor(new ROCellEditor());
else
tc.setCellEditor(new MiniCellEditor(String.class));
m_minWidth.add(new Integer(30));
tc.setHeaderRenderer(new VHeaderRenderer(DisplayType.String));
}
// log.fine( "Renderer=" + tc.getCellRenderer().toString() + ", Editor=" + tc.getCellEditor().toString());
}
use of org.compiere.swing.CCheckBox in project adempiere by adempiere.
the class POSTable method setColumnClass.
@Override
public void setColumnClass(int index, @SuppressWarnings("rawtypes") Class c, int displayType, boolean readOnly, String header) {
// logger.config( "MiniTable.setColumnClass - " + index, c.getName() + ", r/o=" + readOnly);
TableColumn tableColumn = getColumnModel().getColumn(index);
if (tableColumn == null)
return;
// Set R/O
setColumnReadOnly(index, readOnly);
// Header
if (header != null && header.length() > 0)
tableColumn.setHeaderValue(Util.cleanAmp(header));
ArrayList<Integer> minWidth = new ArrayList<Integer>();
boolean multiSelection = false;
// ID Column & Selection
if (c == IDColumn.class) {
IDColumnRenderer columnRenderer = new IDColumnRenderer(multiSelection);
tableColumn.setCellRenderer(columnRenderer);
if (multiSelection) {
VHeaderRenderer headerRenderer = new VHeaderRenderer(multiSelection);
tableColumn.setCellEditor(new IDColumnEditor());
tableColumn.setHeaderRenderer(headerRenderer);
// Connect the IDColumn with the header
columnRenderer.addChangeListener(headerRenderer);
setColumnReadOnly(index, false);
} else {
tableColumn.setCellEditor(new ROCellEditor());
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
}
minWidth.add(new Integer(10));
tableColumn.setMaxWidth(20);
tableColumn.setPreferredWidth(20);
tableColumn.setResizable(false);
} else // Boolean
if (DisplayType.YesNo == displayType || c == Boolean.class) {
CheckRenderer checkRenderer = new CheckRenderer();
tableColumn.setCellRenderer(checkRenderer);
if (readOnly) {
tableColumn.setCellEditor(new ROCellEditor());
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.YesNo));
} else {
if (multiSelection) {
VHeaderRenderer headerRenderer = new VHeaderRenderer(multiSelection);
setColumnReadOnly(index, false);
CCheckBox check = new CCheckBox();
check.setMargin(new Insets(0, 0, 0, 0));
check.setHorizontalAlignment(SwingConstants.CENTER);
tableColumn.setCellEditor(new DefaultCellEditor(check));
tableColumn.setHeaderRenderer(headerRenderer);
// Connect the check control with the header
checkRenderer.addChangeListener(headerRenderer);
}
}
minWidth.add(new Integer(30));
} else // Date
if (DisplayType.Date == displayType || DisplayType.DateTime == displayType || c == Timestamp.class) {
if (DisplayType.DateTime == displayType)
tableColumn.setCellRenderer(new VCellRenderer(DisplayType.DateTime));
else
tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Date));
if (readOnly)
tableColumn.setCellEditor(new ROCellEditor());
else if (DisplayType.Date == displayType || DisplayType.DateTime == displayType)
tableColumn.setCellEditor(new MiniCellEditor(c, displayType));
else
tableColumn.setCellEditor(new MiniCellEditor(c));
minWidth.add(new Integer(30));
if (DisplayType.DateTime == displayType)
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.DateTime));
else
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Date));
} else // Amount
if (DisplayType.Amount == displayType || c == BigDecimal.class) {
tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Amount));
if (readOnly) {
tableColumn.setCellEditor(new ROCellEditor());
minWidth.add(new Integer(70));
} else {
tableColumn.setCellEditor(new MiniCellEditor(c));
minWidth.add(new Integer(80));
}
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
} else // Number
if (DisplayType.Number == displayType || c == Double.class) {
tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Number));
if (readOnly) {
tableColumn.setCellEditor(new ROCellEditor());
minWidth.add(new Integer(70));
} else {
tableColumn.setCellEditor(new MiniCellEditor(c));
minWidth.add(new Integer(80));
}
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
} else // Integer
if (DisplayType.Integer == displayType || c == Integer.class) {
tableColumn.setCellRenderer(new VCellRenderer(DisplayType.Integer));
if (readOnly)
tableColumn.setCellEditor(new ROCellEditor());
else
tableColumn.setCellEditor(new MiniCellEditor(c));
minWidth.add(new Integer(30));
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.Number));
} else // String
{
tableColumn.setCellRenderer(new VCellRenderer(DisplayType.String));
if (readOnly)
tableColumn.setCellEditor(new ROCellEditor());
else
tableColumn.setCellEditor(new MiniCellEditor(String.class));
minWidth.add(new Integer(30));
tableColumn.setHeaderRenderer(new VHeaderRenderer(DisplayType.String));
}
// logger.fine( "Renderer=" + tc.getCellRenderer().toString() + ", Editor=" + tc.getCellEditor().toString());
}
use of org.compiere.swing.CCheckBox in project adempiere by adempiere.
the class QueryOrderHistory method init.
/**
* Set up Panel
*/
@Override
protected void init() {
setTitle(Msg.translate(Env.getCtx(), "C_Order_ID"));
// North
parameterPanel.setLayout(new MigLayout("fill", "", "[50][50][]"));
parameterPanel.setBorder(new TitledBorder(Msg.getMsg(ctx, QUERY)));
CLabel labelDocument = new CLabel(Msg.translate(ctx, DOCUMENTNO));
parameterPanel.add(labelDocument, " growy");
fieldDocumentNo = new POSTextField("", posPanel.getKeyboard());
labelDocument.setLabelFor(fieldDocumentNo);
parameterPanel.add(fieldDocumentNo, "h 30, w 200");
fieldDocumentNo.addActionListener(this);
//
CLabel labelDateFrom = new CLabel(Msg.translate(ctx, DATEORDEREDFROM));
parameterPanel.add(labelDateFrom, "growy");
fieldDateFrom = new VDate();
fieldDateFrom.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
labelDateFrom.setLabelFor(fieldDateFrom);
parameterPanel.add(fieldDateFrom, "h 30, w 200");
fieldDateFrom.addVetoableChangeListener(this);
fieldAllowDate = new CCheckBox(Msg.translate(ctx, DATE));
fieldAllowDate.setSelected(false);
fieldAllowDate.addActionListener(this);
parameterPanel.add(fieldAllowDate, "wrap");
//
posTable.prepareTable(columnInfos, "C_Order", "C_POS_ID = " + posPanel.getC_POS_ID(), false, "C_Order");
posTable.growScrollbars();
// BPartner
CLabel labelBPartner = new CLabel(Msg.translate(ctx, BPARTNERID));
parameterPanel.add(labelBPartner, "growy");
fieldBPartner = new POSTextField("", posPanel.getKeyboard());
labelBPartner.setLabelFor(fieldBPartner);
parameterPanel.add(fieldBPartner, "h 30, w 200");
fieldBPartner.addActionListener(this);
// Date To
CLabel labelDateTo = new CLabel(Msg.translate(ctx, DATEORDEREDTO));
parameterPanel.add(labelDateTo, "growy");
fieldDateTo = new VDate();
fieldDateTo.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
labelDateTo.setLabelFor(fieldDateTo);
parameterPanel.add(fieldDateTo, "h 30, w 200");
fieldDateTo.addVetoableChangeListener(this);
fieldProcessed = new CCheckBox(Msg.translate(ctx, PROCESSED));
fieldProcessed.setSelected(false);
fieldProcessed.addActionListener(this);
parameterPanel.add(fieldProcessed, "");
SwingUtilities.invokeLater(new Runnable() {
public void run() {
fieldDocumentNo.requestFocus();
}
});
pack();
refresh();
}
use of org.compiere.swing.CCheckBox in project adempiere by adempiere.
the class VDeleteEntity method preInit.
/**
* Pre Init
*/
private void preInit() {
refreshButton = ConfirmPanel.createRefreshButton(false);
refreshButton.addActionListener(this);
//
dryRun = new CCheckBox(Msg.getMsg(Env.getCtx(), "DryRun"), true);
clientLabel = new CLabel(Msg.getElement(Env.getCtx(), "AD_Client_ID"));
clientPick = new CComboBox(getClients());
clientPick.setSelectedItem(null);
clientPick.setMandatory(true);
clientPick.setBackground(false);
tableLabel = new CLabel(Msg.getElement(Env.getCtx(), "AD_Table_ID"));
tablePick = new CComboBox(getTables());
tablePick.setSelectedItem(null);
tablePick.setMandatory(true);
tablePick.setBackground(false);
rootNode = new DefaultMutableTreeNode(null);
tree = new CheckboxTree(rootNode);
treePane = new JScrollPane(tree);
JViewport viewPort = treePane.getViewport();
viewPort.add(tree);
}
Aggregations