use of javax.swing.border.LineBorder in project vcell by virtualcell.
the class TableCellEditorAutoCompletion method stopCellEditing.
@Override
public boolean stopCellEditing() {
if (thisTable.getCellEditor() == null) {
return true;
}
if (textFieldAutoCompletion.getSelectedIndex() >= 0) {
return false;
}
final int editingRow = thisTable.getEditingRow();
final int editingColumn = thisTable.getEditingColumn();
textFieldAutoCompletion.stopEditing();
boolean bExpressionValid = true;
if (thisTable.getColumnClass(editingColumn).equals(ScopedExpression.class)) {
if (textFieldAutoCompletion.getSymbolTable() != null) {
ScopedExpression scopedExpression = (ScopedExpression) thisTable.getValueAt(editingRow, editingColumn);
String text = textFieldAutoCompletion.getText();
if (text.trim().length() > 0) {
try {
Expression exp = new Expression(text);
exp.validateUnscopedSymbols();
if (scopedExpression == null || scopedExpression.isValidateFunctionBinding()) {
FunctionInvocation[] functionInvocations = exp.getFunctionInvocations(null);
for (FunctionInvocation functionInvocation : functionInvocations) {
String formalDefinition = functionInvocation.getFormalDefinition();
if (functionInvocation.getFunctionId() == FunctionType.USERDEFINED) {
SymbolTableFunctionEntry stfe = (SymbolTableFunctionEntry) textFieldAutoCompletion.getSymbolTable().getEntry(formalDefinition);
if (stfe == null) {
//
// check for wrong number of arguments
//
Map<String, SymbolTableEntry> entries = new HashMap<String, SymbolTableEntry>();
textFieldAutoCompletion.getSymbolTable().getEntries(entries);
System.out.println("available symbols");
for (String symbol : entries.keySet()) {
System.out.print(symbol + ",");
}
System.out.println("");
throw new ExpressionBindingException("unknown function " + formalDefinition, formalDefinition);
}
} else {
// built in function, check arguments
FunctionType functionType = functionInvocation.getFunctionId();
String formalDefinitionBuiltin = ASTFuncNode.getFormalDefinition(functionType.getName(), functionType.getArgTypes());
if (!formalDefinition.equals(formalDefinitionBuiltin)) {
throw new ExpressionBindingException("expecting " + formalDefinitionBuiltin, formalDefinition);
}
}
}
}
if (scopedExpression == null || scopedExpression.isValidateIdentifierBinding()) {
exp.bindExpression(textFieldAutoCompletion.getSymbolTable());
}
} catch (ExpressionBindingException ex) {
ex.printStackTrace(System.out);
DialogUtils.showErrorDialog(thisTable.getParent(), ex.getMessage() + "\n\nUse 'Ctrl-Space' to see a list of available names in your model or 'Esc' to revert to the original expression.");
bExpressionValid = false;
} catch (ExpressionException ex) {
ex.printStackTrace(System.out);
DialogUtils.showErrorDialog(thisTable.getParent(), ex.getMessage() + "\n\nUse 'Esc' to revert to the original expression.");
bExpressionValid = false;
}
}
}
}
if (!bExpressionValid) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
thisTable.requestFocus();
thisTable.setRowSelectionInterval(editingRow, editingRow);
((JComponent) getComponent()).setBorder(new LineBorder(Color.red));
textFieldAutoCompletion.requestFocus();
}
});
return false;
}
return super.stopCellEditing();
}
use of javax.swing.border.LineBorder in project vcell by virtualcell.
the class ImagePlanePanel method getSlider.
private JSlider getSlider() {
if (slider == null) {
slider = new JSlider();
slider.setBorder(new LineBorder(new Color(0, 0, 0)));
slider.setValue(0);
}
return slider;
}
use of javax.swing.border.LineBorder in project MassBank-web by MassBank.
the class DisplayAll method init.
/**
*/
public void init() {
setLayout(new BoxLayout(this.getContentPane(), BoxLayout.PAGE_AXIS));
// ���ݒ�t�@�C������A�g�T�C�g��URL���擾
String confPath = getCodeBase().toString();
confPath = confPath.replaceAll("jsp/", "");
GetConfig conf = new GetConfig(confPath);
urlList = conf.getSiteUrl();
serverUrl = conf.getServerUrl();
baseUrl = serverUrl + "jsp/";
// �s�[�N�����A�s�[�N���������̃p�����[�^�擾
int paramMzNum = 0;
if (getParameter("type") != null) {
reqType = getParameter("type");
if (reqType.equals("peak") || reqType.equals("diff")) {
paramMzNum = Integer.parseInt(getParameter("pnum"));
searchParam = "&num=" + paramMzNum;
for (int i = 0; i < paramMzNum; i++) {
String pnum = Integer.toString(i);
String mz = getParameter("mz" + pnum);
String tol = getParameter("tol" + pnum);
String rInt = getParameter("int" + pnum);
paramMz += mz + ",";
paramTol += tol + ",";
paramInt += rInt + ",";
searchParam += "&mz" + pnum + "=" + mz;
searchParam += "&tol" + pnum + "=" + tol;
searchParam += "&int" + pnum + "=" + rInt;
}
}
}
numSpct = Integer.valueOf(getParameter("num"));
plotPane = new PlotPane[numSpct];
buttonPane = new ButtonPane[numSpct];
clear();
peaks1 = new Peak[numSpct];
info = new RecordInfo[numSpct];
cnt = new int[urlList.length];
HashSet<String> compoundNameList = new HashSet();
for (int i = 0; i < numSpct; i++) {
// �p�����[�^�擾
String pnum = Integer.toString(i + 1);
int siteNo = Integer.parseInt(getParameter("site" + pnum));
String id = getParameter("id" + pnum);
String title = getParameter("name" + pnum);
String formula = getParameter("formula" + pnum);
String mass = getParameter("mass" + pnum);
String ion = getParameter("ion" + pnum);
int num = cnt[siteNo]++;
info[i] = new RecordInfo(id, title, siteNo, num, formula, mass, ion);
String[] items = title.split(";");
compoundNameList.add(items[0]);
}
// �s�[�N�f�[�^�擾
ArrayList resultList = getPeakData();
// Molfile�f�[�^�擾
Map<String, String> mapMolData = getMolData(compoundNameList);
hitPeaks.mzInfoList = new ArrayList[numSpct];
precursor = new String[numSpct];
Vector<Vector<String>> mzAry = new Vector<Vector<String>>();
for (int i = 0; i < numSpct; i++) {
int siteNo = info[i].getSiteNo();
int num = info[i].getNumber();
ArrayList result = (ArrayList) resultList.get(siteNo);
String line = (String) result.get(num);
// �s�[�N�����A�s�[�N����������Ăꂽ�ꍇ�A�q�b�g����m/z�l���Ԃ�̂Ŋi�[����
String findStr = "hit=";
int pos = line.indexOf(findStr);
if (pos > 0) {
String hit = line.substring(pos + 4);
String[] hitMzInfo = hit.split("\t");
boolean isDiff = false;
// �s�[�N�����̏ꍇ
if (reqType.equals("diff")) {
isDiff = true;
}
// m/z�l���i�[
ArrayList mzInfoList = hitPeaks.setMz(hitMzInfo, isDiff);
hitPeaks.mzInfoList[i] = new ArrayList();
hitPeaks.mzInfoList[i].addAll(mzInfoList);
line = line.substring(0, pos);
}
// �v���J�[�T�[
findStr = "precursor=";
pos = line.indexOf(findStr);
int posNext = 0;
if (pos > 0) {
posNext = line.indexOf("\t", pos);
precursor[i] = line.substring(pos + findStr.length(), posNext);
line = line.substring(0, pos);
} else {
precursor[i] = "";
}
String[] tmp = line.split("\t\t");
Vector<String> mzs = new Vector<String>();
// m/z�i�[
for (int j = 0; j < tmp.length; j++) {
mzs.add(tmp[j]);
}
mzAry.add(mzs);
}
for (int i = 0; i < numSpct; i++) {
plotPane[i] = new PlotPane(i);
plotPane[i].setPreferredSize(new Dimension(780, 200));
plotPane[i].repaint();
JPanel pane1 = new JPanel();
String title = info[i].getTitle();
String id = info[i].getID();
String site = String.valueOf(info[i].getSiteNo());
pane1.add(new NameButton(title, id, site));
pane1.setLayout(new FlowLayout(FlowLayout.LEFT));
pane1.setMaximumSize(new Dimension(pane1.getMaximumSize().width, 100));
JPanel parentPane = new JPanel();
JPanel childPane1 = new JPanel();
JPanel childPane2 = new JPanel();
childPane2.setBackground(Color.WHITE);
childPane2.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
childPane2.setMaximumSize(new Dimension(200, parentPane.getMaximumSize().height));
childPane1.add(pane1);
childPane1.add(plotPane[i]);
buttonPane[i] = new ButtonPane(i);
buttonPane[i].addDiffButton(plotPane[i].idPeak);
buttonPane[i].setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
buttonPane[i].setMaximumSize(new Dimension(buttonPane[i].getMaximumSize().width, 100));
childPane1.add(buttonPane[i]);
childPane1.setLayout(new BoxLayout(childPane1, BoxLayout.Y_AXIS));
parentPane.add(childPane1);
// ���p�l���E��: FORMULA��EXACT MASS��\��
JLabel formuraLabel1 = new JLabel(" Formula: ");
formuraLabel1.setOpaque(true);
formuraLabel1.setBackground(Color.WHITE);
formuraLabel1.setPreferredSize(new Dimension(84, 17));
childPane2.add(formuraLabel1);
JLabel formuraLabel2 = new JLabel(info[i].getFormula());
formuraLabel2.setOpaque(true);
formuraLabel2.setForeground(new Color(57, 127, 0));
formuraLabel2.setBackground(Color.WHITE);
formuraLabel2.setPreferredSize(new Dimension(116, 17));
childPane2.add(formuraLabel2);
JLabel emassLabel1 = new JLabel(" Exact Mass: ");
emassLabel1.setOpaque(true);
emassLabel1.setBackground(Color.WHITE);
emassLabel1.setPreferredSize(new Dimension(84, 17));
childPane2.add(emassLabel1);
JLabel emassLabel2 = new JLabel();
emassLabel2.setOpaque(true);
emassLabel2.setForeground(new Color(57, 127, 0));
emassLabel2.setBackground(Color.WHITE);
emassLabel2.setPreferredSize(new Dimension(116, 17));
String emass = info[i].getExactMass();
if (!emass.equals("") && !emass.equals("0")) {
emassLabel2.setText(emass);
}
childPane2.add(emassLabel2);
// ���p�l���E��: Mol�\���\���p�l�����Z�b�g
JPanel pane3 = null;
String[] items = title.split(";");
boolean isExist = false;
String compoundName = items[0].toLowerCase();
if (mapMolData.containsKey(compoundName)) {
String moldata = mapMolData.get(compoundName);
if (!moldata.equals("")) {
pane3 = (MolViewPaneExt) new MolViewPaneExt(moldata, 200, this);
isExist = true;
}
}
if (!isExist) {
// �f�[�^���擾�ł��Ȃ������ꍇ
JLabel lbl = new JLabel("Not Available", JLabel.CENTER);
lbl.setPreferredSize(new Dimension(180, 180));
lbl.setBackground(new Color(0xF8, 0xF8, 0xFF));
lbl.setBorder(new LineBorder(Color.BLACK, 1));
lbl.setOpaque(true);
GridBagLayout layout = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(1, 1, 1, 1);
layout.setConstraints(lbl, gbc);
pane3 = new JPanel();
pane3.setPreferredSize(new Dimension(200, 200));
pane3.setBackground(Color.WHITE);
pane3.add(lbl);
}
childPane2.add(pane3);
// ���p�l���E��: �\�����\�������̗]��
JLabel lbl3 = new JLabel("");
lbl3.setPreferredSize(new Dimension(200, 30));
childPane2.add(lbl3);
childPane2.setPreferredSize(new Dimension(200, 260));
parentPane.add(childPane2);
parentPane.setLayout(new BoxLayout(parentPane, BoxLayout.X_AXIS));
add(parentPane);
// �㉺�X�y�N�g���̋��
JPanel spacePane = new JPanel();
spacePane.setPreferredSize(new Dimension(800, 2));
spacePane.setBackground(Color.white);
JLabel lbl4 = new JLabel("");
lbl4.setPreferredSize(new Dimension(800, 2));
spacePane.add(lbl4);
add(spacePane);
String ion = info[i].getIon();
peaks1[i] = new Peak((Vector<String>) mzAry.get(i), emass, ion);
}
initMass();
}
use of javax.swing.border.LineBorder in project cayenne by apache.
the class BaseGraphBuilder method createEntityCell.
protected DefaultGraphCell createEntityCell(Entity entity) {
DefaultGraphCell cell = new DefaultGraphCell(getCellMetadata(entity));
GraphConstants.setResize(cell.getAttributes(), true);
GraphConstants.setBorder(cell.getAttributes(), new LineBorder(Color.BLACK));
GraphConstants.setEditable(cell.getAttributes(), false);
entityCells.put(entity.getName(), cell);
cell.addPort();
return cell;
}
Aggregations