listeners) {
46 | this.listeners.addAll(listeners);
47 | }
48 |
49 | /**
50 | * Handles the process of broadcasting the event to listeners
51 | * allowing this process to be decoupled
52 | *
53 | * @param event The generic event (or it's proxy)
54 | */
55 | @Override
56 | public void handleQuitRequestWith(GenericQuitEvent event, GenericQuitResponse response) {
57 | log.debug("Called");
58 | if (event == null) {
59 | log.warn("Received a null event");
60 | return;
61 | }
62 | log.debug("Event class is {}", event.getClass().getSimpleName());
63 | log.debug("Broadcasting to {} listener(s)", listeners.size());
64 | for (GenericQuitEventListener listener : listeners) {
65 | listener.onQuitEvent(event, response);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/handler/GenericAboutHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.handler;
17 |
18 | import net.bither.platform.listener.GenericAboutEvent;
19 |
20 | /**
21 | * Generic handler to provide the following to {@link net.bither.platform.GenericApplication}:
22 | *
23 | * - Provision of application specific handling code
24 | *
25 | *
26 | * @since 0.3.0
27 | *
28 | */
29 | public interface GenericAboutHandler extends GenericHandler {
30 | /**
31 | * Called in response to receiving an About event
32 | *
33 | * @param event The generic About event
34 | */
35 | void handleAbout(GenericAboutEvent event);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/handler/GenericHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.handler;
17 |
18 | /**
19 | * Signature interface for handlers:
20 | *
21 | * @since 0.3.0
22 | *
23 | */
24 | public interface GenericHandler {
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/handler/GenericOpenURIHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.handler;
17 |
18 | import net.bither.platform.listener.GenericOpenURIEvent;
19 |
20 | /**
21 | * Generic handler to provide the following to {@link net.bither.platform.GenericApplication}:
22 | *
23 | * - Proxies any native handling code
24 | *
25 | *
26 | * @since 0.3.0
27 | *
28 | */
29 | public interface GenericOpenURIHandler extends GenericHandler {
30 | /**
31 | * Called in response to receiving an open URI event
32 | *
33 | * @param event The generic open URI event
34 | */
35 | void openURI(GenericOpenURIEvent event);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/handler/GenericPreferencesHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.handler;
17 |
18 | import net.bither.platform.listener.GenericPreferencesEvent;
19 |
20 | /**
21 | * Generic handler to provide the following to {@link net.bither.platform.GenericApplication}:
22 | *
23 | * - Provision of application specific handling code
24 | *
25 | *
26 | * @since 0.3.0
27 | *
28 | */
29 | public interface GenericPreferencesHandler extends GenericHandler {
30 | /**
31 | * Called in response to receiving a Preferences event
32 | *
33 | * @param event The generic Preferences event
34 | */
35 | void handlePreferences(GenericPreferencesEvent event);
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/handler/GenericQuitHandler.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.handler;
17 |
18 | import net.bither.platform.listener.GenericQuitEvent;
19 | import net.bither.platform.listener.GenericQuitResponse;
20 |
21 | /**
22 | * Generic handler to provide the following to {@link net.bither.platform.GenericApplication}:
23 | *
24 | * - Provision of application specific handling code
25 | *
26 | *
27 | * @since 0.3.0
28 | *
29 | */
30 | public interface GenericQuitHandler extends GenericHandler {
31 | /**
32 | * Called in response to receiving a Quit event
33 | *
34 | * @param event The generic Quit event
35 | * @param response The response containing the methods to call if quit can continue or not
36 | */
37 | void handleQuitRequestWith(GenericQuitEvent event, GenericQuitResponse response);
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericAboutEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Generic event to provide the following to {@link net.bither.platform.GenericApplication}:
20 | *
21 | * - Proxies any native handling code
22 | *
23 | *
24 | * @since 0.3.0
25 | *
26 | */
27 | public interface GenericAboutEvent extends GenericEvent {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericAboutEventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Listener to provide the following to applications:
20 | *
21 | * - Notification of an About dialog event
22 | *
23 | *
24 | * @since 0.3.0
25 | *
26 | */
27 | public interface GenericAboutEventListener {
28 | /**
29 | * Received when the user requests the About display
30 | *
31 | * @param event The event
32 | */
33 | void onAboutEvent(GenericAboutEvent event);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Signature interface for generic events:
20 | *
21 | * @since 0.3.0
22 | *
23 | */
24 | public interface GenericEvent {
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericEventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | import java.util.Collection;
19 |
20 | /**
21 | * Generic interface to provide the following to generic event handlers:
22 | *
23 | * - Type safety for adding and removing listeners
24 | *
25 | * See {@link net.bither.platform.handler.DefaultOpenURIHandler} for an example of an implementation
26 | *
27 | * @since 0.3.0
28 | *
29 | */
30 | public interface GenericEventListener {
31 | /**
32 | * @param listeners The listeners to add to the handler
33 | */
34 | void addListeners(Collection listeners);
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericOpenURIEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | import java.net.URI;
19 |
20 | /**
21 | * Generic event to provide the following to {@link net.bither.platform.GenericApplication}:
22 | *
23 | * - Provision of application specific event handling code
24 | *
25 | *
26 | * @since 0.3.0
27 | *
28 | */
29 | public interface GenericOpenURIEvent extends GenericEvent {
30 |
31 | /**
32 | * @return The URI that should be opened
33 | */
34 | URI getURI();
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericOpenURIEventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Listener to provide the following to applications:
20 | *
21 | * - Notification of an Open URI event
22 | *
23 | * Example:
24 | *
25 | *
26 | *
27 | * @since 0.3.0
28 | *
29 | */
30 | public interface GenericOpenURIEventListener {
31 | /**
32 | * Received when the application receives an open URI event
33 | *
34 | * @param event The event
35 | */
36 | void onOpenURIEvent(GenericOpenURIEvent event);
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericPreferencesEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Generic event to provide the following to {@link net.bither.platform.GenericApplication}:
20 | *
21 | * - Proxies any native handling code
22 | *
23 | *
24 | * @since 0.3.0
25 | *
26 | */
27 | public interface GenericPreferencesEvent extends GenericEvent {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericPreferencesEventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Listener to provide the following to applications:
20 | *
21 | * - Notification of a preferences event
22 | *
23 | *
24 | * @since 0.3.0
25 | *
26 | */
27 | public interface GenericPreferencesEventListener {
28 | /**
29 | * Received when the user requests the Preferences display
30 | *
31 | * @param event The event
32 | */
33 | void onPreferencesEvent(GenericPreferencesEvent event);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericQuitEvent.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Generic event to provide the following to {@link net.bither.platform.GenericApplication}:
20 | *
21 | * - Proxies any native handling code
22 | *
23 | *
24 | * @since 0.3.0
25 | *
26 | */
27 | public interface GenericQuitEvent extends GenericEvent {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericQuitEventListener.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Listener to provide the following to applications:
20 | *
21 | * - Notification of a Quit event
22 | *
23 | *
24 | * @since 0.3.0
25 | *
26 | */
27 | public interface GenericQuitEventListener {
28 | /**
29 | * Received when the user requests to Quit
30 | *
31 | * @param event The event
32 | * @param response The response to prevent the quit operation if necessary
33 | */
34 | void onQuitEvent(GenericQuitEvent event, GenericQuitResponse response);
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/platform/listener/GenericQuitResponse.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.platform.listener;
17 |
18 | /**
19 | * Generic response to provide the following to {@link net.bither.platform.GenericApplication}:
20 | *
21 | * - Proxies any native handling code for quit response
22 | *
23 | *
24 | * @since 0.3.0
25 | */
26 | public interface GenericQuitResponse extends GenericEvent {
27 |
28 | /**
29 | * Call if quit should be stopped due to application tasks
30 | */
31 | void cancelQuit();
32 |
33 | /**
34 | * Call if quit is OK to proceed
35 | */
36 | void performQuit();
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/qrcode/DisplayQRCodePanle.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.qrcode;
20 |
21 | import net.bither.BitherUI;
22 | import net.bither.fonts.AwesomeIcon;
23 | import net.bither.languages.MessageKey;
24 | import net.bither.viewsystem.base.Labels;
25 | import net.bither.viewsystem.base.Panels;
26 | import net.bither.viewsystem.froms.WizardPanel;
27 | import net.miginfocom.swing.MigLayout;
28 |
29 | import javax.swing.*;
30 | import java.awt.*;
31 | import java.awt.image.BufferedImage;
32 |
33 | public class DisplayQRCodePanle extends WizardPanel {
34 |
35 | private String qrCodeString;
36 |
37 |
38 | public DisplayQRCodePanle(String qrCodeString) {
39 | super(MessageKey.QR_CODE, AwesomeIcon.QRCODE);
40 | this.qrCodeString = qrCodeString;
41 | }
42 |
43 | @Override
44 | public void initialiseContent(JPanel panel) {
45 | panel.setLayout(new MigLayout(
46 | Panels.migXYLayout(),
47 | "[]", // Column constraints
48 | "10[][][][]" // Row constraints
49 | ));
50 | BufferedImage qrCodeImage = null;
51 | panel.getMaximumSize();
52 | int scaleWidth = BitherUI.POPOVER_MIN_WIDTH;
53 | int scaleHeight = BitherUI.POPOVER_MIN_WIDTH;
54 | Image image = QRCodeGenerator.generateQRcode(qrCodeString, null, null, 1);
55 | if (image != null) {
56 | int scaleFactor = (int) (Math.floor(Math.min(scaleHeight / image.getHeight(null),
57 | scaleWidth / image.getWidth(null))));
58 | qrCodeImage = QRCodeGenerator.generateQRcode(qrCodeString, null, null, scaleFactor);
59 | }
60 |
61 | JLabel imageLabel = Labels.newImageLabel(qrCodeImage);
62 | panel.add(imageLabel, "align center,push,wrap");
63 |
64 |
65 | }
66 |
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/qrcode/GenerateUnsignedTxPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.qrcode;
20 |
21 | import net.bither.fonts.AwesomeIcon;
22 | import net.bither.utils.LocaliserUtils;
23 |
24 | import javax.swing.*;
25 | import java.awt.event.ActionEvent;
26 |
27 | public class GenerateUnsignedTxPanel extends DisplayBitherQRCodePanel {
28 | private IScanQRCode scanQRCode;
29 |
30 | public GenerateUnsignedTxPanel(IScanQRCode scanQRCode, String codeString) {
31 | super(codeString);
32 | this.scanQRCode = scanQRCode;
33 | updateTitle(LocaliserUtils.getString("unsigned_transaction_qr_code_title"));
34 | setOkAction(new AbstractAction() {
35 | @Override
36 | public void actionPerformed(ActionEvent e) {
37 | onOK();
38 | }
39 | });
40 | modifOkButton(AwesomeIcon.CAMERA, LocaliserUtils.getString("unsigned_transaction_qr_code_complete"));
41 |
42 | }
43 |
44 | private void onOK() {
45 | closePanel();
46 | SelectTransportQRCodePanel selectTransportQRCodePanel = new SelectTransportQRCodePanel(scanQRCode);
47 | selectTransportQRCodePanel.showPanel();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/qrcode/HDMServerUnsignedQRCodeListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.qrcode;
20 |
21 | /**
22 | * Created by nn on 15/3/9.
23 | */
24 | public abstract class HDMServerUnsignedQRCodeListener implements IScanQRCode {
25 | public abstract void scanSignedHDMServerQRCodeCancel();
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/qrcode/HDMServerUnsignedQRCodePanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.qrcode;
20 |
21 | import net.bither.fonts.AwesomeIcon;
22 | import net.bither.utils.LocaliserUtils;
23 |
24 | import javax.swing.*;
25 | import java.awt.event.ActionEvent;
26 |
27 | public class HDMServerUnsignedQRCodePanel extends DisplayBitherQRCodePanel {
28 |
29 |
30 | private IScanQRCode scanQRCode;
31 |
32 | public HDMServerUnsignedQRCodePanel(IScanQRCode scanQRCode, String codeString) {
33 | super(codeString);
34 | this.scanQRCode = scanQRCode;
35 | updateTitle(LocaliserUtils.getString("hdm_keychain_add_unsigned_server_qr_code_title"));
36 | setOkAction(new AbstractAction() {
37 | @Override
38 | public void actionPerformed(ActionEvent e) {
39 | onOK();
40 | }
41 | });
42 | modifOkButton(AwesomeIcon.CAMERA, LocaliserUtils.getString("unsigned_transaction_qr_code_complete"));
43 |
44 | }
45 |
46 | private void onOK() {
47 | closePanel();
48 | SelectTransportQRCodePanel selectTransportQRCodePanel = new SelectTransportQRCodePanel(scanQRCode);
49 | selectTransportQRCodePanel.showPanel();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/qrcode/IReadQRCode.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.qrcode;
20 |
21 | public interface IReadQRCode {
22 | public void close();
23 |
24 | public void reTry(String str);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/qrcode/IScanQRCode.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.qrcode;
20 |
21 | public interface IScanQRCode {
22 | public void handleResult(String result, IReadQRCode readQRCode);
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/runnable/BaseRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.runnable;
18 |
19 |
20 | import javax.swing.*;
21 |
22 | public abstract class BaseRunnable implements Runnable {
23 |
24 |
25 | private RunnableListener runnableListener;
26 |
27 | public void setRunnableListener(RunnableListener runnableListener) {
28 | this.runnableListener = runnableListener;
29 | }
30 |
31 | protected void prepare() {
32 | SwingUtilities.invokeLater(new Runnable() {
33 | @Override
34 | public void run() {
35 | if (runnableListener != null) {
36 | runnableListener.prepare();
37 | }
38 | }
39 | });
40 |
41 | }
42 |
43 | protected void success(final Object obj) {
44 |
45 | SwingUtilities.invokeLater(new Runnable() {
46 | @Override
47 | public void run() {
48 | if (runnableListener != null) {
49 | runnableListener.success(obj);
50 | }
51 | }
52 | });
53 |
54 | }
55 |
56 | protected void error(final int errorCode, final String errorMsg) {
57 | SwingUtilities.invokeLater(new Runnable() {
58 | @Override
59 | public void run() {
60 | if (runnableListener != null) {
61 | runnableListener.error(errorCode, errorMsg);
62 | }
63 |
64 | }
65 | });
66 |
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/runnable/CheckRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.runnable;
18 |
19 | import net.bither.model.Check;
20 |
21 | public class CheckRunnable extends BaseRunnable {
22 | private Check check;
23 |
24 | public CheckRunnable(Check check) {
25 | this.check = check;
26 | }
27 |
28 | @Override
29 | public void run() {
30 | prepare();
31 | if (check.check()) {
32 | success(check);
33 | } else {
34 | error(0, "");
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/runnable/DownloadSpvRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.runnable;
18 |
19 | import net.bither.bitherj.core.Block;
20 | import net.bither.bitherj.utils.BlockUtil;
21 |
22 |
23 | public class DownloadSpvRunnable extends BaseRunnable {
24 | @Override
25 | public void run() {
26 | prepare();
27 | try {
28 | Block block = BlockUtil.dowloadSpvBlock();
29 | if (block != null) {
30 | success(null);
31 | } else {
32 | error(0, null);
33 | }
34 | } catch (Exception e) {
35 | error(0, null);
36 | e.printStackTrace();
37 | }
38 |
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/runnable/RCheckRunnable.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2014 http://Bither.net
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package net.bither.runnable;
20 |
21 | import net.bither.bitherj.core.Address;
22 | import net.bither.bitherj.core.Tx;
23 |
24 | public class RCheckRunnable extends BaseRunnable {
25 | private Address address;
26 | private Tx tx;
27 |
28 | public RCheckRunnable(Address address, Tx tx) {
29 | this.address = address;
30 | this.tx = tx;
31 | }
32 |
33 | @Override
34 | public void run() {
35 |
36 | success(tx);
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/runnable/RunnableListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.runnable;
20 |
21 | public abstract class RunnableListener {
22 | public abstract void prepare();
23 |
24 | public abstract void success(Object obj);
25 |
26 | public abstract void error(int errorCode, String errorMsg);
27 |
28 | public void other(int code) {
29 |
30 | }
31 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/Bluetooth.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.utils;
18 |
19 | import javax.annotation.Nonnull;
20 | import java.util.UUID;
21 |
22 | public class Bluetooth {
23 | public static final UUID BLUETOOTH_UUID = UUID
24 | .fromString("3357A7BB-762D-464A-8D9A-DCA592D57D5B");
25 | public static final String MAC_URI_PARAM = "bt";
26 |
27 | public static String compressMac(@Nonnull final String mac) {
28 | return mac.replaceAll(":", "");
29 | }
30 |
31 | public static String decompressMac(@Nonnull final String compressedMac) {
32 | final StringBuilder mac = new StringBuilder();
33 | for (int i = 0; i < compressedMac.length(); i += 2)
34 | mac.append(compressedMac.substring(i, i + 2)).append(':');
35 | mac.setLength(mac.length() - 1);
36 |
37 | return mac.toString();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/DocumentMaxLengthFilter.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import javax.swing.text.AttributeSet;
22 | import javax.swing.text.BadLocationException;
23 | import javax.swing.text.DocumentFilter;
24 |
25 | /**
26 | * Document filter to provide the following to text fields/areas:
27 | *
28 | * - Limiting input to a given maximum length
29 | *
30 | *
31 | * @since 0.0.1
32 | */
33 | public class DocumentMaxLengthFilter extends DocumentFilter {
34 |
35 | private final int maxCharacters;
36 |
37 | public DocumentMaxLengthFilter(int maxChars) {
38 | maxCharacters = maxChars;
39 | }
40 |
41 | public void insertString(FilterBypass fb, int offs, String str, AttributeSet a) throws BadLocationException {
42 |
43 | // Reject if the insertion would be too long
44 | if ((fb.getDocument().getLength() + str.length()) <= maxCharacters) {
45 | super.insertString(fb, offs, str, a);
46 | }
47 | }
48 |
49 | public void replace(FilterBypass fb, int offs, int length, String str, AttributeSet a) throws BadLocationException {
50 |
51 | // Reject if the replacement would be too long
52 | if ((fb.getDocument().getLength() + str.length() - length) <= maxCharacters) {
53 | super.replace(fb, offs, length, str, a);
54 | }
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/ExceptionUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.bitherj.api.http.HttpSetting;
22 |
23 | public class ExceptionUtil {
24 | public static final String getHDMHttpExceptionMessage(int code) {
25 | switch (code) {
26 | case HttpSetting.HDMBIdIsAlready:
27 | return LocaliserUtils.getString("hdm_exception_bid_already_exists");
28 | case HttpSetting.MessageSignatureIsWrong:
29 | return LocaliserUtils.getString("hdm_keychain_add_sign_server_qr_code_error");
30 | default:
31 | return LocaliserUtils.getString("network_or_connection_error");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/HDMSingularDesktop.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2014 http://Bither.net
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.Bither;
22 | import net.bither.bitherj.core.HDMAddress;
23 | import net.bither.bitherj.core.HDMKeychain;
24 | import net.bither.bitherj.delegate.HDMHotAdd;
25 | import net.bither.bitherj.delegate.HDMSingular;
26 |
27 | import javax.annotation.Nonnull;
28 | import javax.swing.*;
29 | import java.util.List;
30 |
31 | public class HDMSingularDesktop extends HDMSingular {
32 |
33 | public HDMSingularDesktop(@Nonnull HDMSingularDelegate delegate) {
34 | super(delegate);
35 |
36 | }
37 |
38 | @Override
39 | protected void runOnUIThread(Runnable runnable) {
40 | SwingUtilities.invokeLater(runnable);
41 | }
42 |
43 | public void server() {
44 | new Thread() {
45 | @Override
46 | public void run() {
47 | callInServer(new HDMHotAdd.IGenerateHDMKeyChain() {
48 | @Override
49 | public void generateHDMKeyChain(HDMKeychain hdmKeychain) {
50 | KeyUtil.setHDKeyChain(hdmKeychain);
51 |
52 | }
53 |
54 | @Override
55 | public void beginCompleteAddress() {
56 | PeerUtil.stopPeer();
57 | }
58 |
59 | @Override
60 | public void completeAddrees(List hdmAddresses) {
61 | Bither.refreshFrame();
62 | }
63 |
64 |
65 | });
66 | }
67 |
68 |
69 | }.start();
70 | }
71 |
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/LocaliserUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.bitherj.utils.Utils;
22 |
23 | import java.util.Locale;
24 |
25 | public class LocaliserUtils {
26 | private static Localiser mLocaliser = new Localiser(Locale.ENGLISH);
27 |
28 | private LocaliserUtils() {
29 |
30 | }
31 |
32 | public static String getString(String key) {
33 | return mLocaliser.getString(key);
34 |
35 | }
36 |
37 | public static String getString(String key, String[] errorMessage) {
38 | return mLocaliser.getString(key, errorMessage);
39 |
40 | }
41 |
42 | public static String getString(String key, Object[] message) {
43 | return mLocaliser.getString(key, message);
44 |
45 | }
46 |
47 | public static Locale getLocale() {
48 | return mLocaliser.getLocale();
49 | }
50 |
51 |
52 | public static void setLocale(Locale locale) {
53 | mLocaliser = new Localiser(locale);
54 | }
55 |
56 | public static void setLocaliser(Localiser localiser) {
57 | mLocaliser = localiser;
58 | }
59 |
60 |
61 | public static Localiser getLocaliser() {
62 | return mLocaliser;
63 | }
64 |
65 | public static boolean isChina() {
66 | String defaultCountry = Locale.getDefault().getCountry();
67 | if (Utils.compareString(defaultCountry, "CN") || Utils.compareString
68 | (defaultCountry, "cn")) {
69 | return true;
70 | } else {
71 | return false;
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/LogUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.bitherj.BitherjSettings;
22 | import net.bither.bitherj.utils.Utils;
23 |
24 | /**
25 | * Created by nn on 15/5/4.
26 | */
27 | public class LogUtil {
28 | public static void printlnOut(String str) {
29 | if (!BitherjSettings.LOG_DEBUG) {
30 | return;
31 | }
32 | if (Utils.isEmpty(str)) {
33 | return;
34 | }
35 | System.out.println(str);
36 | }
37 |
38 | public static void printlnError(String str) {
39 | if (!BitherjSettings.LOG_DEBUG) {
40 | return;
41 | }
42 | if (Utils.isEmpty(str)) {
43 | return;
44 | }
45 | System.err.println(str);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/StringUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.bitherj.utils.Base58;
22 |
23 | import javax.swing.*;
24 | import java.awt.*;
25 | import java.awt.event.WindowEvent;
26 | import java.util.regex.Matcher;
27 | import java.util.regex.Pattern;
28 |
29 | public class StringUtil {
30 |
31 |
32 | public static boolean checkBackupFileOfCold(String fileName) {
33 | Pattern pattern = Pattern.compile("[^-]{6,6}_[^-]{6,6}.bak");
34 | Matcher matcher = pattern.matcher(fileName);
35 | if (matcher.find()) {
36 | return true;
37 | }
38 | return false;
39 | }
40 |
41 | public static String validBicoinAddressBegin(String input) {
42 | final Pattern PATTERN_BITCOIN_ADDRESS = Pattern.compile("[^"
43 | + new String(Base58.ALPHABET) + "]{1,30}");
44 | Matcher matcher = PATTERN_BITCOIN_ADDRESS.matcher(input);
45 | if (!matcher.find()) {
46 | return null;
47 | } else {
48 | return matcher.toMatchResult().group();
49 | }
50 |
51 |
52 | }
53 |
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/SystemUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.bitherj.utils.Utils;
22 |
23 | /**
24 | * Created by nn on 15/5/4.
25 | */
26 | public class SystemUtil {
27 |
28 | public static long maxUsed = 0;
29 |
30 | public static void maxUsedSize() {
31 | Runtime runtime = Runtime.getRuntime();
32 | long total = runtime.totalMemory();
33 | long free = runtime.freeMemory();
34 |
35 | long used = total - free;
36 | if (used > maxUsed) {
37 | maxUsed = used;
38 | runtime.runFinalization();
39 | runtime.gc();
40 | LogUtil.printlnOut("maxUsed:" + Math.round(maxUsed / 1e3));
41 | }
42 | }
43 |
44 | public static void callSystemGC() {
45 |
46 | Runtime runtime = Runtime.getRuntime();
47 | long total = runtime.totalMemory();
48 | long free = runtime.freeMemory();
49 | long max = runtime.maxMemory();
50 | long used = total - free;
51 | LogUtil.printlnOut(" " + Math.round(used / 1e3) + " KB used before GC,total :" + Math.round(total / 1e3) + ",free:" + Math.round(free / 1e3));
52 |
53 |
54 | runtime.runFinalization();
55 | runtime.gc();
56 | runtime = Runtime.getRuntime();
57 | total = runtime.totalMemory();
58 | free = runtime.freeMemory();
59 | max = runtime.maxMemory();
60 | used = total - free;
61 | LogUtil.printlnOut(Math.round(used / 1e3) + " KB used after GC,total :" + Math.round(total / 1e3) + ",free:" + Math.round(free / 1e3));
62 |
63 | }
64 |
65 | public static int getAvailableProcessors() {
66 | return Runtime.getRuntime().availableProcessors();
67 | }
68 |
69 | public static boolean isSystem32() {
70 | return Utils.compareString("32", System.getProperty("sun.arch.data.model"));
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/UpgradeUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 |
18 | package net.bither.utils;
19 |
20 | import net.bither.bitherj.utils.UpgradeAddressUtil;
21 | import net.bither.preference.UserPreference;
22 | import net.bither.runnable.BaseRunnable;
23 | import net.bither.runnable.RunnableListener;
24 |
25 | public class UpgradeUtil {
26 | public static final int UPGRADE_ADDRESS_TO_DB = 131;
27 |
28 | private UpgradeUtil() {
29 |
30 | }
31 |
32 | public static boolean needUpgrade() {
33 | int verionCode = UserPreference.getInstance().getVerionCode();
34 | return verionCode < UPGRADE_ADDRESS_TO_DB;
35 | }
36 |
37 | public static void upgradeNewVerion(final RunnableListener handler) {
38 | BaseRunnable baseRunnable = new BaseRunnable() {
39 | @Override
40 | public void run() {
41 | handler.prepare();
42 | try {
43 | int verionCode = UserPreference.getInstance().getVerionCode();
44 | if (verionCode < UPGRADE_ADDRESS_TO_DB) {
45 | UpgradeAddressUtil.upgradeAddress();
46 | }
47 | handler.success(null);
48 | } catch (Exception e) {
49 | e.printStackTrace();
50 | handler.error(0, null);
51 | }
52 |
53 | }
54 | };
55 | new Thread(baseRunnable).start();
56 |
57 | }
58 |
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/ViewUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.utils;
20 |
21 | import net.bither.viewsystem.dialogs.MessageDialog;
22 |
23 | import javax.swing.*;
24 | import java.awt.*;
25 | import java.io.IOException;
26 | import java.net.URI;
27 |
28 | public class ViewUtil {
29 | private static final int WIDTH_DELTA = 8;
30 | private static final int HEIGHT_DELTA = 8;
31 |
32 | public static int getMax(int... args) {
33 | int max = Integer.MIN_VALUE;
34 | for (int i : args) {
35 | if (max < i) {
36 | max = i;
37 | }
38 | }
39 | return max;
40 | }
41 |
42 |
43 | public static void setDimension(JComponent component, Dimension dimension) {
44 | component.setPreferredSize(dimension);
45 | component.setMinimumSize(dimension);
46 | component.setMaximumSize(dimension);
47 | }
48 |
49 |
50 | public static void openURI(URI uri) {
51 | try {
52 | Desktop desktop = Desktop.getDesktop();
53 | desktop.browse(uri);
54 | } catch (IOException ioe) {
55 | ioe.printStackTrace();
56 | new MessageDialog(LocaliserUtils.getString("browser.unableToLoad", new String[]{uri.toString(), ioe.getMessage()})).showMsg();
57 |
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/utils/WhitespaceTrimmer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.utils;
17 |
18 | import java.util.regex.Matcher;
19 | import java.util.regex.Pattern;
20 |
21 | public class WhitespaceTrimmer {
22 |
23 | private static String whiteRange = "\\p{javaWhitespace}\\p{Zs}";
24 | private static Pattern whiteStart = Pattern.compile("^[" + whiteRange + "]+");
25 | private static Pattern whiteEnd = Pattern.compile("[" + whiteRange + "]+$");
26 |
27 | private WhitespaceTrimmer() {
28 | }
29 |
30 | static String ltrim(String text) {
31 | if (text == null) {
32 | return "";
33 | }
34 | Matcher mStart = whiteStart.matcher(text);
35 | return mStart.find() ? text.substring(mStart.end()) : text;
36 | }
37 |
38 | static String rtrim(String text) {
39 | if (text == null) {
40 | return "";
41 | }
42 | Matcher mEnd = whiteEnd.matcher(text);
43 | if (mEnd.find()) {
44 | int matchStart = mEnd.start();
45 | return text.substring(0, matchStart);
46 | } else {
47 | return text;
48 | }
49 | }
50 |
51 | public static String trim(String text) {
52 | return (rtrim(ltrim(text.trim()))).trim();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/ViewFactory.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem;
17 |
18 | import net.bither.viewsystem.base.ViewEnum;
19 | import net.bither.viewsystem.base.Viewable;
20 | import net.bither.viewsystem.froms.ColdDefaultPanel;
21 | import net.bither.viewsystem.froms.ShowTransactionsForm;
22 |
23 | import java.util.EnumMap;
24 | import java.util.Map;
25 |
26 | public class ViewFactory {
27 | private Map viewMap;
28 |
29 | public ViewFactory() {
30 | initialise();
31 | }
32 |
33 | public final void initialise() {
34 | viewMap = new EnumMap(ViewEnum.class);
35 | }
36 |
37 | public Viewable getView(ViewEnum viewNumber) {
38 | Viewable viewToReturn = viewMap.get(viewNumber);
39 |
40 | if (viewToReturn == null) {
41 | viewToReturn = createView(viewNumber);
42 | }
43 |
44 | return viewToReturn;
45 | }
46 |
47 | private Viewable createView(ViewEnum viewNumber) {
48 | Viewable viewToReturn = null;
49 |
50 | switch (viewNumber) {
51 |
52 | case SAME_VIEW: {
53 | assert false;
54 | break;
55 | }
56 | case TRANSACTIONS_VIEW: {
57 | viewToReturn = new ShowTransactionsForm();
58 | break;
59 | }
60 | case COLD_WALLET_VIEW: {
61 | viewToReturn = new ColdDefaultPanel();
62 | break;
63 | }
64 |
65 |
66 | default: {
67 | }
68 | }
69 |
70 | if (viewToReturn != null) {
71 | viewMap.put(viewNumber, viewToReturn);
72 | }
73 | return viewToReturn;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/AbstractExitAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License
3 | *
4 | * Copyright 2013 Cameron Garnham.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 | package net.bither.viewsystem.action;
25 |
26 | import net.bither.utils.LocaliserUtils;
27 |
28 | import javax.swing.*;
29 |
30 |
31 | public abstract class AbstractExitAction extends AbstractAction {
32 |
33 | public AbstractExitAction() {
34 | super(LocaliserUtils.getString("exitAction.text"));
35 |
36 | MnemonicUtil mnemonicUtil = new MnemonicUtil();
37 | putValue(MNEMONIC_KEY, mnemonicUtil.getMnemonic("exitAction.mnemonicKey"));
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/CopyAction.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2012 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.action;
17 |
18 | import net.bither.utils.LocaliserUtils;
19 | import net.bither.viewsystem.dialogs.MessageDialog;
20 |
21 | import javax.swing.*;
22 | import java.awt.event.ActionEvent;
23 |
24 | /**
25 | * This {@link Action} represents the swing copy receive address action
26 | */
27 | public class CopyAction extends AbstractAction {
28 | public interface ICopy {
29 | public String getCopyString();
30 | }
31 |
32 | private ICopy copy;
33 |
34 |
35 | public CopyAction(ICopy copy) {
36 |
37 | this.copy = copy;
38 | }
39 |
40 | /**
41 | * Copy receive address to clipboard
42 | */
43 | @Override
44 | public void actionPerformed(ActionEvent e) {
45 | // copy receive address to clipboard
46 | TextTransfer textTransfer = new TextTransfer();
47 | //getReceiveAddress
48 | textTransfer.setClipboardContents(copy.getCopyString());
49 | new MessageDialog(LocaliserUtils.getString("copy_address_success")).showMsg();
50 |
51 |
52 | }
53 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/ExitAction.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License"); you may not use this file
5 | * except in compliance with the License. You may obtain a copy of the License
6 | * at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | package net.bither.viewsystem.action;
17 |
18 |
19 | import net.bither.ApplicationInstanceManager;
20 | import net.bither.Bither;
21 | import net.bither.bitherj.core.PeerManager;
22 | import net.bither.utils.LocaliserUtils;
23 | import org.slf4j.Logger;
24 | import org.slf4j.LoggerFactory;
25 |
26 | import javax.swing.*;
27 | import java.awt.*;
28 | import java.awt.event.ActionEvent;
29 |
30 | /**
31 | * Exit the application.
32 | */
33 | public class ExitAction extends AbstractExitAction {
34 | private static final Logger log = LoggerFactory.getLogger(ExitAction.class);
35 |
36 | /**
37 | * Creates a new {@link ExitAction}.
38 | */
39 | public ExitAction() {
40 | super();
41 |
42 | }
43 |
44 | @Override
45 | public void actionPerformed(ActionEvent arg0) {
46 | String shuttingDownTitle = LocaliserUtils.getString("BitherFrame.title.shuttingDown");
47 |
48 | if (Bither.getMainFrame() != null) {
49 | Bither.getMainFrame().setTitle(shuttingDownTitle);
50 |
51 | if (EventQueue.isDispatchThread()) {
52 | Bither.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
53 | } else {
54 | SwingUtilities.invokeLater(new Runnable() {
55 | @Override
56 | public void run() {
57 | Bither.getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
58 | }
59 | });
60 | }
61 |
62 | }
63 | PeerManager.instance().stop();
64 | ApplicationInstanceManager.shutdownSocket();
65 |
66 | // Get rid of main display.
67 | if (Bither.getMainFrame() != null) {
68 | Bither.getMainFrame().setVisible(false);
69 | }
70 |
71 | if (Bither.getMainFrame() != null) {
72 | Bither.getMainFrame().dispose();
73 | }
74 | ApplicationInstanceManager.txDBHelper.close();
75 |
76 |
77 | System.exit(0);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/MnemonicUtil.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.action;
17 |
18 | import net.bither.utils.LocaliserUtils;
19 |
20 | import javax.swing.*;
21 | import java.util.MissingResourceException;
22 |
23 | public class MnemonicUtil {
24 |
25 |
26 | /**
27 | * get the mnemonic key code for the passed in internationalisation key
28 | *
29 | * @param key
30 | * @return
31 | */
32 | public int getMnemonic(String key) {
33 | if (LocaliserUtils.getLocaliser() != null) {
34 | try {
35 | return KeyStroke.getKeyStroke(LocaliserUtils.getLocaliser().getString(key)).getKeyCode();
36 | } catch (NullPointerException npe) {
37 | return 0;
38 | } catch (ClassCastException cce) {
39 | return 0;
40 | } catch (MissingResourceException mre) {
41 | return 0;
42 | }
43 | } else {
44 | return 0;
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/PasteAddressAction.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.action;
17 |
18 | import net.bither.Bither;
19 | import net.bither.bitherj.core.Address;
20 | import net.bither.utils.LocaliserUtils;
21 | import net.bither.utils.WhitespaceTrimmer;
22 |
23 | import javax.swing.*;
24 | import java.awt.event.ActionEvent;
25 |
26 | /**
27 | * This {@link Action} represents the swing paste address action
28 | */
29 | public class PasteAddressAction extends AbstractAction {
30 |
31 | private JTextField jTextField;
32 |
33 | /**
34 | * Creates a new {@link PasteAddressAction}.
35 | */
36 | public PasteAddressAction(JTextField jTextField) {
37 |
38 | this.jTextField = jTextField;
39 |
40 |
41 | MnemonicUtil mnemonicUtil = new MnemonicUtil();
42 | putValue(SHORT_DESCRIPTION, LocaliserUtils.getString("pasteAddressAction.tooltip"));
43 | putValue(MNEMONIC_KEY, mnemonicUtil.getMnemonic("pasteAddressAction.mnemonicKey"));
44 | }
45 |
46 | /**
47 | * delegate to generic paste address action
48 | */
49 | @Override
50 | public void actionPerformed(ActionEvent e) {
51 | // check to see if the wallet files have changed
52 | Address perWalletModelData = Bither.getActionAddress();
53 |
54 |
55 | TextTransfer textTransfer = new TextTransfer();
56 | String stringToPaste = textTransfer.getClipboardContents();
57 | stringToPaste = WhitespaceTrimmer.trim(stringToPaste);
58 | jTextField.setText(stringToPaste);
59 | //Bither.getBitcoinController().displayView(Bither.getBitcoinController().getCurrentView());
60 |
61 | }
62 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/ShowTransactionDetailsAction.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2012 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.action;
17 |
18 | import net.bither.bitherj.core.Tx;
19 | import net.bither.utils.ImageLoader;
20 | import net.bither.utils.LocaliserUtils;
21 | import net.bither.viewsystem.dialogs.TxDetailsDialog;
22 | import net.bither.viewsystem.froms.ShowTransactionsForm;
23 |
24 | import javax.swing.*;
25 | import java.awt.event.ActionEvent;
26 |
27 | /**
28 | * This {@link Action} shows the transaction details dialog
29 | */
30 | public class ShowTransactionDetailsAction extends AbstractAction {
31 |
32 | private static final long serialVersionUID = 1913592498732457765L;
33 |
34 | private ShowTransactionsForm showTransactionsPanel;
35 |
36 | /**
37 | * Creates a new {@link ShowTransactionDetailsAction}.
38 | */
39 | public ShowTransactionDetailsAction(ShowTransactionsForm showTransactionsPanel) {
40 | super(LocaliserUtils.getString("showTransactionsDetailAction.text"), ImageLoader.createImageIcon(ImageLoader.TRANSACTIONS_ICON_FILE));
41 |
42 | this.showTransactionsPanel = showTransactionsPanel;
43 |
44 |
45 | MnemonicUtil mnemonicUtil = new MnemonicUtil();
46 | putValue(SHORT_DESCRIPTION, LocaliserUtils.getString("showTransactionsDetailAction.tooltip"));
47 | putValue(MNEMONIC_KEY, mnemonicUtil.getMnemonic("showTransactionsDetailAction.mnemonicKey"));
48 | }
49 |
50 | /**
51 | * show the show transaction details dialog
52 | */
53 | @Override
54 | public void actionPerformed(ActionEvent e) {
55 | Tx rowTableData = showTransactionsPanel.getSelectedRowData();
56 |
57 | final TxDetailsDialog transactionDetailsDialog = new TxDetailsDialog(rowTableData);
58 | //final TransactionDetailsDialog transactionDetailsDialog = new TransactionDetailsDialog(rowTableData);
59 | transactionDetailsDialog.setVisible(true);
60 |
61 | // Put the focus back on the table so that the up and down arrows work.
62 | showTransactionsPanel.getTable().requestFocusInWindow();
63 | }
64 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/action/WalletMouseListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.action;
20 |
21 | import net.bither.Bither;
22 | import net.bither.bitherj.utils.Utils;
23 | import net.bither.viewsystem.froms.IAddressForm;
24 | import net.bither.viewsystem.panels.WalletListPanel;
25 |
26 | import java.awt.event.MouseAdapter;
27 | import java.awt.event.MouseEvent;
28 | import java.awt.event.MouseListener;
29 |
30 | public class WalletMouseListener extends MouseAdapter implements MouseListener {
31 | private WalletListPanel walletListPanel;
32 | private IAddressForm singleWalletForm;
33 |
34 | public WalletMouseListener(WalletListPanel walletListPanel, IAddressForm singleWalletForm) {
35 | super();
36 | this.walletListPanel = walletListPanel;
37 | this.singleWalletForm = singleWalletForm;
38 | }
39 |
40 | @Override
41 | public void mouseClicked(MouseEvent e) {
42 | if (this.singleWalletForm != null) {
43 | String activeAddress = null;
44 | if (Bither.getActionAddress() != null) {
45 | activeAddress = Bither.getActionAddress().getAddress();
46 | }
47 | if (!Utils.compareString(this.singleWalletForm.getOnlyName()
48 | , activeAddress)) {
49 | walletListPanel.selectWalletPanelByFilename(this.singleWalletForm.getOnlyName());
50 | Bither.getCoreController().fireDataChangedUpdateNow();
51 | }
52 | this.singleWalletForm.getPanel().requestFocusInWindow();
53 |
54 | }
55 |
56 | }
57 |
58 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/BitherLabel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2012 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.base;
17 |
18 | import javax.swing.*;
19 |
20 |
21 | public class BitherLabel extends JLabel {
22 |
23 | private static final long serialVersionUID = -3434455262992702604L;
24 |
25 | public BitherLabel(String labelText) {
26 | super(labelText);
27 |
28 | setOpaque(false);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/ButtonDecorator.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base;
20 |
21 | import net.bither.BitherUI;
22 | import net.bither.fonts.AwesomeDecorator;
23 | import net.bither.fonts.AwesomeIcon;
24 | import net.bither.languages.MessageKey;
25 |
26 | import javax.swing.*;
27 |
28 | /**
29 | * Decorator to provide the following to UI:
30 | *
31 | * - Various button effects
32 | * - Consistent iconography and accessibility
33 | *
34 | *
35 | * @since 0.0.1
36 | */
37 | public class ButtonDecorator {
38 |
39 | /**
40 | * Utilities have no public constructor
41 | */
42 | private ButtonDecorator() {
43 | }
44 |
45 | /**
46 | * Decorate the button so that clicking will cause a "show"
47 | * The icon reflects the current state to make it more intuitive
48 | *
49 | * @param button The button
50 | */
51 | public static void applyShow(JButton button) {
52 |
53 | // #53 Do not use an eye for reveal
54 | AwesomeDecorator.applyIcon(
55 | AwesomeIcon.LOCK,
56 | button,
57 | true,
58 | BitherUI.NORMAL_ICON_SIZE
59 | );
60 |
61 | AccessibilityDecorator.apply(button, MessageKey.SHOW, MessageKey.SHOW);
62 |
63 | }
64 |
65 | /**
66 | * Decorate the button so that clicking will cause a "hide"
67 | * The icon reflects the current state to make it more intuitive
68 | *
69 | * @param button The button
70 | */
71 | public static void applyHide(JButton button) {
72 |
73 | // #53 Do not use an eye for reveal
74 | AwesomeDecorator.applyIcon(
75 | AwesomeIcon.UNLOCK_ALT,
76 | button,
77 | true,
78 | BitherUI.NORMAL_ICON_SIZE
79 | );
80 |
81 | AccessibilityDecorator.apply(button, MessageKey.HIDE, MessageKey.HIDE);
82 |
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/DisplayHint.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base;
20 |
21 |
22 | public enum DisplayHint {
23 | COMPLETE_REDRAW,
24 | WALLET_TRANSACTIONS_HAVE_CHANGED
25 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/FontSizer.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.base;
17 |
18 | import java.awt.*;
19 |
20 | public enum FontSizer {
21 | INSTANCE;
22 |
23 |
24 | private Font adjustedDefaultFont;
25 |
26 | public void initialise() {
27 |
28 | adjustedDefaultFont = createAdjustedDefaultFont();
29 | }
30 |
31 | private Font createAdjustedDefaultFont() {
32 | String fontSizeString = null;
33 |
34 | int unadjustedFontSize = ColorAndFontConstants.BITHER_DEFAULT_FONT_SIZE;
35 |
36 | if (fontSizeString != null && !"".equals(fontSizeString)) {
37 | try {
38 | unadjustedFontSize = Integer.parseInt(fontSizeString);
39 | } catch (NumberFormatException nfe) {
40 | // use default
41 | }
42 | }
43 |
44 | String fontStyleString = null;
45 | int fontStyle = ColorAndFontConstants.BITHER_DEFAULT_FONT_STYLE;
46 |
47 | try {
48 | fontStyle = Integer.parseInt(fontStyleString);
49 | } catch (NumberFormatException nfe) {
50 | // use default
51 | }
52 |
53 | String fontName = null;
54 | if (fontName == null || "".equals(fontName)) {
55 | fontName = ColorAndFontConstants.BITHER_DEFAULT_FONT_NAME;
56 | }
57 |
58 | return new Font(fontName, fontStyle, unadjustedFontSize);
59 | }
60 |
61 | public Font getAdjustedDefaultFont() {
62 | return adjustedDefaultFont;
63 | }
64 |
65 | /**
66 | * Get the required scaled font using the currently specified font size plus a delta
67 | *
68 | * @param delta Delta from default font, in point size
69 | */
70 | public Font getAdjustedDefaultFontWithDelta(int delta) {
71 | return adjustedDefaultFont.deriveFont(adjustedDefaultFont.getStyle(), adjustedDefaultFont.getSize() + delta);
72 | }
73 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/IProgress.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base;
20 |
21 | public interface IProgress {
22 | public void beginProgress();
23 |
24 | public void endProgress();
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/ViewEnum.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License"); you may not use this file
5 | * except in compliance with the License. You may obtain a copy of the License
6 | * at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 | * License for the specific language governing permissions and limitations under
14 | * the License.
15 | */
16 | package net.bither.viewsystem.base;
17 |
18 | import net.bither.bitherj.BitherjSettings;
19 | import net.bither.preference.UserPreference;
20 |
21 | public enum ViewEnum {
22 | SAME_VIEW, // Not a real view - used to forward to the same view as calling
23 | UNKNOWN_VIEW,
24 | TRANSACTIONS_VIEW,
25 | COLD_WALLET_VIEW,
26 | SEND_BITCOIN_CONFIRM_VIEW, // obsolete - now done with Swing dialog
27 |
28 |
29 | OPEN_WALLET_VIEW, // obsolete - now done with Swing dialog
30 | SAVE_WALLET_AS_VIEW, // obsolete - now done with Swing dialog
31 | VALIDATION_ERROR_VIEW, // obsolete - now done with Swing dialog
32 | YOUR_WALLETS_VIEW,
33 | CREATE_BULK_ADDRESSES_VIEW, // obsolete
34 |
35 |
36 | ;
37 |
38 | public static ViewEnum DEFAULT_VIEW() {
39 | if (UserPreference.getInstance().getAppMode() == BitherjSettings.AppMode.COLD) {
40 | return COLD_WALLET_VIEW;
41 | }
42 | return TRANSACTIONS_VIEW;
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/ViewSystem.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2011 multibit.org
3 | *
4 | * Licensed under the MIT license (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://opensource.org/licenses/mit-license.php
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.bither.viewsystem.base;
17 |
18 |
19 | import net.bither.bitherj.core.Address;
20 |
21 | public interface ViewSystem {
22 | /**
23 | * Display the view specified.
24 | */
25 | public void displayView(ViewEnum viewToDisplay);
26 |
27 | /**
28 | * Navigate away from a view - gives the view the opportunity to tidy up/ disappear etc.
29 | *
30 | * @param viewToNavigateAwayFrom - current view to navigate away from -one of the View constants.
31 | */
32 | public void navigateAwayFromView(ViewEnum viewToNavigateAwayFrom);
33 |
34 | /**
35 | * Tells the view system that the model data has changed (but the wallet is still the same).
36 | * Use this variant for when you want the UI to update immediately (typically after user generated events).
37 | */
38 | public void fireDataChangedUpdateNow(DisplayHint displayHint);
39 |
40 | /**
41 | * Tells the view system to recreate all views e.g. after a language change or wallet change.
42 | *
43 | * @param initUI Completely redraw everything on all screens = true
44 | */
45 | public void recreateAllViews(boolean initUI, ViewEnum initialView);
46 |
47 | /**
48 | * Tells the view system that an external process has modified one of the wallets.
49 | */
50 | public void fireFilesHaveBeenChangedByAnotherProcess(Address perWalletModelData);
51 |
52 |
53 | /**
54 | * Set the help context to display.
55 | *
56 | * @param helpContextToDisplay
57 | */
58 | public void setHelpContext(String helpContextToDisplay);
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/Viewable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License
3 | *
4 | * Copyright 2013 Cameron Garnham.
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 | package net.bither.viewsystem.base;
25 |
26 | import javax.swing.*;
27 |
28 | public interface Viewable {
29 |
30 | void displayView(DisplayHint displayHint);
31 |
32 | ViewEnum getViewId();
33 |
34 | JPanel getPanel();
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/renderer/AddressImage.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base.renderer;
20 |
21 | import net.bither.BitherUI;
22 | import net.bither.fonts.AwesomeDecorator;
23 | import net.bither.fonts.AwesomeIcon;
24 | import net.bither.viewsystem.themes.Themes;
25 |
26 | import javax.swing.*;
27 | import javax.swing.table.DefaultTableCellRenderer;
28 | import java.awt.*;
29 |
30 | public class AddressImage extends DefaultTableCellRenderer {
31 | private JLabel labPrivateKey;
32 | private JLabel labWatchOnly;
33 |
34 | public AddressImage() {
35 | labPrivateKey = new JLabel();
36 | labWatchOnly = new JLabel();
37 |
38 | labWatchOnly.setOpaque(true);
39 | labPrivateKey.setOpaque(true);
40 |
41 | AwesomeDecorator.applyIcon(AwesomeIcon.LOCK, labPrivateKey, true, BitherUI.SMALL_ICON_SIZE);
42 | AwesomeDecorator.applyIcon(AwesomeIcon.FA_EYE, labWatchOnly, true, BitherUI.SMALL_ICON_SIZE);
43 | labPrivateKey.setHorizontalTextPosition(SwingConstants.CENTER);
44 | labWatchOnly.setHorizontalTextPosition(SwingConstants.CENTER);
45 | }
46 |
47 | @Override
48 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
49 | int column) {
50 |
51 | if (row % 2 == 0) {
52 | labPrivateKey.setBackground(Themes.currentTheme.detailPanelBackground());
53 | labWatchOnly.setBackground(Themes.currentTheme.detailPanelBackground());
54 |
55 | } else {
56 | labPrivateKey.setBackground(Themes.currentTheme.sidebarPanelBackground());
57 | labWatchOnly.setBackground(Themes.currentTheme.sidebarPanelBackground());
58 |
59 | }
60 | if (Boolean.valueOf(value.toString())) {
61 | return labPrivateKey;
62 | } else {
63 | return labWatchOnly;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/renderer/CurrencyCenterJustifiedRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base.renderer;
20 |
21 | import net.bither.viewsystem.base.BitherLabel;
22 | import net.bither.viewsystem.base.FontSizer;
23 | import net.bither.viewsystem.themes.Themes;
24 |
25 | import javax.swing.*;
26 | import javax.swing.table.DefaultTableCellRenderer;
27 | import java.awt.*;
28 |
29 | /**
30 | * Created by nn on 14-11-10.
31 | */
32 | public class CurrencyCenterJustifiedRenderer extends DefaultTableCellRenderer {
33 | private static final long serialVersionUID = 1549545L;
34 |
35 | private int moduloRow = 0;
36 |
37 | public CurrencyCenterJustifiedRenderer(int moduloRow) {
38 | this.moduloRow = moduloRow;
39 |
40 | }
41 |
42 | BitherLabel label = new BitherLabel("");
43 |
44 | @Override
45 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
46 | int column) {
47 | label.setHorizontalAlignment(SwingConstants.CENTER);
48 | label.setBackground(Themes.currentTheme.detailPanelBackground());
49 | label.setOpaque(true);
50 | label.setText((String) value);
51 | label.setFont(FontSizer.INSTANCE.getAdjustedDefaultFontWithDelta(-1));
52 |
53 | Color backgroundColor = (row % 2 == moduloRow ? Themes.currentTheme.detailPanelBackground()
54 | : Themes.currentTheme.detailPanelBackground());
55 | label.setBackground(backgroundColor);
56 | label.setForeground(table.getForeground());
57 |
58 | return label;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/renderer/CurrencyCenterJustifiedWithRightBorderRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base.renderer;
20 |
21 | /**
22 | * Created by nn on 14-11-10.
23 | */
24 |
25 | import net.bither.viewsystem.base.BitherLabel;
26 | import net.bither.viewsystem.base.FontSizer;
27 | import net.bither.viewsystem.themes.Themes;
28 |
29 | import javax.swing.*;
30 | import javax.swing.table.DefaultTableCellRenderer;
31 | import java.awt.*;
32 |
33 | public class CurrencyCenterJustifiedWithRightBorderRenderer extends DefaultTableCellRenderer {
34 | private static final long serialVersionUID = 9949545L;
35 | private int moduloRow = 0;
36 |
37 | public CurrencyCenterJustifiedWithRightBorderRenderer(int moduloRow) {
38 | this.moduloRow = moduloRow;
39 |
40 | }
41 |
42 | BitherLabel label = new BitherLabel("");
43 |
44 | @Override
45 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
46 | int column) {
47 | label.setHorizontalAlignment(SwingConstants.CENTER);
48 | label.setBackground(Themes.currentTheme.detailPanelBackground());
49 | label.setOpaque(true);
50 | label.setText((String) value);
51 | label.setFont(FontSizer.INSTANCE.getAdjustedDefaultFontWithDelta(-1));
52 |
53 | Color backgroundColor = (row % 2 == moduloRow ? Themes.currentTheme.detailPanelBackground()
54 | : Themes.currentTheme.detailPanelBackground());
55 | label.setBackground(backgroundColor);
56 | label.setForeground(table.getForeground());
57 |
58 | return label;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/renderer/LeadingJustifiedRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base.renderer;
20 |
21 | import net.bither.BitherSetting;
22 | import net.bither.viewsystem.base.BitherLabel;
23 | import net.bither.viewsystem.froms.ShowTransactionsForm;
24 | import net.bither.viewsystem.themes.Themes;
25 |
26 | import javax.swing.*;
27 | import javax.swing.border.EmptyBorder;
28 | import javax.swing.table.DefaultTableCellRenderer;
29 | import java.awt.*;
30 |
31 | /**
32 | * Created by nn on 14-11-7.
33 | */
34 | public class LeadingJustifiedRenderer extends DefaultTableCellRenderer {
35 | private static final long serialVersionUID = 1549545L;
36 |
37 |
38 | private BitherLabel label;
39 | private ShowTransactionsForm showTransactionsFrom;
40 |
41 | public LeadingJustifiedRenderer(ShowTransactionsForm showTransactionsFrom) {
42 | this.showTransactionsFrom = showTransactionsFrom;
43 | label = new BitherLabel("");
44 | }
45 |
46 | @Override
47 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
48 | int column) {
49 | label.setHorizontalAlignment(SwingConstants.LEADING);
50 | label.setOpaque(true);
51 | label.setBorder(new EmptyBorder(new Insets(0, BitherSetting.TABLE_BORDER, 1, BitherSetting.TABLE_BORDER)));
52 |
53 | label.setText(value.toString());
54 | if (isSelected) {
55 | showTransactionsFrom.setSelectedRow(row);
56 | label.setBackground(table.getSelectionBackground());
57 | label.setForeground(table.getSelectionForeground());
58 | } else {
59 | label.setForeground(table.getForeground());
60 | if (row % 2 == 1) {
61 | label.setBackground(Themes.currentTheme.detailPanelBackground());
62 | } else {
63 | label.setBackground(Themes.currentTheme.sidebarPanelBackground());
64 | label.setOpaque(true);
65 | }
66 | }
67 |
68 | return label;
69 | }
70 | }
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/renderer/SelectAddressImage.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base.renderer;
20 |
21 | import net.bither.BitherUI;
22 | import net.bither.fonts.AwesomeDecorator;
23 | import net.bither.fonts.AwesomeIcon;
24 | import net.bither.viewsystem.themes.Themes;
25 |
26 | import javax.swing.*;
27 | import javax.swing.table.DefaultTableCellRenderer;
28 | import java.awt.*;
29 |
30 | public class SelectAddressImage extends DefaultTableCellRenderer {
31 | private JLabel labCheck;
32 | private JLabel labNull;
33 |
34 | public SelectAddressImage() {
35 | labCheck = new JLabel();
36 | labNull = new JLabel();
37 | labCheck.setOpaque(true);
38 | labNull.setOpaque(true);
39 | labNull.setText("");
40 |
41 | AwesomeDecorator.applyIcon(AwesomeIcon.CHECK, labCheck, true, BitherUI.SMALL_ICON_SIZE);
42 |
43 |
44 | }
45 |
46 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
47 | int column) {
48 | if (row % 2 == 0) {
49 | labCheck.setBackground(Themes.currentTheme.detailPanelBackground());
50 | labNull.setBackground(Themes.currentTheme.detailPanelBackground());
51 |
52 | } else {
53 | labCheck.setBackground(Themes.currentTheme.sidebarPanelBackground());
54 | labNull.setBackground(Themes.currentTheme.sidebarPanelBackground());
55 |
56 | }
57 |
58 | if (Boolean.valueOf(value.toString())) {
59 | return labCheck;
60 | } else {
61 | return labNull;
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/base/renderer/TrailingJustifiedStringRenderer.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.base.renderer;
20 |
21 | import net.bither.BitherSetting;
22 | import net.bither.viewsystem.base.BitherLabel;
23 | import net.bither.viewsystem.froms.ShowTransactionsForm;
24 | import net.bither.viewsystem.themes.Themes;
25 |
26 | import javax.swing.*;
27 | import javax.swing.border.EmptyBorder;
28 | import javax.swing.table.DefaultTableCellRenderer;
29 | import java.awt.*;
30 |
31 | /**
32 | * Created by nn on 14-11-7.
33 | */
34 | public class TrailingJustifiedStringRenderer extends DefaultTableCellRenderer {
35 | private static final long serialVersionUID = 1549545L;
36 |
37 | private BitherLabel label;
38 | private ShowTransactionsForm showTransactionsFrom;
39 |
40 | public TrailingJustifiedStringRenderer(ShowTransactionsForm showTransactionsFrom) {
41 | this.showTransactionsFrom = showTransactionsFrom;
42 | label = new BitherLabel("");
43 | }
44 |
45 | public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
46 | int column) {
47 | label.setHorizontalAlignment(SwingConstants.TRAILING);
48 | label.setOpaque(true);
49 | label.setBorder(new EmptyBorder(new Insets(0, BitherSetting.TABLE_BORDER, 1, BitherSetting.TABLE_BORDER)));
50 |
51 | label.setText(value + BitherSetting.THREE_SPACER);
52 |
53 | if (isSelected) {
54 | label.setForeground(table.getSelectionForeground());
55 | } else {
56 | label.setForeground(Color.BLACK);
57 | }
58 |
59 | if (isSelected) {
60 | showTransactionsFrom.setSelectedRow(row);
61 | label.setBackground(table.getSelectionBackground());
62 | } else {
63 | if (row % 2 == 1) {
64 | label.setBackground(Themes.currentTheme.detailPanelBackground());
65 | } else {
66 | label.setBackground(Themes.currentTheme.sidebarPanelBackground());
67 | label.setOpaque(true);
68 | }
69 | }
70 |
71 | return label;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/dialogs/DialogProgress.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.dialogs;
20 |
21 | import net.bither.BitherUI;
22 | import net.bither.viewsystem.base.Labels;
23 | import net.bither.viewsystem.base.Panels;
24 | import net.bither.viewsystem.themes.Themes;
25 | import net.miginfocom.swing.MigLayout;
26 |
27 | import javax.swing.*;
28 |
29 | /**
30 | * Created by nn on 15/3/12.
31 | */
32 | public class DialogProgress extends BitherDialog {
33 |
34 | private JPanel contentPane;
35 |
36 | public DialogProgress() {
37 | contentPane = Panels.newPanel();
38 | setContentPane(contentPane);
39 | setModal(true);
40 | setUndecorated(true);
41 | setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
42 | initDialog();
43 | contentPane.setLayout(new MigLayout(
44 | Panels.migXYLayout(),
45 | "[]", // Column constraints
46 | "[]" // Row constraints
47 |
48 | ));
49 | JLabel labelRefrsh = Labels.newSpinner(Themes.currentTheme.fadedText(), BitherUI.NORMAL_PLUS_ICON_SIZE);
50 | contentPane.add(labelRefrsh, "align center,span,wrap");
51 |
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/dialogs/MessageDialog.form:
--------------------------------------------------------------------------------
1 |
2 |
27 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/froms/AboutPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.froms;
20 |
21 | import net.bither.BitherSetting;
22 | import net.bither.bitherj.api.http.BitherUrl;
23 | import net.bither.fonts.AwesomeIcon;
24 | import net.bither.languages.MessageKey;
25 | import net.bither.utils.LocaliserUtils;
26 | import net.bither.utils.ViewUtil;
27 | import net.bither.viewsystem.base.Buttons;
28 | import net.bither.viewsystem.base.Labels;
29 | import net.bither.viewsystem.base.Panels;
30 | import net.miginfocom.swing.MigLayout;
31 |
32 | import javax.swing.*;
33 | import java.awt.event.ActionEvent;
34 | import java.net.URI;
35 |
36 | public class AboutPanel extends WizardPanel {
37 | public AboutPanel() {
38 | super(MessageKey.ABOUT, AwesomeIcon.SMILE_O);
39 | }
40 |
41 | @Override
42 | public void initialiseContent(JPanel panel) {
43 | panel.setLayout(new MigLayout(
44 | Panels.migXYLayout(),
45 | "[][][][][][][]", // Column constraints
46 | "[]10[][][][][]80[]20[][][]" // Row constraints
47 | ));
48 |
49 | // String version = System.getProperties().getProperty("Implementation-Version");
50 | //System.out.println(System.getProperties());
51 |
52 | panel.add(Labels.newValueLabel(LocaliserUtils.getString("version") + ": " + BitherSetting.VERSION), "push,align center,wrap");
53 |
54 | panel.add(Buttons.newLaunchBrowserButton(getLaunchBrowserAction(), MessageKey.VISIT_WEBSITE), "wrap,align center");
55 |
56 | }
57 |
58 | private Action getLaunchBrowserAction() {
59 |
60 | return new AbstractAction() {
61 | @Override
62 | public void actionPerformed(ActionEvent e) {
63 |
64 | try {
65 | String url = BitherUrl.BITHER_DNS.BITHER_URL;
66 | ViewUtil.openURI(new URI(url));
67 | } catch (Exception e1) {
68 | e1.printStackTrace();
69 | }
70 |
71 | }
72 | };
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/froms/HDMSeedPhrasPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.froms;
20 |
21 | import net.bither.bitherj.BitherjSettings;
22 | import net.bither.fonts.AwesomeIcon;
23 | import net.bither.languages.MessageKey;
24 | import net.bither.preference.UserPreference;
25 | import net.bither.utils.LocaliserUtils;
26 | import net.bither.viewsystem.base.Panels;
27 | import net.miginfocom.swing.MigLayout;
28 |
29 | import javax.swing.*;
30 | import java.util.List;
31 |
32 | public class HDMSeedPhrasPanel extends WizardPanel {
33 | private JTextArea taPrivateText;
34 | private String worldString;
35 |
36 | public HDMSeedPhrasPanel(List worldList) {
37 | super(MessageKey.HDM_COLD_SEED_WORD_LIST, AwesomeIcon.BITBUCKET);
38 | worldString = "";
39 | for (int i = 0; i < worldList.size(); i++) {
40 | if (i == worldList.size() - 1) {
41 | worldString += worldList.get(i);
42 | } else if ((i + 1) % 3 == 0) {
43 | worldString += worldList.get(i) + "-" + "\n";
44 |
45 | } else {
46 | worldString += worldList.get(i) + "-";
47 | }
48 | }
49 |
50 | if (UserPreference.getInstance().getAppMode() == BitherjSettings.AppMode.HOT) {
51 | updateTitle(LocaliserUtils.getString("hdm_hot_seed_word_list"));
52 | }
53 |
54 |
55 | }
56 |
57 | @Override
58 | public void initialiseContent(JPanel panel) {
59 | panel.setLayout(new MigLayout(
60 | Panels.migXYLayout(),
61 | "[][][][][]", // Column constraints
62 | "[]20[][][][][]80[]40[][]" // Row constraints
63 | ));
64 |
65 | taPrivateText = new JTextArea();
66 | taPrivateText.setBorder(null);
67 | taPrivateText.setEditable(false);
68 | taPrivateText.setText(worldString);
69 | taPrivateText.setBackground(panel.getBackground());
70 | taPrivateText.setFont(taPrivateText.getFont().deriveFont(20));
71 | panel.add(taPrivateText, "align center,cell 2 2 ,grow");
72 |
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/froms/IAddressForm.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.froms;
20 |
21 | import net.bither.bitherj.core.Address;
22 |
23 | import javax.swing.*;
24 |
25 | /**
26 | * Created by nn on 14/11/26.
27 | */
28 | public interface IAddressForm {
29 | public JPanel getPanel();
30 |
31 | public void updateFromModel();
32 |
33 | public Address getPerWalletModelData();
34 |
35 | public String getOnlyName();
36 |
37 | public void setSelected(boolean selected);
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/froms/PrivateTextPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.froms;
20 |
21 | import net.bither.bitherj.crypto.SecureCharSequence;
22 | import net.bither.bitherj.utils.Utils;
23 | import net.bither.fonts.AwesomeIcon;
24 | import net.bither.languages.MessageKey;
25 | import net.bither.utils.WalletUtils;
26 | import net.bither.viewsystem.base.Panels;
27 | import net.miginfocom.swing.MigLayout;
28 |
29 | import javax.swing.*;
30 | import java.awt.*;
31 |
32 | public class PrivateTextPanel extends WizardPanel {
33 | private JTextArea taPrivateText;
34 | private SecureCharSequence secureCharSequence;
35 |
36 | public PrivateTextPanel(SecureCharSequence secureCharSequence) {
37 | super(MessageKey.PRIVATE_KEY_TEXT, AwesomeIcon.FA_FILE_TEXT);
38 | this.secureCharSequence = Utils.formatHashFromCharSequence(secureCharSequence, 4, 16);
39 | secureCharSequence.wipe();
40 |
41 | }
42 |
43 | @Override
44 | public void initialiseContent(JPanel panel) {
45 | panel.setLayout(new MigLayout(
46 | Panels.migXYLayout(),
47 | "[][][][][]", // Column constraints
48 | "[]20[][][][][]80[]40[][]" // Row constraints
49 | ));
50 |
51 | taPrivateText = new JTextArea();
52 | taPrivateText.setBorder(null);
53 | taPrivateText.setEditable(false);
54 | taPrivateText.setFont(new Font("Monospaced", taPrivateText.getFont().getStyle(), taPrivateText.getFont().getSize()));
55 | taPrivateText.setText(this.secureCharSequence.toString());
56 | taPrivateText.setBackground(panel.getBackground());
57 |
58 | panel.add(taPrivateText, "align center,cell 2 2 ,grow");
59 |
60 |
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/froms/ShowTransactionsForm.form:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/listener/ICheckPasswordListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.listener;
20 |
21 | import net.bither.bitherj.crypto.SecureCharSequence;
22 |
23 | public interface ICheckPasswordListener {
24 | public boolean checkPassword(SecureCharSequence password);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/listener/IDialogPasswordListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.listener;
20 |
21 | import net.bither.bitherj.crypto.SecureCharSequence;
22 |
23 | public interface IDialogPasswordListener {
24 | public void onPasswordEntered(SecureCharSequence password);
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/panels/RoundedPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.panels;
20 |
21 | import net.bither.BitherUI;
22 | import net.bither.viewsystem.components.ImageDecorator;
23 |
24 | import javax.swing.*;
25 | import java.awt.*;
26 |
27 | /**
28 | * Panel to provide the following to UI:
29 | *
30 | * - Rounded corners for use with wizards/light boxes
31 | *
32 | *
33 | * @since 0.0.1
34 | */
35 |
36 | public class RoundedPanel extends JPanel {
37 |
38 | private final int cornerRadius;
39 |
40 | /**
41 | * @param layout The layout manager
42 | */
43 | public RoundedPanel(LayoutManager2 layout) {
44 | super(layout);
45 |
46 | setOpaque(false);
47 |
48 | this.cornerRadius = BitherUI.COMPONENT_CORNER_RADIUS;
49 |
50 | }
51 |
52 | @Override
53 | protected void paintComponent(Graphics g) {
54 |
55 | super.paintComponent(g);
56 |
57 | // Get the dimensions
58 | int width = getWidth();
59 | int height = getHeight();
60 |
61 | // Ensure we render with smooth outcome
62 | Graphics2D g2 = (Graphics2D) g;
63 | g2.setRenderingHints(ImageDecorator.smoothRenderingHints());
64 |
65 | // Fill in a solid rounded block of the panel
66 | g2.setColor(getBackground());
67 | g2.fillRoundRect(0, 0, width, height, cornerRadius, cornerRadius);
68 |
69 | // Draw the panel foreground over the shadow with rounded corners to give a subtle border effect
70 | Stroke original = g2.getStroke();
71 | g2.setColor(getForeground());
72 | g2.setStroke(new BasicStroke(0));
73 | g2.drawRoundRect(0, 0, width, height, cornerRadius, cornerRadius);
74 | g2.setStroke(original);
75 |
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/themes/BaseTheme.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.themes;
20 |
21 | import java.awt.*;
22 |
23 | /**
24 | * Abstract base class to provide the following to themes:
25 | *
26 | * - Access to common values
27 | *
28 | *
29 | * @since 0.0.1
30 | */
31 | public abstract class BaseTheme implements Theme {
32 |
33 | @Override
34 | public Color creditText() {
35 | // The status color value provides suitable contrast across all themes
36 | return statusGreen();
37 | }
38 |
39 | @Override
40 | public Color debitText() {
41 | // The status color value provides suitable contrast across all themes
42 | return statusRed();
43 | }
44 |
45 | @Override
46 | public Color statusRed() {
47 | return new Color(210, 50, 45);
48 | }
49 |
50 | @Override
51 | public Color statusAmber() {
52 | return new Color(237, 156, 40);
53 | }
54 |
55 | @Override
56 | public Color statusGreen() {
57 | return new Color(71, 164, 71);
58 | }
59 |
60 | @Override
61 | public Color tableRowBackground() {
62 | return sidebarPanelBackground();
63 | }
64 |
65 | @Override
66 | public Color tableRowAltBackground() {
67 | return detailPanelBackground();
68 | }
69 |
70 | @Override
71 | public Color tableRowSelectedBackground() {
72 | return sidebarSelectedText();
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/viewsystem/themes/ThemeKey.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.viewsystem.themes;
20 |
21 |
22 | import net.bither.languages.Languages;
23 | import net.bither.languages.MessageKey;
24 |
25 | /**
26 | * Enum to provide the following to Theme API:
27 | *
28 | * - Provision of supporting meta-data for a theme
29 | *
30 | *
31 | * @since 0.0.1
32 | */
33 | public enum ThemeKey {
34 |
35 | LIGHT(new LightTheme()),
36 | DARK(new DarkTheme()),
37 | BOOTSTRAP(new BootstrapTheme()),
38 |
39 | // End of enum
40 | ;
41 |
42 | private final Theme theme;
43 |
44 | /**
45 | * @param theme The theme
46 | */
47 | ThemeKey(Theme theme) {
48 | this.theme = theme;
49 | }
50 |
51 | /**
52 | * @return The associated singleton instance of the theme
53 | */
54 | public Theme theme() {
55 | return theme;
56 | }
57 |
58 | /**
59 | * @return The names of the themes for the current locale
60 | */
61 | public static String[] localisedNames() {
62 |
63 | return new String[]{
64 | Languages.safeText(MessageKey.LIGHT_THEME),
65 | Languages.safeText(MessageKey.DARK_THEME),
66 | Languages.safeText(MessageKey.BOOTSTRAP_THEME),
67 | };
68 |
69 | }
70 |
71 | /**
72 | * @param theme The theme
73 | * @return The matching theme key
74 | */
75 | public static ThemeKey fromTheme(Theme theme) {
76 |
77 | // Simple approach for a few themes
78 | if (theme instanceof LightTheme) {
79 | return LIGHT;
80 | }
81 | if (theme instanceof DarkTheme) {
82 | return DARK;
83 | }
84 | if (theme instanceof BootstrapTheme) {
85 | return BOOTSTRAP;
86 | }
87 | throw new IllegalArgumentException("Unknown theme '" + theme.getClass().getName() + "'");
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/xrandom/IUEntropy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.xrandom;
18 |
19 | public interface IUEntropy {
20 | public byte[] nextBytes(int length);
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/xrandom/IUEntropySource.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * * Copyright 2014 http://Bither.net
4 | * *
5 | * * Licensed under the Apache License, Version 2.0 (the "License");
6 | * * you may not use this file except in compliance with the License.
7 | * * You may obtain a copy of the License at
8 | * *
9 | * * http://www.apache.org/licenses/LICENSE-2.0
10 | * *
11 | * * Unless required by applicable law or agreed to in writing, software
12 | * * distributed under the License is distributed on an "AS IS" BASIS,
13 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * * See the License for the specific language governing permissions and
15 | * * limitations under the License.
16 | *
17 | */
18 |
19 | package net.bither.xrandom;
20 |
21 | public interface IUEntropySource {
22 | public void onResume();
23 |
24 | public void onPause();
25 |
26 | public UEntropyCollector.UEntropySource type();
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/xrandom/SeedUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Copyright 2014 http://Bither.net
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | * /
17 | */
18 |
19 | package net.bither.xrandom;
20 |
21 | public class SeedUtils {
22 |
23 | public static byte seedInt8(long x) {
24 | return (byte) (x & 255);
25 |
26 | }
27 |
28 | public static byte[] seedInt16(long x) {
29 | byte[] bytes = new byte[2];
30 | bytes[0] = seedInt8(x);
31 | bytes[1] = seedInt8(x >> 8);
32 | return bytes;
33 | }
34 |
35 | public static byte[] seedInt32(long x) {
36 | byte[] bytes = new byte[4];
37 | bytes[0] = seedInt8(x);
38 | bytes[1] = seedInt8(x >> 8);
39 | bytes[2] = seedInt8(x >> 16);
40 | bytes[3] = seedInt8(x >> 24);
41 |
42 | return bytes;
43 | }
44 |
45 | public static byte[] seedTime() {
46 | return seedInt32(System.currentTimeMillis());
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/xrandom/URandom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.xrandom;
18 |
19 | import java.io.DataInputStream;
20 | import java.io.File;
21 | import java.io.FileInputStream;
22 | import java.io.IOException;
23 | import java.security.SecureRandom;
24 |
25 | public class URandom {
26 | public static File urandomFile = new File("/dev/urandom");
27 |
28 | public static synchronized byte[] nextBytes(int length) {
29 | byte[] bytes = new byte[length];
30 | if (!urandomFile.exists()) {
31 | SecureRandom secureRandom = new SecureRandom();
32 | secureRandom.nextBytes(bytes);
33 | } else {
34 | try {
35 | FileInputStream stream = new FileInputStream(urandomFile);
36 | DataInputStream dis = new DataInputStream(stream);
37 | dis.readFully(bytes);
38 | dis.close();
39 | } catch (IOException e) {
40 | throw new RuntimeException("Unable to generate URandom bytes on this Android device", e);
41 | }
42 | }
43 | return bytes;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/net/bither/xrandom/XRandom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014 http://Bither.net
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package net.bither.xrandom;
18 |
19 | import java.security.SecureRandom;
20 |
21 | public class XRandom extends SecureRandom {
22 |
23 | private IUEntropy uEntropy;
24 |
25 | public XRandom(IUEntropy uEntropy) {
26 | this.uEntropy = uEntropy;
27 | }
28 |
29 | private byte[] getRandomBytes(int byteLength) {
30 | System.out.println(XRandom.class.getSimpleName() + ",Request " + byteLength + " bytes from XRandom");
31 | byte[] uRandomBytes = getURandomBytes(byteLength);
32 | if (this.uEntropy == null) {
33 | return uRandomBytes;
34 | } else {
35 | byte[] result = new byte[byteLength];
36 | byte[] userEntropyBytes = getUEntropyBytes(byteLength);
37 | for (int i = 0; i < uRandomBytes.length; i++) {
38 | result[i] = (byte) (uRandomBytes[i] ^ userEntropyBytes[i]);
39 | }
40 | return result;
41 | }
42 | }
43 |
44 | private byte[] getURandomBytes(int length) {
45 | return URandom.nextBytes(length);
46 | }
47 |
48 | private byte[] getUEntropyBytes(int length) {
49 | return this.uEntropy.nextBytes(length);
50 | }
51 |
52 | @Override
53 | public void setSeed(long seed) {
54 |
55 | }
56 |
57 | @Override
58 | public synchronized void nextBytes(byte[] bytes) {
59 | byte[] nextBytes = getRandomBytes(bytes.length);
60 | if (nextBytes.length != bytes.length) {
61 | throw new RuntimeException("xrandom bytes length not match");
62 | }
63 | for (int i = 0;
64 | i < bytes.length && i < nextBytes.length;
65 | i++) {
66 | bytes[i] = nextBytes[i];
67 | }
68 | }
69 |
70 | @Override
71 | public byte[] generateSeed(int numBytes) {
72 | return getRandomBytes(numBytes);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/resources/fonts/Corben-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/fonts/Corben-Regular.ttf
--------------------------------------------------------------------------------
/src/main/resources/fonts/DroidSansMono.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/fonts/DroidSansMono.ttf
--------------------------------------------------------------------------------
/src/main/resources/fonts/FontAwesome-4.2.0.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/fonts/FontAwesome-4.2.0.ttf
--------------------------------------------------------------------------------
/src/main/resources/fonts/OpenSans-Semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/fonts/OpenSans-Semibold.ttf
--------------------------------------------------------------------------------
/src/main/resources/https/bithertruststore.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/https/bithertruststore.jks
--------------------------------------------------------------------------------
/src/main/resources/images/accept.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/accept.png
--------------------------------------------------------------------------------
/src/main/resources/images/address_type_hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/address_type_hd.png
--------------------------------------------------------------------------------
/src/main/resources/images/address_type_hdm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/address_type_hdm.png
--------------------------------------------------------------------------------
/src/main/resources/images/address_type_private.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/address_type_private.png
--------------------------------------------------------------------------------
/src/main/resources/images/address_type_watchonly.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/address_type_watchonly.png
--------------------------------------------------------------------------------
/src/main/resources/images/bither_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/bither_icon.png
--------------------------------------------------------------------------------
/src/main/resources/images/card_corner_bottom_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/card_corner_bottom_left.png
--------------------------------------------------------------------------------
/src/main/resources/images/card_corner_bottom_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/card_corner_bottom_right.png
--------------------------------------------------------------------------------
/src/main/resources/images/card_corner_top_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/card_corner_top_left.png
--------------------------------------------------------------------------------
/src/main/resources/images/card_corner_top_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/card_corner_top_right.png
--------------------------------------------------------------------------------
/src/main/resources/images/checkKey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/checkKey.png
--------------------------------------------------------------------------------
/src/main/resources/images/check_failed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/check_failed.png
--------------------------------------------------------------------------------
/src/main/resources/images/checking_progress_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/checking_progress_light.png
--------------------------------------------------------------------------------
/src/main/resources/images/checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/checkmark.png
--------------------------------------------------------------------------------
/src/main/resources/images/circleProgress0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/circleProgress0.png
--------------------------------------------------------------------------------
/src/main/resources/images/circleProgress1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/circleProgress1.png
--------------------------------------------------------------------------------
/src/main/resources/images/circleProgress2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/circleProgress2.png
--------------------------------------------------------------------------------
/src/main/resources/images/circleProgress3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/circleProgress3.png
--------------------------------------------------------------------------------
/src/main/resources/images/circleProgress4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/circleProgress4.png
--------------------------------------------------------------------------------
/src/main/resources/images/circleProgress5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/circleProgress5.png
--------------------------------------------------------------------------------
/src/main/resources/images/pickaxe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/pickaxe.png
--------------------------------------------------------------------------------
/src/main/resources/images/scan_button_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/scan_button_normal.png
--------------------------------------------------------------------------------
/src/main/resources/images/shapeHexagon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/shapeHexagon.png
--------------------------------------------------------------------------------
/src/main/resources/images/shapePentagon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/shapePentagon.png
--------------------------------------------------------------------------------
/src/main/resources/images/shapeSquare.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/shapeSquare.png
--------------------------------------------------------------------------------
/src/main/resources/images/shapeTriangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/shapeTriangle.png
--------------------------------------------------------------------------------
/src/main/resources/images/sidePanelHide.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/sidePanelHide.png
--------------------------------------------------------------------------------
/src/main/resources/images/sidePanelHideRTL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/sidePanelHideRTL.png
--------------------------------------------------------------------------------
/src/main/resources/images/sidePanelShow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/sidePanelShow.png
--------------------------------------------------------------------------------
/src/main/resources/images/sidePanelShowRTL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/sidePanelShowRTL.png
--------------------------------------------------------------------------------
/src/main/resources/images/singleWallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/singleWallet.png
--------------------------------------------------------------------------------
/src/main/resources/images/smallExclamationMark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/smallExclamationMark.png
--------------------------------------------------------------------------------
/src/main/resources/images/symbol_bits.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/symbol_bits.png
--------------------------------------------------------------------------------
/src/main/resources/images/symbol_bits_slim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/symbol_bits_slim.png
--------------------------------------------------------------------------------
/src/main/resources/images/symbol_bits_slim_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/symbol_bits_slim_black.png
--------------------------------------------------------------------------------
/src/main/resources/images/symbol_btc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/symbol_btc.png
--------------------------------------------------------------------------------
/src/main/resources/images/symbol_btc_slim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/symbol_btc_slim.png
--------------------------------------------------------------------------------
/src/main/resources/images/symbol_btc_slim_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/symbol_btc_slim_black.png
--------------------------------------------------------------------------------
/src/main/resources/images/tick.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/tick.png
--------------------------------------------------------------------------------
/src/main/resources/images/transaction_icon_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/transaction_icon_small.png
--------------------------------------------------------------------------------
/src/main/resources/images/transactions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/transactions.png
--------------------------------------------------------------------------------
/src/main/resources/images/transactionsExport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/transactionsExport.png
--------------------------------------------------------------------------------
/src/main/resources/images/xrandom_address_label_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/xrandom_address_label_normal.png
--------------------------------------------------------------------------------
/src/main/resources/images/yourWallets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/yourWallets.png
--------------------------------------------------------------------------------
/src/main/resources/images/zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/src/main/resources/images/zoom.png
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg %xEx%n
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/main/resources/version.properties:
--------------------------------------------------------------------------------
1 | version=${project.version}
--------------------------------------------------------------------------------
/vanitygen/.gitignore:
--------------------------------------------------------------------------------
1 | *.oclbin
2 | *.o
3 | keyconv
4 | oclvanitygen
5 | oclvanityminer
6 | vanitygen
7 | *.obj
8 | oclvanitygen.pdb
9 | *.pdb
10 |
--------------------------------------------------------------------------------
/vanitygen/linux/oclvanitygen:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/linux/oclvanitygen
--------------------------------------------------------------------------------
/vanitygen/linux/vanitygen:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/linux/vanitygen
--------------------------------------------------------------------------------
/vanitygen/mac/oclvanitygen:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/mac/oclvanitygen
--------------------------------------------------------------------------------
/vanitygen/mac/vanitygen:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/mac/vanitygen
--------------------------------------------------------------------------------
/vanitygen/windows/oclvanitygen.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/windows/oclvanitygen.exe
--------------------------------------------------------------------------------
/vanitygen/windows/oclvanitygen64.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/windows/oclvanitygen64.exe
--------------------------------------------------------------------------------
/vanitygen/windows/pthreadVC2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/windows/pthreadVC2.dll
--------------------------------------------------------------------------------
/vanitygen/windows/vanitygen.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/windows/vanitygen.exe
--------------------------------------------------------------------------------
/vanitygen/windows/vanitygen64.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bither/bither-desktop-java/6940271e48bfd6e0c3a814a60e9f10bebd743c85/vanitygen/windows/vanitygen64.exe
--------------------------------------------------------------------------------