use of javax.swing.border.BevelBorder in project pcgen by PCGen.
the class PurchaseModeFrame method renewAbilityScoreCostTable.
private void renewAbilityScoreCostTable() {
JTable abilityScoreCostTable = new JTable();
abilityScoreCostTable.setBorder(new BevelBorder(BevelBorder.LOWERED));
abilityScoreCostTable.setModel(purchaseModel);
//$NON-NLS-1$
abilityScoreCostTable.setToolTipText(LanguageBundle.getString("in_Prefs_setCost"));
jScrollPane1.setViewportView(abilityScoreCostTable);
}
use of javax.swing.border.BevelBorder in project JMRI by JMRI.
the class FirstTimeStartUpWizard method createButtonPanel.
JPanel createButtonPanel() {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
buttonPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
final JButton previous = new JButton("< Back");
final JButton next = new JButton("Next >");
final JButton finish = new JButton("Finish");
finish.setVisible(false);
JButton cancel = new JButton("Cancel");
cancel.addActionListener((java.awt.event.ActionEvent e) -> {
Locale.setDefault(initalLocale);
dispose();
});
previous.addActionListener((java.awt.event.ActionEvent e) -> {
if (currentScreen < wizPage.size()) {
wizPage.get(currentScreen).getPanel().setVisible(false);
wizPage.get(currentScreen).getHelpDetails().setVisible(false);
}
finish.setVisible(false);
currentScreen = currentScreen - 1;
if (currentScreen != -1) {
wizPage.get(currentScreen).getPanel().setVisible(true);
wizPage.get(currentScreen).getHelpDetails().setVisible(true);
header.setText(wizPage.get(currentScreen).getHeaderText());
header.setFont(header.getFont().deriveFont(14f));
if (currentScreen == 0) {
previous.setEnabled(false);
}
next.setEnabled(true);
next.setVisible(true);
} else {
currentScreen = 0;
previous.setEnabled(false);
}
});
next.addActionListener((java.awt.event.ActionEvent e) -> {
wizPage.get(currentScreen).getPanel().setVisible(false);
wizPage.get(currentScreen).getHelpDetails().setVisible(false);
currentScreen++;
if (currentScreen < wizPage.size()) {
wizPage.get(currentScreen).getPanel().setVisible(true);
wizPage.get(currentScreen).getHelpDetails().setVisible(true);
header.setText(wizPage.get(currentScreen).getHeaderText());
header.setFont(header.getFont().deriveFont(14f));
previous.setEnabled(true);
if (currentScreen == (wizPage.size() - 1)) {
next.setEnabled(false);
next.setVisible(false);
finish.setVisible(true);
}
}
});
finish.addActionListener((java.awt.event.ActionEvent e) -> {
Runnable r = new Connect();
Thread connectThread = new Thread(r);
connectThread.start();
connectThread.setName("Start-Up Wizard Connect");
});
buttonPanel.add(previous);
buttonPanel.add(next);
// filler
buttonPanel.add(new JLabel(" "));
buttonPanel.add(finish);
buttonPanel.add(cancel);
previous.setEnabled(false);
return buttonPanel;
}
use of javax.swing.border.BevelBorder in project ddf by codice.
the class SolrProviderTest method testExtensibleMetacards.
@Test
public void testExtensibleMetacards() throws IngestException, UnsupportedQueryException {
deleteAllIn(provider);
String brandNewField1 = "description";
String brandNewFieldValue1 = "myDescription";
/* BASIC STRINGS */
Set<AttributeDescriptor> descriptors = new HashSet<AttributeDescriptor>();
descriptors.add(new AttributeDescriptorImpl(Metacard.ID, true, true, true, false, BasicTypes.STRING_TYPE));
descriptors.add(new AttributeDescriptorImpl(brandNewField1, true, true, true, false, BasicTypes.STRING_TYPE));
MetacardTypeImpl mType = new MetacardTypeImpl("custom1", descriptors);
MetacardImpl customMetacard = new MetacardImpl(mType);
// customMetacard.setAttribute("id", "44567880");
customMetacard.setAttribute(brandNewField1, brandNewFieldValue1);
create(customMetacard);
// search id
Query query = new QueryImpl(filterBuilder.attribute("id").like().text("*"));
QueryRequest request = new QueryRequestImpl(query);
SourceResponse response = provider.query(request);
assertEquals(1, response.getResults().size());
assertEquals("custom1", response.getResults().get(0).getMetacard().getMetacardType().getName());
assertThat(response.getResults().get(0).getMetacard().getMetacardType().getAttributeDescriptors(), equalTo(descriptors));
// search title - *
query = new QueryImpl(filterBuilder.attribute(brandNewField1).like().text("*"));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(1, response.getResults().size());
assertEquals("custom1", response.getResults().get(0).getMetacard().getMetacardType().getName());
assertThat(response.getResults().get(0).getMetacard().getMetacardType().getAttributeDescriptors(), equalTo(descriptors));
// search title - exact
query = new QueryImpl(filterBuilder.attribute(brandNewField1).equalTo().text(brandNewFieldValue1));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(1, response.getResults().size());
// search negative
query = new QueryImpl(filterBuilder.attribute(brandNewField1).like().text("no"));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(0, response.getResults().size());
// NEW TYPE
String brandNewXmlField1 = "author";
String brandNewXmlFieldValue1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + "<author>john doe</author>";
descriptors = new HashSet<AttributeDescriptor>();
descriptors.add(new AttributeDescriptorImpl(Metacard.ID, true, true, true, false, BasicTypes.STRING_TYPE));
descriptors.add(new AttributeDescriptorImpl(brandNewXmlField1, true, true, true, false, BasicTypes.XML_TYPE));
mType = new MetacardTypeImpl("34ga$^TGHfg:/", descriptors);
customMetacard = new MetacardImpl(mType);
// customMetacard.setAttribute(Metacard.ID, "44567880");
customMetacard.setAttribute(brandNewXmlField1, brandNewXmlFieldValue1);
create(customMetacard);
// Two Ids
query = new QueryImpl(filterBuilder.attribute(Metacard.ID).like().text("*"));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(2, response.getResults().size());
// search xml
query = new QueryImpl(filterBuilder.attribute(brandNewXmlField1).like().caseSensitiveText("doe"));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(1, response.getResults().size());
assertEquals("34ga$^TGHfg:/", response.getResults().get(0).getMetacard().getMetacardType().getName());
assertThat(response.getResults().get(0).getMetacard().getMetacardType().getAttributeDescriptors(), equalTo(descriptors));
// search xml - negative
query = new QueryImpl(filterBuilder.attribute(brandNewXmlField1).like().text("author"));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(0, response.getResults().size());
// EVERYTHING ELSE type
String doubleField = "hertz";
double doubleFieldValue = 16065.435;
String floatField = "inches";
float floatFieldValue = 4.435f;
String intField = "count";
int intFieldValue = 4;
String longField = "milliseconds";
long longFieldValue = 987654322111L;
String byteField = "bytes";
byte[] byteFieldValue = { 86 };
String booleanField = "expected";
boolean booleanFieldValue = true;
String dateField = "lost";
Date dateFieldValue = new Date();
String geoField = "geo";
String geoFieldValue = GULF_OF_GUINEA_POINT_WKT;
String shortField = "daysOfTheWeek";
short shortFieldValue = 1;
String objectField = "payload";
BevelBorder objectFieldValue = new BevelBorder(BevelBorder.RAISED);
descriptors = new HashSet<AttributeDescriptor>();
descriptors.add(new AttributeDescriptorImpl(Metacard.ID, true, true, true, false, BasicTypes.STRING_TYPE));
descriptors.add(new AttributeDescriptorImpl(doubleField, true, true, false, false, BasicTypes.DOUBLE_TYPE));
descriptors.add(new AttributeDescriptorImpl(floatField, true, true, false, false, BasicTypes.FLOAT_TYPE));
descriptors.add(new AttributeDescriptorImpl(intField, true, true, false, false, BasicTypes.INTEGER_TYPE));
descriptors.add(new AttributeDescriptorImpl(longField, true, true, false, false, BasicTypes.LONG_TYPE));
descriptors.add(new AttributeDescriptorImpl(byteField, false, true, false, false, BasicTypes.BINARY_TYPE));
descriptors.add(new AttributeDescriptorImpl(booleanField, true, true, false, false, BasicTypes.BOOLEAN_TYPE));
descriptors.add(new AttributeDescriptorImpl(dateField, true, true, false, false, BasicTypes.DATE_TYPE));
descriptors.add(new AttributeDescriptorImpl(geoField, true, true, false, false, BasicTypes.GEO_TYPE));
descriptors.add(new AttributeDescriptorImpl(shortField, true, true, false, false, BasicTypes.SHORT_TYPE));
descriptors.add(new AttributeDescriptorImpl(objectField, false, true, false, false, BasicTypes.OBJECT_TYPE));
mType = new MetacardTypeImpl("numbersMT", descriptors);
customMetacard = new MetacardImpl(mType);
// customMetacard.setAttribute(Metacard.ID, "245gasg324");
customMetacard.setAttribute(doubleField, doubleFieldValue);
customMetacard.setAttribute(floatField, floatFieldValue);
customMetacard.setAttribute(intField, intFieldValue);
customMetacard.setAttribute(longField, longFieldValue);
customMetacard.setAttribute(byteField, byteFieldValue);
customMetacard.setAttribute(booleanField, booleanFieldValue);
customMetacard.setAttribute(dateField, dateFieldValue);
customMetacard.setAttribute(geoField, geoFieldValue);
customMetacard.setAttribute(shortField, shortFieldValue);
customMetacard.setAttribute(objectField, objectFieldValue);
create(customMetacard);
// Three Ids
query = new QueryImpl(filterBuilder.attribute(Metacard.ID).like().text("*"));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(3, response.getResults().size());
// search double
query = new QueryImpl(filterBuilder.attribute(doubleField).greaterThan().number(doubleFieldValue - 1.0));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(1, response.getResults().size());
// search int
query = new QueryImpl(filterBuilder.attribute(intField).greaterThan().number(intFieldValue - 1));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(1, response.getResults().size());
Metacard resultMetacard = response.getResults().get(0).getMetacard();
assertThat(resultMetacard.getAttribute(Metacard.ID), notNullValue());
assertThat((Double) (resultMetacard.getAttribute(doubleField).getValue()), equalTo(doubleFieldValue));
assertThat((Integer) (resultMetacard.getAttribute(intField).getValue()), equalTo(intFieldValue));
assertThat((Float) (resultMetacard.getAttribute(floatField).getValue()), equalTo(floatFieldValue));
assertThat((Long) (resultMetacard.getAttribute(longField).getValue()), equalTo(longFieldValue));
assertThat((byte[]) (resultMetacard.getAttribute(byteField).getValue()), equalTo(byteFieldValue));
assertThat((Boolean) (resultMetacard.getAttribute(booleanField).getValue()), equalTo(booleanFieldValue));
assertThat((Date) (resultMetacard.getAttribute(dateField).getValue()), equalTo(dateFieldValue));
assertThat((String) (resultMetacard.getAttribute(geoField).getValue()), equalTo(geoFieldValue));
assertThat((Short) (resultMetacard.getAttribute(shortField).getValue()), equalTo(shortFieldValue));
assertThat((BevelBorder) (resultMetacard.getAttribute(objectField).getValue()), instanceOf(BevelBorder.class));
/*
* Going to use the XMLEncoder. If it writes out the objects the same way in xml, then they
* are the same.
*/
ByteArrayOutputStream beveledBytesStreamFromSolr = new ByteArrayOutputStream();
XMLEncoder solrXMLEncoder = new XMLEncoder(new BufferedOutputStream(beveledBytesStreamFromSolr));
solrXMLEncoder.writeObject((resultMetacard.getAttribute(objectField).getValue()));
solrXMLEncoder.close();
ByteArrayOutputStream beveledBytesStreamOriginal = new ByteArrayOutputStream();
XMLEncoder currendEncoder = new XMLEncoder(new BufferedOutputStream(beveledBytesStreamOriginal));
currendEncoder.writeObject(objectFieldValue);
currendEncoder.close();
assertThat(beveledBytesStreamFromSolr.toByteArray(), equalTo(beveledBytesStreamOriginal.toByteArray()));
// search short
query = new QueryImpl(filterBuilder.attribute(shortField).greaterThanOrEqualTo().number(shortFieldValue));
request = new QueryRequestImpl(query);
response = provider.query(request);
assertEquals(1, response.getResults().size());
resultMetacard = response.getResults().get(0).getMetacard();
}
use of javax.swing.border.BevelBorder in project processdash by dtuma.
the class TaskScheduleChart method saveRevertOrCancel.
private boolean saveRevertOrCancel(boolean isAppEvent) {
List<SnippetChartItem> dirtyCharts = getDirtyCharts();
if (dirtyCharts.isEmpty())
return true;
String title = resources.getString("Configure.Confirm.Window_Title");
String header = resources.getString("Configure.Confirm.Header_Msg");
JList dirtyChartList = new JList(dirtyCharts.toArray());
dirtyChartList.setBorder(new BevelBorder(BevelBorder.LOWERED));
String footer = resources.getString("Configure.Confirm.Footer_Msg");
Object[] message = { header, dirtyChartList, footer };
String saveOption = resources.getString("Configure.Confirm.Save_All");
String revertOption = resources.getString("Configure.Confirm.Discard_All");
String cancelOption = resources.getString("Cancel");
Object[] options;
if (isAppEvent)
options = new Object[] { saveOption, revertOption };
else
options = new Object[] { saveOption, revertOption, cancelOption };
switch(JOptionPane.showOptionDialog(this, message, title, 0, JOptionPane.QUESTION_MESSAGE, null, options, saveOption)) {
case // save all
0:
for (SnippetChartItem chart : dirtyCharts) chart.saveSettings();
return true;
case // discard
1:
if (isAppEvent)
for (SnippetChartItem chart : dirtyCharts) chart.revertSettings();
return true;
default:
return false;
}
}
use of javax.swing.border.BevelBorder in project cytoscape-impl by cytoscape.
the class CyColorPaletteChooserImpl method init.
private void init(final Component parent, final String title, final Palette initialPalette, final Color initialColor, int colorCount) {
this.parent = parent;
this.title = title;
this.initialPalette = initialPalette;
this.initialColor = initialColor;
this.colorCount = colorCount;
this.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
// UI configuration
this.setTitle(title);
this.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
final Container pane = this.getContentPane();
pane.setLayout(new BorderLayout());
// Inner panel
this.innerPanel = new JPanel();
this.innerPanel.setLayout(new BorderLayout());
this.innerPanel.setBorder(new CompoundBorder(new BevelBorder(BevelBorder.LOWERED), new EmptyBorder(new Insets(10, 10, 10, 10))));
pane.add(this.innerPanel, BorderLayout.CENTER);
// Colors Tab
final JPanel colorsTab = new JPanel();
colorsTab.setBorder(new EmptyBorder(10, 10, 10, 10));
// colorsTab.setLayout( new GridLayout(3, 1, 5, 0) );
colorsTab.setLayout(new BoxLayout(colorsTab, BoxLayout.Y_AXIS));
this.innerPanel.add(colorsTab);
// set custom colorSelectionModel
ColorPanelSelectionModel model = new ColorPanelSelectionModel();
this.colorChooser = new JColorChooser(model);
if (initialPalette != null)
model.setPalette(initialPalette);
if (initialColor != null)
model.setSelectedColor(initialColor);
// Get the list of palettes
List<PaletteProvider> providers = getPaletteProviders(false);
palettePanels = getPanels(providers);
// overwrite the color chooser panels
if (paletteOnly) {
colorChooser.setChooserPanels(palettePanels);
// Hide the preview panel
colorChooser.setPreviewPanel(new JPanel());
} else {
AbstractColorChooserPanel[] oldPanels = colorChooser.getChooserPanels();
AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[oldPanels.length + palettePanels.length];
for (int i = 0; i < palettePanels.length; i++) {
newPanels[i] = palettePanels[i];
}
for (int i = 0; i < oldPanels.length; i++) {
newPanels[i + palettePanels.length] = oldPanels[i];
}
colorChooser.setChooserPanels(newPanels);
}
colorsTab.add(this.colorChooser, BorderLayout.CENTER);
// color blind friendly checkbox
final JPanel cbFriendlyPanel = new JPanel();
cbFriendlyPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
cbFriendlyPanel.setBorder(new EmptyBorder(10, 0, 0, 0));
colorsTab.add(cbFriendlyPanel, BorderLayout.SOUTH);
final JPanel cbFriendlyGridPanel = new JPanel();
cbFriendlyPanel.add(cbFriendlyGridPanel);
final JCheckBox colorBlindOnly = new JCheckBox("show only colorblind-friendly");
colorBlindOnly.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JCheckBox source = (JCheckBox) e.getSource();
for (ColorBlindAwareColorChooserPanel cbccp : palettePanels) {
cbccp.setShowColorBlindSafe(source.isSelected());
cbccp.updateChooser();
colorChooser.repaint();
}
}
});
cbFriendlyGridPanel.add(colorBlindOnly);
// OK, Cancel, and Reset buttons
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
buttonPanel.setBorder(new EmptyBorder(10, 0, 0, 0));
colorsTab.add(buttonPanel, BorderLayout.CENTER);
final JPanel buttonGridPanel = new JPanel();
buttonGridPanel.setLayout(new GridLayout(1, 3, 5, 0));
buttonPanel.add(buttonGridPanel);
// Reset
final JButton resetButton = new JButton("Reset");
resetButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
setPalette(CyColorPaletteChooserImpl.this.initialPalette);
setColor(CyColorPaletteChooserImpl.this.initialColor);
for (ColorBlindAwareColorChooserPanel cbccp : palettePanels) {
cbccp.setSelectedPalette(CyColorPaletteChooserImpl.this.initialPalette.getName());
cbccp.updateChooser();
colorChooser.repaint();
}
}
});
buttonGridPanel.add(resetButton);
// OK
final JButton okButton = new JButton("OK");
okButton.setDefaultCapable(true);
this.getRootPane().setDefaultButton(okButton);
okButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
CyColorPaletteChooserImpl.this.okWasPressed = true;
CyColorPaletteChooserImpl.this.setVisible(false);
CyColorPaletteChooserImpl.this.initialPalette = getColorPalette();
if (CyColorPaletteChooserImpl.this.okListener != null)
CyColorPaletteChooserImpl.this.okListener.actionPerformed(e);
}
});
buttonGridPanel.add(okButton);
// Cancel
final JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
setPalette(CyColorPaletteChooserImpl.this.initialPalette);
CyColorPaletteChooserImpl.this.okWasPressed = false;
CyColorPaletteChooserImpl.this.setVisible(false);
if (CyColorPaletteChooserImpl.this.cancelListener != null)
CyColorPaletteChooserImpl.this.cancelListener.actionPerformed(e);
}
});
buttonGridPanel.add(cancelButton);
this.pack();
this.validate();
}
Aggregations