use of org.adempiere.webui.component.Borderlayout in project adempiere by adempiere.
the class WPOSKeyPanel method createButton.
/**
* Create Button
* @param C_POSKeyLayout_ID
* @return
* @return Panel
*/
public Panel createButton(int C_POSKeyLayout_ID) {
if (keymap.containsKey(C_POSKeyLayout_ID)) {
return null;
}
Panel card = new Panel();
card.setWidth("100%");
MPOSKeyLayout keyLayout = MPOSKeyLayout.get(Env.getCtx(), C_POSKeyLayout_ID);
Color stdColor = Color.lightGray;
if (keyLayout.getAD_PrintColor_ID() != 0) {
MPrintColor color = MPrintColor.get(Env.getCtx(), keyLayout.getAD_PrintColor_ID());
stdColor = color.getColor();
}
if (keyLayout.get_ID() == 0)
return null;
MPOSKey[] keys = keyLayout.getKeys(false);
HashMap<Integer, MPOSKey> map = new HashMap<Integer, MPOSKey>(keys.length);
keymap.put(C_POSKeyLayout_ID, map);
// Min Columns
int COLUMNS = 3;
// Min Rows
int ROWS = 3;
int noKeys = keys.length;
int cols = keyLayout.getColumns();
if (cols == 0)
cols = COLUMNS;
int buttons = 0;
log.fine("PosSubFunctionKeys.init - NoKeys=" + noKeys + ", Cols=" + cols);
// Content
Panel content = new Panel();
for (MPOSKey key : keys) {
if (!key.getName().equals("")) {
map.put(key.getC_POSKey_ID(), key);
Color keyColor = stdColor;
if (key.getAD_PrintColor_ID() != 0) {
MPrintColor color = MPrintColor.get(Env.getCtx(), key.getAD_PrintColor_ID());
keyColor = color.getColor();
}
log.fine("#" + map.size() + " - " + keyColor);
Panel button = new Panel();
Label label = new Label(key.getName());
Center nt = new Center();
South st = new South();
Borderlayout mainLayout = new Borderlayout();
if (key.getAD_Image_ID() != 0) {
MImage m_mImage = MImage.get(Env.getCtx(), key.getAD_Image_ID());
AImage img = null;
byte[] data = m_mImage.getData();
if (data != null && data.length > 0) {
try {
img = new AImage(null, data);
} catch (Exception e) {
}
}
Image bImg = new Image();
bImg.setContent(img);
bImg.setWidth("66%");
bImg.setHeight("80%");
nt.appendChild(bImg);
}
label.setStyle("word-wrap: break-word; white-space: pre-line;margin: 25px 0px 0px 0px; top:20px; font-size:10pt; font-weight: bold;color: #FFF;");
label.setHeight("100%");
button.setHeight("100px");
st.appendChild(label);
button.setClass("z-button");
button.setStyle("float:left; white-space: pre-line;text-align:center; margin:0.4% 1%; Background-color:rgb(" + keyColor.getRed() + "," + keyColor.getGreen() + "," + keyColor.getBlue() + "); border: 2px outset #CCC; " + "background: -moz-linear-gradient(top, rgba(247,247,247,1) 0%, rgba(255,255,255,0.93) 7%, rgba(186,186,186,0.25) 15%, rgba(" + keyColor.getRed() + "," + keyColor.getGreen() + "," + keyColor.getBlue() + ",1) 100%);" + "background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(247,247,247,1)), color-stop(7%, rgba(255,255,255,0.93)), color-stop(15%, rgba(186,186,186,0.25)), color-stop(100%, rgba(" + keyColor.getRed() + "," + keyColor.getGreen() + "," + keyColor.getBlue() + ",1)));" + "background: -webkit-linear-gradient(top, rgba(247,247,247,1) 0%, rgba(255,255,255,0.93) 7%, rgba(186,186,186,0.25) 15%, rgba(" + keyColor.getRed() + "," + keyColor.getGreen() + "," + keyColor.getBlue() + ",1) 100%);");
mainLayout.appendChild(nt);
mainLayout.appendChild(st);
mainLayout.setStyle("background-color: transparent");
nt.setStyle("background-color: transparent");
st.setStyle("clear: both; background-color: #333; opacity: 0.6;");
st.setZindex(99);
button.appendChild(mainLayout);
button.setId("" + key.getC_POSKey_ID());
button.addEventListener("onClick", this);
int size = 1;
if (key.getSpanX() > 1) {
size = key.getSpanX();
button.setWidth("96%");
} else
button.setWidth(90 / cols + "%");
if (key.getSpanY() > 1) {
size = size * key.getSpanY();
}
buttons = buttons + size;
content.appendChild(button);
}
}
int rows = Math.max((buttons / cols), ROWS);
if (buttons % cols > 0)
rows = rows + 1;
card.appendChild(content);
return card;
}
use of org.adempiere.webui.component.Borderlayout in project adempiere by adempiere.
the class WPOSQuery method initMainPanel.
/**
* Init Main Panel
* @return void
*/
private void initMainPanel() {
// Instance Panel
//
Panel buttonsPanel = new Panel();
Rows rows = null;
Row row = null;
South north = new South();
northPanel = new Panel();
mainLayout = new Borderlayout();
north.setStyle("border: none");
mainLayout.appendChild(north);
north.appendChild(northPanel);
Grid productLayout = GridFactory.newGridLayout();
northPanel.appendChild(productLayout);
rows = productLayout.newRows();
row = rows.newRow();
buttonsPanel.setAlign("Center");
row.setHeight("65px");
row.setSpans("6");
buttonNew = createButtonAction("New", KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
buttonNew.setId("New");
buttonsPanel.appendChild(buttonNew);
buttonNew.addActionListener(this);
buttonEdit = createButtonAction("Edit", KeyStroke.getKeyStroke(KeyEvent.VK_N, 0));
buttonEdit.setId("Edit");
buttonsPanel.appendChild(buttonEdit);
buttonEdit.addActionListener(this);
buttonReset = createButtonAction("Reset", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
buttonsPanel.appendChild(buttonReset);
buttonReset.setId("Reset");
buttonRefresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
buttonsPanel.appendChild(buttonRefresh);
buttonRefresh.setId("Refresh");
buttonOk = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
buttonsPanel.appendChild(buttonOk);
buttonOk.setId("Ok");
buttonCancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
buttonsPanel.appendChild(buttonCancel);
buttonCancel.setId("Cancel");
buttonOk.setTooltiptext(Msg.translate(ctx, "Ok"));
buttonCancel.setTooltiptext(Msg.translate(ctx, "Cancel"));
buttonOk.setTooltiptext(Msg.translate(ctx, "Ok"));
buttonCancel.setTooltiptext(Msg.translate(ctx, "Cancel"));
buttonNew.setTooltiptext(Msg.translate(ctx, "New"));
buttonEdit.setTooltiptext(Msg.translate(ctx, "Edit"));
buttonRefresh.setTooltiptext(Msg.translate(ctx, "Refresh"));
row.appendChild(buttonsPanel);
// Center
posTable = new WListbox();
posTable.addActionListener(this);
// Visible New
buttonNew.setVisible(false);
buttonEdit.setVisible(false);
buttonEdit.setEnabled(false);
}
use of org.adempiere.webui.component.Borderlayout in project adempiere by adempiere.
the class WMRPDetailed method initComponents.
private void initComponents() {
OrderPlanning = new Tabbox();
PanelOrder = new Tab();
PanelFind = new Panel();
PanelCenter = new Panel();
PanelBottom = new Panel();
Results = new Tab();
Borderlayout PanelOrderLayout = new Borderlayout();
PanelOrder.appendChild(PanelOrderLayout);
North north = new North();
PanelOrderLayout.appendChild(north);
north.appendChild(PanelFind);
Center center = new Center();
PanelOrderLayout.appendChild(center);
center.appendChild(PanelCenter);
South south = new South();
PanelOrderLayout.appendChild(south);
south.appendChild(PanelBottom);
OrderPlanning.appendChild(PanelOrder);
OrderPlanning.appendChild(Results);
PanelOrder.setLabel("Order");
Results.setLabel("Result");
Center center2 = new Center();
mainLayout.appendChild(center2);
center2.appendChild(OrderPlanning);
m_frame.setWidth("99%");
m_frame.setHeight("100%");
m_frame.setStyle("position: absolute; padding: 0; margin: 0");
m_frame.appendChild(mainLayout);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
mainLayout.setStyle("position: absolute");
}
use of org.adempiere.webui.component.Borderlayout in project adempiere by adempiere.
the class ProcessPanel method initComponents.
/**
* Initialize components
*/
@Override
public void initComponents() {
m_separators = new ArrayList<Label>();
rows = new Rows();
//
mainPanel = new Panel();
parameterPanel = GridFactory.newGridLayout();
parameterPanel.setInnerWidth(width);
//setup columns
Columns columns = new Columns();
parameterPanel.appendChild(columns);
int colN = getColumns() * 2;
if (colN != 0) {
int percent = 100 / colN;
for (int i = 0; i < colN; i++) {
Column col = new Column();
col.setWidth((i == 0 ? ((int) percent / 2) : percent) + "%");
columns.appendChild(col);
}
}
// Add Rows
parameterPanel.appendChild(rows);
//
mainLayout = new Borderlayout();
mainLayout.setStyle("border: none; overflow: auto");
// Message Panel
if (isShowDescription()) {
messageDiv = new Div();
message = new Html();
messageDiv.appendChild(message);
messageDiv.setStyle(MESSAGE_DIV_STYLE);
messagePanel = new North();
messagePanel.appendChild(messageDiv);
messagePanel.setAutoscroll(true);
messagePanel.setStyle("border: none;");
mainLayout.appendChild(messagePanel);
}
// Parameter Panel
centerPanel = new Center();
mainLayout.appendChild(centerPanel);
centerPanel.appendChild(parameterPanel);
centerPanel.setFlex(false);
centerPanel.setStyle("border: none");
// Buttons Panel
if (isShowButtons()) {
Grid southRowPanel = GridFactory.newGridLayout();
Rows rows = southRowPanel.newRows();
Row row = rows.newRow();
Hbox hBox = new Hbox();
hBox.appendChild(lSaved);
fSavedName.addEventListener(Events.ON_CHANGE, this);
hBox.appendChild(fSavedName);
bSave.setEnabled(false);
bSave.setImage("/images/Save24.png");
bSave.setSclass("action-button");
bSave.addActionListener(this);
hBox.appendChild(bSave);
bDelete.setEnabled(false);
bDelete.setImage("/images/Delete24.png");
bDelete.setSclass("action-button");
bDelete.addActionListener(this);
hBox.appendChild(bDelete);
row.appendChild(hBox);
Panel confParaPanel = new Panel();
confParaPanel.setAlign("right");
// BR [ 300 ]
try {
// Set Ok
WAppsAction action = new WAppsAction(ConfirmPanel.A_OK, null, ConfirmPanel.A_OK);
bOK = action.getButton();
// Set to Cancel
action = new WAppsAction(ConfirmPanel.A_CANCEL, null, ConfirmPanel.A_CANCEL);
bCancel = action.getButton();
// Add Listener
bOK.addEventListener(Events.ON_CLICK, this);
bCancel.addEventListener(Events.ON_CLICK, this);
// Add to Panel
confParaPanel.appendChild(bCancel);
confParaPanel.appendChild(bOK);
} catch (Exception e) {
log.severe("Error loading Buttons " + e.getLocalizedMessage());
}
//
row.appendChild(confParaPanel);
South south = new South();
south.appendChild(southRowPanel);
// Add to Main panel
mainLayout.appendChild(south);
}
// Set Text
if (isShowDescription()) {
message.setContent(getTextMsg());
}
//
mainPanel.appendChild(mainLayout);
mainPanel.setHeight("100%");
mainPanel.setWidth("100%");
}
use of org.adempiere.webui.component.Borderlayout in project adempiere by adempiere.
the class WBrowser method initComponents.
/**
* Initialize View Components
*/
private void initComponents() {
toolsBar = new ToolBar();
bZoom = new Button();
bExport = new Button();
bDelete = new Button();
tabsPanel = new Tabbox();
searchTab = new Borderlayout();
collapsibleSeach = new North();
topPanel = new Hbox();
searchGrid = new WBrowserSearch(getWindowNo(), getAD_Browse_ID(), BrowserSearch.COLUMNS_2);
detail = new WBrowserTable(this);
detail.addEventListener(Events.ON_SELECT, this);
bCancel = new Button();
bOk = new Button();
detailPanel = new Borderlayout();
Borderlayout mainLayout = new Borderlayout();
setupToolBar();
bSelectAll.setLabel(Msg.getMsg(Env.getCtx(), "SelectAll").replaceAll("[&]", ""));
bSelectAll.setEnabled(false);
bSelectAll.addActionListener(new EventListener() {
public void onEvent(Event evt) {
selectedRows();
}
});
toolsBar.appendChild(bSelectAll);
//TODO: victor.perez@e-evolution.com pending print functionality
/*bPrint.setLabel("Print");
bPrint.addActionListener(new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
bPrintActionPerformed(event);
}
});
toolsBar.appendChild(bPrint);*/
bZoom.setLabel(Msg.getMsg(Env.getCtx(), "Zoom").replaceAll("[&]", ""));
bZoom.setEnabled(false);
bZoom.addActionListener(new EventListener() {
public void onEvent(Event evt) {
cmd_Zoom();
}
});
//Only enable if exist a reference
if (AD_Window_ID > 0)
toolsBar.appendChild(bZoom);
bExport.setLabel(Msg.getMsg(Env.getCtx(), "Export"));
bExport.setEnabled(false);
bExport.addActionListener(new EventListener() {
public void onEvent(Event evt) {
cmd_Export();
}
});
toolsBar.appendChild(bExport);
bDelete.setLabel(Msg.getMsg(Env.getCtx(), "Delete").replaceAll("[&]", ""));
bDelete.setEnabled(false);
bDelete.addActionListener(new EventListener() {
public void onEvent(Event evt) {
cmd_deleteSelection();
}
});
if (isDeleteable())
toolsBar.appendChild(bDelete);
m_frame.setWidth("100%");
m_frame.setHeight("100%");
m_frame.setStyle("position: absolute; padding: 0; margin: 0");
m_frame.appendChild(mainLayout);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
mainLayout.setStyle("position: absolute");
North north = new North();
north.appendChild(toolsBar);
mainLayout.appendChild(north);
searchTab = new Borderlayout();
searchTab.setWidth("99.4%");
searchTab.setHeight("99.4%");
searchTab.setStyle("background-color: transparent");
topPanel = new Hbox();
topPanel.setStyle("background-color: transparent");
bSearch.setLabel(Msg.getMsg(Env.getCtx(), "StartSearch"));
bSearch.addActionListener(new EventListener() {
public void onEvent(Event evt) {
cmd_Search();
}
});
Vbox vbox = new Vbox();
vbox.appendChild(topPanel);
vbox.appendChild(bSearch);
vbox.setAlign("center");
vbox.setWidth("100%");
vbox.setStyle("background-color: transparent");
Div div = new Div();
div.appendChild(vbox);
div.setWidth("100%");
div.setHeight("100%");
collapsibleSeach.setTitle(Msg.getMsg(Env.getCtx(), ("SearchCriteria")));
collapsibleSeach.setCollapsible(true);
collapsibleSeach.setAutoscroll(true);
collapsibleSeach.appendChild(div);
collapsibleSeach.setStyle("overflow-y:auto");
collapsibleSeach.setStyle("background-color: transparent");
collapsibleSeach.setStyle("border: none");
searchTab.appendChild(collapsibleSeach);
detail.setWidth("100%");
//detail.setHeight("100%");
Center dCenter = new Center();
dCenter.appendChild(detail);
dCenter.setBorder("none");
detail.setVflex(true);
detail.setFixedLayout(true);
dCenter.setHflex("true");
dCenter.setVflex("true");
dCenter.setAutoscroll(true);
detailPanel.setHeight("100%");
detailPanel.setWidth("100%");
detailPanel.appendCenter(detail);
// Div dv = new Div();
div.appendChild(detailPanel);
div.setHeight("100%");
div.setWidth("100%");
searchTab.appendCenter(detailPanel);
Hbox hbox = new Hbox();
// bCancel.setLabel(Msg.getMsg(Env.getCtx(), "Cancel").replaceAll("[&]",""));
bCancel.addActionListener(new EventListener() {
public void onEvent(Event evt) {
cmd_Cancel();
}
});
// bOk.setLabel(Msg.getMsg(Env.getCtx(), "Ok").replaceAll("[&]",""));
bOk.addActionListener(new EventListener() {
public void onEvent(Event evt) {
cmd_Ok();
}
});
Div confirmDiv = new Div();
confirmDiv.setAlign("center");
hbox.appendChild(bCancel);
hbox.appendChild(bOk);
hbox.setAlign("center");
confirmDiv.appendChild(hbox);
Separator separator = new Separator();
separator.setBar(true);
confirmDiv.appendChild(separator);
confirmDiv.appendChild(statusBar);
searchTab.appendSouth(confirmDiv);
searchTab.getSouth().setBorder("none");
Tabpanel search = new Tabpanel();
search.setWidth("100%");
search.appendChild(searchTab);
Tab tabSearch = new Tab();
tabSearch.addEventListener(Events.ON_SELECT, this);
tabSearch.setLabel(Msg.getMsg(Env.getCtx(), "Search").replaceAll("[&]", ""));
Tabs tabs = new Tabs();
tabs.appendChild(tabSearch);
Tabpanels tabPanels = new Tabpanels();
tabPanels.setWidth("100%");
tabPanels.appendChild(search);
//graphPanel = new Borderlayout();
//TODO victor.perez@e-evolution.com implement Graph Functionality
//Tabpanel graph = new Tabpanel();
//graph.setWidth("100%");
//graph.appendChild(graphPanel);
//Tab tabGraph = new Tab();
//tabGraph.addEventListener(Events.ON_SELECT, this);
//tabGraph.setLabel(Msg.getMsg(Env.getCtx(), "Graph").replaceAll("[&]",
// ""));
//tabs.appendChild(tabGraph);
//tabPanels.appendChild(graph);
tabsPanel.setWidth("100%");
tabsPanel.setHeight("100%");
tabsPanel.appendChild(tabs);
tabsPanel.appendChild(tabPanels);
mainLayout.appendCenter(tabsPanel);
}
Aggregations